mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
attempt
This commit is contained in:
parent
363777987d
commit
bbd36f9513
@ -17,6 +17,7 @@ from .Commands import commands as botcommands
|
||||
from .Database import db as botdb
|
||||
from .Channels import channels as botchannels
|
||||
from .MessageLog import messagelog as botmessagelog
|
||||
from .Config import config as botconfig
|
||||
|
||||
|
||||
def prerun(t_command_type='module', t_command_subtype=None):
|
||||
@ -26,12 +27,18 @@ def prerun(t_command_type='module', t_command_subtype=None):
|
||||
@functools.wraps(function)
|
||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||
|
||||
if t_command_type == "nickname" and not str(trigger.args[1]).lower().startswith(str(bot.nick).lower()):
|
||||
return
|
||||
else:
|
||||
if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)):
|
||||
return
|
||||
|
||||
trigger_command_type = str(t_command_type)
|
||||
|
||||
# Primary command used for trigger, and a list of all words
|
||||
trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||
|
||||
if trigger_prefix == "?":
|
||||
if trigger_prefix == botconfig.SpiceBot_Commands.query_prefix:
|
||||
return
|
||||
|
||||
trigger_command_type = botcommands.find_command_type(trigger_command)
|
||||
@ -98,6 +105,12 @@ def prerun_query(t_command_type='module', t_command_subtype=None):
|
||||
@functools.wraps(function)
|
||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||
|
||||
if t_command_type == "nickname" and not str(trigger.args[1]).lower().startswith(str(bot.nick).lower()):
|
||||
return
|
||||
else:
|
||||
if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)):
|
||||
return
|
||||
|
||||
if t_command_subtype != t_command_type:
|
||||
return
|
||||
|
||||
@ -106,7 +119,7 @@ def prerun_query(t_command_type='module', t_command_subtype=None):
|
||||
# Primary command used for trigger, and a list of all words
|
||||
trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type)
|
||||
|
||||
if trigger_prefix != "?":
|
||||
if trigger_prefix != botconfig.SpiceBot_Commands.query_prefix:
|
||||
return
|
||||
|
||||
# Argsdict Defaults
|
||||
|
||||
@ -56,13 +56,13 @@ def bot_command_rule_ai(bot, trigger):
|
||||
trigger_args, trigger_command = SpiceBot.make_trigger_args(message, 'nickname')
|
||||
trigger_args.insert(0, trigger_command)
|
||||
fulltrigger = bot.nick + " " + spicemanip.main(trigger_args, 0)
|
||||
if str(trigger_command).startswith("?"):
|
||||
if str(trigger_command).startswith(bot.config.SpiceBot_Commands.query_prefix):
|
||||
return
|
||||
if fulltrigger in SpiceBot.commands.dict['nickrules']:
|
||||
return
|
||||
if trigger_command in list(SpiceBot.commands.dict['commands']["nickname"].keys()):
|
||||
return
|
||||
elif str(message).lower().startswith("?"):
|
||||
elif str(message).lower().startswith(bot.config.SpiceBot_Commands.query_prefix):
|
||||
# no query commands detection here
|
||||
return
|
||||
elif str(message).startswith(tuple(bot.config.core.prefix_list)):
|
||||
|
||||
@ -27,7 +27,7 @@ def query_detection_nick(bot, trigger):
|
||||
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||
return
|
||||
|
||||
if not trigger.sb['com'][0] == "?":
|
||||
if not trigger.sb['com'][0] == bot.config.SpiceBot_Commands.query_prefix:
|
||||
return
|
||||
trigger.sb['com'] = trigger.sb['com'][1:]
|
||||
|
||||
@ -60,7 +60,7 @@ def query_detection_nick(bot, trigger):
|
||||
bot.osd("The following " + bot.nick + " commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(validcomlist, 'andlist') + ".", trigger.nick, 'notice')
|
||||
return
|
||||
|
||||
if trigger.sb['com'].endswith("?"):
|
||||
if trigger.sb['com'].endswith(bot.config.SpiceBot_Commands.query_prefix):
|
||||
|
||||
trigger.sb['com'] = trigger.sb['com'][:-1]
|
||||
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user