mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -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 .Database import db as botdb
|
||||||
from .Channels import channels as botchannels
|
from .Channels import channels as botchannels
|
||||||
from .MessageLog import messagelog as botmessagelog
|
from .MessageLog import messagelog as botmessagelog
|
||||||
|
from .Config import config as botconfig
|
||||||
|
|
||||||
|
|
||||||
def prerun(t_command_type='module', t_command_subtype=None):
|
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)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
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)
|
trigger_command_type = str(t_command_type)
|
||||||
|
|
||||||
# Primary command used for trigger, and a list of all words
|
# 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)
|
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
|
return
|
||||||
|
|
||||||
trigger_command_type = botcommands.find_command_type(trigger_command)
|
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)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
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:
|
if t_command_subtype != t_command_type:
|
||||||
return
|
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
|
# 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)
|
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
|
return
|
||||||
|
|
||||||
# Argsdict Defaults
|
# 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, trigger_command = SpiceBot.make_trigger_args(message, 'nickname')
|
||||||
trigger_args.insert(0, trigger_command)
|
trigger_args.insert(0, trigger_command)
|
||||||
fulltrigger = bot.nick + " " + spicemanip.main(trigger_args, 0)
|
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
|
return
|
||||||
if fulltrigger in SpiceBot.commands.dict['nickrules']:
|
if fulltrigger in SpiceBot.commands.dict['nickrules']:
|
||||||
return
|
return
|
||||||
if trigger_command in list(SpiceBot.commands.dict['commands']["nickname"].keys()):
|
if trigger_command in list(SpiceBot.commands.dict['commands']["nickname"].keys()):
|
||||||
return
|
return
|
||||||
elif str(message).lower().startswith("?"):
|
elif str(message).lower().startswith(bot.config.SpiceBot_Commands.query_prefix):
|
||||||
# no query commands detection here
|
# no query commands detection here
|
||||||
return
|
return
|
||||||
elif str(message).startswith(tuple(bot.config.core.prefix_list)):
|
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']):
|
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not trigger.sb['com'][0] == "?":
|
if not trigger.sb['com'][0] == bot.config.SpiceBot_Commands.query_prefix:
|
||||||
return
|
return
|
||||||
trigger.sb['com'] = trigger.sb['com'][1:]
|
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')
|
bot.osd("The following " + bot.nick + " commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(validcomlist, 'andlist') + ".", trigger.nick, 'notice')
|
||||||
return
|
return
|
||||||
|
|
||||||
if trigger.sb['com'].endswith("?"):
|
if trigger.sb['com'].endswith(bot.config.SpiceBot_Commands.query_prefix):
|
||||||
|
|
||||||
trigger.sb['com'] = trigger.sb['com'][:-1]
|
trigger.sb['com'] = trigger.sb['com'][:-1]
|
||||||
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
if not trigger.sb['com'] or not len(trigger.sb['com']):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user