From e0f748d69a6f03ca61d879eb2d5991d1ad49d257 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 2 May 2019 21:09:11 -0400 Subject: [PATCH] Gif Tweaks --- sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py | 10 ++++++++++ sopel_modules/SpiceBot_GifSearch/gifsearch.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py index c20a53f..81080b5 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py +++ b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py @@ -232,6 +232,16 @@ def query_detection(bot, trigger): return +def commandsquery_register_type(bot, command_type): + if 'SpiceBot_CommandsQuery' not in bot.memory: + bot.memory['SpiceBot_CommandsQuery'] = dict() + + if command_type not in bot.memory['SpiceBot_CommandsQuery'].keys(): + bot.memory['SpiceBot_CommandsQuery'][command_type] = dict() + bot.memory['SpiceBot_CommandsQuery'][command_type + "_count"] = 0 + bot.memory['SpiceBot_CommandsQuery'][command_type + "_count"] += 1 + + def commandsquery_register(bot, command_type, validcoms, aliasfor=None): if not isinstance(validcoms, list): diff --git a/sopel_modules/SpiceBot_GifSearch/gifsearch.py b/sopel_modules/SpiceBot_GifSearch/gifsearch.py index 13f2173..6922d29 100644 --- a/sopel_modules/SpiceBot_GifSearch/gifsearch.py +++ b/sopel_modules/SpiceBot_GifSearch/gifsearch.py @@ -10,7 +10,7 @@ import sopel_modules.osd from sopel_modules.SpiceBot_Botevents.BotEvents import set_bot_event, check_bot_events, startup_bot_event -from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register +from sopel_modules.SpiceBot_CommandsQuery.CommandsQuery import commandsquery_register, commandsquery_register_type from sopel_modules.SpiceBot_SBTools import read_directory_json_to_dict, sopel_triggerargs @@ -90,6 +90,7 @@ def setup_thread(bot): while not check_bot_events(bot, ["SpiceBot_CommandsQuery"]): pass + commandsquery_register_type(bot, "prefix_command") for prefix_command in bot.memory["SpiceBot_GifSearch"]['valid_gif_api_dict'].keys(): commandsquery_register(bot, "prefix_command", prefix_command)