nyx/events/messageDelete.js
2021-09-06 18:38:25 +08:00

31 lines
904 B
JavaScript

const client = require("../bot");
client.on("messageDelete", async message => {
let all = [];
if (message.attachments) {
const mapped = message.attachments.map(a => {
if (
a.name.endsWith(".png") ||
a.name.endsWith(".jpg") ||
a.name.endsWith(".jpeg") ||
a.name.endsWith(".gif") ||
a.name.endsWith(".webp")
)
return message.attachments.first().proxyURL;
else return message.attachments.first().url;
});
if (mapped.length == 1) {
all.push(mapped);
} else if (mapped.length > 1) {
message.attachments.map(b => {
all.push(mapped);
});
}
}
client.snipes.push({
channel: message.channel,
content: message.content ? message.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
});