forked from oktayyavuz/Rimuru-Discord.js-v14-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
103 lines (82 loc) · 2.72 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
96
97
98
99
100
101
102
103
const Discord = require("discord.js");
const { EmbedBuilder,MessageEmbed } = require("discord.js")
const fs = require("fs");
const db = require('croxydb')
const config = require("./config.json");
const functions = require('./function/functions');
const Rest = require("@discordjs/rest");
const DiscordApi = require("discord-api-types/v10");
const client = new Discord.Client({
intents: 3276543,
partials: Object.values(Discord.Partials),
allowedMentions: {
parse: ["users", "roles", "everyone"]
},
retryLimit: 3
});
global.client = client;
client.commands = (global.commands = []);
//
console.log(`[-] ${fs.readdirSync("./commands").length} komut algılandı.`)
for(let commandName of fs.readdirSync("./commands")) {
if(!commandName.endsWith(".js")) return;
const command = require(`./commands/${commandName}`);
client.commands.push({
name: command.name.toLowerCase(),
description: command.description.toLowerCase(),
options: command.options,
dm_permission: false,
type: 1
});
console.log(`[+] ${commandName} komutu başarıyla yüklendi.`)
}
client.on('messageCreate', msg => {
if (msg.mentions.has(client.user)) {
msg.reply('Birisi Beni Çağırdı Sanırım Komutlarıma `/yardım` ile bakabilirsin 💕');
}
});
client.on('messageCreate', msg => {
const content = msg.content.toLowerCase();
const replies = {
'sa': 'as cnm la naber 😋',
'naber': 'iyi senden naber 😃',
'sea': 'as cnm la naber 😋',
'selam': 'as cnm la naber 😋',
'selamun aleyküm': 'as cnm la naber 😋',
'selamunaleyküm': 'as cnm la naber 😋',
'selamunaleykum': 'as cnm la naber 😋'
};
if (replies[content]) {
msg.reply(replies[content]);
}
});
//
console.log(`[-] ${fs.readdirSync("./events").length} olay algılandı.`)
for(let eventName of fs.readdirSync("./events")) {
if(!eventName.endsWith(".js")) return;
const event = require(`./events/${eventName}`);
const evenet_name = eventName.split(".")[0];
client.on(event.name, (...args) => {
event.run(client, ...args)
});
console.log(`[+] ${eventName} olayı başarıyla yüklendi.`)
}
//
client.once("ready", async() => {
const rest = new Rest.REST({ version: "10" }).setToken(config.token);
try {
await rest.put(DiscordApi.Routes.applicationCommands(client.user.id), {
body: client.commands, //
});
console.log(`${client.user.tag} Aktif! 💕`);
db.set("botAcilis_", Date.now());
} catch (error) {
throw error;
}
});
client.login(process.env.token).then(() => {
console.log(`[-] Discord API'ye istek gönderiliyor.`);
eval("console.clear()")
}).catch(() => {
console.log(`[x] Discord API'ye istek gönderimi başarısız(token girmeyi unutmuşsun).`);
});