Skip to content

Commit

Permalink
Added Email Regex Checking (#37) (#41)
Browse files Browse the repository at this point in the history
* Added Regex and Changed Logic

* Fixed Regex Changes
  • Loading branch information
Sam2004-2 authored Nov 17, 2023
1 parent c0da5f2 commit 9b1ff1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@ 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(rf'\b{re.escape(egg_phrase)}\b', contents):
await message.add_reaction(reaction)
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


if DEBUG_MODE:
if re.match(PATTERN, contents.lower()): # debug block >1
Expand Down
3 changes: 2 additions & 1 deletion config/configuration_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"good night": "🫖",
"happy halloween": "🎃",
"boo": "😨",
"spooktober": "👻"
"spooktober": "👻",
"\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b": "📧"
}
}

0 comments on commit 9b1ff1b

Please sign in to comment.