dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
684 stars 162 forks source link

Player error: send_audio_packet() got an unexpected keyword argument 'encode' #219

Closed SinanAkkoyun closed 2 years ago

SinanAkkoyun commented 2 years ago

Summary

The voice bot is silent

Reproduction Steps

Install by cloning rebase and running py -3.8 -m pip install .[voice]

run my code

Code

import discord
import asyncio

class MyClient(discord.Client):
  async def on_ready(self):
    print('Logged on as', self.user)

  async def on_message(self, message):
    if message.author == self.user:
      return

    if message.content == 'voice':
      FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn', 'executable': 'C:/ffmpeg/bin/ffmpeg.exe'}
      channel = message.author.voice.channel
      vc = await channel.connect()

      source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio('rickroll.mp3')) #, **FFMPEG_OPTIONS
      vc.play(source, after=lambda e: print(f'Player error: {e}') if e else None)
      await asyncio.sleep(19) #exactly the duration of the song

client = MyClient()

Expected Results

Should rickroll me

Actual Results

Player error: send_audio_packet() got an unexpected keyword argument 'encode'

bot doesn't talk at all

System Information

i am sorry but I'm a noob and I installed the repo via py -3.8 -m pip install -U .[voice] and idk how to do that

Checklist

Additional Information

Thanks for the recent fix :)

dolfies commented 2 years ago

Weird, I'll take a look.

dolfies commented 2 years ago

Going to need a full traceback, because this doesn't seem possible.

dolfies commented 2 years ago

Nevermind, latest commit should fix the issue.

SinanAkkoyun commented 2 years ago

YES OMG IT WORKS THANK YOU SO MUCH!