mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
handle bot nick fully
This commit is contained in:
parent
3fb5e7f710
commit
870b676323
@ -91,11 +91,17 @@ class SpiceBot_AI():
|
|||||||
nick = Identifier(trigger.nick)
|
nick = Identifier(trigger.nick)
|
||||||
nick_id = botdb.get_nick_id(nick, create=True)
|
nick_id = botdb.get_nick_id(nick, create=True)
|
||||||
self.check_user_import(nick, nick_id)
|
self.check_user_import(nick, nick_id)
|
||||||
|
message = self.bot_message_precipher(bot, message)
|
||||||
aiml_response = self.aiml_kernel.respond(message, nick_id)
|
aiml_response = self.aiml_kernel.respond(message, nick_id)
|
||||||
self.save_nick_session(nick, nick_id)
|
self.save_nick_session(nick, nick_id)
|
||||||
aiml_response = self.bot_message_decipher(bot, aiml_response)
|
aiml_response = self.bot_message_decipher(bot, aiml_response)
|
||||||
return aiml_response
|
return aiml_response
|
||||||
|
|
||||||
|
def bot_message_precipher(self, bot, message):
|
||||||
|
while bot.nick in message:
|
||||||
|
message.replace(bot.nick, "bot.nick")
|
||||||
|
return message
|
||||||
|
|
||||||
def bot_message_decipher(self, bot, aiml_response):
|
def bot_message_decipher(self, bot, aiml_response):
|
||||||
while "bot.nick" in aiml_response:
|
while "bot.nick" in aiml_response:
|
||||||
aiml_response.replace("bot.nick", bot.nick)
|
aiml_response.replace("bot.nick", bot.nick)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user