-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
disspace.js
85 lines (74 loc) · 2.7 KB
/
disspace.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
const { Client, Collection, GatewayIntentBits, Partials } = require("discord.js");
const { DisTube } = require('distube');
const { SoundCloudPlugin } = require('@distube/soundcloud');
const { SpotifyPlugin } = require('@distube/spotify');
const { DeezerPlugin } = require('@distube/deezer');
const { YouTubePlugin } = require('@distube/youtube');
const { DirectLinkPlugin } = require('@distube/direct-link');
const { YtDlpPlugin } = require('@distube/yt-dlp');
const { AppleMusicPlugin } = require('distube-apple-music');
const { TidalPlugin } = require('distube-tidal');
class MainClient extends Client {
constructor() {
super({
shards: "auto",
allowedMentions: { parse: ["users", "roles"] },
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Channel, Partials.Message]
});
process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));
this.config = require('./settings/config.js');
this.owner = this.config.OWNER_ID;
this.color = this.config.EMBED_COLOR;
if (!this.token) this.token = this.config.TOKEN;
const client = this;
this.distube = new DisTube(client, {
savePreviousSongs: true,
emitAddListWhenCreatingQueue: true,
emitAddSongWhenCreatingQueue: true,
plugins: [
new TidalPlugin(),
new AppleMusicPlugin(),
new YtDlpPlugin({ update: false }),
new DirectLinkPlugin(),
new YouTubePlugin(),
new SoundCloudPlugin(),
new DeezerPlugin(),
checkSpotify(client)
],
});
["slash"].forEach(x => client[x] = new Collection());
["loadCommands", "loadEvents", "loadPlayer", "loadDatabase"].forEach(x => require(`./handlers/${x}`)(client));
}
connect() {
return super.login(this.token);
};
};
module.exports = MainClient;
function checkSpotify(client) {
if (client.config.SPOTIFY_TRACKS) {
// console.log("[INFO] You're (Enabled) Spotify More Tracks Support!");
return spotifyOn(client);
} else {
// console.log("[INFO] You're (Not Enabled) Spotify More Tracks Support!");
return spotifyOff();
}
}
function spotifyOn(client) {
return new SpotifyPlugin({
api: {
clientId: client.config.SPOTIFY_ID,
clientSecret: client.config.SPOTIFY_SECRET
}
})
}
function spotifyOff() {
return new SpotifyPlugin({})
}