-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfroggy.js
67 lines (59 loc) · 2.09 KB
/
froggy.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
const { Client, Intents, Collection } = require("discord.js");
const { Manager } = require("erela.js");
const spotify = require("better-erela.js-spotify").default;
const deezer = require("erela.js-deezer");
const apple = require("erela.js-apple");
const facebook = require("erela.js-facebook");
const { readdirSync } = require("fs");
const path = require("path");
class MainClient extends Client {
constructor() {
super({
shards: "auto",
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: false
},
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_VOICE_STATES,
]
});
this.config = require("./settings/config.js");
this.loadslash = [];
this.prefix = this.config.PREFIX;
this.owner = this.config.OWNER_ID;
this.dev = this.config.DEV_ID;
if(!this.token) this.token = this.config.TOKEN;
process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));
const client = this;
this.manager = new Manager({
nodes: this.config.NODES,
autoPlay: true,
plugins: [
new spotify(),
new facebook(),
new deezer(),
new apple(),
],
send(id, payload) {
const guild = client.guilds.cache.get(id);
if (guild) guild.shard.send(payload);
},
});
["aliases", "slash", "commands", "premiums"].forEach(x => client[x] = new Collection());
["loadCommand", "loadSlashCommand", "loadEvent", "loadPlayer", "loadDatabase", "loadPremium"].forEach(x => require(`./handlers/${x}`)(client));
readdirSync("./slashcommands/").map(async dir => {
readdirSync(`./slashcommands/${dir}`).map(async (cmd) => {
this.loadslash.push(require(path.join(__dirname, `./slashcommands/${dir}/${cmd}`)));
})
})
}
connect() {
return super.login(this.token);
};
};
module.exports = MainClient;