Additional code jam management utilities#1677
Conversation
The channel creations are static and clutter the cog class. We want to add more commands to the cog, so we move the static functions away to a separate file first.
- An info embed with team the member is in. The team is decided by finding in which channel the member has overwrites. - Command to move a member from one team to another by changing the permissions of the appropriate team channels. - A command to end the code jam and delete all the team channels and categories.
SebastiaanZ
left a comment
There was a problem hiding this comment.
I don't quite like the approach chosen to get additional confirmation for the command that removes the team channels. but it's not a blocker to me.
|
|
||
| def setup(bot: Bot) -> None: | ||
| """Load the CodeJams cog.""" | ||
| from bot.exts.events.code_jams._cog import CodeJams |
There was a problem hiding this comment.
Do we know what kind of side effects we're trying to prevent here? I noticed a similar tactic in the help_channels package, but I'm not sure what we're specifically trying to prevent.
There was a problem hiding this comment.
Circular imports presumably
|
Concerns were raised about blindly deleting a mass of channels. I'll improve the confirmation message before merging this PR. |
The command now sends the details of all channels about to be deleted to the pasting service, and confirmation is done through a reaction by the invoker of the command within a limited time (10 seconds).
|
Setting this to low as the last code jam that needed these utilities occurred not to long ago, and the next code jam probably won't happen for a while. |
Akarys42
left a comment
There was a problem hiding this comment.
Seems like I reviewed this but never actually approved, lgtm!
|
|
||
| def setup(bot: Bot) -> None: | ||
| """Load the CodeJams cog.""" | ||
| from bot.exts.events.code_jams._cog import CodeJams |
There was a problem hiding this comment.
Circular imports presumably
Co-authored-by: Bluenix <bluenixdev@gmail.com>
Co-authored-by: Bluenix <bluenixdev@gmail.com>
Interestingly enough, the reason doesn't seem to be displayed for channel permission overrides.
Co-authored-by: Bluenix <bluenixdev@gmail.com>
…cord/bot into mbaruh/jam-management
Bluenix2
left a comment
There was a problem hiding this comment.
I found two nit-picks, feel free to disregard those unless you're changing other things.
I have not tested or ran these changes myself, at the earliest I can do that tomorrow if necessary
| member = ctx.guild.get_member(int(row["Team Member Discord ID"])) | ||
|
|
||
| if member is None: | ||
| log.trace(f"Got an invalid member ID: {row['Team Member Discord ID']}") |
There was a problem hiding this comment.
Perhaps we want to keep track of this, or maybe just a bool. So that you know when running the command that some members were omitted?
There was a problem hiding this comment.
This was raised in the PR which added this command, but out of scope for this one.
| await ctx.send("Command timed out.", reference=message) | ||
| return | ||
|
|
||
| else: |
There was a problem hiding this comment.
You return in the except, no need to have this in an else.
There was a problem hiding this comment.
I know, but I personally like the explicitness of the flow.
The purpose of this PR is for us to avoid manually searching the permissions of team channels, and dealing with user-based overwrites. This also allows us to quickly tell what team a participant belongs to.
Added:
How to review
This PR isn't as big as it may seem. Most of the diff is from moving the cog to another extension, and moving all the channel creation functions to another module. What I actually added are the few commands in the last couple of commits.