lib/telegram/bot/updates_controller/commands.rb in telegram-bot-0.16.1 vs lib/telegram/bot/updates_controller/commands.rb in telegram-bot-0.16.3
- old
+ new
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
module Telegram
module Bot
class UpdatesController
# Support for parsing commands
module Commands
- CMD_REGEX = %r{\A/([a-z\d_]{,31})(@(\S+))?(\s|$)}i
+ CMD_REGEX = %r{\A/([a-z\d_]{,31})(@(\S+))?(\s|$)}i.freeze
class << self
# Fetches command from text message. All subsequent words are returned
# as arguments.
# If command has mention (eg. `/test@SomeBot`), it returns commands only
@@ -32,10 +34,10 @@
#
# This is not used for edited messages/posts. It process them as basic updates.
def action_for_message
cmd, args = Commands.command_from_text(payload['text'], bot_username)
return unless cmd
- [[action_for_command(cmd), type: :command, command: cmd], args]
+ [[action_for_command(cmd), {type: :command, command: cmd}], args]
end
alias_method :action_for_channel_post, :action_for_message
end
end