mcbot/cmds/misc.lua
changeset 20 d6c602aaa231
parent 16 064a50911e05
child 21 bc5d611e6d6f
equal deleted inserted replaced
19:96e08713cb6a 20:d6c602aaa231
     1 
     1 
     2 local hello = { ["hidden"] = true,
     2 local hello = { ["hidden"] = true,
       
     3                 ["aliases"] = { "hi" },
     3                 ["cmd"] = function (args) return "Hello!" end
     4                 ["cmd"] = function (args) return "Hello!" end
     4               }
     5               }
     5 
     6 
     6 mcbot_register_command("hello", hello)
     7 mcbot_register_command("hello", hello)
     7 mcbot_register_command("hi", hello)
       
     8 
     8 
     9 
     9 
    10 local thanks = { ["hidden"] = true,
    10 local thanks = { ["hidden"] = true,
    11                  ["cmd"] = function (args) return "You're welcome" end
    11                  ["cmd"] = function (args) return "You're welcome" end
    12                }
    12                }
    13 
    13 
    14 mcbot_register_command("thanks", thanks)
    14 mcbot_register_command("thanks", thanks)
    15 
    15 
    16 
    16 
    17 local ping = { ["cmd"] = function (args) return "pong" end }
    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
    18 
    23 
    19 mcbot_register_command("ping", ping)
    24 mcbot_register_command("ping", ping)
    20 
    25 
    21 
    26 
    22 local date = { ["desc"] = "Display the current date" }
    27 local date = { ["desc"] = "Display the current date" }