mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
Add The ability to detect connection stability issues
This commit is contained in:
parent
2cd3acd6c6
commit
47018cdfce
@ -31,12 +31,14 @@ class BotEvents(object):
|
|||||||
self.BOT_READY = '1002'
|
self.BOT_READY = '1002'
|
||||||
self.BOT_CONNECTED = '1003'
|
self.BOT_CONNECTED = '1003'
|
||||||
self.BOT_LOADED = '1004'
|
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 = {
|
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": {},
|
"triggers_recieved": {},
|
||||||
"trigger_queue": [],
|
"trigger_queue": [],
|
||||||
"startup_required": [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED],
|
"startup_required": [self.BOT_WELCOME, self.BOT_READY, self.BOT_CONNECTED],
|
||||||
|
"RPL_WELCOME_Count": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
|
|||||||
14
sopel_modules/SpiceBot_Events/Connection_Count.py
Normal file
14
sopel_modules/SpiceBot_Events/Connection_Count.py
Normal 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")
|
||||||
@ -12,4 +12,6 @@ from sopel_modules.SpiceBot.Events import botevents
|
|||||||
def bot_startup_welcome(bot, trigger):
|
def bot_startup_welcome(bot, trigger):
|
||||||
"""The Bot events system does not start until RPL_WELCOME 001 is recieved
|
"""The Bot events system does not start until RPL_WELCOME 001 is recieved
|
||||||
from the server"""
|
from the server"""
|
||||||
|
if botevents.check(botevents.BOT_WELCOME):
|
||||||
|
return
|
||||||
botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")
|
botevents.trigger(bot, botevents.BOT_WELCOME, "Welcome to the SpiceBot Events System")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user