Skip to content

Commit

Permalink
Added Regular Expression Checking coillteoir#37 (coillteoir#40)
Browse files Browse the repository at this point in the history
Changes to how messages are checked. Uses regex instead of literal string matching to add more expressive config

Co-authored-by: David <[email protected]>
  • Loading branch information
Sam2004-2 and coillteoir committed Nov 17, 2023
1 parent 3a6071a commit cbe466a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ async def on_message(message):

return

# Performing regular expression checking on easter egg phrases
for egg_phrase, reaction in configuration_data["easter_egg_phrases"].items():
if re.search(egg_phrase, contents):
await message.add_reaction(reaction)
return
for egg_phrase in configuration_data["easter_egg_phrases"].keys():
if egg_phrase in contents:
await message.add_reaction(
configuration_data["easter_egg_phrases"][egg_phrase]
)

if DEBUG_MODE:
if re.match(PATTERN, contents.lower()): # debug block >1
Expand Down

0 comments on commit cbe466a

Please sign in to comment.