Why is it saying
ERROR discord.ext.commands.bot Ignoring exception in command play
Traceback (most recent call last):
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 29, in play
voice_channel.play(discord.FFmpegPCMAudio(url))
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/player.py", line 290, in __init__
super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/player.py", line 166, in __init__
self._process = self._spawn_process(args, **kwargs)
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/player.py", line 183, 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 "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1029, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/runner/SuperCooperativeDatamining/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 244, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
I have installed ffmpeg! pip list:
~/SuperCooperativeDatamining$ pip list
Package Version
------------------------- ----------
aiohttp 3.8.5
aiosignal 1.3.1
async-timeout 4.0.2
attrs 23.1.0
blinker 1.6.2
build 0.10.0
cachecontrol 0.12.14
cachy 0.3.0
certifi 2023.5.7
cffi 1.15.1
charset-normalizer 3.2.0
cleo 0.8.1
click 8.1.5
clikit 0.6.2
crashtest 0.3.1
cryptography 41.0.2
debugpy 1.6.7
discord 2.3.1
discord-py 2.3.1
distlib 0.3.7
dulwich 0.21.5
ffmpeg 1.4
filelock 3.12.2
flask 2.3.2
frozenlist 1.4.0
html5lib 1.1
idna 3.4
importlib-metadata 6.8.0
installer 0.7.0
itsdangerous 2.1.2
jaraco-classes 3.3.0
jedi 0.18.2
jeepney 0.8.0
jinja2 3.1.2
jsonschema 4.18.3
jsonschema-specifications 2023.6.1
keyring 24.2.0
lockfile 0.12.2
markupsafe 2.1.3
more-itertools 9.1.0
msgpack 1.0.5
multidict 6.0.4
numpy 1.25.1
packaging 20.9
parso 0.8.3
pastel 0.2.1
pexpect 4.8.0
pip 22.2.2
pkginfo 1.9.6
platformdirs 3.9.1
pluggy 1.2.0
poetry 1.1.13
poetry-core 1.0.8
poetry-plugin-export 1.4.0
ptyprocess 0.7.0
pycparser 2.21
pyflakes 2.5.0
pylev 1.4.0
pynacl 1.5.0
pyparsing 3.1.0
pyproject-hooks 1.0.0
python-lsp-jsonrpc 1.0.0
pytoolconfig 1.2.5
rapidfuzz 2.15.1
referencing 0.29.1
replit-python-lsp-server 1.15.9
requests 2.31.0
requests-toolbelt 0.9.1
rope 1.1.1
rpds-py 0.8.11
secretstorage 3.3.3
setuptools 68.0.0
shellingham 1.5.1
six 1.16.0
toml 0.10.2
tomli 2.0.1
tomlkit 0.11.8
trove-classifiers 2023.7.6
ujson 5.8.0
urllib3 1.26.15
virtualenv 20.24.0
webencodings 0.5.1
werkzeug 2.3.6
whatthepatch 1.0.5
yapf 0.40.1
yarl 1.9.2
youtube-dl 2021.12.17
zipp 3.16.2
Repl link: https://replit.com/@EmilAzimkulov/SuperCooperativeDatamining#main.py
import discord
from discord.ext import commands
import youtube_dl
from discord.utils import get
intents = discord.Intents.default().all()
intents.voice_states = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print("Bot is ready")
@bot.command()
async def play(ctx, url):
# Проверяем, находится ли бот в голосовом канале
if not ctx.voice_client:
channel = ctx.author.voice.channel
await channel.connect()
# Получаем объект голосового канала
voice_channel = get(bot.voice_clients, guild=ctx.guild)
# Проверяем, загружена ли музыка
if not voice_channel.is_playing():
# Загружаем и проигрываем аудио из указанного URL
voice_channel.play(discord.FFmpegPCMAudio(url))
await ctx.send("Сейчас играет музыка")
else:
await ctx.send("Музыка уже играет")
@bot.command()
async def leave(ctx):
voice_channel = discord.utils.get(bot.voice_clients, guild=ctx.guild)
if voice_channel.is_connected():
await voice_channel.disconnect()
bot.run("token")