简体   繁体   中英

How i can disable tag members

sorry for the inconvenience, would someone be so kind to give me a hand to prevent people from tagging other members?

I don't have much experience so I would appreciate any help

client.on("message", message => {
if (message.content.includes("<@313496870305398784>")){
    message.channel.send("no tag this member");  
    };
});

Sorry for the inconvenience

You can't really prevent that because you can't catch the message before it's sent to the channel.
All you can do is delete the message and send "don't ping this user".
But the member will be pinged anyway ( ghost ping ).

In order to do that, check if the user's ID is in the collection of mentioned users.
Then, send your warning and delete the original message:

client.on("message", message => {
    if (message.mentions.has("313496870305398784")){
        message.channel.send("Don't ping this user.");
        message.delete();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM