Onaylı Üye
Ne işe yarar?
Sunucudaki tüm kanallardaki mesajları embed şeklinde belirlenen kanala atar.
Her handler de ve botta çalışmayabilir! Komut bana aittir.
cloud.json adlı dosya açıp içine {} yazmayı unutmayın.
Mesaj log açma komutu:
bot.js, index.js eklenecek kod:
Mesaj log kapama komutu:
Sunucudaki tüm kanallardaki mesajları embed şeklinde belirlenen kanala atar.
Her handler de ve botta çalışmayabilir! Komut bana aittir.
cloud.json adlı dosya açıp içine {} yazmayı unutmayın.
Mesaj log açma komutu:
JavaScript:
const fs = require('fs')
const Discord = require('discord.js')
var sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./cloud.json", "utf8"));
exports.run = async (bot, message, args) =>
{
let profil = JSON.parse(fs.readFileSync("./cloud.json", "utf8"));
if (!message.member.hasPermission("ADMINISTRATOR")){
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('`YONETICI` adlı yetkiye sahip olman gerek!').setColor("0x36393E")).then(msg => msg.delete(5000));
}else{
var mentionedRole = message.mentions.channels.first();
if(!mentionedRole){
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('Bir kanal etiketlemen lazım!').setColor("0x36393E")).then(msg => msg.delete(5000));
}else{
if(!profil[message.guild.id]){
profil[message.guild.id] = {
resim: mentionedRole.id
}
}
profil[message.guild.id].resim = mentionedRole.id
fs.writeFile("./cloud.json", JSON.stringify(profil), (err) => {
console.log('hata')
})
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('Mesaj log başarıyla aktifleştirildi. Kapatmak için `!kapatlog`!').setColor("0x36393E")).then(msg => msg.delete(8000));
}}}
bot.js, index.js eklenecek kod:
JavaScript:
client.on("message", msg =>{
let gkanal = JSON.parse(fs.readFileSync("./cloud.json", "utf8"));
if (msg.author.bot) return;
if(!gkanal[msg.guild.id]) return;
const gözelkanal = msg.guild.channels.get(gkanal[msg.guild.id].resim);
if (gözelkanal === undefined || gözelkanal === null) return;
let mesajlog = new discord.RichEmbed()
//.setTitle(msg.author)
.setThumbnail(msg.author.avatarURL)
.setColor("0x36393E")
.setAuthor('Deneme bot mesaj log')
.setDescription(`
Mesaj atan kişi: ${msg.author}
Mesaj: ${msg.content}
Kanal: <#${msg.channel.id}>
Mesaj ID: ${msg.id}
`)
gözelkanal.send(mesajlog)
}
)
Mesaj log kapama komutu:
JavaScript:
const Discord = require('discord.js')
const fs = require('fs')
exports.run = async (client, message, args) => {
if (!message.member.hasPermission("ADMINISTRATOR")){
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('`YONETICI` adlı yetkiye sahip olman gerek! ').setColor("0x36393E")).then(msg => msg.delete(5000));
}else{
let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./cloud.json", "utf8"));
let otorolkapat = JSON.parse(fs.readFileSync("./cloud.json", "utf8"));
if(!sunucuyaözelayarlarOtorol[message.guild.id]) {
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('Mesaj log ayarlanmamış. Ayarlamak için: `!mesajlog #kanal` ').setColor("0x36393E")).then(msg => msg.delete(8000));
}else{
delete sunucuyaözelayarlarOtorol[message.guild.id]
fs.writeFile("./cloud.json", JSON.stringify(sunucuyaözelayarlarOtorol), (err) => {
console.log(err)
})
message.channel.sendEmbed(new Discord.RichEmbed().setDescription('Mesaj log başarıyla devredışı bırakıldı! ').setColor("0x36393E")).then(msg => msg.delete(8000));
}}}
Son düzenleme: