mcbot/cmds/misc.lua
changeset 16 064a50911e05
parent 0 89add07d6fe4
child 20 d6c602aaa231
--- a/mcbot/cmds/misc.lua	Thu Apr 15 18:35:13 2010 +0200
+++ b/mcbot/cmds/misc.lua	Thu Apr 15 18:57:38 2010 +0200
@@ -1,34 +1,26 @@
 
-local function hello (args)
-    return "Hello!"
-end
+local hello = { ["hidden"] = true,
+                ["cmd"] = function (args) return "Hello!" end
+              }
 
 mcbot_register_command("hello", hello)
 mcbot_register_command("hi", hello)
 
 
-local function thanks (args)
-    return "You're welcome"
-end
+local thanks = { ["hidden"] = true,
+                 ["cmd"] = function (args) return "You're welcome" end
+               }
 
 mcbot_register_command("thanks", thanks)
 
 
-local function help (args)
-    return "I can't help you, buddy"
-end
-
-mcbot_register_command("help", help)
-
-
-local function ping (args)
-    return "pong"
-end
+local ping = { ["cmd"] = function (args) return "pong" end }
 
 mcbot_register_command("ping", ping)
 
 
-local function date (args)
+local date = { ["desc"] = "Display the current date" }
+function date.cmd (args)
     if args then
         return os.date(args)
     else
@@ -37,3 +29,11 @@
 end
 
 mcbot_register_command("date", date)
+
+
+local help = { ["desc"] = "Display the available commands" }
+function help.cmd (args)
+    return "I can't help you, buddy"
+end
+
+mcbot_register_command("help", help)