Trying to sanitize mentions? Here are few examples what you should use. Note: Make sure you're looking at your library example and you have the required library version or higher installed otherwise it won't work.
Discord.py (requires v1.4.0 or higher) There are multiple options:
- add
, allowed_mentions=discord.AllowedMentions(roles=False, everyone=False)
after the output of your command. (works for individual messages only) - put it into client (if you do this, all messages your bot sends will ping nobody by default) ╠ Example 1 If you have it subclassed:
class Bot(commands.AutoShardedBot):
def __init__(self, **kwargs):
super().__init__(
allowed_mentions = discord.AllowedMentions(roles=False, users=False, everyone=False),
)
╚ Example 2 If it's not subclassed:
bot = commands.Bot(allowed_mentions=discord.AllowedMentions(roles=False, users=False, everyone=False))
Example 1 taken from: https://github.com/TheMoksej/Dredd/blob/76ff9608af1bd5a09a89f523996d57103a83b471/bot.py#L107 Example 2 taken from: https://github.com/discordextremelist/bot/blob/915d203ca2b4ae4bbf9f55cb303c5dc5a4b17e8f/bot.py#L59
Discord.JS (requires v12.2.0 or higher) There are multiple options:
- add
, {allowedMentions: {parse: []}}
after the output of your command. (works for individual messages only) - put it into the client (if you do this, all messages your bot sends will ping nobody by default) ╚ Example
const client = new Discord.Client({
allowedMentions: { parse: [] }
});
Example taken from: https://github.com/discordextremelist/website/blob/5394fcd179d5fc75e0ef9fbb9e674186a13f620a/src/Util/Services/discord.ts#L30
Other libs: rd?tag allowed_mentions2
If your lib is not listed - I'm sorry, I don't know how to use it.
Discord docs: https://discord.com/developers/docs/resources/channel#allowed-mentions-object
how do you allow ALL mentions from ALL messages