Class: Tkellem::TkellemBot

Inherits:
Object
  • Object
show all
Defined in:
lib/tkellem/tkellem_bot.rb

Defined Under Namespace

Classes: AtConnectCommand, CRUDCommand, Command, ConnectionsCommand, Help, ListenCommand, NetworkCommand, PasswordCommand, SettingCommand, UserCommand

Class Method Summary collapse

Class Method Details

.run_command(line, bouncer, conn, &block) ⇒ Object

careful here – if no bouncer is given, it’s assumed the command is running as an admin



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tkellem/tkellem_bot.rb', line 10

def self.run_command(line, bouncer, conn, &block)
  args = Shellwords.shellwords(line)
  command_name = args.shift.upcase
  command = commands[command_name]

  unless command
    yield "Invalid command. Use help for a command listing."
    return
  end

  command.run(args, bouncer, conn, block)
end