Вчера бот работал просто прекрасно! Показывал рандомные картинки и тд. А сегодня у меня JSON почему-то сломался и когда я хочу получить рандомную картинку пишет:
Ignoring exception in command fox:
Traceback (most recent call last):
File "C:\Users\Lenovo\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Lenovo\Documents\амогус\bot.py", line 397, in fox
json_data = json.loads(response.text) # Извлекаем JSON
File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Lenovo\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Lenovo\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Lenovo\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Код бота:
@bot.command()
@commands.cooldown(1, 1, commands.BucketType.user)
async def fox(ctx):
response = requests.get('https://some-random-api.ml/img/fox') # Get-запрос
json_data = json.loads(response.text)
embed = discord.Embed(color = 0xff9900, title = 'Рандомная Лиса') # Создание Embed'a
embed.set_image(url = json_data['link']) # Устанавливаем картинку Embed'a
await ctx.send(embed = embed) # Отправляем Embed