mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 22:16:13 +00:00
make sure player is initialized as singleton
This commit is contained in:
1 parent
26ae2871d3
commit
7477621d68
1 file changed
+10
-7
@@ -22,23 +22,26 @@ for (const file of commandFiles) {
|
||||
}
|
||||
|
||||
// Create a new Player, and attach it to the bot client.
|
||||
client.player = new Player(client, {
|
||||
const player = new Player(client, {
|
||||
ytdlOptions: {
|
||||
quality: 'highestaudio',
|
||||
highWaterMark: 1 << 25
|
||||
},
|
||||
FFMPEG_OPTIONS: {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
FFMPEG_OPTIONS: {
|
||||
before_options:
|
||||
'-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
||||
options: '-vn'
|
||||
}
|
||||
});
|
||||
},
|
||||
*/
|
||||
|
||||
client.once('ready', async () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
|
||||
// This method will load all the extractors from the @discord-player/extractor package
|
||||
client.player.extractors.loadDefault();
|
||||
player.extractors.loadDefault();
|
||||
|
||||
// Set Discord status
|
||||
client.user.setActivity('/help', {
|
||||
@@ -71,7 +74,7 @@ client.on('interactionCreate', async (interaction) => {
|
||||
|
||||
try {
|
||||
await interaction.deferReply();
|
||||
await command.run({ client, interaction });
|
||||
await command.run({ client, interaction, player });
|
||||
console.log(
|
||||
`Command '/${interaction.commandName}' was executed successfully.`
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user