Add The ability to detect connection stability issues

This commit is contained in:
deathbybandaid 2019-05-19 17:33:01 -04:00
parent 2cd3acd6c6
commit 47018cdfce
3 changed files with 20 additions and 2 deletions

View File

@ -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):

View File

@ -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")

View File

@ -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")