diff --git a/sopel_modules/SpiceBot/Events.py b/sopel_modules/SpiceBot/Events.py index dee8727..34dfc54 100644 --- a/sopel_modules/SpiceBot/Events.py +++ b/sopel_modules/SpiceBot/Events.py @@ -31,12 +31,14 @@ class BotEvents(object): self.BOT_READY = '1002' self.BOT_CONNECTED = '1003' self.BOT_LOADED = '1004' - self.defaultevents = [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED, self.BOT_LOADED] + self.BOT_RECONNECTED = '1005' + self.defaultevents = [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED, self.BOT_LOADED, self.BOT_RECONNECTED] self.SpiceBot_Events = { - "assigned_IDs": {1000: "Default", 1001: "BOT_WELCOME", 1002: "BOT_READY", 1003: "BOT_CONNECTED", 1004: "BOT_LOADED"}, + "assigned_IDs": {1000: "Default", 1001: "BOT_WELCOME", 1002: "BOT_READY", 1003: "BOT_CONNECTED", 1004: "BOT_LOADED", 1005: "BOT_RECONNECTED"}, "triggers_recieved": {}, "trigger_queue": [], "startup_required": [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED], + "RPL_WELCOME_Count": 0 } def __getattr__(self, name): diff --git a/sopel_modules/SpiceBot_Events/Connection_Count.py b/sopel_modules/SpiceBot_Events/Connection_Count.py new file mode 100644 index 0000000..ca004e3 --- /dev/null +++ b/sopel_modules/SpiceBot_Events/Connection_Count.py @@ -0,0 +1,14 @@ +# coding=utf-8 + +from __future__ import unicode_literals, absolute_import, division, print_function + +import sopel.module + +from sopel_modules.SpiceBot.Events import botevents + + +@sopel.module.event(botevents.RPL_WELCOME) +@sopel.module.rule('.*') +def bot_startup_welcome(bot, trigger): + botevents.SpiceBot_Events["RPL_WELCOME_Count"] += 1 + botevents.trigger(bot, botevents.BOT_RECONNECTED, "Bot Connected to IRC") diff --git a/sopel_modules/SpiceBot_Events/Welcome.py b/sopel_modules/SpiceBot_Events/Welcome.py index 228420e..ca15d55 100644 --- a/sopel_modules/SpiceBot_Events/Welcome.py +++ b/sopel_modules/SpiceBot_Events/Welcome.py @@ -12,4 +12,6 @@ from sopel_modules.SpiceBot.Events import botevents def bot_startup_welcome(bot, trigger): """The Bot events system does not start until RPL_WELCOME 001 is recieved from the server""" + if botevents.check(botevents.BOT_WELCOME): + return botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")