Skip to content

Commit 4a8db11

Browse files
committed
Add crowns command back in
1 parent 204fd99 commit 4a8db11

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

cogs/lastfm.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,35 @@ async def user_ranking(
19581958

19591959
return content, rows, crown_holder, crown_playcount
19601960

1961+
@commands.command()
1962+
@is_small_server()
1963+
@commands.guild_only()
1964+
async def crowns(self, ctx: MisoContext, *, user: discord.Member = None):
1965+
"""See your current artist crowns on this server"""
1966+
if user is None:
1967+
user = ctx.author
1968+
1969+
crownartists = await self.bot.db.fetch(
1970+
"""
1971+
SELECT artist_name, cached_playcount FROM artist_crown
1972+
WHERE guild_id = %s AND user_id = %s ORDER BY cached_playcount DESC
1973+
""",
1974+
ctx.guild.id,
1975+
user.id,
1976+
)
1977+
if not crownartists:
1978+
return await ctx.send("You don't have any crowns yet!")
1979+
1980+
rows = [
1981+
f"**{escape_markdown(artist)}** with **{playcount}** {play_s(playcount)}"
1982+
for artist, playcount in crownartists
1983+
]
1984+
content = discord.Embed(color=discord.Color.gold())
1985+
content.title = f"👑 {util.displayname(user, escape=False)} | Artist crowns"
1986+
content.set_footer(text=f"Total {len(crownartists)} crowns")
1987+
1988+
await RowPaginator(content, rows).run(ctx)
1989+
19611990
@commands.command(aliases=["wk", "whomstknows"], usage="<artist> 'np'")
19621991
@commands.guild_only()
19631992
@is_small_server()
@@ -2329,7 +2358,7 @@ def parse_playcount(text: str):
23292358

23302359

23312360
def raise_no_artist_plays(artist: str, timeframe: Period):
2332-
artist_escaped = discord.utils.escape_markdown(artist)
2361+
artist_escaped = escape_markdown(artist)
23332362
raise exceptions.CommandInfo(
23342363
f"You have never listened to **{artist_escaped}**!"
23352364
if timeframe == Period.OVERALL

0 commit comments

Comments
 (0)