Class: Ruboty::Handlers::Command
- Inherits:
-
Base
- Object
- Base
- Ruboty::Handlers::Command
- Defined in:
- lib/ruboty/handlers/command.rb
Class Method Summary collapse
-
.register_commands ⇒ Object
Registering commands.
Instance Method Summary collapse
Class Method Details
.register_commands ⇒ Object
Registering commands. Each command is located under “commands” directory. The path name to the executable command is gonna be a command name.
i.e. commands/server/monitor => /server monitor/
The command should return a usage with -h option
18 19 20 21 22 |
# File 'lib/ruboty/handlers/command.rb', line 18 def self.register_commands Ruboty::ExecCommand::Command.all.each do |e| on /#{e.command_name}/i, name: "command_handler", description: e.help end end |
Instance Method Details
#command_handler(message) ⇒ Object
24 25 26 |
# File 'lib/ruboty/handlers/command.rb', line 24 def command_handler() Ruboty::ExecCommand::Actions::Command.new().call end |
#kill_command(message) ⇒ Object
32 33 34 |
# File 'lib/ruboty/handlers/command.rb', line 32 def kill_command() Ruboty::ExecCommand::Actions::Command.new().kill_command end |
#list_commands(message) ⇒ Object
28 29 30 |
# File 'lib/ruboty/handlers/command.rb', line 28 def list_commands() Ruboty::ExecCommand::Actions::Command.new().list_commands end |