Skip to content

Commit 1de7876

Browse files
committed
add changes requested
1 parent 9ec6709 commit 1de7876

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

src/commands/help.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from src.main import AeBot
1010

1111

12-
class HelpCog(commands.GroupCog, group_name="help"):
12+
class HelpCog(commands.Cog):
1313
def __init__(self, bot: AeBot):
1414
self.bot = bot
1515

@@ -23,19 +23,42 @@ def __init__(self, bot: AeBot):
2323
async def help(self, interaction: Interaction):
2424
embed = Embed(title="Aide du bot", color=Color.blue())
2525

26+
pres_commande = ["remove_member", "add_member"]
27+
admin_commande = ["passation", "arret", "create"]
28+
29+
roles = interaction.user.roles
30+
n = len(roles)
31+
i = 0
32+
loop = True
33+
grade = 2 #0 for admin 1 for presidence of clubs and 2 for member
34+
while i < n and loop:
35+
if roles[i].name == "Présidence AE":
36+
grade = 0
37+
loop = False
38+
elif roles[i].name.startswith("Responsable"):
39+
grade = 1
40+
loop = False
41+
else:
42+
pass
43+
i += 1
44+
2645
for command in self.bot.tree.get_commands():
2746
if isinstance(command, app_commands.Group) and command.commands:
28-
subcommands = "\n".join(
29-
f" /{command.name} {sub.name} - {sub.description}"
30-
for sub in command.commands
31-
)
32-
embed.add_field(
33-
name=f"/{command.name} (groupe)", value=subcommands, inline=False
34-
)
35-
else:
47+
for sub in command.commands:
48+
if not (
49+
(sub.name in pres_commande and grade > 1) or (sub.name in admin_commande and grade != 0)
50+
):
51+
subcommands = f" {sub.description}\n"
52+
embed.add_field(
53+
name=f"/{command.name} {sub.name}",
54+
value=subcommands,
55+
inline=False,
56+
)
57+
58+
elif command.name != "role":
3659
embed.add_field(
3760
name=f"/{command.name}",
38-
value=command.description or "Pas de description.",
61+
value=command.description or "",
3962
inline=False,
4063
)
4164

0 commit comments

Comments
 (0)