discord.py - 我无法制作 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()```
解决方案
推荐阅读
- c# - Xamarin CarouselView,在另一个页面中显示当前项目
- c# - 如何在 WPF RichTextBox 中的内联元素上捕获键盘事件
- ios - 如何将表格视图单元格添加到 xib 中的表格视图?
- amazon-web-services - 为什么会有这么多 AWS SQS 请求?
- reactjs - 在默认导入上使用 doMock
- python - 有没有办法通过使用语音回答问题,通过 Python 语音识别将输入作为语音到文本
- typescript - 我应该如何退出应用内购买测试模式
- html - 与其他浏览器相比,SVG 图像未正确显示在表格中
- php - 如何在 laravel 验证中验证嵌套数组并将其合并
- c# - 如何在更新/修改模式下打开 MemoryStream