-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
95 lines (90 loc) · 3.04 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 config = require(`./botconfig/config.json`);
const settings = require(`./botconfig/settings.json`);
const filters = require(`./botconfig/filters.json`);
const colors = require("colors");
const Enmap = require("enmap");
const libsodium = require("libsodium-wrappers");
const ffmpeg = require("ffmpeg-static");
const voice = require("@discordjs/voice");
const DisTube = require("distube").default;
const https = require('https-proxy-agent');
const client = new Discord.Client({
restTimeOffset: 0,
shards: "auto",
allowedMentions: {
parse: [ ],
repliedUser: false,
},
partials: ['MESSAGE', 'CHANNEL', 'REACTION'],
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
]
});
const proxy = 'http://123.123.123.123:8080';
const agent = https(proxy);
const { SpotifyPlugin } = require("@distube/spotify");
const { SoundCloudPlugin } = require("@distube/soundcloud");
let spotifyoptions = {
parallel: true,
emitEventsAfterFetching: true,
}
if(config.spotify_api.enabled){
spotifyoptions.api = {
clientId: config.spotify_api.clientId,
clientSecret: config.spotify_api.clientSecret,
}
}
client.distube = new DisTube(client, {
emitNewSongOnly: false,
leaveOnEmpty: true,
leaveOnFinish: true,
leaveOnStop: true,
savePreviousSongs: true,
emitAddSongWhenCreatingQueue: false,
//emitAddListWhenCreatingQueue: false,
searchSongs: 0,
youtubeCookie: config.youtubeCookie, //Comment this line if you dont want to use a youtube Cookie
nsfw: true, //Set it to false if u want to disable nsfw songs
emptyCooldown: 25,
ytdlOptions: {
//requestOptions: {
// agent //ONLY USE ONE IF YOU KNOW WHAT YOU DO!
//},
highWaterMark: 1024 * 1024 * 64,
quality: "highestaudio",
format: "audioonly",
liveBuffer: 60000,
dlChunkSize: 1024 * 1024 * 64,
},
youtubeDL: true,
updateYouTubeDL: true,
customFilters: filters,
plugins: [
new SpotifyPlugin(spotifyoptions),
new SoundCloudPlugin()
]
})
//Define some Global Collections
client.commands = new Discord.Collection();
client.cooldowns = new Discord.Collection();
client.slashCommands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.categories = require("fs").readdirSync(`./commands`);
client.allEmojis = require("./botconfig/emojis.json");
client.setMaxListeners(100); require('events').defaultMaxListeners = 100;
client.settings = new Enmap({ name: "settings",dataDir: "./databases/settings"});
client.infos = new Enmap({ name: "infos", dataDir: "./databases/infos"});
//Require the Handlers Add the antiCrash file too, if its enabled
["events", "commands", "slashCommands", settings.antiCrash ? "antiCrash" : null, "distubeEvent"]
.filter(Boolean)
.forEach(h => {
require(`./handlers/${h}`)(client);
})|| config.token
//Start the Bot
client.login(process.env.token || config.token)
client.on("ready", () => {
require("./dashboard/index.js")(client);
})