Added /irc_disconnect and /irc_reconnect

This commit is contained in:
Diego Martínez 2012-12-31 13:53:01 -02:00
parent ff14ed3153
commit 873fab6d36
3 changed files with 41 additions and 3 deletions

View File

@ -118,9 +118,16 @@ All settings are changed in the `config.lua' file. If any of these settings
mt_irc.debug (boolean, default false)
Whether to output debug information.
mt_irc.connect_on_join (boolean, default false)
If true, players are connected by default. If false, players
have to use the /irc_connect command to connect to the server.
mt_irc.auto_connect (boolean, default false)
If true, the bot is connected by default. If false, a player with
`irc_admin' privilege has to use the /irc_connect command to
connect to the server.
mt_irc.auto_connect (boolean, default false)
If true, players join the channel automatically upon entering the
game. If false, each user must manually use the /join command to
join the channel. In any case, the players may use the /part
command to opt-out of being in the channel.
USAGE
-----

View File

@ -36,6 +36,35 @@ minetest.register_chatcommand("irc_connect", {
end;
});
minetest.register_chatcommand("irc_disconnect", {
params = "";
description = "Disconnect from the IRC server";
privs = { irc_admin=true; };
func = function ( name, param )
if (not mt_irc.connect_ok) then
minetest.chat_send_player(name, "IRC: You are not connected.");
return;
end
irc.quit("Manual BOT Disconnection");
minetest.chat_send_player(name, "IRC: You are now disconnected.");
mt_irc.connect_ok = false;
end;
});
minetest.register_chatcommand("irc_reconnect", {
params = "";
description = "Reconnect to the IRC server";
privs = { irc_admin=true; };
func = function ( name, param )
if (mt_irc.connect_ok) then
irc.quit("Reconnecting BOT...");
minetest.chat_send_player(name, "IRC: Reconnecting bot...");
mt_irc.connect_ok = false;
end
mt_irc.connect();
end;
});
minetest.register_chatcommand("join", {
params = "";
description = "Join the IRC channel";

View File

@ -133,6 +133,8 @@ mt_irc.say = function ( to, msg )
irc.say(to, msg);
end
mt_irc._irc = irc;
dofile(MODPATH.."/callback.lua");
dofile(MODPATH.."/chatcmds.lua");
dofile(MODPATH.."/botcmds.lua");