make bot responsive in dms without mention

This commit is contained in:
Adora Laura Kalb 2024-01-01 18:40:00 +01:00
parent fd66696361
commit 10ae222474
Signed by: adoralaura
GPG key ID: 7A4552166FC8C056

8
app.py
View file

@ -38,12 +38,14 @@ async def on_message(message):
await message.channel.send(f"{message.author.mention} 👋") await message.channel.send(f"{message.author.mention} 👋")
return return
# Handle @Bot mention
messagearray = message.content.split() messagearray = message.content.split()
if not (isinstance(message.channel, discord.channel.DMChannel)) and not (messagearray[0] == client.user.mention):
return
# Handle @Bot mention
if messagearray[0] == client.user.mention: if messagearray[0] == client.user.mention:
messagearray.pop(0) messagearray.pop(0)
else:
return
command = messagearray[0].lower() command = messagearray[0].lower()