Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to restrict the acces to the bot savely? #1

Closed
pinpox opened this issue Jul 24, 2015 · 1 comment
Closed

Is there a way to restrict the acces to the bot savely? #1

pinpox opened this issue Jul 24, 2015 · 1 comment

Comments

@pinpox
Copy link

pinpox commented Jul 24, 2015

I want to be able to share inforamtion to certain users.
Is it safe enough to do something like:

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|

    case message.text
      if message.from.id == "My super secret id"
    when '/start'
      puts message.from.inspect
      bot.api.sendMessage(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}")
    when '/stop'
      bot.api.sendMessage(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}")
    end
    else
      bot.api.sendMessage(chat_id: message.chat.id, text: "Not authorized")
    end
  end
end

Any better/safer way?

@atipugin
Copy link
Owner

I don't see any issues with your approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants