Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bot/cogs/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,11 @@ def timeout_feedback_embed() -> discord.Embed:

@commands.dm_only()
@commands.cooldown(60, 0, commands.BucketType.user)
@commands.hybrid_command(name="aplicar", aliases=["role", "membro", "aplicar_role"])
@commands.hybrid_command(
name="aplicar",
aliases=["role", "membro", "aplicar_role"],
description="Inicia o processo de autenticação para receber o cargo de membro.",
)
async def aplicar_role(self, ctx: Context):
self.logger.info(f"[{ctx.author}] Autenticação iniciada.")

Expand Down
4 changes: 3 additions & 1 deletion bot/cogs/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ async def github(self, ctx: Context):

# @commands.bot_has_permissions(embed_links=True)
@commands.hybrid_command(
name="atlantisbot", aliases=["atlbot", "atlbotcommands", "atlcommands"]
name="atlantisbot",
aliases=["atlbot", "atlbotcommands", "atlcommands"],
description="Exibe a lista de comandos disponíveis do AtlantisBot.",
)
async def atlantisbot(self, ctx: Context):
runepixels_url = (
Expand Down
15 changes: 13 additions & 2 deletions bot/cogs/clan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import rs3clans
import discord
from discord import app_commands
from discord.ext import commands

from bot.bot_client import Bot
Expand Down Expand Up @@ -110,8 +111,18 @@ async def clan_user_info(self, ctx: Context, *, username: str):

@commands.cooldown(1, 5, commands.BucketType.user)
@commands.bot_has_permissions(embed_links=True)
@commands.hybrid_command(aliases=["ranksupdate", "upranks", "rank"])
async def ranks(self, ctx: Context, *, clan: str = "Atlantis"):
@commands.hybrid_command(
aliases=["ranksupdate", "upranks", "rank"],
description="Mostra os ranks pendentes de atualização no clã selecionado.",
)
@app_commands.describe(clan="Escolha o clã para verificar os ranks pendentes")
@app_commands.choices(
clan=[
app_commands.Choice(name="Atlantis", value="atlantis"),
app_commands.Choice(name="Atlantis Argus", value="argus"),
]
)
async def ranks(self, ctx: Context, *, clan: str = "atlantis"):
if getattr(ctx, "interaction", None) is None:
await ctx.send("Dica: use o comando de barra `/ranks` para uma melhor experiência.")

Expand Down
21 changes: 21 additions & 0 deletions tests/test_ranks_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,24 @@ def test_ranks_prefix_suggests_slash(monkeypatch):
assert len(ctx.sent_messages) == 2
assert "use o comando de barra `/ranks`" in ctx.sent_messages[0]["content"]
assert ctx.sent_messages[1]["embed"] is not None


def test_ranks_has_clan_choices():
clan_cog = make_clan()

command = clan_cog.ranks

app_command = command.app_command
clan_parameter = next(parameter for parameter in app_command.parameters if parameter.name == "clan")

assert [choice.name for choice in clan_parameter.choices] == ["Atlantis", "Atlantis Argus"]
assert [choice.value for choice in clan_parameter.choices] == ["atlantis", "argus"]


def test_ranks_default_clan_is_atlantis():
clan_cog = make_clan()

command = clan_cog.ranks
clan_parameter = next(parameter for parameter in command.app_command.parameters if parameter.name == "clan")

assert clan_parameter.default == "atlantis"