From d579cfd24edba90656be2b8d7ab0729798e28868 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 18:46:17 -0400 Subject: [PATCH 01/13] remove unrequired check --- sopel_modules/SpiceBot_SBTools/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index b664170..2575cdd 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -97,8 +97,7 @@ def bot_logging(bot, logtype, logentry): logmessage = "[" + logtype + "] " + logentry + "" - if bot.config.SpiceBot_Logs.logging_channel: - bot.memory['SpiceBot_Logs_queue'].append(logmessage) + bot.memory['SpiceBot_Logs_queue'].append(logmessage) stderr("\n" + logmessage + "\n") From a628f495f23e2d16da4a8e98c8c39ec2aa503d06 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 19:22:37 -0400 Subject: [PATCH 02/13] cleaner way to restart the bot --- sopel_modules/SpiceBot_BotPrivs/BotPrivs.py | 4 ++++ sopel_modules/SpiceBot_Botevents/BotEvents.py | 5 +++++ sopel_modules/SpiceBot_Channels/Channels.py | 5 +++++ .../SpiceBot_CommandsQuery/CommandsQuery.py | 5 +++++ .../SpiceBot_Database_Addons/Databaseaddons.py | 4 ++++ .../SpiceBot_Database_Cache/DatabaseCache.py | 5 +++++ .../SpiceBot_Database_Tools/DatabaseTools.py | 12 ++++++++++++ sopel_modules/SpiceBot_Docs/Docs.py | 4 ++++ sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py | 4 ++++ sopel_modules/SpiceBot_Gender/Gender.py | 4 ++++ sopel_modules/SpiceBot_GifSearch/gifsearch.py | 5 +++++ .../SpiceBot_InsultHandler/InsultHandler.py | 4 ++++ sopel_modules/SpiceBot_Logs/Logs.py | 7 +++++++ sopel_modules/SpiceBot_Messaging/Messaging.py | 4 ++++ sopel_modules/SpiceBot_Restart/Restart.py | 7 ++++++- sopel_modules/SpiceBot_SBTools/__init__.py | 4 ++++ .../SpiceBot_StartupMonologue/StartupMonologue.py | 4 ++++ sopel_modules/SpiceBot_Update/Update.py | 7 ++++++- sopel_modules/SpiceBot_Uptime/Uptime.py | 5 +++++ sopel_modules/SpiceBot_osd/__init__.py | 4 ++++ 20 files changed, 101 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_BotPrivs/BotPrivs.py b/sopel_modules/SpiceBot_BotPrivs/BotPrivs.py index f6ae1b5..1954150 100644 --- a/sopel_modules/SpiceBot_BotPrivs/BotPrivs.py +++ b/sopel_modules/SpiceBot_BotPrivs/BotPrivs.py @@ -17,6 +17,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.nickname_commands('owners', 'owner') def bot_command_owners(bot, trigger): bot_command_process(bot, trigger) diff --git a/sopel_modules/SpiceBot_Botevents/BotEvents.py b/sopel_modules/SpiceBot_Botevents/BotEvents.py index 57db01d..b6f88dd 100644 --- a/sopel_modules/SpiceBot_Botevents/BotEvents.py +++ b/sopel_modules/SpiceBot_Botevents/BotEvents.py @@ -20,6 +20,11 @@ def setup(bot): threading.Thread(target=setup_thread, args=(bot,)).start() +def shutdown(bot): + if "Sopel_BotEvents" in bot.memory: + del bot.memory["Sopel_BotEvents"] + + def setup_thread(bot): if "Sopel_BotEvents" not in bot.memory: bot.memory["Sopel_BotEvents"] = {"loaded": [], "startup": []} diff --git a/sopel_modules/SpiceBot_Channels/Channels.py b/sopel_modules/SpiceBot_Channels/Channels.py index 54dca05..908a5f1 100644 --- a/sopel_modules/SpiceBot_Channels/Channels.py +++ b/sopel_modules/SpiceBot_Channels/Channels.py @@ -51,6 +51,11 @@ def setup(bot): bot.memory['SpiceBot_Channels']['ProcessLock'] = False +def shutdown(bot): + if "SpiceBot_Channels" in bot.memory: + del bot.memory["SpiceBot_Channels"] + + @sopel.module.event('001') @sopel.module.rule('.*') def trigger_channel_list_initial(bot, trigger): diff --git a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py index 0d3f6fc..0ed520c 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py +++ b/sopel_modules/SpiceBot_CommandsQuery/CommandsQuery.py @@ -26,6 +26,11 @@ def setup(bot): threading.Thread(target=setup_thread, args=(bot,)).start() +def shutdown(bot): + if "SpiceBot_CommandsQuery" in bot.memory: + del bot.memory["SpiceBot_CommandsQuery"] + + def setup_thread(bot): if 'SpiceBot_CommandsQuery' not in bot.memory: diff --git a/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py b/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py index 7c07129..ad33a4e 100644 --- a/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py +++ b/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py @@ -21,6 +21,10 @@ def setup(bot): SopelDB._create_table = SopelDBCache._create_table +def shutdown(bot): + pass + + class SopelDBCache: """Dynamic Table Creation""" diff --git a/sopel_modules/SpiceBot_Database_Cache/DatabaseCache.py b/sopel_modules/SpiceBot_Database_Cache/DatabaseCache.py index 754d0ed..1811877 100644 --- a/sopel_modules/SpiceBot_Database_Cache/DatabaseCache.py +++ b/sopel_modules/SpiceBot_Database_Cache/DatabaseCache.py @@ -11,3 +11,8 @@ def setup(bot): bot_logging(bot, 'SpiceBot_DatabaseCache', "Setting up Database Cache") if 'SpiceBot_DatabaseCache' not in bot.memory: bot.memory['SpiceBot_DatabaseCache'] = dict() + + +def shutdown(bot): + if "SpiceBot_DatabaseCache" in bot.memory: + del bot.memory["SpiceBot_DatabaseCache"] diff --git a/sopel_modules/SpiceBot_Database_Tools/DatabaseTools.py b/sopel_modules/SpiceBot_Database_Tools/DatabaseTools.py index 816c56f..53242da 100644 --- a/sopel_modules/SpiceBot_Database_Tools/DatabaseTools.py +++ b/sopel_modules/SpiceBot_Database_Tools/DatabaseTools.py @@ -6,6 +6,18 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi import sopel.module +def configure(config): + pass + + +def setup(bot): + pass + + +def shutdown(bot): + pass + + """Dyanmic Table Creation""" diff --git a/sopel_modules/SpiceBot_Docs/Docs.py b/sopel_modules/SpiceBot_Docs/Docs.py index 16b7116..bdda514 100644 --- a/sopel_modules/SpiceBot_Docs/Docs.py +++ b/sopel_modules/SpiceBot_Docs/Docs.py @@ -17,6 +17,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.nickname_commands('help', 'docs', 'wiki') def bot_command_owners(bot, trigger): bot.osd(["IRC Modules Repository", str(github_dict["url_main"] + github_dict["repo_owner"] + "/" + github_dict["repo_name"] + github_dict["url_path_wiki"])]) diff --git a/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py b/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py index 12b9431..c0c8086 100644 --- a/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py +++ b/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py @@ -15,6 +15,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$') def bot_command_hello(bot, trigger): hello = spicemanip.main(['Hi', 'Hey', 'Hello'], "random") diff --git a/sopel_modules/SpiceBot_Gender/Gender.py b/sopel_modules/SpiceBot_Gender/Gender.py index 8069f0d..f74655d 100644 --- a/sopel_modules/SpiceBot_Gender/Gender.py +++ b/sopel_modules/SpiceBot_Gender/Gender.py @@ -13,6 +13,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.nickname_commands('gender') def bot_command_gender(bot, trigger): bot.osd("If societal genders are binary, my gender is female") diff --git a/sopel_modules/SpiceBot_GifSearch/gifsearch.py b/sopel_modules/SpiceBot_GifSearch/gifsearch.py index 28f9b69..b6cad11 100644 --- a/sopel_modules/SpiceBot_GifSearch/gifsearch.py +++ b/sopel_modules/SpiceBot_GifSearch/gifsearch.py @@ -57,6 +57,11 @@ def setup(bot): threading.Thread(target=setup_thread, args=(bot,)).start() +def shutdown(bot): + if "SpiceBot_GifSearch" in bot.memory: + del bot.memory["SpiceBot_GifSearch"] + + def setup_thread(bot): startup_bot_event(bot, "SpiceBot_GifSearch") diff --git a/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py b/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py index 724aae4..311ed8e 100644 --- a/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py +++ b/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py @@ -13,6 +13,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.rule(r'(?i)(Fuck|Screw) (you|off),? $nickname[ \t]*$') def bot_command_srewyou(bot, trigger): bot.osd("Watch your mouth, " + trigger.nick + ", or I'll tell your mother!") diff --git a/sopel_modules/SpiceBot_Logs/Logs.py b/sopel_modules/SpiceBot_Logs/Logs.py index b507710..ebbb12c 100644 --- a/sopel_modules/SpiceBot_Logs/Logs.py +++ b/sopel_modules/SpiceBot_Logs/Logs.py @@ -30,6 +30,13 @@ def setup(bot): bot.memory['SpiceBot_Logs_queue'] = [] +def shutdown(bot): + if "SpiceBot_Logs" in bot.memory: + del bot.memory["SpiceBot_Logs"] + if "SpiceBot_Logs_queue" in bot.memory: + del bot.memory["SpiceBot_Logs_queue"] + + @sopel.module.event('001') @sopel.module.rule('.*') def join_log_channel(bot, trigger): diff --git a/sopel_modules/SpiceBot_Messaging/Messaging.py b/sopel_modules/SpiceBot_Messaging/Messaging.py index 099d356..8b24a0b 100644 --- a/sopel_modules/SpiceBot_Messaging/Messaging.py +++ b/sopel_modules/SpiceBot_Messaging/Messaging.py @@ -17,6 +17,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @sopel.module.nickname_commands('action') def bot_command_action(bot, trigger): bot_command_process(bot, trigger) diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index 58baea5..28da9eb 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -9,6 +9,10 @@ from sopel.config.types import StaticSection, ValidatedAttribute from sopel_modules.SpiceBot_SBTools import service_manip, bot_logging +def shutdown(bot): + pass + + @sopel.module.nickname_commands('restart') def nickname_comand_chanstats(bot, trigger): @@ -18,4 +22,5 @@ def nickname_comand_chanstats(bot, trigger): bot_logging(bot, 'SpiceBot_Restart', "Received command from " + trigger.nick + " to restart") bot.osd("Received command from " + trigger.nick + " to restart. Be Back Soon!", bot.channels.keys()) - service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') + # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') + bot.restart() diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index 2575cdd..cb442e1 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -251,6 +251,10 @@ def channel_list_current(bot): """Environment Functions""" +def spicebot_reload(bot): + bot.reload_plugins() + + def service_manip(bot, servicename, dowhat, log_from='service_manip'): if str(dowhat) not in ["start", "stop", "restart"]: return diff --git a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py index ef27a1a..f86d971 100644 --- a/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py +++ b/sopel_modules/SpiceBot_StartupMonologue/StartupMonologue.py @@ -18,6 +18,10 @@ def setup(bot): pass +def shutdown(bot): + pass + + @module.event('001') @module.rule('.*') @module.thread(True) diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index c137b5c..e45acec 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -29,6 +29,10 @@ def setup(bot): bot.config.define_section("SpiceBot_Update", SpiceBot_Update_MainSection, validate=False) +def shutdown(bot): + pass + + @sopel.module.nickname_commands('update') def nickname_comand_chanstats(bot, trigger): @@ -57,7 +61,8 @@ def nickname_comand_chanstats(bot, trigger): if commandused == 'deps': spicebot_update(bot, "True") - service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') + # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') + bot.restart() def spicebot_update(bot, deps="False"): diff --git a/sopel_modules/SpiceBot_Uptime/Uptime.py b/sopel_modules/SpiceBot_Uptime/Uptime.py index 1e56e13..81ba858 100644 --- a/sopel_modules/SpiceBot_Uptime/Uptime.py +++ b/sopel_modules/SpiceBot_Uptime/Uptime.py @@ -22,6 +22,11 @@ def setup(bot): bot.memory["SpiceBot_Uptime"] = now +def shutdown(bot): + if "SpiceBot_Uptime" in bot.memory: + del bot.memory["SpiceBot_Uptime"] + + @sopel.module.nickname_commands('uptime') def bot_command_srewyou(bot, trigger): timesince = str(humanized_time(time.time() - bot.memory["SpiceBot_Uptime"])) + " ago." diff --git a/sopel_modules/SpiceBot_osd/__init__.py b/sopel_modules/SpiceBot_osd/__init__.py index 92c3810..e4c73d0 100644 --- a/sopel_modules/SpiceBot_osd/__init__.py +++ b/sopel_modules/SpiceBot_osd/__init__.py @@ -54,6 +54,10 @@ def setup(bot): bot.config.define_section("MAXTARGCONFIG", MAXTARGCONFIG, validate=False) +def shutdown(bot): + pass + + # RPL_ISUPPORT = '005' @module.event('005') @module.rule('.*') From 8cde891e32850e817b7ba88464124902cc34c0b5 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 19:37:06 -0400 Subject: [PATCH 03/13] new restart sequence --- sopel_modules/SpiceBot_Restart/Restart.py | 2 +- sopel_modules/SpiceBot_SBTools/__init__.py | 1 + sopel_modules/SpiceBot_Update/Update.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index 28da9eb..1d0b26b 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -23,4 +23,4 @@ def nickname_comand_chanstats(bot, trigger): bot.osd("Received command from " + trigger.nick + " to restart. Be Back Soon!", bot.channels.keys()) # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') - bot.restart() + # bot.restart() diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index cb442e1..00e8883 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -253,6 +253,7 @@ def channel_list_current(bot): def spicebot_reload(bot): bot.reload_plugins() + bot.restart() def service_manip(bot, servicename, dowhat, log_from='service_manip'): diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index e45acec..1c5a0c2 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -62,7 +62,7 @@ def nickname_comand_chanstats(bot, trigger): spicebot_update(bot, "True") # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') - bot.restart() + # bot.restart() def spicebot_update(bot, deps="False"): From 1e19f48ed407267db9512ddde3f1c8becbc5199e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 19:39:35 -0400 Subject: [PATCH 04/13] implant new startup code --- sopel_modules/SpiceBot_Restart/Restart.py | 5 ++--- sopel_modules/SpiceBot_Update/Update.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index 1d0b26b..3e03ee8 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals, absolute_import, print_function, divisi import sopel.module from sopel.config.types import StaticSection, ValidatedAttribute -from sopel_modules.SpiceBot_SBTools import service_manip, bot_logging +from sopel_modules.SpiceBot_SBTools import service_manip, bot_logging, spicebot_reload def shutdown(bot): @@ -22,5 +22,4 @@ def nickname_comand_chanstats(bot, trigger): bot_logging(bot, 'SpiceBot_Restart', "Received command from " + trigger.nick + " to restart") bot.osd("Received command from " + trigger.nick + " to restart. Be Back Soon!", bot.channels.keys()) - # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') - # bot.restart() + spicebot_reload(bot) diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index 1c5a0c2..e3ca602 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -10,7 +10,7 @@ import os import spicemanip -from sopel_modules.SpiceBot_SBTools import service_manip, sopel_triggerargs, command_permissions_check, bot_logging +from sopel_modules.SpiceBot_SBTools import service_manip, sopel_triggerargs, command_permissions_check, bot_logging, spicebot_reload class SpiceBot_Update_MainSection(StaticSection): @@ -61,8 +61,7 @@ def nickname_comand_chanstats(bot, trigger): if commandused == 'deps': spicebot_update(bot, "True") - # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') - # bot.restart() + spicebot_reload(bot) def spicebot_update(bot, deps="False"): From 1e349ae89c2c6c5ed5f65647bf5331da5a57f21b Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 20:11:41 -0400 Subject: [PATCH 05/13] Attempt to self trigger 001 RPL_Welcome --- sopel_modules/SpiceBot_SBTools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index 00e8883..012b81b 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -253,7 +253,7 @@ def channel_list_current(bot): def spicebot_reload(bot): bot.reload_plugins() - bot.restart() + bot.write(('NOTICE', bot.nick), '001 Foo :Hello') def service_manip(bot, servicename, dowhat, log_from='service_manip'): From 2a8dc4fa8c7a0508d3ab44e7dd7ef1efdbf84ceb Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 20:36:02 -0400 Subject: [PATCH 06/13] revert changes --- sopel_modules/SpiceBot_Restart/Restart.py | 3 ++- sopel_modules/SpiceBot_SBTools/__init__.py | 7 ++++--- sopel_modules/SpiceBot_Update/Update.py | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index 3e03ee8..b9d2863 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -22,4 +22,5 @@ def nickname_comand_chanstats(bot, trigger): bot_logging(bot, 'SpiceBot_Restart', "Received command from " + trigger.nick + " to restart") bot.osd("Received command from " + trigger.nick + " to restart. Be Back Soon!", bot.channels.keys()) - spicebot_reload(bot) + # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') + spicebot_reload(bot, 'SpiceBot_Restart') diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index 012b81b..12a3c21 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -251,9 +251,10 @@ def channel_list_current(bot): """Environment Functions""" -def spicebot_reload(bot): - bot.reload_plugins() - bot.write(('NOTICE', bot.nick), '001 Foo :Hello') +def spicebot_reload(bot, log_from='service_manip'): + service_manip(bot, bot.nick, 'restart', log_from) + # bot.reload_plugins() + # bot.write(('NOTICE', bot.nick), '001 Foo :Hello') def service_manip(bot, servicename, dowhat, log_from='service_manip'): diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index e3ca602..96f3be6 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -61,7 +61,8 @@ def nickname_comand_chanstats(bot, trigger): if commandused == 'deps': spicebot_update(bot, "True") - spicebot_reload(bot) + # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') + spicebot_reload(bot, 'SpiceBot_Update') def spicebot_update(bot, deps="False"): From 622021f765de6de658382c6b85bc9a1de8c4d69d Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 20:57:48 -0400 Subject: [PATCH 07/13] pip.main install test --- sopel_modules/SpiceBot_Update/Update.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index 96f3be6..0c741d1 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -7,6 +7,7 @@ import sopel.module from sopel.config.types import StaticSection, ValidatedAttribute import os +import pip import spicemanip @@ -67,11 +68,21 @@ def nickname_comand_chanstats(bot, trigger): def spicebot_update(bot, deps="False"): + """ pipcommand = "sudo pip3 install --upgrade" if deps == "False": pipcommand += " --no-deps" pipcommand += " --force-reinstall" pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch) + """ + + pipcommand = ['install'] + pipcommand.append('--upgrade') + if deps == "False": + pipcommand.append('--no-deps') + pipcommand.append('--force-reinstall') + pipcommand.append("git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)) + pip.main(pipcommand) bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") for line in os.popen(pipcommand).read().split('\n'): From 2b48a14af27ef524a20c7b160ef3a59c08edf357 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 21:08:00 -0400 Subject: [PATCH 08/13] comment out old code --- sopel_modules/SpiceBot_Update/Update.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index 0c741d1..09b1b86 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -84,9 +84,9 @@ def spicebot_update(bot, deps="False"): pipcommand.append("git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)) pip.main(pipcommand) - bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") - for line in os.popen(pipcommand).read().split('\n'): - bot_logging(bot, 'SpiceBot_Update', " " + line) + # bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") + # for line in os.popen(pipcommand).read().split('\n'): + # bot_logging(bot, 'SpiceBot_Update', " " + line) # Remove stock modules, if present main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__)) From 06fcb5dbdd005e8fe9616d2891832b8bd2c07e3d Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 4 May 2019 21:08:54 -0400 Subject: [PATCH 09/13] revert change --- sopel_modules/SpiceBot_Update/Update.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index 09b1b86..f2f0c2b 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -68,14 +68,13 @@ def nickname_comand_chanstats(bot, trigger): def spicebot_update(bot, deps="False"): - """ pipcommand = "sudo pip3 install --upgrade" if deps == "False": pipcommand += " --no-deps" pipcommand += " --force-reinstall" pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch) - """ + """ pipcommand = ['install'] pipcommand.append('--upgrade') if deps == "False": @@ -83,10 +82,11 @@ def spicebot_update(bot, deps="False"): pipcommand.append('--force-reinstall') pipcommand.append("git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)) pip.main(pipcommand) + """ - # bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") - # for line in os.popen(pipcommand).read().split('\n'): - # bot_logging(bot, 'SpiceBot_Update', " " + line) + bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") + for line in os.popen(pipcommand).read().split('\n'): + bot_logging(bot, 'SpiceBot_Update', " " + line) # Remove stock modules, if present main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__)) From 95b25c7b890f1e7009525a9dd5ae9418cde655de Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sun, 5 May 2019 10:05:11 -0400 Subject: [PATCH 10/13] bot.restart attempt --- sopel_modules/SpiceBot_SBTools/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index 12a3c21..7171a3f 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -252,9 +252,10 @@ def channel_list_current(bot): def spicebot_reload(bot, log_from='service_manip'): - service_manip(bot, bot.nick, 'restart', log_from) + # service_manip(bot, bot.nick, 'restart', log_from) # bot.reload_plugins() # bot.write(('NOTICE', bot.nick), '001 Foo :Hello') + bot.restart() def service_manip(bot, servicename, dowhat, log_from='service_manip'): From 9cc3458de4612ea0fa9cda02a5f4eb389398d34a Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sun, 5 May 2019 10:58:29 -0400 Subject: [PATCH 11/13] Updates --- README.md | 8 ++++++++ requirements.txt | 1 - sopel_modules/SpiceBot_Channels/Channels.py | 2 +- sopel_modules/SpiceBot_Restart/Restart.py | 2 +- sopel_modules/SpiceBot_Update/Update.py | 17 ++++++----------- sopel_modules/SpiceBot_osd/__init__.py | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 47140c4..ea9474b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,14 @@ SpiceBot aims to run SpiceBot as an IRC service Use at your own risk. Problems are not my faultâ„¢. # Installation +This install assumes you know that you need sopel installed, depending on how bleeding edge you want sopel to be, + +```` +pip3 install sopel>=6.0,<7 +OR +pip3 install git+https://github.com/sopel-irc/sopel@master +```` + ```` git clone https://github.com/SpiceBot/SpiceBot.git cd SpiceBot diff --git a/requirements.txt b/requirements.txt index bb005cf..6aabc4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -sopel>=6.0,<7 spicemanip>=0.1.6 gitpython fake-useragent diff --git a/sopel_modules/SpiceBot_Channels/Channels.py b/sopel_modules/SpiceBot_Channels/Channels.py index 908a5f1..c181b53 100644 --- a/sopel_modules/SpiceBot_Channels/Channels.py +++ b/sopel_modules/SpiceBot_Channels/Channels.py @@ -137,7 +137,7 @@ def watch_chanlist_complete(bot, trigger): @sopel.module.nickname_commands('channels', 'channel') -def nickname_comand_chanstats(bot, trigger): +def nickname_comand_channels(bot, trigger): triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command') diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index b9d2863..818a823 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -14,7 +14,7 @@ def shutdown(bot): @sopel.module.nickname_commands('restart') -def nickname_comand_chanstats(bot, trigger): +def nickname_comand_restart(bot, trigger): if not trigger.admin: bot.say("You are not authorized to perform this function.") diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index f2f0c2b..d51648b 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -35,7 +35,7 @@ def shutdown(bot): @sopel.module.nickname_commands('update') -def nickname_comand_chanstats(bot, trigger): +def nickname_comand_update(bot, trigger): if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']): bot.say("I was unable to process this Bot Nick command due to privilege issues.") @@ -74,20 +74,15 @@ def spicebot_update(bot, deps="False"): pipcommand += " --force-reinstall" pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch) - """ - pipcommand = ['install'] - pipcommand.append('--upgrade') - if deps == "False": - pipcommand.append('--no-deps') - pipcommand.append('--force-reinstall') - pipcommand.append("git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)) - pip.main(pipcommand) - """ - bot_logging(bot, 'SpiceBot_Update', "Running `" + pipcommand + "`") for line in os.popen(pipcommand).read().split('\n'): bot_logging(bot, 'SpiceBot_Update', " " + line) + stock_modules_begone(bot) + + +def stock_modules_begone(bot): + # Remove stock modules, if present main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__)) modules_dir = os.path.join(main_sopel_dir, 'modules') diff --git a/sopel_modules/SpiceBot_osd/__init__.py b/sopel_modules/SpiceBot_osd/__init__.py index e4c73d0..93cbfc2 100644 --- a/sopel_modules/SpiceBot_osd/__init__.py +++ b/sopel_modules/SpiceBot_osd/__init__.py @@ -37,7 +37,7 @@ def setup(bot): # Inject OSD bot_logging(bot, 'SpiceBot_OSD', "Implanting OSD function into bot") bot.osd = SopelOSD.osd - bot.SopelWrapper.osd = SopelOSD.SopelWrapper.osd + sopel.bot.SopelWrapper.osd = SopelOSD.SopelWrapper.osd tools.get_available_message_bytes = ToolsOSD.get_available_message_bytes tools.get_sendable_message_list = ToolsOSD.get_sendable_message_list tools.get_message_recipientgroups = ToolsOSD.get_message_recipientgroups From 963ff50dcf49114864623f8097e9eb8ae9121044 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sun, 5 May 2019 11:01:35 -0400 Subject: [PATCH 12/13] Update to new sopelwrapper format --- sopel_modules/SpiceBot_osd/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot_osd/__init__.py b/sopel_modules/SpiceBot_osd/__init__.py index 93cbfc2..8c4bbbb 100644 --- a/sopel_modules/SpiceBot_osd/__init__.py +++ b/sopel_modules/SpiceBot_osd/__init__.py @@ -44,10 +44,10 @@ def setup(bot): # overwrite default bot messaging bot_logging(bot, 'SpiceBot_OSD', "Overwrite Default Sopel messaging commands") - bot.SopelWrapper.say = SopelOSD.SopelWrapper.say - bot.SopelWrapper.action = SopelOSD.SopelWrapper.action - bot.SopelWrapper.notice = SopelOSD.SopelWrapper.notice - bot.SopelWrapper.reply = SopelOSD.SopelWrapper.reply + sopel.bot.SopelWrapper.say = SopelOSD.SopelWrapper.say + sopel.bot.SopelWrapper.action = SopelOSD.SopelWrapper.action + sopel.bot.SopelWrapper.notice = SopelOSD.SopelWrapper.notice + sopel.bot.SopelWrapper.reply = SopelOSD.SopelWrapper.reply # verify config settings for server bot_logging(bot, 'SpiceBot_OSD', "Checking for config settings") From dc8ca7464040118eee3559ebd46e90bfb6431324 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sun, 5 May 2019 11:08:11 -0400 Subject: [PATCH 13/13] quitmessage required --- sopel_modules/SpiceBot_Restart/Restart.py | 7 ++++--- sopel_modules/SpiceBot_SBTools/__init__.py | 4 ++-- sopel_modules/SpiceBot_Update/Update.py | 15 ++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sopel_modules/SpiceBot_Restart/Restart.py b/sopel_modules/SpiceBot_Restart/Restart.py index 818a823..e14c412 100644 --- a/sopel_modules/SpiceBot_Restart/Restart.py +++ b/sopel_modules/SpiceBot_Restart/Restart.py @@ -19,8 +19,9 @@ def nickname_comand_restart(bot, trigger): if not trigger.admin: bot.say("You are not authorized to perform this function.") - bot_logging(bot, 'SpiceBot_Restart', "Received command from " + trigger.nick + " to restart") - bot.osd("Received command from " + trigger.nick + " to restart. Be Back Soon!", bot.channels.keys()) + quitmessage = "Received command from " + trigger.nick + " to restart. Be Back Soon!" + bot_logging(bot, 'SpiceBot_Restart', quitmessage) + bot.osd(quitmessage, bot.channels.keys()) # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Restart') - spicebot_reload(bot, 'SpiceBot_Restart') + spicebot_reload(bot, 'SpiceBot_Restart', quitmessage) diff --git a/sopel_modules/SpiceBot_SBTools/__init__.py b/sopel_modules/SpiceBot_SBTools/__init__.py index 7171a3f..2e3003a 100644 --- a/sopel_modules/SpiceBot_SBTools/__init__.py +++ b/sopel_modules/SpiceBot_SBTools/__init__.py @@ -251,11 +251,11 @@ def channel_list_current(bot): """Environment Functions""" -def spicebot_reload(bot, log_from='service_manip'): +def spicebot_reload(bot, log_from='service_manip', quitmessage='Recieved QUIT'): # service_manip(bot, bot.nick, 'restart', log_from) # bot.reload_plugins() # bot.write(('NOTICE', bot.nick), '001 Foo :Hello') - bot.restart() + bot.restart(quitmessage) def service_manip(bot, servicename, dowhat, log_from='service_manip'): diff --git a/sopel_modules/SpiceBot_Update/Update.py b/sopel_modules/SpiceBot_Update/Update.py index d51648b..991c54e 100644 --- a/sopel_modules/SpiceBot_Update/Update.py +++ b/sopel_modules/SpiceBot_Update/Update.py @@ -54,22 +54,23 @@ def nickname_comand_update(bot, trigger): triggerargs = spicemanip.main(triggerargs, '2+', 'list') - bot_logging(bot, 'SpiceBot_Update', "Received command from " + trigger.nick + " to update from Github and restart") - bot.osd("Received command from " + trigger.nick + " to update from Github and restart. Be Back Soon!", bot.channels.keys()) + quitmessage = "Received command from " + trigger.nick + " to update from Github and restart" + bot_logging(bot, 'SpiceBot_Update', quitmessage) + bot.osd(quitmessage, bot.channels.keys()) if commandused == 'nodeps': - spicebot_update(bot, "False") + spicebot_update(bot, False) if commandused == 'deps': - spicebot_update(bot, "True") + spicebot_update(bot, True) # service_manip(bot, bot.nick, 'restart', 'SpiceBot_Update') - spicebot_reload(bot, 'SpiceBot_Update') + spicebot_reload(bot, 'SpiceBot_Update', quitmessage) -def spicebot_update(bot, deps="False"): +def spicebot_update(bot, deps=False): pipcommand = "sudo pip3 install --upgrade" - if deps == "False": + if not deps: pipcommand += " --no-deps" pipcommand += " --force-reinstall" pipcommand += " git+" + str(bot.config.SpiceBot_Update.gitrepo) + "@" + str(bot.config.SpiceBot_Update.gitbranch)