diff --git a/src/init.lua b/src/init.lua index dfff384..0a66dd1 100644 --- a/src/init.lua +++ b/src/init.lua @@ -41,10 +41,18 @@ minetest.register_privilege("irc_admin", { give_to_singleplayer = true }) +local firstrun = true minetest.register_globalstep(function(dtime) return mt_irc:step(dtime) end) function mt_irc:step(dtime) + if firstrun then + firstrun = false + if self.config.auto_connect then + self:connect() + end + end + if not self.connected then return end -- Tick down the recent message count @@ -146,7 +154,3 @@ function mt_irc:send(line) end -if mt_irc.config.auto_connect then - mt_irc:connect() -end -