Class: TelegramBotEngine::Authorizer
- Inherits:
-
Object
- Object
- TelegramBotEngine::Authorizer
- Defined in:
- lib/telegram_bot_engine/authorizer.rb
Class Method Summary collapse
-
.authorized?(username, bot: nil) ⇒ Boolean
Authorizes an inbound command username.
Class Method Details
.authorized?(username, bot: nil) ⇒ Boolean
Authorizes an inbound command username. ‘bot: nil` ⇒ global behavior, unchanged (docs/0001 §3.5). When a bot is given in :database mode, both global (nil bot_id) and that bot’s own allow entries apply.
8 9 10 11 12 13 |
# File 'lib/telegram_bot_engine/authorizer.rb', line 8 def self.(username, bot: nil) return true if TelegramBotEngine.config.allowed_usernames.nil? allowed = resolve_allowed_usernames(bot) allowed.map(&:downcase).include?(username&.downcase) end |