Skip to content

Commit

Permalink
Add command to show information about a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
SylteA committed Mar 16, 2024
1 parent ad2ce5f commit 6286cf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 15 additions & 0 deletions bot/extensions/tags/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ async def make(self, interaction: core.InteractionType):
"""Starts an interactive session to create your tag."""
await interaction.response.send_modal(MakeTagModal(cog=self))

@tags.command()
@app_commands.autocomplete(name=fetch_similar_tags)
@app_commands.describe(name="The name of the tag to show.")
async def info(self, interaction: core.InteractionType, name: str):
"""Shows information about the tag with the given name."""
tag = await Tag.fetch_by_name(guild_id=interaction.guild.id, name=name)

if tag is None:
return await interaction.response.send_message("There is no tag with that name", ephemeral=True)

author = self.bot.get_user(tag.author_id)
author = str(author) if isinstance(author, discord.User) else f"(ID: {tag.author_id})"
text = f"Tag: {name}\n\n```prolog\nCreator: {author}\n Uses: {tag.uses}\n```"
await interaction.response.send_message(content=text, ephemeral=True)

@tags.command()
@app_commands.autocomplete(name=staff_tag_autocomplete)
@app_commands.describe(name="The name of the tag to edit.")
Expand Down
2 changes: 0 additions & 2 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ async def main(ctx):
"bot.extensions.suggestions",
"bot.extensions.tags",
"bot.extensions.youtube",
"bot.cogs._help",
"bot.cogs.clashofcode",
"bot.cogs.roles",
)

Expand Down

0 comments on commit 6286cf2

Please sign in to comment.