-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
main.js
33 lines (27 loc) · 1.12 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
require('dotenv').config();
const { Player } = require('discord-player');
const { Client, GatewayIntentBits } = require('discord.js');
const { YoutubeiExtractor } = require('discord-player-youtubei'); // Import the new extractor
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);
// Register the new Youtubei extractor
player.extractors.register(YoutubeiExtractor, {});
console.clear();
require('./loader');
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);
}
});