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
# 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
triggersb['comtype'] = triggersb['comdict']["type"].lower()
@ -71,7 +71,7 @@ class BotDictCommands():
dict_from_file = self.valid_dictcom_dict[jsondict]
dict_from_file["comtype"] = "prefix"
dict_from_file["comtype"] = "dictcom"
# default command to filename
if "validcoms" not in list(dict_from_file.keys()):

View File

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

View File

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

View File

@ -10,12 +10,11 @@ import sopel.module
import sopel_modules.SpiceBot as SpiceBot
@SpiceBot.prerun('module')
@SpiceBot.prerun('module', 'dictcom')
@sopel.module.commands('(.*)')
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
trigger.sb = SpiceBot.dictcoms.get_dict(trigger.sb)

View File

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