const { Client, ChannelType, EmbedBuilder } = require("discord.js"); const modSchema = require("../../Structures/Schemas/mod"); module.exports = { name: "messageCreate", async execute(message, client) { if (message.channel.type === ChannelType.GuildText) { const guild = client.guilds.cache.get("1135445496580800512"); const member = message.author; let data = await modSchema .findOne({ Guild: guild.id, User: member }) .exec(); if (data == null) return; const colChannel = guild.channels.cache.find( (c) => c.name === `${data.User}` ); if (message.channel.id == colChannel.id) { if (message.author.bot) return; const memberID = data.User; const member = await client.users.fetch(memberID); if (message.attachments.size > 0) { message.react('❌'); return member.send("I cannot send this message!"); } message.react(`✉️`); const embed = new EmbedBuilder() .setColor("Blue") .setAuthor({ name: `${message.author.username}`, iconURL: `${message.author.displayAvatarURL()}`}) .setDescription(`${message.content}`) member.send({ embeds: [embed] }) } } }, };