From 9ac5f86475f69100127c3b6d4acceb9153cce7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Fri, 28 Dec 2012 09:41:10 -0200 Subject: [PATCH] Various Fixes --- .gitignore | 2 ++ src/botcmds.lua | 6 ++++++ src/chatcmds.lua | 9 +++++++++ src/init.lua | 10 ++++++++++ 4 files changed, 27 insertions(+) diff --git a/.gitignore b/.gitignore index c2314b9..469e5c3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ irc *.zip *.tar.gz *.tar.bz2 +*.marks +screenshot_*.png diff --git a/src/botcmds.lua b/src/botcmds.lua index c8e17ef..1afc3d9 100644 --- a/src/botcmds.lua +++ b/src/botcmds.lua @@ -20,6 +20,8 @@ mt_irc.register_bot_command = function ( name, def ) end mt_irc.register_bot_command("help", { + params = "[]"; + description = "Get help about a command"; func = function ( from, args ) if (args ~= "") then mt_irc.bot_help(from, args); @@ -35,6 +37,8 @@ mt_irc.register_bot_command("help", { }); mt_irc.register_bot_command("who", { + params = nil; + description = "Tell who is playing"; func = function ( from, args ) local s = ""; for k, v in pairs(mt_irc.connected_players) do @@ -47,6 +51,8 @@ mt_irc.register_bot_command("who", { }); mt_irc.register_bot_command("whereis", { + params = ""; + description = "Tell the location of "; func = function ( from, args ) if (args == "") then diff --git a/src/chatcmds.lua b/src/chatcmds.lua index 1c2ca0d..b4db8e3 100644 --- a/src/chatcmds.lua +++ b/src/chatcmds.lua @@ -79,3 +79,12 @@ minetest.register_chatcommand("who", { minetest.chat_send_player(name, "Players On Channel:"..s); end; }); + +minetest.register_chatcommand("uptime", { + params = ""; + description = "Tell how much time the server has been up"; + privs = { shout=true; }; + func = function ( name, param ) + local t = os.time(); + end; +}); diff --git a/src/init.lua b/src/init.lua index 9e70c3a..acd8083 100644 --- a/src/init.lua +++ b/src/init.lua @@ -123,6 +123,16 @@ mt_irc.connect = function ( ) end end +mt_irc.say = function ( to, msg ) + if (not msg) then + msg = to; + to = mt_irc.channel; + end + to = to or mt_irc.channel; + msg = msg or ""; + irc.say(to, msg); +end + dofile(MODPATH.."/callback.lua"); dofile(MODPATH.."/chatcmds.lua"); dofile(MODPATH.."/botcmds.lua");