nex-perms
v1.0.0
Published
Discord botları için modüler sistem: komut yükleyici, veri yöneticisi ve daha fazlası.
Downloads
6
Maintainers
Readme
nex-perms
Discord botlar için dinamik yetkilendirme (permissions) sistemi.
YAML dosyasından okunur
Canlı güncellenebilir → restart gerekmez
Komut başında kolay check yapılır
Prefix + Slash command destekler
Kurulum
npm install nex-perms
npm install yamlÖrnek Yapı
my-bot/
├── index.js
├── config/
│ └── permissions.yaml
└── package.jsonindex.js
const { Client, GatewayIntentBits } = require('discord.js');
const { PermsManager } = require('nex-perms');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
const perms = new PermsManager('./config/permissions.yaml');
const config = require('./config.json')
client.on('messageCreate', msg => {
if (!msg.content.startsWith('!') || msg.author.bot) return;
const args = msg.content.slice(1).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
if (!perms.check(msg.member, commandName)) {
msg.reply(' Bu komutu kullanmaya yetkin yok.');
return;
}
msg.reply(` ${commandName} komutu çalıştırıldı!`);
});
client.login('config.token');config/permissions.yaml
permissions:
ping:
- everyone
avatar:
- everyone
ban:
- Admin
- Moderator
kick:
- Admin
mute:
- Moderator