Check that the server is in its channel

This commit is contained in:
ShadowNinja 2016-06-01 11:57:24 -04:00
parent 22e523cc7a
commit 0e79e91fd2
1 changed files with 6 additions and 2 deletions

View File

@ -44,8 +44,12 @@ irc:register_bot_command("login", {
return false, "Player name and password required."
end
local inChannel = false
local users = irc.conn.channels[irc.config.channel].users
for cnick, cuser in pairs(users) do
local channel = irc.conn.channels[irc.config.channel]
if not channel then
return false, "The server needs to be in its "..
"channel for anyone to log in."
end
for cnick, cuser in pairs(channel.users) do
if user.nick == cnick then
inChannel = true
break