ZerioDev / Music-bot

A complete code to download for a cool Discord music bot !
https://discord.gg/5cGSYV8ZZj
GNU General Public License v3.0
880 stars 1.08k forks source link

[Bug with fix available] No extractors fix. #284

Closed pendragons-code closed 1 year ago

pendragons-code commented 1 year ago
const { Player } = require('discord-player');
const Genius = require("genius-lyrics");
const { Client, GatewayIntentBits } = require('discord.js');
const { YouTubeExtractor } = require("@discord-player/extractor");
global.client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.MessageContent
    ],
    disableMentions: 'everyone',
});

client.config = require('./config');

global.player = new Player(client, client.config.opt.discordPlayer);
global.genius = new Genius.Client();
player.extractors.loadDefault()

require('./src/loader');

client.login(client.config.app.token);

This should fix the error, and the bot should actually work find if you add this to beta, as I have encountered 0 issues so far with this being the only change I made. The changes made allows the extractor to work and not crash with the extractor error. Also recent changes to both discord and discord-player has been made so that the music can now be played there.

pendragons-code commented 1 year ago

It is worth noting that the docs seem to recommend doing this in an async manner, having awaits before the loading of extractors.

Nickeldon commented 1 year ago

https://discord.com/channels/773639842449850368/1102793257450225684/1103288193949913098

pendragons-code commented 1 year ago

https://discord.com/channels/773639842449850368/1102793257450225684/1103288193949913098

ye i know im just leaving it here since they seem to have yet to include it in the beta version, unless im wrong

revot334 commented 1 year ago

will be added! to beta soon

pendragons-code commented 1 year ago

will be added! to beta soon

nice