mcbot/cmds/misc.lua
changeset 16 064a50911e05
parent 0 89add07d6fe4
child 20 d6c602aaa231
equal deleted inserted replaced
15:203b49c24dde 16:064a50911e05
     1 
     1 
     2 local function hello (args)
     2 local hello = { ["hidden"] = true,
     3     return "Hello!"
     3                 ["cmd"] = function (args) return "Hello!" end
     4 end
     4               }
     5 
     5 
     6 mcbot_register_command("hello", hello)
     6 mcbot_register_command("hello", hello)
     7 mcbot_register_command("hi", hello)
     7 mcbot_register_command("hi", hello)
     8 
     8 
     9 
     9 
    10 local function thanks (args)
    10 local thanks = { ["hidden"] = true,
    11     return "You're welcome"
    11                  ["cmd"] = function (args) return "You're welcome" end
    12 end
    12                }
    13 
    13 
    14 mcbot_register_command("thanks", thanks)
    14 mcbot_register_command("thanks", thanks)
    15 
    15 
    16 
    16 
    17 local function help (args)
    17 local ping = { ["cmd"] = function (args) return "pong" end }
    18     return "I can't help you, buddy"
       
    19 end
       
    20 
       
    21 mcbot_register_command("help", help)
       
    22 
       
    23 
       
    24 local function ping (args)
       
    25     return "pong"
       
    26 end
       
    27 
    18 
    28 mcbot_register_command("ping", ping)
    19 mcbot_register_command("ping", ping)
    29 
    20 
    30 
    21 
    31 local function date (args)
    22 local date = { ["desc"] = "Display the current date" }
       
    23 function date.cmd (args)
    32     if args then
    24     if args then
    33         return os.date(args)
    25         return os.date(args)
    34     else
    26     else
    35         return os.date()
    27         return os.date()
    36     end
    28     end
    37 end
    29 end
    38 
    30 
    39 mcbot_register_command("date", date)
    31 mcbot_register_command("date", date)
       
    32 
       
    33 
       
    34 local help = { ["desc"] = "Display the available commands" }
       
    35 function help.cmd (args)
       
    36     return "I can't help you, buddy"
       
    37 end
       
    38 
       
    39 mcbot_register_command("help", help)