当我使用Genius API时,它没有给出完整的歌词

2024-09-20 22:21:16 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行此代码(discord.py)时,我没有得到完整的歌词:

@commands.command()
async def lyrics(self, ctx, arg1, arg2):
    song = genius.search_song(arg2, arg1)
    print(song)
    embedgenius = discord.Embed(title=arg2.capitalize(), description=arg1.capitalize(), colour=0x69ff00)
    embedgenius.add_field(name="Lyrics:", value=song)
    await ctx.send(embed=embedgenius)

我只知道:

Polo G-说唱歌手示例:

"RAPSTAR" by Polo G:
[Intro]
(Shout out my n**** Synco)

[Chorus]
Uh (Tuned up), copped a BMW, new deposit, I picked up a...

Tags: 代码pyasyncsong歌词commandcommandsctx
1条回答
网友
1楼 · 发布于 2024-09-20 22:21:16

您将歌曲设置为值,而不是歌词

embedgenius.add_field(name="Lyrics:", value=song)

你基本上是在打印歌曲对象,里面有歌词的一部分只是巧合。要打印歌曲的歌词,请使用song.lyrics。但是,您应该记住,嵌入字段限制为1024个字符


@commands.command()
async def lyrics(self, ctx, arg1, arg2):
    song = genius.search_song(arg2, arg1)
    print(song.lyrics)
    embedgenius = discord.Embed(title=arg2.capitalize(), description=arg1.capitalize(), colour=0x69ff00)
    embedgenius.add_field(name="Lyrics:", value=song.lyrics)
    await ctx.send(embed=embedgenius)

相关问题 更多 >

    热门问题