- Yasaklandı
- #1
const keytr = require('keytr.js');
Banlı Üye
İlk Öncelikle npm i quick.db modülünü indiriniz.
Modül indirmek için klasör shitf-sağ tık basiyoruz komut veya power shell sistemi olur npm i quick.db yaziyoruz ve enter basip gerisine karişmiyoruz
JavaScript:
//bot.js
const db = require('quick.db')
client.on("guildMemberAdd", member => {
db.fetch(`autoRole_${member.guild.id}`).then(otorol => {
if(!otorol || otorol.toLowerCase() === 'yok') return;
else {
try {
member.addRole(member.guild.roles.find(`name`, otorol))
}catch (e) {
console.log('Rol verilemedi sunucu idsi', member.guild.id)
}
}
})
})
//komutlar/otorol.js
const db = require('quick.db')
module.exports.run = async (bot, message, args) => {
if (!message.member.hasPermission('MANAGE_ROLES')) return message.reply('`ROLLERİ_YÖNET` yetkisine sahip değilsin!')
if (!args.join(" ").trim()) return message.channel.send('Geçerli bir rol ismi giriniz !otorol <rol-ismi>')
db.set(`autoRole_${message.guild.id}`, args.join(" ").trim()).then(otorol => {
if (!message.guild.roles.find(`name`, otorol.text)) return message.channel.send("Rol bulunamadı")
message.channel.send(`Otorol Rolü Başarıyla **${otorol}** olarak ayarlandı!`)
})
}
module.exports.help = {
name:"otorol"
}