discordのボイスチャンネルで音楽を流したいと思っています。
FFmpegPCMAudioを使い流すのですが、FFmpegPCMAudioでエラーが起きてしまいました。
検索しましたがあまり、ヒットしませんでした。
ご教授お願いします。
コード
voice_client.play(ffmpeg_audio_source)
この行でエラーが起きてます
python
1@client.command() 2async def play(ctx): 3 if ctx.author.voice is None: 4 await ctx.send("いずれかのボイスチャンネルに接続してください") 5 return 6 else: 7 await ctx.author.voice.channel.connect() 8 voice_client = ctx.message.guild.voice_client 9 if not voice_client: 10 await ctx.send("ボイスチャンネルの接続に失敗しました") 11 return 12 if ctx.message.attachments: 13 await ctx.send("添付された曲を再生します") 14 await ctx.message.attachments[0].save("tmp.mp3") 15 music = "tmp.mp3" 16 ffmpeg_audio_source = discord.FFmpegPCMAudio(music) 17 voice_client.play(ffmpeg_audio_source) 18 return 19 else: 20 await ctx.send("ファイルを添付してください")
エラー
Ignoring exception in command play: Traceback (most recent call last): File "C:\Users\waon-pc\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\core.py", line 125, in wrapped ret = await coro(*args, **kwargs) File "c:\Users****\Desktop\discord\discord.bot\voicebot.py", line 24, in play ffmpeg_audio_source = discord.FFmpegPCMAudio(music) File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\player.py", line 244, in __init__ super().__init__(source, executable=executable, args=args, **subprocess_kwargs) File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\player.py", line 148, in __init__ self._process: subprocess.Popen = self._spawn_process(args, **kwargs) File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\player.py", line 157, in _spawn_process raise ClientException(executable + ' was not found.') from None discord.errors.ClientException: ffmpeg was not found. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\bot.py", line 960, in invoke await ctx.command.invoke(ctx) File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\core.py", line 825, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ext\commands\core.py", line 134, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found. Exception ignored in: <function AudioSource.__del__ at 0x057944A8> Traceback (most recent call last): File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\player.py", line 115, in __del__ self.cleanup() File "C:\Users****\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\player.py", line 164, in cleanup proc = self._process AttributeError: 'FFmpegPCMAudio' object has no attribute '_process'

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/09/12 04:17