Browse Source

make keywords case insensitive

master
Hendrik Langer 2 years ago
parent
commit
53d372d11d
  1. 2
      matrix_pygmalion_bot/core.py

2
matrix_pygmalion_bot/core.py

@ -64,7 +64,7 @@ class Callbacks(object):
# parse keywords # parse keywords
self.bot.extra_info = {"persona": [], "scenario": [], "example_dialogue": []} self.bot.extra_info = {"persona": [], "scenario": [], "example_dialogue": []}
for i, keyword in enumerate(self.bot.keywords): for i, keyword in enumerate(self.bot.keywords):
if re.search(keyword["regex"], event.body): if re.search(keyword["regex"], event.body, flags=re.IGNORECASE):
self.bot.keywords[i]['active'] = int(keyword["duration"]) self.bot.keywords[i]['active'] = int(keyword["duration"])
logger.info(f"keyword \"{keyword['regex']}\" detected") logger.info(f"keyword \"{keyword['regex']}\" detected")
if 'active' in self.bot.keywords[i]: if 'active' in self.bot.keywords[i]:

Loading…
Cancel
Save