Fix Regex term

Should now only match when at the start of message or word
This commit is contained in:
Aadi Desai 2021-11-18 22:17:36 +00:00
parent f4a44f891b
commit 558eabccca
No known key found for this signature in database
GPG key ID: CFFFE425830EF4D9

2
app.py
View file

@ -28,7 +28,7 @@ async def on_message(message):
else: else:
global counter global counter
print("Message from " + message.author.name + ": " + message.content) print("Message from " + message.author.name + ": " + message.content)
reply = re.split("I'm |Im |i'm |im |I am |i am ", message.content, 1) reply = re.split("(^| )(I'm |Im |i'm |im |I am |i am )", message.content, 1)
if len(reply) > 1: if len(reply) > 1:
if counter > 0: if counter > 0:
counter -= 1 counter -= 1