telegram-bot-ruby
telegram-bot-ruby copied to clipboard
get argument
how to get argument from start key like this bot https://telegram.me/EvandBot?scope=&redirect_uri=https%3A%2F%2Fevand.com%2Fauth%2Foauth
?
hmm ... you have to do something tricky ..
here is the example:
user should start the bot via this url: http://t.me/botname?start=12345
require 'telegram/bot'
token = 'SECRET_BOT_TOKEN'
Telegram::Bot::Client.run(token) do |telegram_bot|
telegram_bot.listen do |message|
case message.text
when '/start'
p "user was clicked the start button"
p message.text
else
p "user typed something else ..."
p message.text
end
end
end
and here is the result of our code:
> "user typed something else ..."
> "/start 12345"
i hope you've found the answer
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.