首页 > 解决方案 > 我无法制作 discord.py 歌词查找器机器人

问题描述

请帮我找到一个有效的代码

这段代码我也写了 edosent 工作

async def lyrics(self, ctx, artist,*, title):
async with aiohttp.ClientSession() as session:
           async with session.get(f"https://api.lyrics.ovh/v1/{artist}/{title}") as response:
                data = await response.json()
                lyrics = data['lyrics']
                if lyrics is None:
                    await ctx.send("Song not found! Please enter correct Artist and Song title")
                if len(lyrics) > 2048:
                     lyrics = lyrics[:2048]
                emb = discord.Embed(title = f"{title}" , description = f"{lyrics}")
                await ctx.send(embed=emb)
        await session.close()```

标签: discord.py

解决方案


推荐阅读