author | Mikael Berthe <mikael@lilotux.net> |
Tue, 27 Nov 2012 16:36:17 +0100 | |
changeset 67 | 5c756a9d7d8c |
parent 33 | 50aa4b0d63c1 |
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, |
33 | 11 |
["aliases"] = { "thx", "thank" }, |
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
12 |
} |
33 | 13 |
function thanks.cmd (args, botdata, cmd) |
14 |
return "You're welcome" |
|
15 |
end |
|
0 | 16 |
|
17 |
mcbot_register_command("thanks", thanks) |
|
18 |
||
19 |
||
20 | 20 |
local ping = {} |
21 |
ping.aliases = { "ding" } |
|
33 | 22 |
function ping.cmd (args, botdata, cmd) |
20 | 23 |
if cmd:lower() == "ding" then return "dong" end |
24 |
return "pong" |
|
25 |
end |
|
0 | 26 |
|
27 |
mcbot_register_command("ping", ping) |
|
28 |
||
29 |
||
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
30 |
local date = { ["desc"] = "Display the current date" } |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
31 |
function date.cmd (args) |
0 | 32 |
if args then |
33 |
return os.date(args) |
|
34 |
else |
|
35 |
return os.date() |
|
36 |
end |
|
37 |
end |
|
38 |
||
39 |
mcbot_register_command("date", date) |