This commit is contained in:
deathbybandaid 2019-06-26 14:10:51 -04:00
parent ed7d0545e3
commit 6806d6c1b2
2 changed files with 18 additions and 8 deletions

View File

@ -11,6 +11,7 @@ from sopel.config.types import StaticSection, ValidatedAttribute
import os import os
import threading import threading
import copy
import spicemanip import spicemanip
import sopel_modules import sopel_modules
@ -68,6 +69,14 @@ class BotCommands():
return commandstype return commandstype
return None return None
def get_command_dict(self, command, trigger_command_type=None):
if not trigger_command_type:
trigger_command_type = self.find_command_type(command)
if not trigger_command_type:
return {}
command_dict = copy.deepcopy(self.dict['commands'][trigger_command_type][command])
return command_dict
def get_realcom(self, command, trigger_command_type): def get_realcom(self, command, trigger_command_type):
realcom = command realcom = command

View File

@ -47,8 +47,9 @@ def prerun(t_command_type='module', t_command_subtype=None):
# messagelog ID # messagelog ID
argsdict_default["log_id"] = botmessagelog.messagelog_assign() argsdict_default["log_id"] = botmessagelog.messagelog_assign()
realcom = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type)
argsdict_default["realcom"] = realcom
argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type)
# split into && groupings # split into && groupings
and_split = trigger_and_split(trigger_args) and_split = trigger_and_split(trigger_args)
@ -332,27 +333,27 @@ def trigger_hyphen_arg_handler(bot, trigger):
return return
elif trigger.sb["hyphen_arg"] in ['example', 'usage']: elif trigger.sb["hyphen_arg"] in ['example', 'usage']:
botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["com"] + ": " + str(trigger.sb["example"])) botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["com"] + ": " + str(trigger.sb["dict"]["example"]))
return return
elif trigger.sb["hyphen_arg"] in ['filename', 'filepath']: elif trigger.sb["hyphen_arg"] in ['filename', 'filepath']:
botmessagelog.messagelog(trigger.sb["log_id"], "The " + str(trigger.sb["com"]) + " file is located at " + str(trigger.sb[trigger.sb["hyphen_arg"]])) botmessagelog.messagelog(trigger.sb["log_id"], "The " + str(trigger.sb["com"]) + " file is located at " + str(trigger.sb["dict"][trigger.sb["hyphen_arg"]]))
return return
elif trigger.sb["hyphen_arg"] in ['foldername', 'folderpath']: elif trigger.sb["hyphen_arg"] in ['foldername', 'folderpath']:
botmessagelog.messagelog(trigger.sb["log_id"], "The " + str(trigger.sb["com"]) + " folder is located at " + str(trigger.sb[trigger.sb["hyphen_arg"]])) botmessagelog.messagelog(trigger.sb["log_id"], "The " + str(trigger.sb["com"]) + " folder is located at " + str(trigger.sb["dict"][trigger.sb["hyphen_arg"]]))
return return
elif trigger.sb["hyphen_arg"] in ['author']: elif trigger.sb["hyphen_arg"] in ['author']:
botmessagelog.messagelog(trigger.sb["log_id"], "The author of the " + str(trigger.sb["com"]) + " command is " + trigger.sb["author"] + ".") botmessagelog.messagelog(trigger.sb["log_id"], "The author of the " + str(trigger.sb["com"]) + " command is " + trigger.sb["dict"]["author"] + ".")
return return
elif trigger.sb["hyphen_arg"] in ['contribs', 'contrib', "contributors"]: elif trigger.sb["hyphen_arg"] in ['contribs', 'contrib', "contributors"]:
botmessagelog.messagelog(trigger.sb["log_id"], "The contributors of the " + str(trigger.sb["com"]) + " command are " + spicemanip.main(trigger.sb["contributors"], "andlist") + ".") botmessagelog.messagelog(trigger.sb["log_id"], "The contributors of the " + str(trigger.sb["com"]) + " command are " + spicemanip.main(trigger.sb["dict"]["contributors"], "andlist") + ".")
return return
elif trigger.sb["hyphen_arg"] in ['alias', 'aliases']: elif trigger.sb["hyphen_arg"] in ['alias', 'aliases']:
botmessagelog.messagelog(trigger.sb["log_id"], "The alaises of the " + str(trigger.sb["com"]) + " command are " + spicemanip.main(trigger.sb["validcoms"], "andlist") + ".") botmessagelog.messagelog(trigger.sb["log_id"], "The alaises of the " + str(trigger.sb["com"]) + " command are " + spicemanip.main(trigger.sb["dict"]["validcoms"], "andlist") + ".")
return return
return return