Jure
Jure

Reputation: 3

Discord.py bot tagging everyone

So I'm trying to make a command that if used the bot tags everyone.

@client.command(aliases=['l'])
async def lol(ctx):
    if ctx.author.guild_permissions.administrator:
        message = await ctx.send("<@&EVERYONE_ROLE_ID>")
        await ctx.message.delete() # Delete user's message

The bot sends "@@everyone" instead of "@everyone". No errors, how do I make it tag everyone?

Upvotes: 0

Views: 3774

Answers (2)

Ahsoka
Ahsoka

Reputation: 184

Edited answer

So, to mention everyone you need to simply use the string @everyone

message = await ctx.send('@everyone')

If this doesn't work, in your client options try adding

client = commands.Bot(allowed_mentions = discord.AllowedMentions(everyone = True))

Upvotes: 1

Jure
Jure

Reputation: 3

@client.command(aliases=['l'])
async def lol(ctx):
    if ctx.author.guild_permissions.administrator:
        message = await ctx.send(f'{ctx.guild.default_role}')
        await ctx.message.delete() # Delete user's message

Found the answer, {ctx.guild.default_role} instead of ctx.guild.id

Upvotes: 0

Related Questions