lib/telegram/bot/updates_controller/commands.rb
# Fetches command from text message. All subsequent words are returned
# as arguments.
# If command has mention (eg. `/test@SomeBot`), it returns commands only
# for specified username. Set `username` to `true` to accept
# any commands.
Fetches command from text message. All subsequent words are returned
as arguments.
If command has mention , it returns commands only
for specified username. Set `username` to `true` to accept
any commands.
Fetches command from text message . All subsequent words are returned as arguments . If command has mention it returns commands only for specified username . Set ` username ` to ` true ` to accept any commands .
def command_from_text(text, username = nil)
            return unless text
            match = text.match(CMD_REGEX)
            return unless match
            mention = match[3]
            [match[1], text.split.drop(1)] if username == true || !mention || mention == username
          end
def command_from_text ( text , username = nil ) return unless text match = text . match ( CMD_REGEX ) return unless match mention = match [ 3 ] [ match [ 1 ] , text . split . drop ( 1 ) ] if username == true || ! mention || mention == username end
Fetches command from text message.
Fetches command from text message .
text
username