mcbot/cmds/misc.lua
author Mikael Berthe <mikael@lilotux.net>
Thu, 15 Apr 2010 20:28:34 +0200
changeset 20 d6c602aaa231
parent 16 064a50911e05
child 21 bc5d611e6d6f
permissions -rw-r--r--
Use aliases


local hello = { ["hidden"] = true,
                ["aliases"] = { "hi" },
                ["cmd"] = function (args) return "Hello!" end
              }

mcbot_register_command("hello", hello)


local thanks = { ["hidden"] = true,
                 ["cmd"] = function (args) return "You're welcome" end
               }

mcbot_register_command("thanks", thanks)


local ping = {}
ping.aliases = { "ding" }
ping.cmd = function (args, botdata, cmd)
    if cmd:lower() == "ding" then return "dong" end
    return "pong"
end

mcbot_register_command("ping", ping)


local date = { ["desc"] = "Display the current date" }
function date.cmd (args)
    if args then
        return os.date(args)
    else
        return os.date()
    end
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)