Skip to content
Snippets Groups Projects
Commit 5c2f0371 authored by Reviath's avatar Reviath
Browse files

Added message delete event.

parent 0346828c
Branches
No related tags found
No related merge requests found
module.exports = {
messagedelete: (client, connection, Discord) => {
client.on('messageDelete', async (message) => {
if(message.author.id == client.user.id) {
return;
};
const channeldb = await new Promise((resolve, reject) => {
connection.query(`SELECT channel FROM log_channel WHERE guild ='${message.guild.id}'`, function (err, result) {
if (err)
reject(err);
resolve(result);
});
});
let channelvariable;
if (channeldb.length < 1) {
return;
} else {
channelvariable = channeldb[0].channel;
};
if (message.content == ""){
return;
};
const channel = message.guild.channels.cache.get(channelvariable);
const embed = new Discord.MessageEmbed()
.setAuthor(`Message Deleted!`)
.addField(`Message content:`,`${message.content}`)
.addField(`Channel:`,`<#${message.channel.id}> (\`${message.channel.name}\`)`)
.addField(`User:`, `${message.author} (${message.author.tag})`)
.setTimestamp()
.setColor("RANDOM");
channel.send(embed)
});
}
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment