messageCreate event

anyone got any clue why this aint working?
client.on('messageCreate', (message) => {
if (message.mentions.has(message.guild.members.cache.find((member) => member.hasPermission('ADMINISTRATOR')))) {
message.delete();

const warningEmbed = new Discord.MessageEmbed()
.setColor('RED')
.setTitle('Warning')
.setDescription(`You cannot ping an administrator in this server. Your message has been deleted.`)
.setTimestamp();

message.author.send({ embeds: [warningEmbed] });
}
});
client.on('messageCreate', (message) => {
if (message.mentions.has(message.guild.members.cache.find((member) => member.hasPermission('ADMINISTRATOR')))) {
message.delete();

const warningEmbed = new Discord.MessageEmbed()
.setColor('RED')
.setTitle('Warning')
.setDescription(`You cannot ping an administrator in this server. Your message has been deleted.`)
.setTimestamp();

message.author.send({ embeds: [warningEmbed] });
}
});
its supposed to detect when a member pings someone with administrator then delete the ping adn send a warning embed but.. it just doesnt
7 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
CrypLemonade
CrypLemonadeOP11mo ago
Yeah, of course gimme about 10-20mins
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
CrypLemonade
CrypLemonadeOP11mo ago
Still wouldn't work.. Got no idea why. But also how do I make it so only certain roles can run a slash command
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Morgan
Morgan11mo ago
There is sense? You make guest ping.
Want results from more Discord servers?
Add your server