在我的cat命令中,一切都正常,但imgae通常不会在不一致的情况下加载

ruyhziif  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(145)
@client.command(aliases=['cats'])
async def cat(ctx):
    async with aiohttp.ClientSession() as cs:
        async with cs.get('https://www.reddit.com/r/cats/hot.json') as r: #the link
            res = await r.json()
            embed = discord.Embed(title='There you go^^', color=0xef42f5) # the embed
            embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url'])
            embed.set_footer(icon_url = ctx.author.avatar_url, text = f'Requested by {ctx.author.name}')
            await ctx.send(embed=embed)
``` `So as of now, the bot sends an embed like I want, but often the image wont load which is why I am asking this question. Did I do anything wrong and/or how can I fix it?` 如果我格式化了任何错误的东西,请不要生气,我是新来的,我不知道如何格式化所有正确的方式

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题