Skip to content

Commit

Permalink
🩹Fixed problem with bots not rejoining
Browse files Browse the repository at this point in the history
  • Loading branch information
MotiCAT committed Dec 5, 2023
1 parent 89e5420 commit e41fb1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Events/onVoiceStateUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { client } from '../index';
import { Queue, queueManager } from '../classes/queue';
import { VoiceState } from 'discord.js';

Expand All @@ -8,6 +9,7 @@ export async function onVoiceStateUpdate(oldState: VoiceState, newState: VoiceSt

if (channel && channel.members.size === 1 && channel.members.has(botId)) {
newState.guild.members.me?.voice.disconnect();
client.player = undefined;
queueManager.deleteQueue(newState.guild.id);
}

Expand Down
2 changes: 2 additions & 0 deletions src/commands/stop.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { client } from '../index';
import { queueManager } from '../classes/queue';
import { embeds } from '../embeds';
import { Message } from 'discord.js';

export async function stopCommand(message: Message): Promise<void> {
if (message.guild?.members.me?.voice.channel) {
message.guild.members.me.voice.disconnect();
client.player = undefined;
message.reply(embeds.videoStopped);
} else {
message.reply(embeds.videoNotPlaying);
Expand Down
2 changes: 2 additions & 0 deletions src/interactions/stop.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { queueManager } from '../classes/queue';
import { embeds } from '../embeds';
import { client } from '../index';
import { ChatInputCommandInteraction } from 'discord.js';

export async function stopCommand(interaction: ChatInputCommandInteraction): Promise<void> {
if (interaction.guild?.members.me?.voice.channel) {
interaction.guild.members.me.voice.disconnect();
client.player = undefined;
interaction.reply(embeds.videoStopped);
} else {
interaction.reply(embeds.videoNotPlaying);
Expand Down

0 comments on commit e41fb1c

Please sign in to comment.