-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
95 lines (77 loc) · 2.52 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const discord = require("discord.js");
const client = new discord.Client({ disableEveryone: true, disabledEvents: ["TYPING_START"] });
const { readdirSync } = require("fs");
const { join } = require("path");
const { TOKEN, PREFIX } = require("./config.json");
const db = require("quick.db")
client.login(TOKEN);
client.commands = new discord.Collection();
client.prefix = PREFIX;
client.queue = new Map();
client.dispatcher;
client.on("ready", () => {
console.log(
`${client.user.username} ready!`
);
const link = "https://discordapp.com/oauth2/authorize?client_id="+client.user.id+"&scope=bot&permissions=8";
console.log(
`Davet : [${link}]!!`
)
});
client.on("warn", info => console.log(info));
client.on("error", console.error);
const commandFiles = readdirSync(join(__dirname, "commands")).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(join(__dirname, "commands", `${file}`));
client.commands.set(command.name, command);
}
const talkedRecently = new Set();
client.on("message", async message => {
if (message.author.bot) return;
if (!message.guild) return;
if (message.content.startsWith(PREFIX)) {
const args = message.content
.slice(PREFIX.length)
.trim()
.split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
if (talkedRecently.has(message.author.id)) {
return message.channel.send(
"`4.5` Saniye de Bir Komut Kullanabilirsin"
);
} else {
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 4500);
}
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply(
"Bu komut yürütülürken bir hata oluştu."
).catch(console.error);
}
}
});
const dc = require("discord.jsv2");
const dcc = new dc.Client();
client.ayar = db;
client.config = require("./config.js");
client.ayarlar = require("./config.js")
dcc.ayar = db;
dcc.config = require("./config.js");
dcc.ayarlar = require("./config.js")
require("./modules/functions.js")(dcc);
client.on("ready", async () => {
client.appInfo = await client.fetchApplication();
dcc.appInfo = await client.fetchApplication();
setInterval( async () => {
client.appInfo = await client.fetchApplication();
dcc.appInfo = await client.fetchApplication();
}, 60000);
require("./modules/dashboard.js")(dcc, client);
});
dcc.login(TOKEN);