forked from ZerioDev/Music-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
39 lines (32 loc) · 1.19 KB
/
main.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
require('dotenv').config()
const { Player } = require('discord-player');
const { Client, GatewayIntentBits } = require('discord.js');
global.client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent
],
disableMentions: 'everyone',
});
client.config = require('./config');
const player = new Player(client, client.config.opt.discordPlayer);
player.extractors.loadDefault();
console.clear()
require('./loader');
require('./keep-alive');
client.login(client.config.app.token)
.catch(async (e) => {
if (e.message === 'An invalid token was provided.') {
require('./process_tools').throwConfigError('app', 'token', '\n\t ❌ Invalid Token Provided! ❌ \n\tchange the token in the config file\n');
} else {
console.error('❌ An error occurred while trying to login to the bot! ❌ \n', e);
if (client.config.app.autoRestart) {
restartService(client.config.app.autoRestartService);
} else {
console.log('Service restart is disabled.');
}
}
});