-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
63 lines (44 loc) · 1.36 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 { Client, GatewayIntentBits, Partials, Collection } = require("discord.js");
const INTENTS = Object.values(GatewayIntentBits);
const PARTIALS = Object.values(Partials);
const client = new Client({
intents: INTENTS,
allowedMentions: {
parse: ["users"]
},
partials: PARTIALS,
retryLimit: 3
});
global.client = client;
client.commands = (global.commands = []);
const { readdirSync } = require("fs")
const { TOKEN } = require("./config.json");
/* Slash Komutları Yüklüyoruz */
readdirSync('./commands').forEach(f => {
if(!f.endsWith(".js")) return;
const props = require(`./commands/${f}`);
client.commands.push({
name: props.name.toLowerCase(),
description: props.description,
options: props.options,
dm_permission: props.dm_permission,
type: 1
});
console.log(`[COMMAND] ${props.name} komutu yüklendi.`)
});
/* Slash Komutları Yüklüyoruz */
/* Eventleri Yüklüyoruz */
readdirSync('./events').forEach(e => {
const eve = require(`./events/${e}`);
const name = e.split(".")[0];
client.on(name, (...args) => {
eve(client, ...args)
});
console.log(`[EVENT] ${name} eventi yüklendi.`)
});
/* Eventleri Yüklüyoruz */
client.login(TOKEN).then(app => {
console.log(`[BOT] Token girişi başarılı.`)
}).catch(app => {
console.log(`[BOT] Token girşi başarısız.`)
})