简体   繁体   English

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

[英]When I use the Genius API, it doesn't give me the full lyrics

When i run this code (discord.py), i do not get the full lyrics:当我运行此代码 (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)

I just get that:我只是明白:

example Polo G - Rapstar:示例 Polo G - Rapstar:

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

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

You're setting the song as the value, not the lyrics.您将歌曲设置为值,而不是歌词。

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

You're basically printing the song object and it having parts of the lyrics in it is just a coincidence.您基本上是在打印歌曲对象,其中包含部分歌词只是巧合。 To print the lyrics of a song use song.lyrics .要打印歌曲的歌词,请使用song.lyrics However you should keep in mind that embed fields are limited to 1024 characters.但是您应该记住,嵌入字段限制为 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM