#AUTOMOD
1 messages · Page 1 of 1 (latest)
Use a bin
here
const guild = client.guilds.cache.get("805180562888327238");
client.on('messageCreate', async (message) => {
const badWords = ['nig', 'bitch', 'cock', 'dick', 'pentai', 'sex', 'fag', 'b!tch', 's3x', 'f@g', 'horny', 'hentai'];
const badWordsRegex = new RegExp(`^${badWords.join('|')}`, 'gim');
try {
if (badWordsRegex.test(message.content)) {
await message.delete();
await message.channel.send(` <@${message.author.id}> , **No profanity!**`);
const modembed = new Discord.MessageEmbed()
.setAuthor(member.user.tag, member.user.displayAvatarURL({ dynamic: true }))
.setColor("#FF0000")
.setTitle(`You have been warned in ${member.guild.name}.`)
.addFields(
{ name: 'Reason', value: 'Profanity' },
)
.setTimestamp()
.setFooter({ text: `${member.guild.name}`, iconURL: member.guild.iconURL() });
await message.author.send({ embeds: [modembed] });
}
}
catch (e) {
if (e.code !== 10008) {
message.channel.send(`Something went wrong.`);
}
}
})```
it responds SOMETHING IS WRONG
Log the error so you have something more specific to go off of
it says MEMBER IS NOT DEFINED
not at all
<:_:874569322742308864> Message#member
Represents the author of the message as a guild member. Only available if the message comes from a guild where the author is still a member
const member = message.author;```
That is not a GuildMember instance
maybe?
?
what are you confused about
const Discord = require('discord.js');
const prefix = `.`
const channel = client.guild.channels.cache.find(ch => ch.id == "945362909654044832");
module.exports = {
name: 'ping',
description: 'Ping Command',
run: async(client, message, args) => {
channel.send(` Pinging...`)
const pingembed = new Discord.MessageEmbed()
.setDescription(` Latency is ${Date.now() - message.createdTimestamp}ms. \n > API Latency is ${Math.round(client.ws.ping)}ms.`)
message.channel.send({ embeds: [pingembed] })
}
}```
it says have to define so many things
Sounds like you copy pasted code that you don't understand
i got the auto-mod thing i fixed it
bro i made this code from scratch
Then you should know that variables must be defined, the most bare basics of JS
so i have to define channel and client and everything thats not right
You should not ever make multiple clients unless you have multiple bots