diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 23bf697..913011b 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -438,6 +438,7 @@ def trigger_cant_run(bot, trigger, botcom, message=None): def trigger_hyphen_args(trigger_args_part): valid_hyphen_args = [ 'check', 'view', + 'count', 'enable', 'disable', 'block', 'unblock', "activate", "deactivate", @@ -529,6 +530,10 @@ def trigger_hyphen_arg_handler(bot, trigger, botcom): bot.osd(relist, trigger.nick, 'notice') return False + elif botcom.dict["hyphen_arg"] in ['count']: + bot.osd("The " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " command has " + str(len(botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])) + " entries.") + return False + elif botcom.dict["hyphen_arg"] in [ 'enable', 'disable', 'block', 'unblock', diff --git a/sopel_modules/SpiceBot_Core_Commands/DictComs.py b/sopel_modules/SpiceBot_Core_Commands/DictComs.py index da9cd69..dff2948 100644 --- a/sopel_modules/SpiceBot_Core_Commands/DictComs.py +++ b/sopel_modules/SpiceBot_Core_Commands/DictComs.py @@ -49,7 +49,7 @@ def bot_dictcom_process(bot, trigger, botcom): botcom.dict["nonstockoptions"].append(command) # This allows users to specify which reply by number by using an ! and a digit (first or last in string) - validspecifides = ['last', 'random', 'count', 'view', 'add', 'del', 'remove', 'special'] + validspecifides = ['last', 'random', 'count', 'add', 'del', 'remove', 'special'] botcom.dict["specified"] = None argone = spicemanip(botcom.dict['args'], 1) if str(argone).startswith("--") and len(str(argone)) > 2: @@ -85,22 +85,6 @@ def bot_dictcom_process(bot, trigger, botcom): elif botcom.dict["specified"] == 'count': return bot.osd("The " + str(botcom.dict["realcom"]) + " " + str(botcom.dict["responsekey"] or '') + " command has " + str(len(botcom.dict["dict"][botcom.dict["responsekey"]]["responses"])) + " entries.") - elif botcom.dict["specified"] == 'view': - if botcom.dict["dict"][botcom.dict["responsekey"]]["responses"] == []: - return bot.osd("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 = 1, [] - for item in botcom.dict["dict"][botcom.dict["responsekey"]]["responses"]: - 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) - return - elif botcom.dict["specified"] == 'add': if not botcom.dict["dict"][botcom.dict["responsekey"]]["updates_enabled"]: