Skip to content

Commit

Permalink
extract vc from member not from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
galnir committed Aug 15, 2023
1 parent 8e8d6a9 commit 3a9266c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/bot/src/commands/music/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { container } from '@sapphire/framework';
import searchSong from '../../lib/music/searchSong';
import type { Song } from '../../lib/music/classes/Song';
import { trpcNode } from '../../trpc';
import { GuildMember } from 'discord.js';

@ApplyOptions<CommandOptions>({
name: 'play',
Expand Down Expand Up @@ -87,9 +88,7 @@ export class PlayCommand extends Command {

const { music } = client;

const voiceChannel = interaction.guild?.voiceStates?.cache?.get(
interaction.user.id
)?.channel;
const voiceChannel = (interaction.member as GuildMember).voice.channel;

// edge case - someome initiated the command but left the voice channel
if (!voiceChannel) {
Expand Down Expand Up @@ -151,7 +150,7 @@ export class PlayCommand extends Command {
return;
}

await queue.start();
queue.start();

return await interaction.followUp({ content: message });
}
Expand Down

0 comments on commit 3a9266c

Please sign in to comment.