another test

This commit is contained in:
deathbybandaid 2019-06-03 16:01:05 -04:00
parent 1febf78acf
commit b5d0db4ff2
2 changed files with 14 additions and 4 deletions

View File

@ -98,13 +98,17 @@ 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.replace(str(bot.nick), "botnick") for botitem in ["nick"]:
message = message.replace(str(trigger.nick), "triggernick") message = message.replace(str(eval("bot." + botitem)), "bot" + botitem)
for triggeritem in ["nick", "sender"]:
message = message.replace(str(eval("trigger." + triggeritem)), "trigger" + triggeritem)
return message return message
def bot_message_decipher(self, bot, trigger, aiml_response): def bot_message_decipher(self, bot, trigger, aiml_response):
aiml_response = aiml_response.replace("botnick", str(bot.nick)) for botitem in ["nick"]:
aiml_response = aiml_response.replace("triggernick", str(trigger.nick)) aiml_response = aiml_response.replace("bot" + botitem, str(eval("bot." + botitem)))
for triggeritem in ["nick", "sender"]:
aiml_response = aiml_response.replace("trigger" + triggeritem, str(eval("trigger." + triggeritem)))
return aiml_response return aiml_response
def check_user_import(self, nick, nick_id=None): def check_user_import(self, nick, nick_id=None):

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0"> <aiml version="1.0">
<category><pattern>BOTNICK</pattern> <category><pattern>BOTNICK</pattern>
<template>That's my name, don't wear it out!</template> <template>That's my name, don't wear it out!</template>
</category> </category>
<category><pattern>BOTNICK IS COOL</pattern>
<template>Thanks!</template>
</category>
</aiml> </aiml>