nex-perms
Version:
Discord botları için modüler sistem: komut yükleyici, veri yöneticisi ve daha fazlası.
68 lines (53 loc) • 1.45 kB
Markdown
# 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
```bash
npm install nex-perms
npm install yaml
```
## Örnek Yapı
```
my-bot/
├── index.js
├── config/
│ └── permissions.yaml
└── package.json
```
index.js
```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
```js
permissions:
ping:
- everyone
avatar:
- everyone
ban:
- Admin
- Moderator
kick:
- Admin
mute:
- Moderator
```