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];
if (not cmd) then
irc.say(from, "Unknown command `"..cmdname.."'");
return;
end
local usage = "Usage: !"..cmdname;
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
mt_irc.got_motd = 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();
end