Skip to content

Code jam role removal #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 1 addition & 4 deletions bot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,13 @@ class _Roles(EnvConfig, env_prefix="ROLE_"):
event_runner: int = 940911658799333408
summer_aoc: int = 988801794668908655
code_jam_participants: int = 991678713093705781
code_jam_team_leads: int = 1262472493755797594
code_jam_support: int = 1254657197535920141
helpers: int = 267630620367257601
aoc_completionist: int = 1191547731873894440
bots: int = 277546923144249364
moderation_team: int = 267629731250176001

team_list: int = 1222691191582097418
team_dict: int = 1222691368653033652
team_tuple: int = 1222691399246286888


Roles = _Roles()

Expand Down
9 changes: 8 additions & 1 deletion bot/exts/code_jams/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def announce(self, ctx: commands.Context) -> None:
@commands.has_any_role(Roles.admins, Roles.events_lead)
async def end(self, ctx: commands.Context) -> None:
"""
Delete all code jam channels.
Delete all code jam channels and team-specific roles.

A confirmation message is displayed with the categories and channels
that are going to be deleted, by pressing "Confirm" the deletion
Expand Down Expand Up @@ -142,6 +142,13 @@ async def end(self, ctx: commands.Context) -> None:
view=confirm_view
)
await confirm_view.wait()

# Unassign the code jam participant and team lead roles, without deleting the roles themselves
for permanent_role_id in (Roles.code_jam_team_leads, Roles.code_jam_participants):
permanent_role = await ctx.guild.get_role(permanent_role_id)
for user in permanent_role.members:
await user.remove_roles(permanent_role)

await ctx.send("Code Jam has officially ended! :sunrise:")

@codejam.command()
Expand Down
Loading