question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bot joins voice channel, doesn't do anything.

See original GitHub issue

So, I have the following code:

        public async Task JoinChannel(IVoiceChannel channel = null)
        {
            channel = channel ?? (Context.Message.Author as IGuildUser)?.VoiceChannel;

            if (channel == null)
            {
                await ReplyError("You need to be in a voice channel, or pass one as an argument.");
                return;
            }

            audioclient = await channel.ConnectAsync();
        }

When I run the bot and use a command to make it join a voice channel, it connects to that channel, but then it shows “A MessageReceived handler is blocking the gateway task.” (Warning), and eventually times out without completing ConnectAsync().

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
Joe4evrcommented, Apr 20, 2017

You need to set RunMode = RunMode.Async in the Command attribute on all your commands that deal with voice. See here.

0reactions
CodeDiseaseDevcommented, Mar 31, 2022

But what if I use my own command handler? I can’t set RunMode then can I?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bot not joining voice chat : r/Discord_Bots
Make sure that the bot has the permission to join VC. You can add it by giving it a role that's able to...
Read more >
discord.js v13 bot Joins voice channel but doesn't play ...
I tried using different mp3 files. It joins the voice channel but does not play anything. javascript · node.js · discord.js · audio-player....
Read more >
Why does my bot not join discord voice channel
I am trying to make a discord music bot but it is not working.
Read more >
won't fix - It doesn't show any voice channel (Discord)
I let the bot connect to my Discord server but it doesn't show any channels so i cant let it join. it has...
Read more >
How to Fix Discord Rhythm Bot Not Working Issue
If either setting is not compatible with the bot, the bot will stop working completely. Here is how you can check the volume...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found