This commit is contained in:
deathbybandaid 2019-06-26 08:11:03 -04:00
parent 99960263cc
commit 980fce89d5
5 changed files with 9 additions and 19 deletions

View File

@ -50,7 +50,7 @@ class BotDictCommands():
# simplify usage of the bot command going forward # simplify usage of the bot command going forward
# copy dict to not overwrite # copy dict to not overwrite
triggersb['comdict'] = copy.deepcopy(botcommands.dict['commands']["prefix"][triggersb['realcom']]) triggersb['comdict'] = copy.deepcopy(botcommands.dict['commands']["dictcom"][triggersb['realcom']])
# execute function based on command type # execute function based on command type
triggersb['comtype'] = triggersb['comdict']["type"].lower() triggersb['comtype'] = triggersb['comdict']["type"].lower()
@ -71,7 +71,7 @@ class BotDictCommands():
dict_from_file = self.valid_dictcom_dict[jsondict] dict_from_file = self.valid_dictcom_dict[jsondict]
dict_from_file["comtype"] = "prefix" dict_from_file["comtype"] = "dictcom"
# default command to filename # default command to filename
if "validcoms" not in list(dict_from_file.keys()): if "validcoms" not in list(dict_from_file.keys()):

View File

@ -9,6 +9,7 @@ from sopel.tools import Identifier
import functools import functools
import copy import copy
import datetime import datetime
import spicemanip import spicemanip
from .Tools import command_permissions_check from .Tools import command_permissions_check
@ -16,7 +17,7 @@ from .Commands import commands as botcommands
from .Database import db as botdb from .Database import db as botdb
def prerun(t_command_type='module'): def prerun(t_command_type='module', t_command_subtype=None):
def actual_decorator(function): def actual_decorator(function):
@ -32,16 +33,8 @@ def prerun(t_command_type='module'):
if not trigger_command_type: if not trigger_command_type:
return return
if trigger_command_type not in list(botcommands.dict["commands"].keys()): if t_command_subtype:
return if trigger_command_type != trigger_command_type:
if trigger_command not in list(botcommands.dict["commands"][trigger_command_type].keys()):
return
if trigger_command_type != t_command_type:
if t_command_type not in list(botcommands.dict["commands"].keys()):
return
if trigger_command in list(botcommands.dict["commands"][t_command_type].keys()):
return return
# Argsdict Defaults # Argsdict Defaults

View File

@ -9,7 +9,6 @@ import sopel
import collections import collections
import os import os
import sys import sys
import codecs
from difflib import SequenceMatcher from difflib import SequenceMatcher
from operator import itemgetter from operator import itemgetter
from collections import abc from collections import abc

View File

@ -10,12 +10,11 @@ import sopel.module
import sopel_modules.SpiceBot as SpiceBot import sopel_modules.SpiceBot as SpiceBot
@SpiceBot.prerun('module') @SpiceBot.prerun('module', 'dictcom')
@sopel.module.commands('(.*)') @sopel.module.commands('(.*)')
def command_dictcom(bot, trigger): def command_dictcom(bot, trigger):
bot.say("here")
if trigger.sb['com'] not in list(SpiceBot.commands.dict['commands']["prefix"].keys()): if trigger.sb['com'] not in list(SpiceBot.commands.dict['commands']["dictcom"].keys()):
return return
trigger.sb = SpiceBot.dictcoms.get_dict(trigger.sb) trigger.sb = SpiceBot.dictcoms.get_dict(trigger.sb)

View File

@ -11,7 +11,7 @@ import spicemanip
# TODO custom gif shortcut commands # TODO custom gif shortcut commands
@SpiceBot.prerun('module') @SpiceBot.prerun('module', "gif_prefix")
@sopel.module.commands('gif') @sopel.module.commands('gif')
def gif_trigger(bot, trigger): def gif_trigger(bot, trigger):
@ -33,7 +33,6 @@ def gif_trigger(bot, trigger):
@SpiceBot.prerun('module') @SpiceBot.prerun('module')
@sopel.module.commands('(.*)') @sopel.module.commands('(.*)')
def gifapi_triggers(bot, trigger): def gifapi_triggers(bot, trigger):
bot.say("here")
if trigger.sb['com'] not in list(SpiceBot.gif.valid_api.keys()): if trigger.sb['com'] not in list(SpiceBot.gif.valid_api.keys()):
return return