Ali
DIAdiscord.js - Imagine an app
•Created by Ali on 8/19/2023 in #djs-questions
Direct message not being sent
The bot is supposed to send a direct message to the user if he used a blacklisted word in his message. I’m using [email protected].
Part of the code:
client.on('messageCreate', async (message) => {
if (message.author.bot) return;
if (blacklist.some(word => message.content.toLowerCase().includes(word))) {
handleBlacklistedWord(message);
}
});
async function handleBlacklistedWord(message) {
await message.delete();
const duration = 'Undefined, temporary.';
const reason = 'Using blacklisted words.';
const userEmbed = new MessageEmbed()
.setTitle('You have been muted.')
.setDescription(
You used a blacklisted word in your message. Moderators will review the message to make the final decision.\n**Duration - ** ${duration}\n**Reason - ** ${reason}\n**Message Content - ** \
${message.content}``)
.setColor('#aeaba8')
.setFooter('Auto-Moderator');
Thank you.15 replies