The code I use:
const token = "";
let discord = require("discord.js");
client.on(`message`, (message) => {
if (message.author.bot) return;
if (!message.guild) return;
if (message.content.startsWith("https://roblox.com")) {
const msgLog = `[MESSAGE] [${message.guild.name}] [#${message.channel.name}] ${message.author.username}#${message.author.discriminator}: ${message.content}\n`;
client.channels.get(`CHANNEL ID`).send(msgLog);
return;
}
});
client.login(token);
How would I make this have this embed and log in a certain channel
const embed = new Discord.RichEmbed()
.setTitle("64 Games")
.setColor(0x00AE86)
.setDescription("A Game Has been found!!!")
.setThumbnail("https://yagami.xyz/content/uploads/2018/11/discord-512-1.png")
.setTimestamp()
message.channel.send({embed})
Operating under the assumption that you are using discord.js v12, there are two things you need to watch out for:
In your code, you send the message in a channel by doing:
client.channels.get(`channel ID`).send(msgLog);
However, client.channels does not have the get method, you have to first use the cache property which then returns a Collection you can go through. So you should replace that with:
client.channels.cache.get(`channel ID`).send(msgLog);
Your code declares the embed like so:
const embed = new Discord.RichEmbed()
However, you need to lowercase the Discord (since you initially set discord to the discord.js module, and not Discord). In addition, RichEmbed is discontinued as of discord.js v12, you should use MessageEmbed instead, like this:
const embed = new discord.MessageEmbed()