简体   繁体   中英

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:

@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:

"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)

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 . However you should keep in mind that embed fields are limited to 1024 characters.


@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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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