revert changes

This commit is contained in:
deathbybandaid 2019-05-13 13:27:16 -04:00
parent 2a92b4679f
commit a3b2d4250e
2 changed files with 11 additions and 20 deletions

View File

@ -18,7 +18,7 @@ def setup(bot):
bot_events_startup_register(bot, ['2002'])
if 'SpiceBot_CommandsQuery' not in bot.memory:
bot.memory['SpiceBot_CommandsQuery'] = {"counts": 0, 'commands_all': {}, "commands": {}, "nickrules": []}
bot.memory['SpiceBot_CommandsQuery'] = {"counts": 0, "commands": {}, "nickrules": []}
for comtype in ['module', 'nickname', 'rule']:
if comtype not in bot.memory['SpiceBot_CommandsQuery']['commands'].keys():
@ -152,15 +152,6 @@ def setup(bot):
if command not in bot.memory['SpiceBot_CommandsQuery']['nickrules']:
bot.memory['SpiceBot_CommandsQuery']['nickrules'].append(command)
for commandstype in bot.memory['SpiceBot_CommandsQuery']['commands'].keys():
if commandstype != 'rule':
for com in bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype].keys():
if com not in bot.memory['SpiceBot_CommandsQuery']['commands_all'].keys():
if commandstype == 'nickname':
bot.memory['SpiceBot_CommandsQuery']['commands_all'][str(bot.nick) + " " + com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com]
else:
bot.memory['SpiceBot_CommandsQuery']['commands_all'][com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com]
bot_events_trigger(bot, 2002, "SpiceBot_CommandsQuery")
@ -182,7 +173,7 @@ def bot_events_complete(bot, trigger):
def commandsquery_register(bot, command_type, validcoms, aliasfor=None):
if 'SpiceBot_CommandsQuery' not in bot.memory:
bot.memory['SpiceBot_CommandsQuery'] = {"counts": 0, 'commands_all': {}, "commands": {}, "nickrules": []}
bot.memory['SpiceBot_CommandsQuery'] = {"counts": 0, "commands": {}, "nickrules": []}
if not isinstance(validcoms, list):
validcoms = [validcoms]
@ -212,14 +203,6 @@ def commandsquery_register(bot, command_type, validcoms, aliasfor=None):
if comalias not in bot.memory['SpiceBot_CommandsQuery']['commands'][command_type].keys():
bot.memory['SpiceBot_CommandsQuery']['commands'][command_type][comalias] = {"aliasfor": aliasfor}
for comalias in comaliases:
if command_type != 'rule':
if comalias not in bot.memory['SpiceBot_CommandsQuery']['commands_all'].keys():
if command_type == 'nickname':
bot.memory['SpiceBot_CommandsQuery']['commands_all'][str(bot.nick) + " " + comalias] = bot.memory['SpiceBot_CommandsQuery']['commands'][command_type][comalias]
else:
bot.memory['SpiceBot_CommandsQuery']['commands_all'][comalias] = bot.memory['SpiceBot_CommandsQuery']['commands'][command_type][comalias]
@sopel.module.event('2002')
@sopel.module.rule('.*')

View File

@ -18,7 +18,15 @@ def query_detection(bot, trigger):
while not bot_events_check(bot, '2002'):
pass
commands_list = bot.memory['SpiceBot_CommandsQuery']['commands_all']
commands_list = dict()
for commandstype in bot.memory['SpiceBot_CommandsQuery']['commands'].keys():
if commandstype != 'rule':
for com in bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype].keys():
if com not in commands_list.keys():
if commandstype == 'nickname':
commands_list[str(bot.nick) + " " + com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com]
else:
commands_list[com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com]
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'query_command')