nyx/unused/events/messageDelete.js

27 lines
806 B
JavaScript
Raw Normal View History

const client = require("../");
2021-09-06 12:38:25 +02:00
client.on("messageDelete", async message => {
const all = [];
2021-09-06 12:38:25 +02:00
if (message.attachments) {
2021-09-21 01:51:56 +02:00
const files = message.attachments.map(e => e);
for (let i = 0; i < files.length; i++) {
all.push(files[i].url);
2021-09-06 12:38:25 +02:00
}
}
2021-09-21 01:51:56 +02:00
if (message.embeds) {
for (let i = 0; i < message.embeds.length; i++) {
2021-09-21 01:51:56 +02:00
const files = message.embeds.map(e => e.image?.url);
all.push(files);
}
}
const snipes = client.snipes.get(message.channel.id) || [];
snipes.push({
2021-09-06 12:38:25 +02:00
channel: message.channel,
content: message.content ? message.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
2021-09-21 01:51:56 +02:00
snipes.splice(10);
client.snipes.set(message.channel.id, snipes);
2021-09-06 12:38:25 +02:00
});