create top artists command
This commit is contained in:
parent
55d2409a80
commit
f45d91d0c0
1 changed files with 13 additions and 5 deletions
|
|
@ -58,14 +58,11 @@ def setup(bot: bot.Bot):
|
||||||
top_list = user.get_top_artists(period=timeframe, limit=count, cacheable=False)
|
top_list = user.get_top_artists(period=timeframe, limit=count, cacheable=False)
|
||||||
for index, i in enumerate(top_list):
|
for index, i in enumerate(top_list):
|
||||||
msg_content += f"\n{index+1}. [{i.item.get_name(properly_capitalized=True)}]({i.item.get_url()}) | {i.weight} plays"
|
msg_content += f"\n{index+1}. [{i.item.get_name(properly_capitalized=True)}]({i.item.get_url()}) | {i.weight} plays"
|
||||||
case "album":
|
|
||||||
|
case "album" | "track":
|
||||||
top_list = user.get_top_albums(period=timeframe, limit=count)
|
top_list = user.get_top_albums(period=timeframe, limit=count)
|
||||||
for index, i in top_list:
|
for index, i in top_list:
|
||||||
msg_content += f"\n{index+1}. [{i.item.get_title(properly_capitalized=True)}]({i.item.get_url()}) by [{i.item.get_artist().get_name(properly_capitalized=True)}]({i.item.get_artist().get_url()}) | {i.weight} plays"
|
msg_content += f"\n{index+1}. [{i.item.get_title(properly_capitalized=True)}]({i.item.get_url()}) by [{i.item.get_artist().get_name(properly_capitalized=True)}]({i.item.get_artist().get_url()}) | {i.weight} plays"
|
||||||
case "track":
|
|
||||||
top_list = user.get_top_tracks(period=timeframe, limit=count, cacheable=False)
|
|
||||||
for index, i in top_list:
|
|
||||||
msg_content += f"\n{index+1}. [{i.item.get_title(properly_capitalized=True)}]({i.item.get_url()}) by [{i.item.get_artist().get_name(properly_capitalized=True)}]({i.item.get_artist().get_url()}) | {i.weight} plays"
|
|
||||||
|
|
||||||
msg_head = f"Top {len(top_list)} {entity}s {period} for [{username}]({user.get_url()}):\n"
|
msg_head = f"Top {len(top_list)} {entity}s {period} for [{username}]({user.get_url()}):\n"
|
||||||
|
|
||||||
|
|
@ -83,3 +80,14 @@ def setup(bot: bot.Bot):
|
||||||
print(e)
|
print(e)
|
||||||
await ctx.send(u.error_msg(f"Unknown error:\n`{e}`"))
|
await ctx.send(u.error_msg(f"Unknown error:\n`{e}`"))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@bot.command(name="topartists", aliases=["ta","topartist"])
|
||||||
|
@bot.slash_command(name="topartists", description="Generate a list of your top artists.")
|
||||||
|
async def topartists(ctx: nerimity.Context, timeframe: str = "7day", username: str = None, countstr: str = "10"):
|
||||||
|
await send_top(
|
||||||
|
ctx = ctx,
|
||||||
|
entity = "artist",
|
||||||
|
timeframe = timeframe,
|
||||||
|
username = username,
|
||||||
|
countstr = countstr
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue