const fs = require ('fs')
const Discord = require('discord.js')
var sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
exports.run = async (bot, message, args) =>
{
let profil = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
var mentionedChannel = message.mentions.channels.first();
if (!mentionedChannel && args[0] !== "sıfırla") return message.channel.send("Ayarlamam İçin Bir Rol Etiketlemelisin. \nRolü Etiketleyemiyorsan **Rolün Etiketleme Seçeneğini Aktif Etmeyi Unutma** \nÖrnek Kullanım : ::otorol @rol #kanal \n**Oto Yazı Kapatmak İstiyorsan ::kapat otoyazı**");
if (message.guild.member(message.author.id).hasPermission(0x8))
{
var mentionedRole = message.mentions.roles.first();
if (!mentionedRole) return message.channel.send("**Doğru Kullanım = ::otorol @<roladı> #<metinkanalı>**".then(msg => msg.delete(5000)));
if(!profil[message.guild.id]){
profil[message.guild.id] = {
sayi: mentionedRole.id,
kanal: mentionedChannel.id
};
}
profil[message.guild.id].sayi = mentionedRole.id
profil[message.guild.id].kanal = mentionedChannel.id
fs.writeFile("./otorol.json", JSON.stringify(profil), (err) => {
console.log(err)
})
const embed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: Otorol başarıyla ${args[0]} olarak ayarlandı! \nOtorol Mesaj kanalı başarıyla ${mentionedChannel} olarak ayarlandı.\n\nOto Mesaj'ı kapatabilmek için **+otomesajkapat** yazabilirsiniz!`)
.setColor("RANDOM")
.setTimestamp()
message.channel.send({embed})
}
}
exports.conf =
{
enabled: true,
guildOnly: true,
aliases: ["setautorole", "otorol", "otoroldeğiştir"]
}
exports.help =
{
name: 'Otorol',
description: 'Sunucuya Girenlere Verilecek Olan Otorolü Ayarlar.',
usage: 'otorolayarla'
}
const Discord = require('discord.js')
const fs = require('fs')
exports.run = async (client, message, args) => {
let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
if(!sunucuyaözelayarlarOtorol[message.guild.id]) {
const embed = new Discord.RichEmbed()
.setDescription(`Otorolü Ayarlamadığın İçin Kapatamazsın!`)
.setColor("RED")
.setTimestamp('Ayarlamak İçin ::otorol @roladi')
message.channel.send({embed})
return
}
exports.run = async (client, message, args, member) => {
let giriscikis = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
delete giriscikis[message.guild.id]
fs.writeFile("./otorol.json", JSON.stringify(giriscikis), (err) => {
})
const embed = new Discord.RichEmbed()
.setDescription(`Otorol Mesajları Başarıyla Kapatıldı`)
.setColor("RANDOM")
.setTimestamp()
message.channel.send({embed})
return
}}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["kapatotoyazı"],
permLevel: 0
};
exports.help = {
name: 'otorolmesajkapat',
description: 'Slots oyunu oynar',
usage: 'otorolmesajkapat'
};
const Discord = require('discord.js')
const fs = require('fs')
exports.run = async (client, message, args) => {
let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
if(!sunucuyaözelayarlarOtorol[message.guild.id]) {
const embed = new Discord.RichEmbed()
.setDescription(`Otorolü Ayarlamadığın İçin Kapatamazsın!`)
.setColor("RED")
.setTimestamp('Ayarlamak İçin ::otorol @roladi')
message.channel.send({embed})
return
}
exports.run = async (client, message, args, member) => {
let giriscikis = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
delete giriscikis[message.guild.id]
fs.writeFile("./otorol.json", JSON.stringify(giriscikis), (err) => {
})
const embed = new Discord.RichEmbed()
.setDescription(`Otorol Mesajları Başarıyla Kapatıldı`)
.setColor("RANDOM")
.setTimestamp()
message.channel.send({embed})
return
}}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["otorolmesaj"],
permLevel: 0
};
exports.help = {
name: 'Otorol Mesaj Kapat',
description: 'Slots oyunu oynar',
usage: 'otorolmesajkapat'
};
const Discord = require('discord.js')
const fs = require('fs')
exports.run = async (client, message, args) => {
let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
let otorolkapat = JSON.parse(fs.readFileSync("./otorol.json", "utf8"));
if(!sunucuyaözelayarlarOtorol[message.guild.id]) {
const embed = new Discord.RichEmbed()
.setDescription(`Otorolü Ayarlamadığın İçin Sıfırlayamazsın!`)
.setColor("RED")
.setTimestamp('Ayarlamak İçin ::otorol @roladi')
message.channel.send({embed})
return
}
delete sunucuyaözelayarlarOtorol[message.guild.id]
fs.writeFile("./otorol.json", JSON.stringify(sunucuyaözelayarlarOtorol), (err) => {
console.log(err)
})
const embed = new Discord.RichEmbed()
.setDescription(`Otorol Başarıyla Sıfırlandı`)
.setColor("RANDOM")
.setTimestamp()
message.channel.send({embed})
return
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["otorolsıfırla"],
permLevel: 0
};
exports.help = {
name: 'Otorol Kapat',
description: 'Slots oyunu oynar',
usage: 'otorolkapat'
};
Merhaba, glitch sitesinden botunuza bunları eklemeniz gerekmekte (Jacquelyn'den alıntıdır)
Gerekli Modüller
- npm i fs
otorol.json oluşturun ve içine {} yazın yoksa komutlar hata verecektir.
otorol.js komutu oluşturun ve aşağıda ki kodları yazın.
JavaScript:const fs = require ('fs') const Discord = require('discord.js') var sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); exports.run = async (bot, message, args) => { let profil = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); var mentionedChannel = message.mentions.channels.first(); if (!mentionedChannel && args[0] !== "sıfırla") return message.channel.send("Ayarlamam İçin Bir Rol Etiketlemelisin. \nRolü Etiketleyemiyorsan **Rolün Etiketleme Seçeneğini Aktif Etmeyi Unutma** \nÖrnek Kullanım : ::otorol @rol #kanal \n**Oto Yazı Kapatmak İstiyorsan ::kapat otoyazı**"); if (message.guild.member(message.author.id).hasPermission(0x8)) { var mentionedRole = message.mentions.roles.first(); if (!mentionedRole) return message.channel.send("**Doğru Kullanım = ::otorol @<roladı> #<metinkanalı>**".then(msg => msg.delete(5000))); if(!profil[message.guild.id]){ profil[message.guild.id] = { sayi: mentionedRole.id, kanal: mentionedChannel.id }; } profil[message.guild.id].sayi = mentionedRole.id profil[message.guild.id].kanal = mentionedChannel.id fs.writeFile("./otorol.json", JSON.stringify(profil), (err) => { console.log(err) }) const embed = new Discord.RichEmbed() .setDescription(`:white_check_mark: Otorol başarıyla ${args[0]} olarak ayarlandı! \nOtorol Mesaj kanalı başarıyla ${mentionedChannel} olarak ayarlandı.\n\nOto Mesaj'ı kapatabilmek için **+otomesajkapat** yazabilirsiniz!`) .setColor("RANDOM") .setTimestamp() message.channel.send({embed}) } } exports.conf = { enabled: true, guildOnly: true, aliases: ["setautorole", "otorol", "otoroldeğiştir"] } exports.help = { name: 'Otorol', description: 'Sunucuya Girenlere Verilecek Olan Otorolü Ayarlar.', usage: 'otorolayarla' }
otorolyazıkapat.js oluşturun ve aşağıda ki kodları yazın.
otorolmesajkapat.js oluşturun ve aşağıda ki kodları yazın.JavaScript:const Discord = require('discord.js') const fs = require('fs') exports.run = async (client, message, args) => { let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); if(!sunucuyaözelayarlarOtorol[message.guild.id]) { const embed = new Discord.RichEmbed() .setDescription(`Otorolü Ayarlamadığın İçin Kapatamazsın!`) .setColor("RED") .setTimestamp('Ayarlamak İçin ::otorol @roladi') message.channel.send({embed}) return } exports.run = async (client, message, args, member) => { let giriscikis = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); delete giriscikis[message.guild.id] fs.writeFile("./otorol.json", JSON.stringify(giriscikis), (err) => { }) const embed = new Discord.RichEmbed() .setDescription(`Otorol Mesajları Başarıyla Kapatıldı`) .setColor("RANDOM") .setTimestamp() message.channel.send({embed}) return }} exports.conf = { enabled: true, guildOnly: false, aliases: ["kapatotoyazı"], permLevel: 0 }; exports.help = { name: 'otorolmesajkapat', description: 'Slots oyunu oynar', usage: 'otorolmesajkapat' };
otorolkapat.js oluşturun ve aşağıda ki kodları yazın.JavaScript:const Discord = require('discord.js') const fs = require('fs') exports.run = async (client, message, args) => { let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); if(!sunucuyaözelayarlarOtorol[message.guild.id]) { const embed = new Discord.RichEmbed() .setDescription(`Otorolü Ayarlamadığın İçin Kapatamazsın!`) .setColor("RED") .setTimestamp('Ayarlamak İçin ::otorol @roladi') message.channel.send({embed}) return } exports.run = async (client, message, args, member) => { let giriscikis = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); delete giriscikis[message.guild.id] fs.writeFile("./otorol.json", JSON.stringify(giriscikis), (err) => { }) const embed = new Discord.RichEmbed() .setDescription(`Otorol Mesajları Başarıyla Kapatıldı`) .setColor("RANDOM") .setTimestamp() message.channel.send({embed}) return }} exports.conf = { enabled: true, guildOnly: false, aliases: ["otorolmesaj"], permLevel: 0 }; exports.help = { name: 'Otorol Mesaj Kapat', description: 'Slots oyunu oynar', usage: 'otorolmesajkapat' };
JavaScript:const Discord = require('discord.js') const fs = require('fs') exports.run = async (client, message, args) => { let sunucuyaözelayarlarOtorol = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); let otorolkapat = JSON.parse(fs.readFileSync("./otorol.json", "utf8")); if(!sunucuyaözelayarlarOtorol[message.guild.id]) { const embed = new Discord.RichEmbed() .setDescription(`Otorolü Ayarlamadığın İçin Sıfırlayamazsın!`) .setColor("RED") .setTimestamp('Ayarlamak İçin ::otorol @roladi') message.channel.send({embed}) return } delete sunucuyaözelayarlarOtorol[message.guild.id] fs.writeFile("./otorol.json", JSON.stringify(sunucuyaözelayarlarOtorol), (err) => { console.log(err) }) const embed = new Discord.RichEmbed() .setDescription(`Otorol Başarıyla Sıfırlandı`) .setColor("RANDOM") .setTimestamp() message.channel.send({embed}) return } exports.conf = { enabled: true, guildOnly: false, aliases: ["otorolsıfırla"], permLevel: 0 }; exports.help = { name: 'Otorol Kapat', description: 'Slots oyunu oynar', usage: 'otorolkapat' };
Sunucunda rolü ayarlıyacaksın daha sonra bunları glitch sitesine gireceksin.Çok teşekkür ederim öncelikleotorol.json içine verilecek rolü mü yazacaz sadece yoksa başka yazacağımız var mı ?
kanka bot yapmak yerine hazır bot botlarda ekleyebilirsin
Sunucunda rolü ayarlıyacaksın daha sonra bunları glitch sitesine gireceksin.
Bir şey sorabilirmiyim - npm i fs modülünü nasıl ekleyebilirim.
Teşekkür ederimGlitch den kod yazıyorsan en altta package.json var ona tıkla sol üstte add package var ona tıkla ve fs yaz ilk çıkanı indir
Consoldan yazıyorsan kodu cmd ye yada powershell e gir npm i fs yaz
Bilgili vardrı elbet bu konuda veya en basititnden youtube gibi platformlardan iizle
Bu kodu bot.js,index.js yada server.js hangisini kullanıyorsan oraya atyok knka ya kod olsun hazır olsun pek istemiyorum
Post automatically merged:
seni sürekli rahatsız ediyorum ama kb ben rolü yarladım sunucuda metin kalanıla prefix + otorol @rol #kanal yapıyorum ayarlandı diyor sonra sunucuya birisi gelince rol vermiyor. yardım edebilirsen sevinirim tekrar rahatsızlık için kb
///////////////////////////////////
//otorol
client.on("guildMemberAdd", async member => {
let sayac = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let otorole = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let arole = otorole[member.guild.id].sayi;
let giriscikis = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let embed = new Discord.RichEmbed()
.setTitle("Otorol Sistemi")
.setDescription(
`:loudspeaker: :inbox_tray: @${member.user.tag}'a Otorol Verildi `
)
.setColor("GREEN")
.setFooter("LND", client.user.avatarURL);
if (!giriscikis[member.guild.id].kanal) {
return;
}
try {
let giriscikiskanalID = giriscikis[member.guild.id].kanal;
let giriscikiskanali = client.guilds
.get(member.guild.id)
.channels.get(giriscikiskanalID);
giriscikiskanali.send(
`:loudspeaker: :white_check_mark: Hoşgeldin **${member.user.tag}** Rolün Başarıyla Verildi.`
);
} catch (e) {
// eğer hata olursa bu hatayı öğrenmek için hatayı konsola gönderelim.
return console.log(e);
}
});
client.on("guildMemberAdd", async member => {
let autorole = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let role = autorole[member.guild.id].sayi;
member.addRole(role);
});
///////////////////////////////////
//otorol
client.on("guildMemberAdd", async member => {
let sayac = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let otorole = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let arole = otorole[member.guild.id].sayi;
let giriscikis = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let embed = new Discord.RichEmbed()
.setTitle("Otorol Sistemi")
.setDescription(
`:loudspeaker: :inbox_tray: @${member.user.tag}'a Otorol Verildi `
)
.setColor("GREEN")
.setFooter("LND", client.user.avatarURL);
if (!giriscikis[member.guild.id].kanal) {
return;
}
try {
let giriscikiskanalID = giriscikis[member.guild.id].kanal;
let giriscikiskanali = client.guilds
.get(member.guild.id)
.channels.get(giriscikiskanalID);
giriscikiskanali.send(
`:loudspeaker: :white_check_mark: Hoşgeldin **${member.user.tag}** Rolün Başarıyla Verildi.`
);
} catch (e) {
// eğer hata olursa bu hatayı öğrenmek için hatayı konsola gönderelim.
return console.log(e);
}
});
client.on("guildMemberAdd", async member => {
let autorole = JSON.parse(fs.readFileSync("./jsonlar/otorol.json", "utf8"));
let role = autorole[member.guild.id].sayi;
member.addRole(role);
});
ben güzel bir bot yaptım onu kullanmak istersenDostum cok zahmeti iş hazır bot kullan