mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +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.
|
// Create a new Player, and attach it to the bot client.
|
||||||
client.player = new Player(client, {
|
const player = new Player(client, {
|
||||||
ytdlOptions: {
|
ytdlOptions: {
|
||||||
quality: 'highestaudio',
|
quality: 'highestaudio',
|
||||||
highWaterMark: 1 << 25
|
highWaterMark: 1 << 25
|
||||||
},
|
}
|
||||||
FFMPEG_OPTIONS: {
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
FFMPEG_OPTIONS: {
|
||||||
before_options:
|
before_options:
|
||||||
'-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
'-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
||||||
options: '-vn'
|
options: '-vn'
|
||||||
}
|
},
|
||||||
});
|
*/
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
|
|
||||||
// This method will load all the extractors from the @discord-player/extractor package
|
// This method will load all the extractors from the @discord-player/extractor package
|
||||||
client.player.extractors.loadDefault();
|
player.extractors.loadDefault();
|
||||||
|
|
||||||
// Set Discord status
|
// Set Discord status
|
||||||
client.user.setActivity('/help', {
|
client.user.setActivity('/help', {
|
||||||
@@ -71,7 +74,7 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
await command.run({ client, interaction });
|
await command.run({ client, interaction, player });
|
||||||
console.log(
|
console.log(
|
||||||
`Command '/${interaction.commandName}' was executed successfully.`
|
`Command '/${interaction.commandName}' was executed successfully.`
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user