Search code examples
pythondiscorddiscord.py

discord.py @silent message


I have a small discord bot and want to create a !luck command. If you use it the result should be like @wumpus won!. Now, to prevent ping spam there's a possibility to "turn off" pings, just add @silence to your message. Basically it works perfectly, when I add @silent before my message, the user doesn't gets pinged (message looks like this after sending: @wumpus this is a silent mention). But if I want to do that with my discord bot, the @silent before the message is just like normel text.

My code:

await ctx.message.reply(f"@silent <@{choice(members)}> won!")

The result is @silent @wumpus won!

How can I use the @silent feature in discord.py?


Solution

  • You can use the new "silent" Parameter for that. It came with the discord.py 2.2 update. Make sure to update your discord.py for it to work.

    await ctx.message.reply(f"{ctx.message.author.mention} won!", silent=True)
    

    It should show like this:

    silent message example