Skip to content

Commit

Permalink
Case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
ajax146 committed Sep 1, 2023
1 parent a3ddb65 commit 8a8e462
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions techsupport_bot/extensions/autoreact.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ async def match(self, config, _, content):
bool: True if there needs to be a reaction, False otherwise
"""
search_content = f" {content} "
search_content = search_content.lower()
for word in config.extensions.autoreact.react_map.value:
if f" {word} " in search_content:
if f" {word.lower()} " in search_content:
return True
return False

Expand All @@ -48,9 +49,10 @@ async def response(self, config, ctx, content, _):
_ (bool): The result from the match function
"""
search_content = f" {content} "
search_content = search_content.lower()
reactions = []
for word in config.extensions.autoreact.react_map.value:
if f" {word} " in search_content:
if f" {word.lower()} " in search_content:
reaction = config.extensions.autoreact.react_map.value.get(word)
if reaction not in reactions:
reactions.append(
Expand Down

0 comments on commit 8a8e462

Please sign in to comment.