Open
Description
tux/tux/cogs/utility/snippets.py
Line 230 in 604c0db
# find the top 10 snippets by uses
snippets: list[Snippet] = await self.db.get_all_snippets_by_guild_id(ctx.guild.id)
if not snippets:
await self.send_snippet_error(ctx, description="No snippets found.")
return
snippets.sort(key=lambda x: x.uses, reverse=True)
# Format the text
text = "```\n"
for i, snippet in enumerate(snippets[:10]):
text += f"{i + 1}. {snippet.snippet_name.ljust(20)} | uses: {snippet.uses}\n"
text += "```"
# only show top 10, no pagination
# TODO: add pagination
embed = EmbedCreator.create_embed(
embed_type=EmbedType.DEFAULT,
title="Top Snippets",