From 411fe4d50594cbe1f7ac5867b822347ae4e239cc Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Wed, 1 Dec 2021 11:57:00 +0000 Subject: [PATCH] Add detection for spoiler tags and ignore matching messages --- app.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index df9ae83..efa8d3f 100644 --- a/app.py +++ b/app.py @@ -25,8 +25,19 @@ async def on_ready(): @bot.event async def on_message(message): + global counter + global idleMessageCounter if message.author == bot.user: return + elif bool(re.search("\|\|", message.content)): + idleMessageCounter += 1 + if idleMessageCounter % 5 == 0: + await bot.change_presence( + status=discord.Status.online, + activity=discord.Game( + name="with Godlina [" + str(idleMessageCounter) + "]" + ), + ) elif message.author.id == 581890740360052764: reply = re.split( "(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1 @@ -45,8 +56,6 @@ async def on_message(message): "Replied unconditionally to " + message.author.name + " with Dad Joke" ) else: - global counter - global idleMessageCounter # TODO: Add detection for "genshin" and replace with "g*nshin" reply = re.split( "(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1