From c8a162d778039a655b85fcf70e3ad4cf94ae0e4e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 19 Sep 2019 09:03:52 -0400 Subject: [PATCH] attempt view change --- sopel_modules/SpiceBot/Prerun.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index feda81a..23bf697 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -437,7 +437,7 @@ def trigger_cant_run(bot, trigger, botcom, message=None): def trigger_hyphen_args(trigger_args_part): valid_hyphen_args = [ - 'check', + 'check', 'view', 'enable', 'disable', 'block', 'unblock', "activate", "deactivate", @@ -512,6 +512,23 @@ def trigger_hyphen_arg_handler(bot, trigger, botcom): botmessagelog.messagelog(botcom.dict["log_id"], botcom.dict["comtext"] + " is a valid command") return False + elif botcom.dict["hyphen_arg"] in ['view']: + if not len(botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]): + botmessagelog.messagelog(botcom.dict["log_id"], "The " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " command appears to have no entries!") + else: + bot.osd("The " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " command contains:", trigger.nick, 'notice') + listnumb, relist = 0, [] + for item in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]: + listnumb += 1 + if isinstance(item, dict): + relist.append(str("[#" + str(listnumb) + "] COMPLEX dict Entry")) + elif isinstance(item, list): + relist.append(str("[#" + str(listnumb) + "] COMPLEX list Entry")) + else: + relist.append(str("[#" + str(listnumb) + "] " + str(item))) + bot.osd(relist, trigger.nick, 'notice') + return False + elif botcom.dict["hyphen_arg"] in [ 'enable', 'disable', 'block', 'unblock',