Compare commits

...

7 Commits

2 changed files with 10 additions and 5 deletions

View File

@@ -41,7 +41,11 @@ class YarnCog(LionCog):
@LionCog.listener("on_reaction_remove")
async def lilac_unconfirms(self, reaction: discord.Reaction, user: discord.User):
if reaction.me and reaction.count == 1:
if (
reaction.me
and reaction.count == 1
and reaction.message.author.id != self.bot.user.id
):
await reaction.remove(self.bot.user)
@cmds.hybrid_command(name="voicestate")
@@ -97,9 +101,10 @@ class YarnCog(LionCog):
total_time="SUM(COALESCE(duration, EXTRACT(EPOCH FROM (NOW() - joined_at))))",
)
.order_by("total_time", ORDER.DESC)
.group_by("userid")
.with_no_adapter()
)
leaderboard = [(row["userid"], row["total_time"]) for row in await query]
leaderboard = [(row["userid"], int(row["total_time"])) for row in await query]
# Format for display and pager
# First collect names
@@ -108,7 +113,7 @@ class YarnCog(LionCog):
user = ctx.guild.get_member(uid)
if user is None:
try:
user = await ctx.bot.fetch_member(uid)
user = await ctx.guild.fetch_member(uid)
except discord.NotFound:
user = None
names[uid] = user.display_name if user else str(uid)
@@ -126,4 +131,4 @@ class YarnCog(LionCog):
title = "Voice Leaderboard"
pages = paginate_list(lb_strings, block_length=page_len, title=title)
await ctx.pager(pages)
await pager(ctx, pages)