- kedy0
- Katılım
- 14 Eyl 2021
- Mesajlar
- 379
- Tepkime puanı
- 322
- Şehir
- İstanbul
Selam millet! Bugün sizlere ayarlanabilir modlog komutu vereceğim.
Komutlara atılacak :
Main'e atılacak:
Komutlara atılacak :
JavaScript:
//komutlara atın
const Discord = require("discord.js");
const db = require("quick.db");
let prefix = process.env.prefix;
const ayarlar = require("../ayarlar.json");
exports.run = async (client, message, args) => {
let prefix = ayarlar.prefix;
if (!message.member.hasPermission("MANAGE_GUILD"))
return message.channel.send(
` Bu komutu kullanabilmek için "\`Yönetici\`" yetkisine sahip olmalısın.`
);
let logk = message.mentions.channels.first();
let logkanal = await db.fetch(`log_${message.guild.id}`);
if (args[0] === "sıfırla" || args[0] === "kapat") {
if (!logkanal)
return message.channel.send(
new Discord.MessageEmbed()
.setColor("#ff0000")
.setDescription(`ModLog Kanalı Zaten Ayarlı Degil.`)
);
db.delete(`log_${message.guild.id}`);
message.channel.send(
new Discord.MessageEmbed()
.setColor("#ff0000")
.setDescription(
`✅ | Mod-log kanalı başarıyla sıfırlandı.`
)
);
return;
}
if (!logk)
return message.channel.send(
new Discord.MessageEmbed()
.setColor("#ff0000")
.setDescription(
` Yanlış Kullanım \n Doğru Kullanım: ${prefix}mod-log #kanal`
)
);
db.set(`log_${message.guild.id}`, logk.id);
message.channel.send(
new Discord.MessageEmbed()
.setColor("#ff0000")
.setDescription(` Mod-log kanalı başarıyla ${logk} olarak ayarlandı.`)
);
message.react("✳️");
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["mod-log", "modlog", "log-ayarlama"],
permLevel: 3,
kategori: "moderasyon"
};
exports.help = {
name: "mod-log",
description: "Mod-Log kanalını belirler.",
usage: "mod-log <#kanal>"
};
Main'e atılacak:
JavaScript:
//ModLog Baş
client.on("message", async (msg, member, guild) => {
let i = await db.fetch(`saas_${msg.guild.id}`);
if (i === "açık") {
if (msg.content.toLowerCase() === "sa") {
msg.reply("**Aleyküm Selam Hoşgeldin.**");
}
}
});
client.on("messageDelete", async message => {
if (message.author.bot || message.channel.type == "dm") return;
let log = message.guild.channels.cache.get(
await db.fetch(`log_${message.guild.id}`)
);
if (!log) return;
const embed = new Discord.MessageEmbed()
.setTitle(message.author.username + " | Mesaj Silindi")
.addField("Kullanıcı: ", message.author)
.addField("Kanal: ", message.channel)
.addField("Mesaj: ", "" + message.content + "");
log.send(embed);
});
client.on("messageUpdate", async (oldMessage, newMessage) => {
let modlog = await db.fetch(`log_${oldMessage.guild.id}`);
if (!modlog) return;
let embed = new Discord.MessageEmbed()
.setAuthor(oldMessage.author.username, oldMessage.author.avatarURL())
.addField("**Eylem:**", "Mesaj Düzenleme")
.addField(
"**Mesajın sahibi:**",
`<@${oldMessage.author.id}> === **${oldMessage.author.id}**`
)
.addField("**Eski Mesajı:**", `${oldMessage.content}`)
.addField("**Yeni Mesajı:**", `${newMessage.content}`)
.setTimestamp()
.setColor("#ff0000")
.setFooter(
`Sunucu: ${oldMessage.guild.name} - ${oldMessage.guild.id}`,
oldMessage.guild.iconURL()
)
.setThumbnail(oldMessage.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("channelCreate", async channel => {
let modlog = await db.fetch(`log_${channel.guild.id}`);
if (!modlog) return;
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_CREATE" })
.then(audit => audit.entries.first());
let kanal;
if (channel.type === "text") kanal = `<#${channel.id}>`;
if (channel.type === "voice") kanal = `\`${channel.name}\``;
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Kanal Oluşturma")
.addField("**Kanalı Oluşturan Kişi:**", `<@${entry.executor.id}>`)
.addField("**Oluşturduğu Kanal:**", `${kanal}`)
.setTimestamp()
.setColor("#ff0000")
.setFooter(
`Sunucu: ${channel.guild.name} - ${channel.guild.id}`,
channel.guild.iconURL()
)
.setThumbnail(channel.guild.iconUR);
client.channels.cache.get(modlog).send(embed);
});
client.on("channelDelete", async channel => {
let modlog = await db.fetch(`log_${channel.guild.id}`);
if (!modlog) return;
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_DELETE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Kanal Silme")
.addField("**Kanalı Silen Kişi:**", `<@${entry.executor.id}>`)
.addField("**Silinen Kanal:**", `\`${channel.name}\``)
.setTimestamp()
.setColor("#ff0000")
.setFooter(
`Sunucu: ${channel.guild.name} - ${channel.guild.id}`,
channel.guild.iconURL()
)
.setThumbnail(channel.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("roleCreate", async role => {
let modlog = await db.fetch(`log_${role.guild.id}`);
if (!modlog) return;
const entry = await role.guild
.fetchAuditLogs({ type: "ROLE_CREATE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Rol Oluşturma")
.addField("**Rolü Oluşturan Kişi:**", `<@${entry.executor.id}>`)
.addField("**Oluşturulan Rol:**", `\`${role.name}\` **=** \`${role.id}\``)
.setTimestamp()
.setFooter(
`Sunucu: ${role.guild.name} - ${role.guild.id}`,
role.guild.iconURL
)
.setColor("#ff0000")
.setThumbnail(role.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("roleDelete", async role => {
let modlog = await db.fetch(`log_${role.guild.id}`);
if (!modlog) return;
const entry = await role.guild
.fetchAuditLogs({ type: "ROLE_DELETE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Rol Silme")
.addField("**Rolü Silen Kişi:**", `<@${entry.executor.id}>`)
.addField("**Silinen Rol:**", `\`${role.name}\` **=** \`${role.id}\``)
.setTimestamp()
.setFooter(
`Sunucu: ${role.guild.name} - ${role.guild.id}`,
role.guild.iconURL
)
.setColor("#ff0000")
.setThumbnail(role.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("emojiCreate", async emoji => {
let modlog = await db.fetch(`log_${emoji.guild.id}`);
if (!modlog) return;
const entry = await emoji.guild
.fetchAuditLogs({ type: "EMOJI_CREATE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Emoji Oluşturma")
.addField("**Emojiyi Oluşturan Kişi:**", `<@${entry.executor.id}>`)
.addField("**Oluşturulan Emoji:**", `${emoji} - İsmi: \`${emoji.name}\``)
.setTimestamp()
.setColor("#ff0000")
.setFooter(
`Sunucu: ${emoji.guild.name} - ${emoji.guild.id}`,
emoji.guild.iconURL
)
.setThumbnail(emoji.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("emojiDelete", async emoji => {
let modlog = await db.fetch(`log_${emoji.guild.id}`);
if (!modlog) return;
const entry = await emoji.guild
.fetchAuditLogs({ type: "EMOJI_DELETE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Emoji Silme")
.addField("**Emojiyi Silen Kişi:**", `<@${entry.executor.id}>`)
.addField("**Silinen Emoji:**", `${emoji}`)
.setTimestamp()
.setFooter(
`Sunucu: ${emoji.guild.name} - ${emoji.guild.id}`,
emoji.guild.iconURL
)
.setColor("#ff0000")
.setThumbnail(emoji.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("emojiUpdate", async (oldEmoji, newEmoji) => {
let modlog = await db.fetch(`log_${oldEmoji.guild.id}`);
if (!modlog) return;
const entry = await oldEmoji.guild
.fetchAuditLogs({ type: "EMOJI_UPDATE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Emoji Güncelleme")
.addField("**Emojiyi Güncelleyen Kişi:**", `<@${entry.executor.id}>`)
.addField(
"**Güncellenmeden Önceki Emoji:**",
`${oldEmoji} - İsmi: \`${oldEmoji.name}\``
)
.addField(
"**Güncellendikten Sonraki Emoji:**",
`${newEmoji} - İsmi: \`${newEmoji.name}\``
)
.setTimestamp()
.setColor("#ff0000")
.setFooter(
`Sunucu: ${oldEmoji.guild.name} - ${oldEmoji.guild.id}`,
oldEmoji.guild.iconURL
)
.setThumbnail(oldEmoji.guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("guildBanAdd", async (guild, user) => {
let modlog = await db.fetch(`log_${guild.id}`);
if (!modlog) return;
const entry = await guild
.fetchAuditLogs({ type: "MEMBER_BAN_ADD" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Yasaklama")
.addField("**Kullanıcıyı Yasaklayan Yetkili:**", `<@${entry.executor.id}>`)
.addField("**Yasaklanan Kullanıcı:**", `**${user.tag}** - ${user.id}`)
.addField("**Yasaklanma Sebebi:**", `${entry.reason}`)
.setTimestamp()
.setColor("#ff0000")
.setFooter(`Sunucu: ${guild.name} - ${guild.id}`, guild.iconURL)
.setThumbnail(guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
client.on("guildBanRemove", async (guild, user) => {
let modlog = await db.fetch(`log_${guild.id}`);
if (!modlog) return;
const entry = await guild
.fetchAuditLogs({ type: "MEMBER_BAN_REMOVE" })
.then(audit => audit.entries.first());
let embed = new Discord.MessageEmbed()
.setAuthor(entry.executor.username, entry.executor.avatarURL())
.addField("**Eylem:**", "Yasak Kaldırma")
.addField("**Yasağı Kaldıran Yetkili:**", `<@${entry.executor.id}>`)
.addField(
"**Yasağı Kaldırılan Kullanıcı:**",
`**${user.tag}** - ${user.id}`
)
.setTimestamp()
.setColor("#ff0000")
.setFooter(`Sunucu: ${guild.name} - ${guild.id}`, guild.iconURL)
.setThumbnail(guild.iconURL);
client.channels.cache.get(modlog).send(embed);
});
// ModLog Son