summary refs log tree commit diff
path: root/events/messageDelete.js
blob: cfba4465512e8b569e198dd2e670ac6764f716e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { getWebhook } = require("../libs/webhook.js");

module.exports = {
	name: "messageDelete",
	async execute(msg) {
		if (msg.webhookId !== null) return;

		console.log("a");
		const wh = await getWebhook(msg.guild.id);
		if (wh === null) return;
		console.log("b");

		await wh.send({
			content: `Message deleted in <#${msg.channel.id}>`,
			embeds: [
				{
					title: "Deleted message",
					author: {
						name: `${msg.author.globalName} (${msg.author.username}; ${msg.author.id})`
					},
					fields: [
						{
							name: "Content",
							value: msg.content
						}
					],
					timestamp: msg.createdAt
				}
			]
		});
		delete wh;
		console.log("d");
	}
}