Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

join_voice_channel() not working #1130

Closed
mikicat opened this issue Mar 10, 2018 · 7 comments
Closed

join_voice_channel() not working #1130

mikicat opened this issue Mar 10, 2018 · 7 comments

Comments

@mikicat
Copy link

mikicat commented Mar 10, 2018

When calling vc = await bot.join_voice_channel(voice_channel) I get an AttributeError:

AttributeError: 'Bot' object has no attribute 'join_voice_channel'

The code I have is:

import discord
from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio

bot = commands.Bot(command_prefix='?')

@bot.command(pass_context=True)
async def yt(ctx, url):

    author = ctx.message.author
    voice_channel = author.voice.channel
    vc = await bot.join_voice_channel(voice_channel)

    player = await vc.create_ytdl_player(url)
    player.start()

bot.run('token')
@Gorialis
Copy link
Contributor

No repro.
Try reinstalling the library:

pip install -U discord.py[voice]

@mikicat
Copy link
Author

mikicat commented Mar 10, 2018

No luck.

@Gorialis
Copy link
Contributor

There should be no instances where this is reasonably possible with this library (unless you're on some ancient version without voice support?)
Try reinstalling again with no cache (and ensure you're using the right pip):

pip install --no-cache-dir -U discord.py[voice]

If this doesn't work, there's not much more I can do to help you.

@mikicat
Copy link
Author

mikicat commented Mar 10, 2018

Ok, after reinstalling it like that it worked. Thanks!

@mikicat mikicat closed this as completed Mar 10, 2018
@filegeiasou
Copy link

@mikicat help me have a problem
the song doesnt play what can i do

@Harmon758
Copy link
Contributor

@filegeiasou Please don't necrobump issues.
For help with using the library, you should join either the official discord.py server or the Discord API server, as the README also links.

@alanhong23
Copy link

alanhong23 commented Jun 1, 2019

@client.command(pass_content=True)
async def connect (ctx):
channel = ctx.message.author.VoiceChannel
await client.VoiceChannel.connect(channel)<

and i get this error

Traceback (most recent call last):
File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 859, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 725, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'VoiceChannel'

Repository owner locked as resolved and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants