Class: TelegramMeetupBot::CommandsHandler
- Inherits:
-
Object
- Object
- TelegramMeetupBot::CommandsHandler
- Defined in:
- lib/telegram_meetup_bot/commands_handler.rb
Instance Attribute Summary collapse
-
#botan ⇒ Object
readonly
Returns the value of attribute botan.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#messenger ⇒ Object
readonly
Returns the value of attribute messenger.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
-
#initialize(args) ⇒ CommandsHandler
constructor
A new instance of CommandsHandler.
- #process ⇒ Object
Constructor Details
#initialize(args) ⇒ CommandsHandler
Returns a new instance of CommandsHandler.
5 6 7 8 9 10 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 5 def initialize(args) parser = build_parser(args) @command = TelegramMeetupBot::Commands::Factory.build(parser) @messenger = args.fetch(:messenger) @botan = args[:botan] end |
Instance Attribute Details
#botan ⇒ Object (readonly)
Returns the value of attribute botan.
3 4 5 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 3 def botan @botan end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 3 def command @command end |
#messenger ⇒ Object (readonly)
Returns the value of attribute messenger.
3 4 5 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 3 def messenger @messenger end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
3 4 5 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 3 def mode @mode end |
Instance Method Details
#process ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/telegram_meetup_bot/commands_handler.rb', line 12 def process if command && mode == :send messenger.send_text(*command.exec) botan.track(command.command) if botan elsif command && mode == :edit messenger.edit_text(*command.exec) end end |