nyx/events/messsageDelete.js

32 lines
857 B
JavaScript
Raw Normal View History

2021-06-24 09:53:19 +02:00
const client = require("../bot");
2021-06-12 12:53:51 +02:00
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,
attachment: all ? all : null,
date: new Date(),
});
});