-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
63 lines (54 loc) · 1.94 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const Discord = require('discord.js');
const client = new Discord.Client();
const ayarlar = require('./config.json');
const moment = require('moment');
const fs = require('fs');
const db = require('quick.db');
var prefix = ayarlar.prefix;
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
const lazefe = fs.readdirSync('./komutlar').filter(f => f.endsWith('.js'))
for(const f of lazefe){
let efebeyS = require(`./komutlar/${f}`)
if(efebeyS.help.name){
console.log(`Yüklenen Komut => ${efebeyS.help.name}`)
client.commands.set(efebeyS.help.name, efebeyS)
}
efebeyS.conf.aliases.forEach(alias => {
client.aliases.set(alias, efebeyS.help.name)
})
}
client.on("message", message => {
let client = message.client;
if (message.author.bot) return;
if (!message.content.startsWith(ayarlar.prefix)) return;
let command = message.content.split(' ')[0].slice(ayarlar.prefix.length);
let params = message.content.split(' ').slice(1);
let perms = client.elevation(message);
let cmd;
if (client.commands.has(command)) {
cmd = client.commands.get(command);
} else if (client.aliases.has(command)) {
cmd = client.commands.get(client.aliases.get(command));
}
if (cmd) {
if (perms < cmd.conf.permLevel) return;
cmd.run(client, message, params, perms);
}
})
client.elevation = message => {
if (!message.guild) {
return;
}
let permlvl = 0;
if (message.member.hasPermission("BAN_MEMBERS")) permlvl = 2;
if (message.member.hasPermission("ADMINISTRATOR")) permlvl = 3;
if (message.author.id === ayarlar.sahip) permlvl = 4;
return permlvl;
};
client.on("ready", () => {
client.user.setStatus("online");
console.log("Bot aktif | Tüm komutlar yüklendi.")
client.user.setActivity("Alpha Phoenix | !yardım", {type: "WATCHING"});
})
client.login(ayarlar.token)