Command.ChatInputCommandInteraction GuildMember.voice not updating
public async play(interaction : Command.ChatInputCommandInteraction) { const interactionGuildId = interaction.guildId; const member = interaction.member as GuildMember; if (interactionGuildId == null || member == null) { await interaction.reply("This command can only be used in a server"); return; } const voiceState = member.voice; if (voiceState == null || voiceState.channel == null) { //I get this message even when in a voice channel await interaction.reply("You must be in a voice channel to use this command"); return; }
public async play(interaction : Command.ChatInputCommandInteraction) { const interactionGuildId = interaction.guildId; const member = interaction.member as GuildMember; if (interactionGuildId == null || member == null) { await interaction.reply("This command can only be used in a server"); return; } const voiceState = member.voice; if (voiceState == null || voiceState.channel == null) { //I get this message even when in a voice channel await interaction.reply("You must be in a voice channel to use this command"); return; }
If before starting my bot I am in a voice channel, then it works as expected, but when I start the bot, and then join a voice channel, it doesn't work.
interaction.member.voice.channel
interaction.member.voice.channel
is null, as well as
interaction.member.voice.channelId
interaction.member.voice.channelId
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
S-IaF
Sapphire - Imagine a Framework
Sapphire is a next-gen object-oriented Discord.js bot framework.