mirror of
https://github.com/supleed2/gondilinabot-python.git
synced 2024-11-14 03:35:48 +00:00
Add detection for spoiler tags and ignore matching messages
This commit is contained in:
parent
fdb7a2bb6e
commit
411fe4d505
13
app.py
13
app.py
|
@ -25,8 +25,19 @@ async def on_ready():
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
|
global counter
|
||||||
|
global idleMessageCounter
|
||||||
if message.author == bot.user:
|
if message.author == bot.user:
|
||||||
return
|
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:
|
elif message.author.id == 581890740360052764:
|
||||||
reply = re.split(
|
reply = re.split(
|
||||||
"(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1
|
"(^| )(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"
|
"Replied unconditionally to " + message.author.name + " with Dad Joke"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
global counter
|
|
||||||
global idleMessageCounter
|
|
||||||
# TODO: Add detection for "genshin" and replace with "g*nshin"
|
# TODO: Add detection for "genshin" and replace with "g*nshin"
|
||||||
reply = re.split(
|
reply = re.split(
|
||||||
"(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1
|
"(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1
|
||||||
|
|
Loading…
Reference in a new issue