1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-11-17 07:10:19 +01:00

Fixed crash when requesting help for unknown command with !help

This commit is contained in:
Diego Martínez 2013-01-26 18:50:18 -02:00
parent 33a16ac395
commit 9eb893e50a
2 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,7 @@ mt_irc.bot_help = function ( from, cmdname )
local cmd = mt_irc.bot_commands[cmdname]; local cmd = mt_irc.bot_commands[cmdname];
if (not cmd) then if (not cmd) then
irc.say(from, "Unknown command `"..cmdname.."'"); irc.say(from, "Unknown command `"..cmdname.."'");
return;
end end
local usage = "Usage: !"..cmdname; local usage = "Usage: !"..cmdname;
if (cmd.params) then usage = usage.." "..cmd.params; end if (cmd.params) then usage = usage.." "..cmd.params; end

View File

@ -206,6 +206,8 @@ irc.handlers.on_err_nicknameinuse = function ( from, respond_to )
end end
mt_irc.got_motd = false; mt_irc.got_motd = false;
mt_irc.connect_ok = false; mt_irc.connect_ok = false;
mt_irc.server_nick = mt_irc.server_nick:sub(1, -2)..math.floor(math.random(10)); local n = (tonumber(mt_irc.server_nick:sub(-1)) or 0) + 1;
if (n == 10) then n = 1; end
mt_irc.server_nick = mt_irc.server_nick:sub(1, -2)..n;
mt_irc.connect(); mt_irc.connect();
end end