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