Answer the question
In order to leave comments, you need to log in
How to make a bot unable to ping roles?
I need the bot to not be able to ping roles, only people.
Code:
@bot.command()
async def say(ctx, *arg):
await ctx.message.delete()
author = ctx.message.author
msg = ctx.message.content
if(msg.find("@everyone") == -1) and (msg.find("@here") == -1):
await ctx.send(' '.join(arg))
else: await ctx.send("Нельзя упоминать всех!")
Answer the question
In order to leave comments, you need to log in
Everything you need is right in the Message class:
for m in ctx.message.mentions:
print ("user mention %s" % m)
for m in ctx.message.role_mentions:
print ("role mention %s" % m)
if ctx.message.mention_everyone:
print ('everyone mention')
if ctx.message.role_mentions or ctx.message.mention_everyone:
await ctx.send(author.mention+", не пингуй!")
else:
await ctx.send(msg)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question