Published by
Gelişmiş Snipe v14
Sunucuda silinen son mesajlara bakabileceğiniz gelişmiş snipe mesaj geçmişine bakma komutudur.
- License MIT
- Publication Date 15/02/2023 - 22:23
- Version Discord.js V14
- Command Type Prefix
- Views 74
- Downloads 1
- Files 2
- Images 1
const { EmbedBuilder, AttachmentBuilder } = require("discord.js");
const cdb = require("croxydb");
const moment = require("moment");
const fs = require("fs");
moment.locale("tr");
exports.run = async (client, message, args) => {
const snipedata = await cdb.get(`snipe.${message.guild.id}`);
const sayı = args[0];
if (!snipedata)
return message.channel.send({
embeds: [
new EmbedBuilder()
.setDescription(`Daha önceden hiç mesaj silinememiş!`)
.setColor([255, 0, 0]),
],
});
if (isNaN(sayı))
return message.channel.send({
embeds: [
new EmbedBuilder()
.setDescription(`Bir sayı belirtmelisin dostum!`)
.setColor([255, 0, 0]),
],
});
const liste = snipedata
.map(
(x, sleax) =>
`\`${sleax + 1}. Silinen Mesaj\` \nMesajı Atan Üye: **${
x.authors
}** \nMesajın İçeriği: \`${
x.contents
}\` \nMesaj Silme Tarihi: <t:${Math.floor(x.tarih / 1000)}:R>`
)
.slice(0, sayı)
.join("\n\n");
try {
const embed = new EmbedBuilder()
.setAuthor({
name: `${message.guild.name}`,
iconURL: message.guild.iconURL({ dynamic: true }),
})
.setDescription(liste)
.setColor([0, 255, 4])
.setThumbnail(message.author.displayAvatarURL({ dynamic: true }))
.setFooter({
text: `${message.author.username}`,
iconURL: message.author.displayAvatarURL({ dynamic: true }),
})
.setTimestamp();
message.channel.send({ embeds: [embed] });
} catch (e) {
const listex = snipedata
.map(
(x, sleax) =>
`${sleax + 1}. Silinen Mesaj \nMesajı Atan Üye: ${
x.authors
} \nMesajın İçeriği: ${x.contents}\nMesaj Silme Tarihi: ${moment(
x.tarih
).format("LLL")}`
)
.slice(0, sayı)
.join("\n\n");
const files = "./snipe.txt";
const content = "\u200B";
fs.writeFileSync(files, content);
const cs = fs.readFileSync("./snipe.txt", "utf-8");
fs.writeFileSync("./snipe.txt", listex + cs);
const attachment = new AttachmentBuilder("./snipe.txt", "snipe.txt");
message.channel.send({
content: `${message.author}, mesaj sığmadığı için dosya olarak gönderdim!`,
files: [attachment],
});
setTimeout(() => {
fs.unlinkSync("snipe.txt");
}, 1000);
}
};
exports.conf = {
aliases: [],
};
exports.help = {
name: "snipe",
};
client.on("messageDelete", async (message) => {
const cdb = require("croxydb");
if (message.author.bot) return;
if (message.content.length > "1000") {
cdb.push(`snipe.${message.guild.id}`, {
authors: message.author.username,
contents: "Silinen mesaj 1000 karakteri aşıyor!",
tarih: Date.now(),
});
} else {
cdb.push(`snipe.${message.guild.id}`, {
authors: message.author.username,
contents: message.content,
tarih: Date.now(),
});
}
});