author | Mikael Berthe <mikael@lilotux.net> |
Thu, 15 Apr 2010 18:57:38 +0200 | |
changeset 16 | 064a50911e05 |
parent 0 | 89add07d6fe4 |
child 20 | d6c602aaa231 |
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, |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
3 |
["cmd"] = function (args) return "Hello!" end |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
4 |
} |
0 | 5 |
|
6 |
mcbot_register_command("hello", hello) |
|
7 |
mcbot_register_command("hi", 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 |
||
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
17 |
local ping = { ["cmd"] = function (args) return "pong" end } |
0 | 18 |
|
19 |
mcbot_register_command("ping", ping) |
|
20 |
||
21 |
||
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
22 |
local date = { ["desc"] = "Display the current date" } |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
23 |
function date.cmd (args) |
0 | 24 |
if args then |
25 |
return os.date(args) |
|
26 |
else |
|
27 |
return os.date() |
|
28 |
end |
|
29 |
end |
|
30 |
||
31 |
mcbot_register_command("date", date) |
|
16
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
32 |
|
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
33 |
|
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
34 |
local help = { ["desc"] = "Display the available commands" } |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
35 |
function help.cmd (args) |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
36 |
return "I can't help you, buddy" |
064a50911e05
Update command infrastructure
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
37 |
end |
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 |
mcbot_register_command("help", help) |