author | Mikael Berthe <mikael@lilotux.net> |
Thu, 15 Apr 2010 20:28:34 +0200 | |
changeset 20 | d6c602aaa231 |
parent 16 | 064a50911e05 |
child 21 | bc5d611e6d6f |
permissions | -rw-r--r-- |
0 | 1 |
|
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
2 |
local hello = { ["hidden"] = true, |
20 | 3 |
["aliases"] = { "hi" }, |
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
4 |
["cmd"] = function (args) return "Hello!" end |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
5 |
} |
0 | 6 |
|
7 |
mcbot_register_command("hello", hello) |
|
8 |
||
9 |
||
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
10 |
local thanks = { ["hidden"] = true, |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
11 |
["cmd"] = function (args) return "You're welcome" end |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
12 |
} |
0 | 13 |
|
14 |
mcbot_register_command("thanks", thanks) |
|
15 |
||
16 |
||
20 | 17 |
local ping = {} |
18 |
ping.aliases = { "ding" } |
|
19 |
ping.cmd = function (args, botdata, cmd) |
|
20 |
if cmd:lower() == "ding" then return "dong" end |
|
21 |
return "pong" |
|
22 |
end |
|
0 | 23 |
|
24 |
mcbot_register_command("ping", ping) |
|
25 |
||
26 |
||
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
27 |
local date = { ["desc"] = "Display the current date" } |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
28 |
function date.cmd (args) |
0 | 29 |
if args then |
30 |
return os.date(args) |
|
31 |
else |
|
32 |
return os.date() |
|
33 |
end |
|
34 |
end |
|
35 |
||
36 |
mcbot_register_command("date", date) |
|
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
37 |
|
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
38 |
|
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
39 |
local help = { ["desc"] = "Display the available commands" } |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
40 |
function help.cmd (args) |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
41 |
return "I can't help you, buddy" |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
42 |
end |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
43 |
|
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
44 |
mcbot_register_command("help", help) |