JavaScript
x
3
1
if client.user.mentioned_in(message):
2
await ctx.send("Hi!")
3
So I want my bot to respond to anyone who @mentions it. It does work as it should, but the only problem it’ll respond to @everyone and @here pings. It’s probably simple and I am overthinking it but I just want to know if there is any way to make the bot respond to messages it’s actually mentioned in, not @everyone or @here pings?
Advertisement
Answer
Check whether the bot’s user id is in the message content. Try the following:
JavaScript
1
3
1
if str(client.user.id) in message.content:
2
await ctx.send("Hi!")
3