Skip to content

Commit

Permalink
Improve role messages
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHoodHacker authored Sep 6, 2024
1 parent 4479a64 commit 4577eb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/cogs/ctfs/ctfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ class CTFs(Extension):

@subcommand()
async def optin(self, ctx: SlashContext):
'''Get the CTF role. Requires the UIUC role.'''
'''Add yourself to the CTF Team. Requires the UIUC role.'''
if (ctx.guild == None):
await ctx.send(":x: Must be used inside a guild.")
await ctx.send(":x: You can only run this command in a server.", ephemeral=True)
return
user = ctx.guild.get_member(ctx.user.id)
if (user == None):
await ctx.send(":x: User not in guild. This should be impossible.")
await ctx.send(":x: You aren't in the server! Are you a ghost?", ephemeral=True)
return
if (not any(user.has_role(role) for role in UIUC_ROLES)):
await ctx.send(":x: Must be UIUC verified.")
await ctx.send(":x: You need to be UIUC verified to use this command. Verify yourself at <https://sigpwny.com/auth>.", ephemeral=True)
return
if (any(user.has_role(role) for role in CTF_ROLES)):
await ctx.send(":x: You already have the CTF role.")
await ctx.send(f":x: You already have the **:red_circle: CTF Team** role.", ephemeral=True)
return

await user.add_roles(CTF_ROLES)
await ctx.send("Added CTF role.")
await ctx.send(f":white_check_mark: Added to **:red_circle: CTF Team**.")

@subcommand()
async def optout(self, ctx: SlashContext):
'''Remove the CTF role'''
'''Remove yourself from the CTF Team.'''
if (ctx.guild == None):
await ctx.send(":x: Must be used inside a guild.")
await ctx.send(":x: You can only run this command in a server.", ephemeral=True)
return

user = ctx.guild.get_member(ctx.user.id)
if (user == None):
await ctx.send(":x: User not in guild. This should be impossible.")
await ctx.send(":x: You aren't in the server! Are you a ghost?", ephemeral=True)
return
if (not any(user.has_role(role) for role in CTF_ROLES)):
await ctx.send(":x: You do not have the CTF role.")
await ctx.send(f":x: You do not have the **:red_circle: CTF Team** role.", ephemeral=True)
return

await user.remove_roles(CTF_ROLES)
await ctx.send("Removed CTF role.")
await ctx.send(f":white_check_mark: Removed from **:red_circle: CTF Team**.")
8 changes: 4 additions & 4 deletions src/cogs/roles/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, _):

@subcommand(role={"description": "Role to add","autocomplete": True})
async def add(self, ctx: SlashContext, role: str) -> None:
"""Add a private role. Requires the UIUC role."""
"""Add yourself to a team role. Requires the UIUC role."""
if (ctx.guild == None):
await ctx.send(":x: You can only run this command in a server.", ephemeral=True)
return
Expand All @@ -34,13 +34,13 @@ async def add(self, ctx: SlashContext, role: str) -> None:
await ctx.send(f":x: You already have the **{role}** role.", ephemeral=True)
return
await user.add_role(valid_role_id)
await ctx.send(f":white_check_mark: Added you to **{role}**.", ephemeral=True)
await ctx.send(f":white_check_mark: Added to **{role}**.")
return
await ctx.send(":x: Invalid role.")

@subcommand(role={"description": "Role to remove","autocomplete": True})
async def remove(self, ctx: SlashContext, role: str) -> None:
"""Removes a private role."""
"""Remove yourself from a team role."""
if (ctx.guild == None):
await ctx.send(":x: You can only run this command in a server.", ephemeral=True)
return
Expand All @@ -58,7 +58,7 @@ async def remove(self, ctx: SlashContext, role: str) -> None:
await ctx.send(f":x: You do not have the **{role}** role.", ephemeral=True)
return
await user.remove_role(valid_role_id)
await ctx.send(f":white_check_mark: Removed you from **{role}**.", ephemeral=True)
await ctx.send(f":white_check_mark: Removed from **{role}**.")
return
await ctx.send(":x: Invalid role.")

Expand Down

0 comments on commit 4577eb3

Please sign in to comment.