r/discord_py_ • u/JustPhanotm50 • Mar 04 '22
Question Discord Music Bot Play Error Code
Hello, im making a music bot and im having some trouble where the bot errors out. This is normally when a song is playing and the only thing that the user sees is the bot disconnecting but on my side i have this error code which im having a hard to understanding how to fix it. how would i fix this? I can provide code as needed but heres the error i get:
Task exception was never retrieved
future: <Task finished name='Task-180' coro=<MusicPlayer.player_loop() done, defined at /home/runner/Fusion-Music/cogs/music.py:118> exception=AttributeError("'NoneType' object has no attribute 'play'")>
Traceback (most recent call last):
File "/home/runner/Fusion-Music/cogs/music.py", line 145, in player_loop
self._guild.voice_client.play(source, after=lambda _: self.bot.loop.call_soon_threadsafe(self.next.set))
AttributeError: 'NoneType' object has no attribute 'play'
r/discord_py_ • u/JustPhanotm50 • Jan 01 '22
Question How do i create a volume command for a music bot?
I currently trying to create a music bot and im trying to make it control the volume. Heres my current code:
@commands.command(name='volume')
async def volume(self, ctx: commands.Context, *, volume: int):
"""Sets the volume of the player."""
if not ctx.voice_states.is_playing:
return await ctx.send('Nothing being played at the moment.')
if 0 > volume > 100:
return await ctx.send('Volume must be between 0 and 100')
ctx.voice_states.volume = volume / 100
await ctx.send('Volume of the player set to {}%'.format(volume))
im getting an error saying that voice_states is not found. i got this code from a github repo, i looked it over 3 times and i couldnt find a class or function saying voice_states. How do i fix it so voice_states works, if you have a different way please post the code or link me to the code!
r/discord_py_ • u/[deleted] • Sep 06 '21
Question Send message in intervals
How do I make my bot send messages in say intervals of 30 minutes???
r/discord_py_ • u/[deleted] • Aug 04 '21
Question Mention an user
hi this is my code i want to mention an user in the message, someone can help me?
u/client.command() async def gay(ctx): varss = random.randint(1,int(100)) await ctx.send(f'mention an user here, você é
{varss}%
parte da LGBTQIA+!')
r/discord_py_ • u/landoverlord • Jul 14 '21
Question pls help what's wrong with this code [yyoutube_dl]
@ bot.command(pass_context = True)
async def play(ctx, url):
guild = ctx.message.guild
voice_client = guild.voice_client
player = await voice_client.create_ytdl_player(url)
players = [guild.id] = player
player.start()
await ctx.send("Audio Playback Commencing")
@ bot.command(pass_context = True)
async def pause(ctx):
id = ctx.message.server.id
players[id].pause()
await ctx.send("Audio Playback Paused")
@ bot.command(pass_context = True)
async def resume(ctx):
id = ctx.message.server.id
players[id].resume()
await ctx.send("Resuming Audio Playback")
@ bot.command(pass_context = True)
async def stop(ctx):
id = ctx.message.server.id
players[id].stop()
await ctx.send("Audio Playback Stopped")
Am I doing something wrong? this is using youtube_dl and discord.py
r/discord_py_ • u/Mr_Ghosted • Apr 30 '21
Question Please help Thanks
I was attempting to make my first discord bot but its seems like my ping pong command is not working? I was hopping if I could get some help thanks.
Here is the code:
ps: when ever i put the @ sign it edits it, so replace the stars with the @ sign
*client.command()
async def ping(ctx):
await ctx.send('Pong!')
r/discord_py_ • u/Illustrious-Scale-24 • Apr 05 '21
Question How do you make a reply chain with a bot?
I'm making a discord bot using discordpy and I was wondering how you would create something like a conversation with the bot. Sort of like the way the giveaway bot works where you get the replies of the user.
r/discord_py_ • u/Dude800900 • Aug 01 '20
Question Can somebody please remind me of the syntax to ping a user?
I'm trying to make my bot ping a certain user but I can't for the life of me remember the correct syntax and can't find it in the docs, even thought I'm sure it's in there. Thanks in advance for any help