telegram-bot-ruby icon indicating copy to clipboard operation
telegram-bot-ruby copied to clipboard

get argument

Open mm580486 opened this issue 7 years ago • 1 comments

how to get argument from start key like this bot https://telegram.me/EvandBot?scope=&redirect_uri=https%3A%2F%2Fevand.com%2Fauth%2Foauth

?

mm580486 avatar Oct 28 '17 09:10 mm580486

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

eVanilla avatar Nov 14 '17 13:11 eVanilla

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.

github-actions[bot] avatar Feb 19 '23 15:02 github-actions[bot]