diff --git a/sopel_modules/SpiceBot_AI/AI.py b/sopel_modules/SpiceBot_AI/AI.py index 8fd489a..d1fe128 100644 --- a/sopel_modules/SpiceBot_AI/AI.py +++ b/sopel_modules/SpiceBot_AI/AI.py @@ -17,7 +17,7 @@ def bot_command_nick(bot, trigger): if str(trigger.args[1])[0] == "?": return - while not bot_events_check(bot, [botevents.BOT_LOADED, '2002']): + while not bot_events_check(bot, [botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command') diff --git a/sopel_modules/SpiceBot_Channels/Channels.py b/sopel_modules/SpiceBot_Channels/Channels.py index 2ca8c89..5bb11d6 100644 --- a/sopel_modules/SpiceBot_Channels/Channels.py +++ b/sopel_modules/SpiceBot_Channels/Channels.py @@ -34,7 +34,7 @@ def configure(config): def setup(bot): bot_logging(bot, 'SpiceBot_Channels', "Starting setup procedure") - bot_events_startup_register(bot, ['2001']) + bot_events_startup_register(bot, [botevents.BOT_CHANNELS]) bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False) @@ -74,7 +74,7 @@ def trigger_channel_list_initial(bot, trigger): channel_list_current(bot) foundchannelcount = len(bot.memory['SpiceBot_Channels']['channels'].keys()) bot_logging(bot, 'SpiceBot_Channels', "Channel listing finished! " + str(foundchannelcount) + " channel(s) found.") - bot_events_trigger(bot, '2001', "SpiceBot_Channels") + bot_events_trigger(bot, botevents.BOT_CHANNELS, "SpiceBot_Channels") join_all_channels(bot) chanadmin_all_channels(bot) @@ -123,7 +123,7 @@ def bot_part_empty(bot): del bot.memory['SpiceBot_Channels']['channels'][channel.lower()] -@sopel.module.event('2001') +@sopel.module.event(botevents.BOT_CHANNELS) @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py index 2d9e2ce..434630e 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py +++ b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py @@ -15,7 +15,7 @@ import spicemanip def setup(bot): bot_logging(bot, 'SpiceBot_CommandsQuery', "Starting setup procedure") - bot_events_startup_register(bot, ['2002']) + bot_events_startup_register(bot, [botevents.BOT_COMMANDSQUERY]) if 'SpiceBot_CommandsQuery' not in bot.memory: bot.memory['SpiceBot_CommandsQuery'] = {"counts": 0, "commands": {}, "nickrules": []} @@ -162,7 +162,7 @@ def setup(bot): if command not in bot.memory['SpiceBot_CommandsQuery']['nickrules']: bot.memory['SpiceBot_CommandsQuery']['nickrules'].append(command) - bot_events_trigger(bot, 2002, "SpiceBot_CommandsQuery") + bot_events_trigger(bot, botevents.BOT_COMMANDSQUERY, "SpiceBot_CommandsQuery") def shutdown(bot): @@ -214,7 +214,7 @@ def commandsquery_register(bot, command_type, validcoms, aliasfor=None): bot.memory['SpiceBot_CommandsQuery']['commands'][command_type][comalias] = {"aliasfor": aliasfor} -@sopel.module.event('2002') +@sopel.module.event(botevents.BOT_COMMANDSQUERY) @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_CommandsQuery/NickQueryCommand.py b/sopel_modules/SpiceBot_CommandsQuery/NickQueryCommand.py index 407b045..a934b8d 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/NickQueryCommand.py +++ b/sopel_modules/SpiceBot_CommandsQuery/NickQueryCommand.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel import sopel.module -from sopel_modules.SpiceBot_Events.System import bot_events_check +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string @@ -15,7 +15,7 @@ import spicemanip @sopel.module.nickname_commands('^\?(.*)') def query_detection_nick(bot, trigger): - while not bot_events_check(bot, '2002'): + while not bot_events_check(bot, botevents.BOT_COMMANDSQUERY): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command') diff --git a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py index 1d549a5..8f8011b 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py +++ b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel import sopel.module -from sopel_modules.SpiceBot_Events.System import bot_events_check +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, similar_list, letters_in_string @@ -15,7 +15,7 @@ import spicemanip @sopel.module.rule('^\?(.*)') def query_detection(bot, trigger): - while not bot_events_check(bot, '2002'): + while not bot_events_check(bot, botevents.BOT_COMMANDSQUERY): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'query_command') diff --git a/sopel_modules/SpiceBot_GifSearch/gif.py b/sopel_modules/SpiceBot_GifSearch/gif.py index 52d272f..6c344a9 100644 --- a/sopel_modules/SpiceBot_GifSearch/gif.py +++ b/sopel_modules/SpiceBot_GifSearch/gif.py @@ -7,7 +7,7 @@ from sopel import module from .gifsearch import getGif from sopel_modules.SpiceBot_SBTools import sopel_triggerargs -from sopel_modules.SpiceBot_Events.System import bot_events_check +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents import spicemanip @@ -15,7 +15,7 @@ import spicemanip @module.commands('gif') def gif_trigger(bot, trigger): - while not bot_events_check(bot, '2003'): + while not bot_events_check(bot, botevents.BOT_GIFSEARCH): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger) diff --git a/sopel_modules/SpiceBot_GifSearch/gifapi.py b/sopel_modules/SpiceBot_GifSearch/gifapi.py index 05a7b0e..fa500b9 100644 --- a/sopel_modules/SpiceBot_GifSearch/gifapi.py +++ b/sopel_modules/SpiceBot_GifSearch/gifapi.py @@ -9,13 +9,13 @@ import sopel.module import spicemanip from sopel_modules.SpiceBot_SBTools import sopel_triggerargs -from sopel_modules.SpiceBot_Events.System import bot_events_check +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents @sopel.module.commands('(.*)') def gifapi_triggers(bot, trigger): - while not bot_events_check(bot, '2003'): + while not bot_events_check(bot, botevents.BOT_GIFSEARCH): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command') diff --git a/sopel_modules/SpiceBot_GifSearch/gifsearch.py b/sopel_modules/SpiceBot_GifSearch/gifsearch.py index fb9581d..884bd11 100644 --- a/sopel_modules/SpiceBot_GifSearch/gifsearch.py +++ b/sopel_modules/SpiceBot_GifSearch/gifsearch.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module from sopel.config.types import StaticSection, ValidatedAttribute -from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger +from sopel_modules.SpiceBot_Events.System import bot_events_startup_register, bot_events_recieved, bot_events_trigger, botevents from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register @@ -47,7 +47,7 @@ def configure(config): def setup(bot): bot_logging(bot, 'SpiceBot_GifSearch', "Starting Setup Procedure") - bot_events_startup_register(bot, ['2003']) + bot_events_startup_register(bot, [botevents.BOT_GIFSEARCH]) if 'SpiceBot_GifSearch' not in bot.memory: bot.memory["SpiceBot_GifSearch"] = {"cache": {}, "badgiflinks": [], 'valid_gif_api_dict': {}} @@ -79,7 +79,7 @@ def setup(bot): if validgifapi not in bot.memory["SpiceBot_GifSearch"]['cache'].keys(): bot.memory["SpiceBot_GifSearch"]['cache'][validgifapi] = dict() - bot_events_trigger(bot, 2003, "SpiceBot_GifSearch") + bot_events_trigger(bot, botevents.BOT_GIFSEARCH, "SpiceBot_GifSearch") def shutdown(bot): @@ -251,7 +251,7 @@ def getGif(bot, searchdict): return gifdict -@sopel.module.event('2003') +@sopel.module.event(botevents.BOT_GIFSEARCH) @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py b/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py index 41c5f69..73250cb 100644 --- a/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py +++ b/sopel_modules/SpiceBot_InvalidCommand/InvalidCommand.py @@ -31,7 +31,7 @@ def bot_events_complete(bot, trigger): def InvalidCommand_triggers(bot, trigger): return - while not bot_events_check(bot, [botevents.BOT_LOADED, '2002']): + while not bot_events_check(bot, [botevents.BOT_LOADED, botevents.BOT_COMMANDSQUERY]): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'prefix_command') diff --git a/sopel_modules/SpiceBot_Logs/ErrorDisplay.py b/sopel_modules/SpiceBot_Logs/ErrorDisplay.py index db978ab..1a18456 100644 --- a/sopel_modules/SpiceBot_Logs/ErrorDisplay.py +++ b/sopel_modules/SpiceBot_Logs/ErrorDisplay.py @@ -4,12 +4,12 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module -from sopel_modules.SpiceBot_Events.System import bot_events_recieved +from sopel_modules.SpiceBot_Events.System import bot_events_recieved, botevents from sopel_modules.SpiceBot_SBTools import bot_logging from .Logs import stdio_logs_fetch -@sopel.module.event('2005') +@sopel.module.event(botevents.BOT_STARTUPMONOLOGUE) @sopel.module.rule('.*') def bot_startup_monologue_start(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_Logs/Logs.py b/sopel_modules/SpiceBot_Logs/Logs.py index 4be59f0..151928a 100644 --- a/sopel_modules/SpiceBot_Logs/Logs.py +++ b/sopel_modules/SpiceBot_Logs/Logs.py @@ -26,11 +26,11 @@ def setup(bot): bot_logging(bot, 'SpiceBot_Logs', "Starting Setup Procedure") bot.config.define_section("SpiceBot_Logs", SpiceBot_Logs_MainSection, validate=False) - bot_events_startup_register(bot, ['2004']) + bot_events_startup_register(bot, [botevents.BOT_LOGS]) bot_logs_setup_check(bot) - bot_events_trigger(bot, 2004, "SpiceBot_Logs") + bot_events_trigger(bot, botevents.BOT_LOGS, "SpiceBot_Logs") def bot_logs_setup_check(bot): @@ -131,7 +131,7 @@ def get_running_pid(bot): return pidnum -@sopel.module.event('2004') +@sopel.module.event(botevents.BOT_LOGS) @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_Logs/Logs_Command.py b/sopel_modules/SpiceBot_Logs/Logs_Command.py index de9da49..a095e39 100644 --- a/sopel_modules/SpiceBot_Logs/Logs_Command.py +++ b/sopel_modules/SpiceBot_Logs/Logs_Command.py @@ -7,14 +7,14 @@ import sopel.module import spicemanip from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, inlist, inlist_match, similar_list -from sopel_modules.SpiceBot_Events.System import bot_events_check +from sopel_modules.SpiceBot_Events.System import bot_events_check, botevents from .Logs import systemd_logs_fetch, stdio_logs_fetch @sopel.module.nickname_commands('logs', 'debug') def bot_command_logs(bot, trigger): - while not bot_events_check(bot, '2004'): + while not bot_events_check(bot, botevents.BOT_LOGS): pass if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']): diff --git a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py index c036231..fd5b640 100644 --- a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py +++ b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py @@ -4,19 +4,19 @@ from __future__ import unicode_literals, absolute_import, division, print_functi import sopel.module -from sopel_modules.SpiceBot_Events.System import bot_events_recieved, bot_events_startup_register +from sopel_modules.SpiceBot_Events.System import bot_events_recieved, bot_events_startup_register, botevents from sopel_modules.SpiceBot_SBTools import bot_logging def setup(bot): bot_logging(bot, 'SpiceBot_StartupMonologue', "Starting setup procedure") - bot_events_startup_register(bot, ['2010', '2011', '2012']) + bot_events_startup_register(bot, [botevents.BOT_STARTUPMONOLOGUE_CHANNELS, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, botevents.BOT_STARTUPMONOLOGUE_CONNECTED]) if 'SpiceBot_StartupMonologue' not in bot.memory: bot.memory['SpiceBot_StartupMonologue'] = [] -@sopel.module.event('2005', '2010', '2011', '2012') +@sopel.module.event(botevents.BOT_STARTUPMONOLOGUE, botevents.BOT_STARTUPMONOLOGUE_CHANNELS, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, botevents.BOT_STARTUPMONOLOGUE_CONNECTED) @sopel.module.rule('.*') def bot_events_setup(bot, trigger): bot_events_recieved(bot, trigger.event) diff --git a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py index e638bfb..77e15f5 100644 --- a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py +++ b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue_Display.py @@ -19,10 +19,10 @@ def bot_startup_monologue_start(bot, trigger): bot_logging(bot, 'SpiceBot_StartupMonologue', bot.nick + " is now starting. Please wait while I load my configuration") bot.osd(" is now starting. Please wait while I load my configuration.", bot.channels.keys(), 'ACTION') - bot_events_trigger(bot, 2012, "SpiceBot_StartupMonologue") + bot_events_trigger(bot, botevents.BOT_STARTUPMONOLOGUE_CONNECTED, "SpiceBot_StartupMonologue") -@sopel.module.event('2002') +@sopel.module.event(botevents.BOT_COMMANDSQUERY) @sopel.module.rule('.*') def bot_startup_monologue_commands(bot, trigger): bot_events_recieved(bot, trigger.event) @@ -35,10 +35,10 @@ def bot_startup_monologue_commands(bot, trigger): bot.memory['SpiceBot_StartupMonologue'].append("There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.") bot_logging(bot, 'SpiceBot_StartupMonologue', "There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files.") - bot_events_trigger(bot, 2011, "SpiceBot_StartupMonologue") + bot_events_trigger(bot, botevents.BOT_STARTUPMONOLOGUE_COMMANDSQUERY, "SpiceBot_StartupMonologue") -@sopel.module.event('2001') +@sopel.module.event(botevents.BOT_CHANNELS) @sopel.module.rule('.*') def bot_startup_monologue_channels(bot, trigger): bot_events_recieved(bot, trigger.event) @@ -47,7 +47,7 @@ def bot_startup_monologue_channels(bot, trigger): servercount = len(bot.memory['SpiceBot_Channels']['channels'].keys()) bot.memory['SpiceBot_StartupMonologue'].append("I am in " + str(botcount) + " of " + str(servercount) + " channel(s) available on this server.") - bot_events_trigger(bot, 2010, "SpiceBot_StartupMonologue") + bot_events_trigger(bot, botevents.BOT_STARTUPMONOLOGUE_CHANNELS, "SpiceBot_StartupMonologue") @sopel.module.event(botevents.BOT_LOADED) @@ -64,5 +64,5 @@ def bot_startup_monologue_display(bot, trigger): bot.osd(bot.memory['SpiceBot_StartupMonologue'], bot.channels.keys(), 'ACTION') - bot_events_trigger(bot, 2005, "SpiceBot_StartupMonologue") + bot_events_trigger(bot, botevents.BOT_STARTUPMONOLOGUE, "SpiceBot_StartupMonologue") bot_logging(bot, 'SpiceBot_StartupMonologue', "Startup Monologue has been issued to all channels.", True)