equal
deleted
inserted
replaced
13 return string.sub(String, 1, string.len(Start)) == Start |
13 return string.sub(String, 1, string.len(Start)) == Start |
14 end |
14 end |
15 |
15 |
16 function mcbot_register_command (name, object) |
16 function mcbot_register_command (name, object) |
17 commands[name] = object |
17 commands[name] = object |
|
18 end |
|
19 |
|
20 function mcbot_get_command_list () |
|
21 return commands |
18 end |
22 end |
19 |
23 |
20 require "cmds.wtf" |
24 require "cmds.wtf" |
21 require "cmds.calc" |
25 require "cmds.calc" |
22 require "cmds.spell" |
26 require "cmds.spell" |
36 if not cmd then |
40 if not cmd then |
37 -- Check if there are arguments |
41 -- Check if there are arguments |
38 cmd, arg = line:match("^(%w+)%s+(.*)") |
42 cmd, arg = line:match("^(%w+)%s+(.*)") |
39 end |
43 end |
40 if cmd then |
44 if cmd then |
|
45 local lccmd = cmd:lower() |
41 for name, obj in pairs(commands) do |
46 for name, obj in pairs(commands) do |
42 if cmd and cmd:lower() == name then |
47 if lccmd == name then |
43 return obj.cmd(arg, botdata) |
48 return obj.cmd(arg, botdata, cmd) |
44 end |
49 end |
45 end |
50 end |
46 else |
51 else |
47 -- Ignore smileys |
52 -- Ignore smileys |
48 if line:match("^[:;8]'?%-?[D()|/\\%[%]pPoO$@]+%s*$") then return nil,nil end |
53 if line:match("^[:;8]'?%-?[D()|/\\%[%]pPoO$@]+%s*$") then return nil,nil end |