[python-discord/sir-robin] New branch created: pr\-cj\-patch\-role\-lock
#dev-log
1 messages · Page 100 of 1
[python-discord/sir-robin] Pull request opened: #51 Remove CJ role check from the CJ command group\.
We have command level role locks, so that is unnecessary, this way the info command can be used by the Events Team.
11b7c2d Patch CJ info embed to be raw text - D0rs4n
[python-discord/sir-robin] New branch created: cj\-change\-info\-embed


Images show everything, I had to end the jam once, hence the deleted-channel (I made the screen after I ended the jam, silly me)
GitHub Actions run 2693271628 failed.
Just out of interest, what would this look like? Just to include it in the pre-amble too.
message = f"<@{member['user_id']}>"
if member["is_leader"] :
message += " (Team Leader)"
team_members.append(message)
team_members_formatted = "\n".join(team_members)
response_text = (
f"You have been sorted into {team_channel}"
f"{', and *you are the ...
GitHub Actions run 2693315210 succeeded.
84cd6cf Make the CJ info output more consistent - D0rs4n
Participants in our code jam have asked for a way to pin things in their channel. We can't reasonably give them the native Discord permission, but we do have bots. Let's use the bots.
This command should be usable by Admins, Events Team, and anyone with the Code Jam Participants Role. It'll let people pin/un-pin messages only in their team channel via the bot. This should work with a reply to a message and also a message link.
I figure one way to do this is have a wonky role-check-l...
[python-discord/sir-robin] New comment on issue #53: Add \`&cj pin\` command for participants to use
We can use the Code Jam MGMT API, and do a basic ID check. I can do this.
[python-discord/sir-robin] New comment on issue #53: Add \`&cj pin\` command for participants to use
I really like this idea. (Note: I'm not a participant). How would the command work? Like reply to a message and invoke the command, similar to the .uwu command on Lancebot? I think that's probably the best way to implement this. Just stating my opinion.
We have bot commands for moving people between teams, but we use a manually-updated spreadsheet to figure out where to move them and who to replace as leader, etc. If we generated a view of the participants in the database we don't have to worry about maintaining two sources of truth.
Participants should be grouped into teams, and teams should be ordered by timezone. It should include whatever background info we have about each participant such as experience-level estimate, leadership pref...
Tested and works like a charm!
It even works with old persisted buttons~
[python-discord/sir-robin] branch deleted: cj\-change\-info\-embed
Connected!
327ab17 Remove Code Jam Participant role when issuing `... - D0rs4n
[python-discord/sir-robin] New branch created: cj\-remove\-partc\-role
[python-discord/sir-robin] New comment on issue #53: Add \`&cj pin\` command for participants to use
Yes, exactly like this. We need to add a "middleware" though, to check the channel ID, but basically what you said.
[python-discord/sir-robin] New branch created: cj\-pin
Lets Code Jam participants pin messages in their own team channels. Check done via the Code Jam MGMT api.
Tested and works very well. I tested with a couple of different options and it worked as expected with no errors popping up.
e5a88a4 Remove Code Jam Participant role when issuing ... - D0rs4n [e90d240`](https://github.com/python-discord/sir-robin/commit/e90d24072baf2dc57acd455e8a9d7e5d40457d46) Merge pull request #55 from python-discord/cj-r... - D0rs4n
[python-discord/sir-robin] branch deleted: cj\-remove\-partc\-role
Connected!
await ctx.reply("You don't have permission to unpin this message in this channel!")
else:
await ctx.reply(":x: You have to reply to a message in order to unpin it!")
[python-discord/site] New branch created: add\-cj9\-links
So, I always navigate to the events page and somehow miss the huge summer code jam duck banner on the index page.
I was missing the big green box linking to CJ9 on the Events page and I think we should keep this here for the duration of the event. Let's not make users hunt for content.
To that end I've also added a CJ9 link on the CJ Info page, which can be updated once the theme is finalized and announced. (I know it's not a "previous" jam yet but soon enough, it will be)
GitHub Actions run 2695280768 succeeded.
In my opinion, if this command is ran outside of the code jam team category, it should silently fail. Sir-Robin has no reason to respond to this command outside of that context.
If it is inside the code jam category, then you can assume the user running the command has permission to pin the message, as no other users will be in those channels.
If we really wanted to be safe, we can still check that the user invoking the command is a participant, but it's not 100% needed with the above s...
[python-discord/site] branch deleted: add\-cj9\-links
GitHub Actions run 2697120874 succeeded.
In my opinion, if this command is ran outside of the code jam team category, it should silently fail. Sir-Robin has no reason to respond to this command outside of that context.
If it is inside the code jam category, then you can assume the user running the command has permission to pin the message, as no other users will be in those channels.
If we really wanted to be safe, we can still check that the user invoking the command is a participant, but it's not 100% needed with t...
LGTM content-wise, have not tested locally
aa1496e Add cj add command and add_flow to the CJ e... - D0rs4n
[python-discord/sir-robin] New branch created: add\-cj\-add
This PR introduces a new command and flow, which will enable the events team to add someone to the Code Jam either as a team lead or participant.
(Note: This add_flow is a modified version of the move_flow)
In my opinion, if this command is ran outside of the code jam team category, it should silently fail. Sir-Robin has no reason to respond to this command outside of that context.
If it is inside the code jam category, then you can assume the user running the command has permission to pin the message, as no other users will be in those channels.
If we really wanted to be safe, we can still check that the user invoking the command is a participant, but it's not 100% needed with the...
[python-discord/forms-frontend] New branch created: 404
Adds a handler for 404s, and some cleanup for the styles used in the 404 page.
87349d0 Fix Navigation Element Size - HassanAbouelela
db082ac Add in_code_jam_category check and apply it o... - D0rs4n
In my opinion, if this command is ran outside of the code jam team category, it should silently fail. Sir-Robin has no reason to respond to this command outside of that context.
If it is inside the code jam category, then you can assume the user running the command has permission to pin the message, as no other users will be in those channels.
If we really wanted to be safe, we can still check that the user invoking the command is a participant, but it's not 100% needed wi...
LGTM content-wise, have not tested locally
That sounds like a great idea. However as of now, the Code Jam Management system does not store timezone information.
My main question regarding that is.. whether you want this spreadsheet-like view to be editable, or just read-only.
Being editable would mean, that we would have to interact with the discord API, and upon interacting with the spreadsheet it would edit the roles as well. This is the hardest version, at least in point of implementation.
The read-only version would just be a g...
Normally, you are able to use !docs for class methods (e.g. str.split) like so:
However, this does not work for Sequence and Set types (list, tuple, range, set, frozenset):
The most likely reason for this is because the documentation for them are formatted differently on the official documentation, they could be added as an edge case that uses a different check to search for attributes.
Hey, this is actually a problem with the python docs themselves, and there's an issue open for it python/cpython#89923. To parse the symbols in the tutorial would require adding a bunch of edge case code which does not make sense for such a limited scope of resources. If you'd like to see this resolved sooner, feel free to drop a comment on the linked issue. Thanks!
a36f303 Bump Motor Version To 3.0.0 - HassanAbouelela
[python-discord/forms-backend] New branch created: bump\-motor
Motor version 2.4 is not fully compatible with the version of mongo we're using (we're using latest, which is now 5.0.9 in production, and similar if you recreate your container). Run docker compose up mongo -d --build to update.
GitHub Actions run 2703031246 failed.
GitHub Actions run 2703084421 succeeded.
GitHub Actions run 2703147656 succeeded.
GitHub Actions run 2703137217 succeeded.
GitHub Actions run 2703153884 succeeded.
GitHub Actions run 2703154903 succeeded.
Tested with several configurations, overall it looks good minus the one role that's getting added no matter what.
This is adding the Team Leader role, even if I've specified that they are not a Team Leader. This should be under a check based on what we've passed in.
6c81b0f Prevent adding team leader role to members if s... - D0rs4n
Oh right, thank you! Resolved in 6c81b0f
We can revert this. After some internal discussion we can keep it open to Events Teams.
Same comment as earlier, potentially adding in support for message links.
Looks good! I have a request/comment about allowing pin/unpins from message links. I can be swayed either way though.
Also a small note about reverting an earlier decision about which role to lock commands to.
Can we add the ability to check if they're passing in a message link? Not sure how much it would be used but it would be nice to have the option.
We would have to check if the message exists in the current channel though.
223882b Add message ID / message link support to `cj pi... - D0rs4n
bfd5630 Allow the Events team to use the cj info comm... - D0rs4n
Please refrain from opening irrelevant issues.
Looks good, just the one thing on the conditional error message (I don't think it should have a dangling comma)
f"Something went wrong{', you might have reached the 50 pins per channel limit!' if not unpin else ''}"
GitHub Actions run 2707403099 succeeded.
Please ignore the fact that I accidentally wrote xvg in my commit message instead of svg.
b194795 Allow admins and the events team to use the pin... - D0rs4n
These two commands have an authorization issue and maaaybe another one too:
- The Events Lead cannot use
&cj pinor&cj unpin(poor Kat) - Any helper part of the Events Team can abuse
&cj pinand&cj unpinto (un)pin any messages in channels Robin has permission to do so. I have no idea what permissions Robin will be given in the actual server during normal operations, but let's verify if not block this route entirely.
log.trace(f"Something went wrong when pinning a CJ message: {err}")
Either get rid of the superfluous return in the except clause or move code out of the else clause.
Either get rid of the superfluous return in the except clause or move code out of the else clause.
These two commands have an authorization issue and maaaybe another one too:
1. The Events Lead cannot use `&cj pin` or `&cj unpin` (poor Kat) 2. Any helper part of the Events Team can abuse `&cj pin` and `&cj unpin` to (un)pin any messages in channels Robin has permission to do so. I have no idea what permissions Robin will be given in the actual server during normal operations, but let's verify this won't be an issue (if not block this route entirely).
1.:The Event...
Re 1. right makes sense. Sorry about that. Re 2. I'm talking about a staff member who is on the Events Team invoking &cj pin in a CJ team channel to pin a message outside of the CJ categories. A bit of an edge case I'll admit, but I thought it was worth mentioning.
I'll downgrade the review to comment so a merge is still possible since 2 is definitely an edge case.
These two commands have an authorization issue and maaaybe another one too:
- The Events Lead cannot use
&cj pinor&cj unpin(poor Kat) - Any helper part of the Events Team can abuse
&cj pinand&cj unpinto (un)pin any messages in channels Robin has permission to do so. I have no idea what permissions Robin will be given in the actual server during normal operations, but let's verify this won't be an issue (if not block this route entirely).
2 is valid, Stalling the PR while figuring it out.
0ca41f2 Prevent pinning messages outside of the Code Ja... - D0rs4n
I would be open to helping develop this feature, if it is still being considered.
afc0d82 Enhance code consistency in the Code Jam Extension - D0rs4n
Looks good, just the one thing on the conditional error message (I don't think it should have a dangling comma)
if not message_is_in_code_jam_category(referenced_message, _creation_utils.CATEGORY_NAME, ctx):
I'm sorry, but some more changes are needed.
Technically the Events Team and Admins can (un)pin a message from a CJ team channel that IS NOT the channel the command was invoked in, but honestly I don't think this matters much and isn't a permission bypass (just confusing). So I suggest ignoring this unless someone feels very strongly. I'm kind of scared of making any more changes than necessary :sweat_smile:
await ctx.reply(":x: You cannot unpin a message outside of the Code Jam category!")
Copy and pasting is the no. 1 drug for boosting productivity, side-effects include decreased focus for the little details. Call 1-800-CPY-PAST for more information.
await ctx.reply("You don't have permission to unpin this message in that channel!")
Both the pin and unpin command have a lot of duplicated code. IMO this tends to mean that it should be abstracted to a helper func, where the two commands just call this function with pin or unpin and the helper func does all this work in a single place. (see the help channel implementation.)
There also seems to be a very common pattern in sir-robin where we get a team, do some API error handling and then do something with the team.
IMO this fetching of the team and error handling shoul...
if ctx.message.channel.category.name == code_jam_category_name
return True
This pin wrapper can be re-used from the bot, as it comes with more error handling.
https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_message.py#L264-L286
return message.channel.category and message.channel.category.name == code_jam_category_name
this also removes the need for the ctx arg.
Thanks for the PR, could you fix up some of the issues I commented on? Thanks!
2. Next, we need to copy our Python project's external dependencies to some directory *inside the container*. Let's call it `/app`
Can we specify what the -t mybot part is?
Could we elaborate on what a "working directory" is?
I think explaining what a base image is would be helpful, as it's quite important
1. First we need to specify the *base image*, which is the OS that the docker container will be running. Doing that will make Docker install some apps we need to run our bot, for
Thanks for your work on this PR, LGTM. I'll comment if I notice something that needs to be changed.
Just a few small comments, looks good otherwise.
I also really appreciate you including screenshots of it in action in your PR! :)
REGEX_EMOJI = re.compile(r"<(a)?:(\w+?):(\d{15,21}?)>", re.ASCII)
The ? inside the first match (a?) is unneeded as the is another ? outside the match block, doing the same thing.
The ID for the emoji is a snowflake, so it's actually valid between 15 and 21 characters.
"""Replaces any emoji the bot cannot send in input_text with a random emoticons."""
GitHub Actions run 2708504940 succeeded.
GitHub Actions run 2708508834 succeeded.
Wheee this looks so much nicer. Can confirm it works and has no permission issues. Great work @D0rs4n, and thank you @ChrisLovering for bringing some sensibility back into this mess :)
await ctx.reply(f"You don't have permission to {pin_msg} this message in this channel!")
Since the user can only use this command on a message in their current channel "this" makes more sense.
Wheee this looks so much nicer. Can confirm it works and has no permission issues. Great work @D0rs4n, and thank you @ChrisLovering for bringing some sensibility back into this mess :)
Thank you for your thorough review! :)
- :feature:`106` Add an optional ``message`` attr to :obj:`botcore.utils.interactions.ViewWithUserAndRoleCheck`. On view timeout, this message has its view removed if set.
28e5fa0 squash me: punctuation fix - ChrisLovering
603fc83 Add an optional message attr to ViewWithUserAnd... - ChrisLovering
[python-discord/bot-core] branch deleted: remove\-view\-on\-timeout
[python-discord/bot-core] New tag created: v7\.4\.0
GitHub Actions run 2711614892 succeeded.
c6ec291 Use the view clear on timeout feature from bot-... - ChrisLovering
4148216 Include what version of Python was used in snek... - ChrisLovering
28d91d4 Update snekbox tests to expect new output - ChrisLovering
76caa09 Start 3.11 snekbox container by default - ChrisLovering
977b682 Merge pull request #2225 from python-discord/sn... - ChrisLovering
[python-discord/bot] branch deleted: snekbox\-snags
Connected!
GitHub Actions run 2711665428 succeeded.
c6ec291 Use the view clear on timeout feature from bot-... - ChrisLovering
4148216 Include what version of Python was used in snek... - ChrisLovering
28d91d4 Update snekbox tests to expect new output - ChrisLovering
76caa09 Start 3.11 snekbox container by default - ChrisLovering
977b682 Merge pull request #2225 from python-discord/sn... - ChrisLovering
GitHub Actions run 2711709730 succeeded.
Renaming this PR - no need to bring alcoholism into this. All I see is a nice duck enjoying a cold one on a warm day.
e5a88a4 Remove Code Jam Participant role when issuing ... - D0rs4n [e90d240](https://github.com/python-discord/sir-robin/commit/e90d24072baf2dc57acd455e8a9d7e5d40457d46) Merge pull request #55 from python-discord/cj-r... - D0rs4n [9fbd02b`](https://github.com/python-discord/sir-robin/commit/9fbd02b6474e7ba42c4fcdefa3973de8f4e5119e) Merge branch 'main' into cj-pin - ChrisLovering
56ca4d2 Add cj pin command and adjust permissions acc... - D0rs4n
e4b3cf5 Add cj unpin command, and a general helper to... - D0rs4n
d5e2102 Make Sir Robin silently fail when pinning outsi... - D0rs4n
db082ac Add in_code_jam_category check and apply it o... - D0rs4n
223882b Add message ID / message link support to `cj pi... - D0rs4n
[python-discord/sir-robin] branch deleted: cj\-pin
Connected!
Works well on my end too.
I don't like that the majority of the logic in in the except block with lots of indentation, with a single line else at the end, but this can be solved after the CJ.
[python-discord/sir-robin] New branch created: pined
Act like nothing happened.
[python-discord/sir-robin] branch deleted: pined
Connected!
@akabinds Yes, that would be a welcome contribution. However, how to accomplish this has not been researched yet; that's probably where you should start. Maybe it should be an in-memory file system (tmpfs) rather than on disk?
Here is what I believe needs to be implemented:
- Each eval mounts a new read-write directory.
- It is initially empty.
- It is set as the CWD for the eval.
- It is isolated, meaning evals from other requests cannot access this directory (neither read nor write...
"""Add a member to the Code Jam by specifying the team's name, and whether they should be a leader."""
if err.response.status == 404:
await ctx.send(":x: User could not be found.")
If the team doesn't exist, wouldn't the guarded GET request to teams/find fail and cause the function to return early?
Did not test out this PR on the dev server, just a read-through review.
9bed4c5 Adjust the comment wording in the CJ extension - D0rs4n
@akabinds Yes, that would be a welcome contribution. However, how to accomplish this has not been researched yet; that's probably where you should start. Maybe it should be an in-memory file system (tmpfs) rather than on disk?
Here is what I believe needs to be implemented:
- Each eval mounts a new read-write directory.
- It is initially empty.
- It is set as the CWD for the eval.
- It is isolated, meaning evals from other requests cannot access this directory (neithe...
GitHub Actions run 2714722501 succeeded.
With the release of https://github.com/SebastiaanZ/async-rediscache/releases/tag/v1.0.0-rc1 there are no longer any blockers to using Python 3.10.
We can go ahead and make a start on 3.10 using this release candidate and bump up to the production version when it is made before merging.
The Compose file uses some features of the spec only supported by Docker Compose v2, such as pull_policy. The contribution documentation and the Makefile currently refer to the v1 command, docker-compose. Under some circumstances, this can be aliased to v2, but it isn't guaranteed to always be the case. All references should be updated to use the v2 command, docker compose. An explicit mention of v2 being required for the command would be helpful as well.
0ed9322 Clarify WebSocket restriction rule's impact on ... - Bluenix2
[python-discord/site] New branch created: clarify\-websocketrule
Before this change, the rule technically disallowed implementing JavaScript clients because webbrowsers use HTTP to fetch the static files.
Originally brought up in one of the code jam team channels.
This PR also fixes a mistake in a previous commit where Markdown-style characters were used instead of code-tags.
1d0b576 Remove unnecessary "also" in new exception to c... - Bluenix2
GitHub Actions run 2714890619 succeeded.
I like solution 2, as it seems like the most robust version. We’re not doing anything risky like generating the code from the spec, and we aren’t doing anything that’ll go out of sync. I don’t mind which library. For the GitHub pages aspect, it’s actually a very common thing to deploy the built docs from actions. There’s an action which abstracts 100% of the work, and pushes to a docs branch. We use it on botcore for the docs.
GitHub Actions run 2714893274 succeeded.
Yea, solution 2 is nice. We could have some CI that builds the OpenAPI spec, and if it detects what is in the code base is out of date it fails the CI and tells the user to run poetry runn task api.
Then another CI flow to push the built spec to GH pages.
b1d9468 Strike out beginning of code jam date - Bluenix2
GitHub Actions run 2714917337 succeeded.
GitHub Actions run 2714942215 succeeded.
Okay, I was leaning towards 2 as well. In fact, I contributed to spectree to reduce the amount of dependencies it needs.
Can you go into more detail on the build process for GH pages? Would the action on snekbox build the docs and deploy them to the GH pages repo, or would there instead be an action on the GH pages repo to do this?
How would I avoid building docs if there are no changes? Would I need to put the spec file in version control for that? Is it even worth to try to avoid red...
We could have the first part of the CI in a custom pre-commit hook if it's performant enough to not be annoying
How would I avoid building docs if there are no changes? Would I need to put the spec file in version control for that? Is it even worth to try to avoid redundant builds?
Do we even need to worry about that? If unsure what the performance of building these docs is, so we could just build them all the time, if anything in /snekbox is changed if it's only a few seconds.
Apparently redoc just needs a URI to the spec file. Everything else is generated by JS I guess. So, it comes down to
CI could generate the spec and then create a commit if it detects a change, but that feels hacky. Alternatively, it could just check if a spec needs to be regenerated without actually doing it, but it would be a bit tedious for the PR author to have to generate it.
And not sure in which repo the spec file should be.
If you are changing other things, maybe consider making this Optional[bool]? This enables a special behaviour, where if it fails to match the argument it will skip it - and go to the next. I believe this is what you were looking to have happen with the default?
See the documentation about it.
Looks good, I think you've got a nice structure with the flows here. Looks pretty clean and somewhat nice "separation of concern" behaviour (I say somewhat because it still passes ctx).
I do have an inquiry though, what happens if there's already a leader and we want this member to be the leader? This may be a question for the codejam management system.
Note that it is the team that is using this command. I suppose this still satisfies the purpose of getting us to check the logging 😄.
Connected!
Actually, here, by team, I meant the Python Discord team.
e1a3856 Make is_leader an optional parameter in cj add - D0rs4n
Thanks for the clarification (you may want to specify in the PR body that this edits the info for theme and the calendar)
Looks good, I think you've got a nice structure with the flows here. Looks pretty clean and somewhat nice "separation of concern" behaviour (I say somewhat because it still passes
ctx).I do have an inquiry though, what happens if there's already a leader and we want this member to be the leader? This may be a question for the codejam management system.
As of now, there is no Code Jam Management support for that, but I'll definitely write that one up on the list, since it's impo...
