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

Support /start@fooBot command format #145

Closed
betzerra opened this issue Nov 23, 2020 · 3 comments
Closed

Support /start@fooBot command format #145

betzerra opened this issue Nov 23, 2020 · 3 comments

Comments

@betzerra
Copy link

From Telegram's Bot page:

If multiple bots are in a group, it is possible to add bot usernames to commands in order to avoid confusion:

/start@TriviaBot
/start@ApocalypseBot

This is done automatically when commands are selected via the list of suggestions. Please remember that your bot needs to be able to process commands that are followed by its username.

Is there a way to handle these automatically?
It seems that def start!(data = nil, *) only handles /start and not /start@fooBot

@betzerra betzerra changed the title Support Support /start@fooBot command format Nov 23, 2020
@printercu
Copy link
Member

Hi! There is username option for a bot, or if you use Rails see this section https://github.com/telegram-bot-rb/telegram-bot#configuration-in-rails-app

@betzerra
Copy link
Author

For some reason I'm not able to run the bot with credentials (maybe I'm having same issue as #74 )

so my workaround was adding this code at initializers/telegram.rb

require 'telegram/bot'

Telegram.bots_config = {
  default: ENV['TELEGRAM_TOKEN']
}

Is there a way to set a username in that method?

@betzerra
Copy link
Author

Ok, this works:

Telegram.bots_config = {
  default: {
    token: ENV['TELEGRAM_TOKEN'],
    username: ENV['TELEGRAM_USERNAME']
  }
}

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