mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
better handling
This commit is contained in:
parent
28f9015411
commit
8fec26ddee
@ -89,13 +89,14 @@ class SpiceBot_AI():
|
|||||||
return aiml_response
|
return aiml_response
|
||||||
|
|
||||||
def bot_message_precipher(self, bot, trigger, message):
|
def bot_message_precipher(self, bot, trigger, message):
|
||||||
|
message = message.upper()
|
||||||
puct_dict = {"!": "exclamationmark", ".": "period", "?": "questionmark", ",": "comma"}
|
puct_dict = {"!": "exclamationmark", ".": "period", "?": "questionmark", ",": "comma"}
|
||||||
for puctuation in puct_dict.keys():
|
for puctuation in puct_dict.keys():
|
||||||
message = message.replace(puctuation, puct_dict[puctuation])
|
message = message.replace(puctuation, puct_dict[puctuation])
|
||||||
for botitem in ["nick"]:
|
for botitem in ["nick"]:
|
||||||
message = message.replace(str(eval("bot." + botitem)), "bot" + botitem)
|
message = message.replace(str(eval("bot." + botitem)).upper(), str("bot" + botitem).upper())
|
||||||
for triggeritem in ["nick", "sender"]:
|
for triggeritem in ["nick", "sender"]:
|
||||||
message = message.replace(str(eval("trigger." + triggeritem)), "trigger" + triggeritem)
|
message = message.replace(str(eval("trigger." + triggeritem)).upper(), str("trigger" + triggeritem).upper())
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def bot_message_decipher(self, bot, trigger, aiml_response):
|
def bot_message_decipher(self, bot, trigger, aiml_response):
|
||||||
|
|||||||
@ -6,9 +6,11 @@ import sopel.module
|
|||||||
|
|
||||||
import sopel_modules.SpiceBot as SpiceBot
|
import sopel_modules.SpiceBot as SpiceBot
|
||||||
|
|
||||||
|
import spicemanip
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.rule('(.*)')
|
@sopel.module.rule('(.*)')
|
||||||
def bot_command_nick(bot, trigger):
|
def bot_command_rule(bot, trigger):
|
||||||
|
|
||||||
# TODO add config limits
|
# TODO add config limits
|
||||||
# but still allow in privmsg
|
# but still allow in privmsg
|
||||||
@ -25,6 +27,15 @@ def bot_command_nick(bot, trigger):
|
|||||||
if str(message).startswith(tuple(bot.config.core.prefix_list)):
|
if str(message).startswith(tuple(bot.config.core.prefix_list)):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if str(message).lower().startswith(str(bot.nick).lower()):
|
||||||
|
trigger_args, trigger_command = SpiceBot.prerun.trigger_args(trigger.args[1], 'nickname')
|
||||||
|
|
||||||
|
if trigger_command in SpiceBot.commands.dict['commands']["nickname"].keys():
|
||||||
|
return
|
||||||
|
|
||||||
|
trigger_args.insert(0, bot.nick)
|
||||||
|
message = spicemanip.main(trigger_args, 0).lower()
|
||||||
|
|
||||||
returnmessage = SpiceBot.botai.on_message(bot, trigger, message)
|
returnmessage = SpiceBot.botai.on_message(bot, trigger, message)
|
||||||
if returnmessage:
|
if returnmessage:
|
||||||
bot.osd(str(returnmessage))
|
bot.osd(str(returnmessage))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user