From 0e79e91fd2f23dd85cae75b082c52b477fc99d64 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Wed, 1 Jun 2016 11:57:24 -0400 Subject: [PATCH] Check that the server is in its channel --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 647b1a4..6d88afc 100644 --- a/init.lua +++ b/init.lua @@ -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