#dev-log
1 messages ยท Page 60 of 1
I think if there is a situation that makes sense we should try account for it, but I'm open to other opinions.
Those proposed situations don't sound like they are that unlikely, just not something we do now.
Postgres backup completed!
9e4b78b Create command for showing Discord snowflake cr... - ks129
Title say everything... Here is one screenshot:

Closes #1279
Connected!
Connected!
The snakes cog has a command error handler for several commands. The handled attribute needs to be set on the errors it handles. Maybe the handler can be removed completely, but it does have a special case for OSError for some unknown reason.
There's also an on_command_error in the bot subclass. The error handled in there may also require the attribute, but I'm not sure if it will propagate from there.
Other than a few style nitpicks, everything looks good to me so far.
activity_output.append(user_activity["activity_blocks"] or "No activity")
Can this docstring mention the usage of the API?
activity_output.append(user_activity["total_messages"] or "No messages")
Simplifies the code, and maintains the style used in other parts of the code base.
Connected!
Postgres backup completed!
This issue is now up for grabs, if anyone is interested.
a2d85eb Use custom status embeds for workflow runs - SebastiaanZ
This pull request introduces custom status embeds for our workflow runs. The standard embeds GitHub sends to our webhook do not contain a lot of information and, because they're being sent for every individual workflow, generate a lot of noise in our #dev-log channel. By using a custom action to send embeds, we can fine tune when we want to send out an embed.
Note: The required webhook token has been added an organization secret and the default "check run" embeds Discord sends are al...
Crossed a 100 commits!
The embed looks awesome, I love it!
I think this issue has been closed by PR #496
Set the max requests parameter for gunicorn to restart our workers between 1 and 1000 requests to help control the damage of memory leaks. This comes after we observed over 1GB RAM usage from our site container.
A bonus feature of this PR is that it integrates the statsd client inside gunicorn to report to our graphite server so we should be able to measure metric data.
I think this should be in format constant string not function.
We need to allow month override for development. Use Client.month_override from constant and when this is None, only then use utcnow.
This warning should give more context.
702afad Switch underscores for dashes in gunicorn CLI o... - jb3
Oh I was just using that for intellisense. I'll remove it.
There should be constant:
MENTION = "<@{id}>"
and then in code:
user_mention = MENTION.format(id=user_id)
await channel.send(
"Let's move on to the next name!\nAnd the next name is...\n"
f"**{self.name}**!\nTry to spookify that... :smirk:"
)
You mean directly use Channels.community_bot_commands?
The entire Embed, right?
Yes, there is no need for wrapper for this value.
Actually, this should use JSON for this help message. Take a look to AdventOfCode cog that uses JSON to store help messages.
Yet another fantastic PR, great work ks!
5ddbcaa Move from PyMongo to Motor driver for asynchron... - ks129
baf067f Lock all forms showing to admins only - ks129
6e7ea2a Fix Question circular import and use cls instea... - ks129
a47c499 Use cls instead self for Question model validators - ks129
a494835 Move MongoDB output to Form model and after con... - ks129
9efd0cb Include DestroyModelMixin to infractions view f... - ks129
Closes #430
Added this mixin and documented this in doctoring.
I don't think I can do that. Currently I am dynamically producing some data using a variable in my program (EMOJIS_VAL) which I don't think I should hardcode.
Okay, then make content (not field titles) constants.
Create a new review policy to require a core developer approval on all PRs made to forms frontend.
a349b7a Add *.iml to .gitignore (IntelliJ file based conf) - ks129
Postgres backup completed!
I have moved everything to be constant, is it better now @ks129 ?
Would it be better if I put something like "Bot is unable to get the seasonalbot-commands channel. Please check the channel ID."?
Put hashtag before channel name and then yes.
This comment is useless
EMOJIS_VAL = {
Constant name already say that
This should be also hard-coded to code, not using constant.
if not Client.month_override:
return datetime.utcnow().month == Month.OCTOBER
return Client.month_override == Month.OCTOBER
Use here get or fetch pattern:
channel = self.bot.get_channel(Channels.community_bot_commands) or await self.bot.fetch_channel(Channels.community_bot_commands)
await self.messages.set(message.id, json.dumps({
The jitter value is only applied to the -max-request option if max-requests is greater than 0. It's meant to jitter your max-requests value and I don't think it works if you only set the jitter value. From the gunicorn source code:
if cfg.max_requests > 0:
jitter = randint(0, cfg.max_requests_jitter)
self.max_requests = cfg.max_requests + jitter
else:
self.max_requests = sys.maxsize
(Note: this is applied to each ...
Ah! That makes more sense, misunderstanding of the docs on my behalf.
I didn't understand... what is Client.month_override supposed to be?
Oh wait nevermind, I think I got it.
Try doing pipenv sync --dev and then pipenv run start?
This looks good for me now.
Connected!
Not sure I like the combination of creating your own embed, and then reading from a dict to extend it. The variable HELP_MESSAGE doesn't quite hit with what it holds.
I would like to see the entire embed be in the dict, and created from Embed.from_dict({dict}). The description can hold a format placeholder for the prefix that you change in the dict before calling from_dict.
This should probably be a link to the bot command channel? #sir-lancebot-playground
# added, the author's id, and the author's score (which is 0 by default)
f537768 Bot relays the infraction reason in the DM. - swfarnsworth
d7e94f2 Add starify and unstarify as command aliases. - swfarnsworth
873dcd7 Merge branch 'master' of https://github.com/pyt... - swfarnsworth
0f66fe3 User gets a more detailed message from the bot - swfarnsworth
Previously, when a moderator used the !superstarify command, the reason they gave only gets recorded in the user's infraction history and is not relayed to the user in the direct message sent by the bot. This PR changes the message the user is sent to fix this.
However, we're discussing if the special embed that gets posted in the channel where the command is issued is actually appropriate.
:

This is the DM that they get:

This is what the mod would see in the user's infraction history:
, whereas the message still appears in the message sent to the user. The messages are otherwise the same.

Per an internal discussion, we'll retain the original wording of the embed, but the title will still be "Superstarify!" instead of "Congratulations!"
Connected!
I realised this actually doesn't even do anything since a CommandError's class hierarchy has no relation to OSError. It would have to use error.original, if that attribute even happens to exist. And again, I'm not even sure why this has a special case for OSError in the first place. Does anyone else know if this is even needed?
We should attach an optional Discord webhook to the forms to relay new submissions into a Discord channel.
We'll need to update the form model and SCHEMA.md file with an optional webhook_url property and a WEBHOOK_ENABLED form feature.
138417e Update schema file with new objects - jb3
Adds a form response schema to the SCHEMA.md file ready for Pydantic implementation.
Issue
I came across this issue when trying to run code that uses the sympy library invoked via a webserver in Snekbox. It seems that if there is a memory-intensive request, Snekbox will begin returning "137" out-of-memory errors if it receives multiple of them at the same time.
For an import to a large library like networkx, pandas, or sympy, merely two requests that import these at the same time will cause either one (typical) or both (rare) requests to fail.
Environment
...
Observation:
If I change the number of workers in gunicorn from 2 to 1 (so that requests are processed synchronously) then I am able to process many high-memory requests sequentially. The drawback, of course, is each request must wait for the last to finish executing.
Still, it would be nice if I could provide a flag to the docker container to achieve something to the effect of providing this configuration.
workers = 1
bind = "0.0.0.0:8060"
logger_class = "snekbox.Guni...
Should I just move the entire embed as a constant so that it doesn't keep recreating the Embed?
Postgres backup completed!
Was there an official consensus on echoing back the user's name, or is that not a concern?
Don't forget to update this, based on the poll results.
The expiry time is duplicated in two different spots in the direct message embed (L115). Can you remove this from the main embed, and only add it to the message sent to the invocation context?
You could if you don't expect anything, like the prefix, to change through runtime.
Does this convert it to a bool, by wrapping it in parenthesis? In that case TIL.
Both of these return None or channel. None is false, but channel is true. So when channel exists, this is channel, else None.
If fail to see the difference then? I simply suggeted wrapping it in parenthesis to linewrap the expression, making it easier to read.
I am guessing this is how the original cog was designed, it doesn't seem very needed now though.
Actions https://github.com/python-discord/organisation/issues/315.
We should have a dynamic message at the bottom of #how-to-get-help saying something along the lines of
โThe currently available channels are #help-element1 and #help-element2, feel free to ask in any of those two channels!โ,
to avoid getting anyone getting confused by the currently open channels like we had in the past.
Hmm okay! I think I will make it constant because if the prefix changes, the bot will need to restart right?
I will format it as you suggested in the first part, the second suggestion looks sort of... malformed or something.
I think I over-complicated it... :sweat_smile:
Connected!
This is referring to what will appear in the infraction history.
I think it's important to specify that they will be unable to change the nickname until the infraction expires, and in that case duplicating the date doesn't seem too bad.
I have a radical solution: If none of us can think of a reason for it being here after reading the code and it's not documented, we should remove it. It would get this PR going (which is important for the Advent of Code PR, which we ideally merge soon, as the event is ongoing) and, if we do that it was needed, we'll notice that at some point and can add it back in.
I think it's preferable to having some vestigial piece of code in our cog that's non-critical (it's not part of the core featu...
Right, so, after some thinking, I think an OSError may be raised if we failed to download any bytes for an image. It would be a bit weird for this to happen, but I think Image.open raises an OSError for an empty BytesIO read.
The public embed is always the same:

The infraction message depends on whether or not the mod gave a reason:


The message in the infraction history is ...
Sure, but it does appear in the infraction history, DMs, and server invocation channel. I am curious if we want to be sending the old names as part of the (public-facing) embeds or not. It was a point touched upon during discussions, but not fully explored.
We can still mention that you can't change your name while this is in effect, without adding the date, but at that point, we're splitting hairs. If you're fine with the duplication, then I won't complain.
Postgres backup completed!
You should avoid bare exceptions.
Use log.error instead.
This should be constant.
We initially designed the RedisCache around the collections.abc.MutableMapping interface, but that did not match well with the commands Redis offers us. That's why we decided to step away from the symmetry with Python's mapping objects and focus on RedisCache being a type of its own.
In short, for the methods you're proposing, you'd still fetch the entire hashset from Redis, but then discard parts of the output internally, but we'd drop half of it. I'm kinda leaning against that, becau...
increment and decrement returning the new value
This is included in the new release, which also makes the increment/decrement operations atomic from a Redis point of view.
I'm planning on including expiry in the future. I'm already using myself in another project (the advent of code leaderboard cache in python-discord/sir-lancebot has an expiry set with the underlying connection). As discussed above, it would only work on an entire RedisCache at once because of Redis limitations.
I guess we can also expose the underlying connection more easily (it's currently accessible using a marked-as-private attribute), but manual operat...
Discordpy does not provide the fetch method for channels.
I am going for the following pattern:
- using properties like before
- add a custom property decorator that caches the value and unloads the cog if the property value is None.
discord.py have fetch_channel method.
Is this a new release of Redis that you're referring to, and is it already in a state that we can migrate to it?
How do you feel about the generics?
Works great, maybe a sf alias as well?
This feels a bit unconventional and odd, but it's quite smart.
Code looks good and works well!
8ea1376 !close removes the cooldown role from the cla... - swfarnsworth
089efa3 !close removes role when they have no help ch... - swfarnsworth
731fea1 Moved the removal of the cooldown role from cl... - swfarnsworth [3b28570](https://github.com/python-discord/bot/commit/3b28570818b923cb099476ad1305923dca986aea) Merge branch 'master' of https://github.com/pyt... - swfarnsworth [3f490ab](https://github.com/python-discord/bot/commit/3f490ab413b64474bc7e40a2d66d3c3178d615ba) Changes requested by @MarkKoz, new unclaim_cha... - swfarnsworth
Connected!
infraction history and DM - yes, we want to know what the old nick was for future reference, and I don't see a reason for it to not be DMed.
For the public embed, from what I gathered people didn't seem to think it was an major issue, and most starts are applied form private channels anyway. Also in the vote it says to keep the content, and I can only assume it includes the old nick.
8ea1376 !close removes the cooldown role from the cla... - swfarnsworth
089efa3 !close removes role when they have no help ch... - swfarnsworth
731fea1 Moved the removal of the cooldown role from cl... - swfarnsworth [3b28570](https://github.com/python-discord/bot/commit/3b28570818b923cb099476ad1305923dca986aea) Merge branch 'master' of https://github.com/pyt... - swfarnsworth [3f490ab](https://github.com/python-discord/bot/commit/3f490ab413b64474bc7e40a2d66d3c3178d615ba) Changes requested by @MarkKoz, new unclaim_cha... - swfarnsworth
Postgres backup completed!
f537768 Bot relays the infraction reason in the DM. - swfarnsworth
d7e94f2 Add starify and unstarify as command aliases. - swfarnsworth
873dcd7 Merge branch 'master' of https://github.com/pyt... - swfarnsworth
0f66fe3 User gets a more detailed message from the bot - swfarnsworth
032b64f Use the original wording of the public embed, b... - swfarnsworth
Connected!
What needs to happen to make this move forward? I can look into the isinstance check, if needed, to get this PR to a mergeable state. Normally, I'd not mind a few extra days (or even weeks), but this PR is currently blocking the PR to extend/change the Advent of Code channels, which is obviously an ongoing event. Would be nice to get them both merged at some point in the near future, so we can benefit during the current edition.
Sorry for the late commits, I had a lot of schoolwork, so I couldn't work on this for the past two days.
Why is the lint failing? pipenv run lint passed for me. Looks like it is some error with the discord webhook or something?

Why is the lint failing?
pipenv run lintpassed for me. Looks like it is some error with the discord webhook or something?
I was slightly afraid of this. You can ignore it for now; I'll fix it.
62a7dda Create Pydantic model for form response antispa... - ks129
bc68d2f Create DiscordUser Pydantic model for form resp... - ks129
8e0a9a6 Add AntiSpam and DiscordUser models to init.py - ks129
5112df4 Create model for form response - ks129
f04f605 Remove some validators from models because they... - ks129
Closes #8
Created models for form responses, added captcha and blacklist validation and updated user validation. Now also stores data to DB.
Also added duplicate ID validation for forms as side change (found bug when testing).
oh, right, how did I miss that.
return JSONResponse({
"error": "missing_discord_data"
}, status_code=400)
Let's return some status codes
return JSONResponse({
"error": "Form with same ID already exists."
}, status_code=400)
Let's put this in a JavaScript friendly format and add a status code.
return JSONResponse({
"error": "missing_fields",
"fields": missing_fields
}, status_code=400)
Wrong button, meant to request changes!
Comments made above!
This PR looks good and seems like a good base for form responses. Once this is through I'll get to work looking at how to render these forms on the frontend in a good way and how to collect responses.
Thanks!
There are a couple of other places where status codes should be returned. We'll also standardise the error format at some point.
Don't worry about those, implement the changes in this PR and I'll open a PR in the next day or so to change things โ but they are not critical.
Connected!
e0335bb Create Verify cog for new !verify command. - swfarnsworth
This PR submits a new !verify command for moderators to apply the Developer role to any user. This is so that we can give the role to users who inform us via modmail that they're having difficulty verifying.
Previously, !verify was an alias for !accept.
Code all looks good, very clean!
I'm not sure this feature needs a cog of it's own โ it fits fairly well into the existing Verification cog.
I'd be intereted to hear from others though, so I'll request changes for now.
The method for the actual command could be copied over to the Verification cog almost unchanged, so that would be an easy fix. There wasn't any particular reason this had to be its own cog, so I'm happy to make that change unless someone feels otherwise.
Putting this in the Verification cog sounds good to me.
8ea1376 !close removes the cooldown role from the cla... - swfarnsworth
089efa3 !close removes role when they have no help ch... - swfarnsworth
731fea1 Moved the removal of the cooldown role from cl... - swfarnsworth [3b28570](https://github.com/python-discord/bot/commit/3b28570818b923cb099476ad1305923dca986aea) Merge branch 'master' of https://github.com/pyt... - swfarnsworth [3f490ab](https://github.com/python-discord/bot/commit/3f490ab413b64474bc7e40a2d66d3c3178d615ba) Changes requested by @MarkKoz, new unclaim_cha... - swfarnsworth
Postgres backup completed!
This should probably use constants.Roles.verified, and then it can be combined with the next line.
Nitpicky and not important, but I'd use already verified here. Feel free to ignore this one.
Connected!
362c665 Make JSON errors more JS friendly and add respo... - ks129
Connected!
So going over the channel there seem to be some people who get confused from occasionally and drop selenium questions there in the middle of a help session, but those users could possibly do the same in another occupied channel otherwise.
Personally I wouldn't mind either way. If we think it's a possible issue lets just get rid of the name.
Seems like the Snowflake converter could fit here
I wanted to see what would happen. If you've observed selenium-related questions being dropped in the middle of ongoing conversations in that channel, then we should just remove it. It's just a name.
The only consideration I have is that if we do ever add atomic numbers to the channel names, there would be a more obvious gap, but how obvious is a missing number in an unsorted list of 40 channels split over three categories? I don't really think it's going to be an issue.
47a2607 Use Snowflake converter for snowflake command - ks129
I don't think we would notice a missing number, since they aren't sorted, yeah.
8ea1376 !close removes the cooldown role from the cla... - swfarnsworth
089efa3 !close removes role when they have no help ch... - swfarnsworth
731fea1 Moved the removal of the cooldown role from cl... - swfarnsworth [3b28570](https://github.com/python-discord/bot/commit/3b28570818b923cb099476ad1305923dca986aea) Merge branch 'master' of https://github.com/pyt... - swfarnsworth [3f490ab](https://github.com/python-discord/bot/commit/3f490ab413b64474bc7e40a2d66d3c3178d615ba) Changes requested by @MarkKoz, new unclaim_cha... - swfarnsworth
b92e802 Skip status embed for skipped Build workflow - SebastiaanZ
Connected!
You can try in:help-selenium selenium. It's not very often, but it seems to happen occasionally.
Let's just remove it then. It's just a name.
9e4b78b Create command for showing Discord snowflake cr... - ks129
9d00ef3 Add sf alias to snowflake command - ks129
47a2607 Use Snowflake converter for snowflake command - ks129
97b9c7d Merge branch 'master' into ks123/snowflake-command - mbaruh
cc8b218 Merge pull request #1318 from python-discord/ks... - mbaruh
Connected!
bb4b364 Add name and description fields to Form model - ks129
Title say everything.
Connected!
223455d Compressed embed building - Xithrius
dd2f29f Slightly reformatted activity block building. - Xithrius
77a8e42 Added docstring for the user activity function. - Xithrius
Connected!
1447327 Improve !pep command - ks129
355c1bd Merge branch 'master' into pep-improvisations - ks129
6b6d2a7 Moved async_cache decorator from Doc cog fi... - ks129
bf26ad7 Created new task in Utils cog: refresh_peps_... - ks129 [a2f0de1](https://github.com/python-discord/bot/commit/a2f0de1c34dc320f4ee61d64a33b0d866bf41af2) Refactor pep` command, implement caching - ks129
Not all errors will have this attribute, so use getattr or hasattr.
Sorry for a late response; I've been busier this week. I also haven't been as vigilant with GitHub notification since I've disabled e-mail notifications and started relying on the browser add-on.
Anyway, I didn't realise I was holding up another PR over some relatively insignificant feature. However, it seems almost fixed by this point.
Connected!
4d2f899 Modify error handler check for locally handled ... - RohanJnr
cd24f9b Check value of handled attribute on error in gl... - RohanJnr
cd20acf Modify snakes_cog error handler. - RohanJnr
40fce53 Check if error.original is an instance of OSError. - RohanJnr
e6e8afd Merge pull request #540 from RohanJnr/error_han... - MarkKoz
Connected!
I don't believe it's desirable to re-raise the error because I'm concerned it then won't get handled properly by the global command error handler. That aforementioned handler will receive the error without it needing to be raised here.
Sorry for a late response; I've been busier this week. I also haven't been as vigilant with GitHub notifications since I've disabled e-mail notifications and started relying on the browser add-on.
Just to be sure, no issue, obviously. I was trying to put a feeler out for if Rohan/Iceman would have time to work on it or if we could solve in some other way.
discord.py resolves the forward refs by evaluating their value using the function's globals
https://github.com/Rapptz/discord.py/blob/a4b20d08c33814de80b0591cd1cbe0ec633df59a/discord/ext/commands/core.py#L304-L309, when the lock is applied it replaces the callback with a function that has new globals that only contain names from the utils.lock module causing the piece of code that resolves annotations to fail
from discord.ext import commands
from bot.utils.lock import lock
an...
Replacing or merging the globals should fix this. Wouldn't this be an issue with every decorator?
The globals are read only, but updating them should work, didn't think of that. I believe it is an issue for every decorator but most of them apply to the command instead of the coroutine function or return the function object
Noted! I was unsure if having the custom cog error handler would stop the error from propagating through. New commit has removed the re-raising of the error.
Connected!
Connected!
Connected!
How would the #how-to-get-help message be stored? Would the bot just get the latest message from the channel?
I could probably work on this.
Connected!
The items that go to the queue get deleted once they are added to the queue, so there shouldn't be any case where that'd happen
Connected!
I'm not entirely sold on this being worth it with the rare usage of the command, using the inventory dict here would mean having to create one more method to nicely handle the argument before passing it over to update_single
Is that the intended behaviour? https://github.com/python-discord/bot/blob/bcab67375c778fb30c86d8edd19bed854b0f8b45/bot/utils/messages.py#L51-L53
The supress here will exit the block when it catches the TimeoutError, skipping the message delete
Connected!
Connected!
I've moved it to the finally block in 19c6d55b, it also simplifies the clean up of the parse task attribute so it's a win-win
Implemented the locks in ac6d25cf, now every coro that can trigger a refresh is behind a lock and the get command will wait for refreshes to finish before proceeding to schedule new symbols
All of the symbols from a page are now stored when the page is fetched in redis, behind the page url as the key with expires handled by redis.
I've decided to not update the expire in case a new symbol from the page was requested after the got bot shut down during parsing and left an uncompleted cache, but then realised we'll overwrite all the keys there anyway so maybe the expire should be updated anyway. Any thoughts on whether we should always update the expire or only when the hash is n...
62a7dda Create Pydantic model for form response antispa... - ks129
bc68d2f Create DiscordUser Pydantic model for form resp... - ks129
8e0a9a6 Add AntiSpam and DiscordUser models to init.py - ks129
5112df4 Create model for form response - ks129
f04f605 Remove some validators from models because they... - ks129
62a7dda Create Pydantic model for form response antispa... - ks129
bc68d2f Create DiscordUser Pydantic model for form resp... - ks129
8e0a9a6 Add AntiSpam and DiscordUser models to init.py - ks129
5112df4 Create model for form response - ks129
f04f605 Remove some validators from models because they... - ks129
Review bot is benig funky about update merges.
We should add an admin route for forms admins to fetch a response by the ID, that way we can link to it from Discord.
The route should take the ID as a URL parameter and essentially return the entire FormResponse object.
A route should be returning the preferences on a form.
The response should vary slightly dependent on the user requesting.
If the user is unauthenticated or is not an admin then they should only be able to pull forms that are OPEN. Alongside that we should not return the internal preferences such as the Discord webhook URL returned for sending new responses (#15).
If the user is authenticated and an admin we should return the whole response object, even if the form is not open,...
After the route for fetching form details (#20) has been implemented we should add a route which will return the responses for the form by pulling from the form responses MongoDB collection where the form ID is the one passed in the URL parameters.
This should be an admin only route and no return data sanitisation should be necessary, we need to have anti-spam and discord information available to the administrators.
The route should append to the route inย #20 to look like `/forms/{form_...
b9be82f Bump ini from 1.3.5 to 1.3.8 - dependabot[bot]
Bumps ini from 1.3.5 to 1.3.8.
Commits
a2c5da8 1.3.8
af5c6bb Do not use Object.create(null)
8b648a1 don't test where our devdeps don't even work
c74c8af 1.3.7
024b8b5 update deps, add linting
032fbaf Use Object.create(null) to avoid default object property hazards
2da9039 1.3.6
cfea636 better git push script, before publish instead of after
56d2805 do not allow invalid hazardous string as section name
See full diff in compare view
Maintainer changes
This ...
This should be good to go now. We decided in #branding that we want to have the emote on the repo, but that the lemoji folder wasn't a good fit. This is the main reason:
I consider each lemoji to be a distinct lemonhead, and that those lemonheads can be used as components to build lots of fun stuff, like the stuff we made for the welcome video. It's great that someone made a lemonsaurus, just don't mix it in with the actual lemojis. It's completely stylistically different and the lemon its...
4b6b8cc Bump ini from 1.3.5 to 1.3.8 - dependabot[bot]
Bumps ini from 1.3.5 to 1.3.8.
Commits
a2c5da8 1.3.8
af5c6bb Do not use Object.create(null)
8b648a1 don't test where our devdeps don't even work
c74c8af 1.3.7
024b8b5 update deps, add linting
032fbaf Use Object.create(null) to avoid default object property hazards
2da9039 1.3.6
cfea636 better git push script, before publish instead of after
56d2805 do not allow invalid hazardous string as section name
See full diff in compare view
Maintainer changes
This ...
c4a1d02 added lemonsaurus SVG - MrAwesomeRocks
59c1919 added lemonsaurus PNG - MrAwesomeRocks
3cfa08a Merge branch 'master' of https://github.com/pyt... - gustavwilliam
42f837f Move lemonsaurus to emotes/other folder - gustavwilliam
8497fef Merge pull request #58 from MrAwesomeRocks/lemo... - lemonsaurus
Connected!
02c5c7e Fix leaderboard glitch caused by duplicate names - SebastiaanZ
4d2f899 Modify error handler check for locally handled ... - RohanJnr
cd24f9b Check value of handled attribute on error in gl... - RohanJnr
1aad543 Support a fallback session cookie in constants - SebastiaanZ
c21014a Mitigate session expiry by using fallback session - SebastiaanZ
I quite like this idea, because there isn't really a situation where the user would need more than one help channel.
If they would have another question then they should feel free to ask them on the same channel.
1270adf Create route for showing single form response - ks129
Admin-only route. Closes #19
bf06cc2 Add some sanity to frontpage projects. - lemonsaurus
If no API data is available, the front page shouldn't crash and burn.
This commit will ensure the front page will just render without the projects it can't get API data for instead of crashing the whole thing.

- Created custom
dictfunction forFormmodel to return only public fields when user is not admin. - Return only public fields for discovery.
- Move form creation to
/formsPOST from/forms/new. - Created route for getting single form that return all fields and all forms for admins, but only public fields and open forms for others.
- Closes #20
fa9ef1d Remove pointless try/except. - lemonsaurus
The fix looks good to me and works fine locally.
Description
Cache guild, channels, and roles during the bot start and before any cog loads in.
This is going to make accessing channels and roles easier in the cogs/code without getting/fetching them in the cog.
This will also avoid repetitively getting or fetching the same channel/role in multiple cogs.
By doing this, we can make sure that all required channels and roles are loaded and present.
Additional
The bot should stop even if one channel/role is found to be `No...
I don't think this is really necessary, with the wait_until_guild_available it's almost guaranteed that the get will succeed for channels the bots may use, with the gets being a fairly cheap lookup. When #393's implementation gets merged we'll get the warnings for missing channels, and then the cogs that try to get them can handle failed gets in their own way if necessary
Won't it make it more convenient to just use the cached value instead of getting it again? and as I mentioned above, This will also avoid repetitively getting or fetching the same channel/role in multiple cogs.
So instead of importing the ID, we would just simply importing the channel/role instance.
13e09af Clean up stale metadata when HomeView starts. - lemonsaurus
We don't want to keep lots of old metadata for repos we no longer need to track on the frontpage. Previously, whenever we changed the frontpage repo line-up, we'd be left with useless, stale data in the database. This fixes that, and adds relevant tests.
I hadn't really considered it till now, but ran some tests now and the markdown parsing which is fully synchronous took up to 250ms after I fetched some pages, I suppose this would be an issue for the real bot. I'll look into switching it over whole to a thread and if that's not viable without too many complications at least the parsing itself can run in an executor
aaf7333 Increase per_page to 100 for GitHub API call. - lemonsaurus
Snekbox was being banished to page 2 and we were not iterating pages, so
it was not appearing in the data we got from our call to /repos. This
commit changes the request to use per_page=100, which will work at
least until we have >100 repos in our organisation.
The changing of /new to / is incorrect here. We should delete the new file entirely and instead add a new post method to the route at backend/routes/forms/index.py
Not sure I like some of the new line breaks. Most of them should probably just be a variable.
like
for data in [
json.loads(user_data) for _, user_data in await self.messages.items()
]:
if data["author"] == message.author.id:
SpookNameRate.debug is not the same as self.debug. One is attached to the cog instance, the other the class itself. If you need to use the static version, set on the class, then you need to use it everywhere else.
If not, then pass as an optional argument or something
efdf72f Move form creation to index file - ks129
Let's use this diff as an opportunity to kaizen this fix.
"error": "id_taken"
6a849b1 Make error message more user friendly - ks129
Fixes the data sanitisation method of forms to be compatible with the aliases placed on id/_id.
449f673 Fix dodgy indent and wrong field name - jb3
I've not tested this but I trust that you have. The changes are more minimal than the diff implies so I feel confident to approve.
This could be useful when someone asks for Python videos, someone could then proceed to type !resources watch or !resources videos and the Python bot would link the Watch part of the resources page. It's a small change but it could save a step.

I think another way of doing it would be so that individual resources could also be passed, for example someone could invoke the command like !resources realpython and if realpython is not one of the 8 sections on the resources page (watch, podcasts, try, etc) it would attempt to get the closest match (which is realpython.com)
Implements #1320.
I think all the code needed is there but I may have done it wrong since it is my first time contributing.
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Contributor Wiki - A set of resources about setting up our services
- Python Discord Code of Conduct - Code of conduct for our commu...
oops let me fix the lint check
6cae737 Sort routes to have constants first and path fr... - jb3
This fixes the bug that prevented discoverable from overriding the forms path fragment path.
The issue is specified in this Notion ticket.
The solution is to sort the route map by whether the URL contains a path fragment (e.g. /forms/{id:str}) or not (e.g. /forms/discoverable).
Having a think about this, maybe we should integrate the other issue about having a list of all responses into this as well (this ticket).
We should namespace these like so:
/forms/{form_id:str}/responses - return all responses
/forms/{form_id:str}/responses/{response_id:str} - return a single response
This makes the frontend interaction much clearer.
Dependabot tried to merge this PR, but received the following error from GitHub:
You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information.
84ed287 Create route for returning all form responses - ks129
Closes #21
Admin-only route, returns all form responses by form ID.
1270adf Create route for showing single form response - ks129
d8d3052 Restructure single response route - ks129
afc3596 Merge branch 'main' into ks123/single-response-... - jb3
ff5be5d Merge pull request #22 from python-discord/ks12... - jb3
ee338b2 Merge branch 'main' into ks123/responses-route - jb3
- Updated models to match changes in backend.
- Made
getFormsusing API instead hard-coded values. - Installed Axios and made global client.
- Sorry, I never used
jest, so I don't know well how to write tests. I made that current tests don't fail, but I can't create new ones.
4fbf9cc Change how the ALLOWED_HOSTS environment variab... - jb3
This environment variable won't be fed into the build by default. It needs to be mirrored into the section of line 80 in the webpack.config.j file. We can also then remove the default.
baseURL: process.env.BACKEND_URL
Minor change regarding the environment
0ef1dee Add BACKEND_URL env variable for build - ks129
41dc7ef Simplify Axios client baseURL definition - ks129
The changes are more minimal than the diff implies so I feel confident to approve.
Yeah, I decided to move it to the helpers file, which caused the large diff. The main difference now is that there's logic for handling out-of-season start-ups of the tasks that are still able to wake up when the AoC draws near without having to restart the bot after the event has started.
On some devices the previous escaping didn't work properly, escaping
all backticks will make sure none of them get registered as Markdown
Does this fix need to be applied to the examples used by the code block cog too?
The example string in the cog already escapes all of the backticks https://github.com/python-discord/bot/blob/bcab67375c778fb30c86d8edd19bed854b0f8b45/bot/exts/info/codeblock/_instructions.py#L11-L15
That sounds acceptable though I don't truly know what an acceptable range is since I've never benchmarked anything in this context.
That's probably intentional. Never mind - I just misremembered how it worked.
It doesn't seem that complicated to me. Return a tuple from the converter and change update_single to accept an inventory instead of a URL. Change any other callers to fetch the inventory instead of passing a URL.
621949c 'Refactored by Sourcery' - Sourcery AI
Branch main refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
VS Code
PyCharm
Review changes via command line
To manually merge these changes, make sure you're on the main branch, then ...
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
Function Form.validate_features refactored with the following changes:
- Invert any/all to simplify comparisons (
invert-any-all) - Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension)
Sourcery Code Quality Report
โ ย Merging this PR will increase code quality in the affected files by 3.26%.
| Quality metrics | Before | After | Change |
|---|---|---|---|
| Complexity | 15.76 ๐ | 12.36 ๐ | -3.40 ๐ |
| Method Length | 56.33 โญ | 55.17 โญ | -1.16 ๐ |
| [Working memory](https://github.com/sourcery-ai/... |
why though, what does this achieve?
947a30f fix various type annotation issues - decorator-factory
7e98943 minor refactorings - decorator-factory
Tried putting the whole parsing task into a thread but it was a bit of hard to wrap around all the locking after I was done, while still being unsure if there aren't any more race conditions around. Decided to go with the executor because of that and I'll leave this as it is now unless someone else has an opinion against it
Implemented it in https://github.com/python-discord/bot/pull/1014/commits/5258c797e1ea3bc08eeddb5fd30dc35b85628e3e after consideration separating the rescheduling logic from the update method is also nice. As a consequence the fetches from the set command now don't get rescheduled but I don't think that's much of an issue
Decided to just force the text attribute to always be None with a warning if it's set as I don't foresee any usages in the doc cog, this simplified the checking a bit as the matches function can be ignored in the method on our side
2f4d1d8 Make import name of route working for every pla... - ks129
As Windows use \ instead /, current way doesn't work in Windows, because replacing / with . doesn't do anything with \.
Now this join parent parts instead, what doesn't include separations.
Connected!
cbb3d9f Update route levels parsing to work in all plat... - ks129
9c7af9c remove stray print - decorator-factory
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
57c9f02 Fix f-string referencing the wrong name - decorator-factory
b074a27 Fix missing type annotation - decorator-factory
This issues is resolved by merged PR #407.
@Inheritanc-e we had a discussion about this in a staff meeting. This is what I wrote after that meeting:
There seems to be consensus that users receiving help in multiple channels concurrently is bad, but Ves raised the point that sometimes a channel will be inactive for a few minutes and another user will move in and receive help. We wouldn't want to shut those conversations down even if they weren't following the correct help channel flow. Unfortunately there may not be a solution to ...
Nice work! Few minor comments.
Should we be adding pytest in this PR? Looks like the changes to poetry.lock and pyproject.toml are related but really we should be adding this in a PR which introduces not only this but CI tests as well.
Why would kwargs be t.Any? Wouldn't it make more sense to be dict[str, t.Any]?
cc @decorator-factory since I think this is a refactor.
I was working on another PR, and was asked to alphabetized my additions. A lot of the content in this file, and other constants files are already alphabetized, and this shouldn't be particularly difficult.
This isn't really important, but if you're generalizing this function, you might as well accept a timezone parameter, instead of only returning EST (you'd just have to move the EST constant into the function and pass it the timezone).
Everything looks good. Whether my comment gets actioned or not does not matter much.
Description
The remind and bookmark commands are useful features, particularly when working on projects on the server. The way they are currently set up, you have to invoke the command yourself (or get mentioned in the case of reminders), but I think a useful feature would be allowing users to "+1" on other's bookmarks/reminders. This is a feature that exists in other reminder systems, such as the remindme bot on reddit.
This feature would make it easier to work on things together and ...
24e10ed Add renovate.json - renovate-bot
673a54a Add renovate.json - renovate-bot
Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.
:vertical_traffic_light: To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.
Detected Package Files
docker-compose.yml(docker-compose)- `Dockerfile...
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.
:vertical_traffic_light: To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.
Detected Package Files
.github/workflows/codeql-analysis.yml(github-acti...
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
sry for spam
8b99f4b Set groupName to all to make one large initial PR - jb3
7fb1106 Don't separate semver PRs for renovate - jb3
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @emotion/core | ^10.0.35 -> ^11.0.0 |
[ |
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
ca82871 Update dependency python-dotenv to ^0.15.0 - renovate-bot
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| python-dotenv | dependencies | minor | ^0.14.0 -> ^0.15.0 |
Release Notes
theskumar/python-dotenv
v0.15.0
[Compare Source](https:/...
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
586f83b Update dependency starlette to ^0.14.0 - renovate-bot
83dbb65 replace @emotion/core with @emotion/react - jb3
f6c8fd0 Pin dependencies - renovate-bot
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| @emotion/react | dependencies | pin | ^11.1.2 -> 11.1.2 |
| @fortawesome/fontawesome-svg-core (source) | dependencies | p... |
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
spam should be over 4 now
0b30260 Adds Cross-Env - HassanAbouelela
Running the yarn startup scripts on windows would error out due to the way the environment variables are set. This PR adds cross-env to handle running the project on different platforms.
Future scripts have to be prefixed with cross-env to be as cross-compatible as possible.
Thank you for contributing to Python Discord!
Please check out the following documents:
- Join the Discord server! - If you have not already, join the Discord server and introduce yourself in our #dev-contrib channel.
- Python Discord Code of Conduct โ Code of conduct for our community
- Python Discord Contributor Wiki - A set of resources about setting up our serv...
452342b Update dependency uvicorn to ^0.13.0 - renovate-bot
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| uvicorn | dependencies | minor | ^0.12.2 -> ^0.13.0 |
Release Notes
encode/uvicorn
v0.13.1
[Compare Source](https://togithub.com/encode/uvicorn/comp...
de4e400 Update Font Awesome - renovate-bot
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @fortawesome/fontawesome-svg-core (source) | 1.2.30 -> 1.2.32 |
[ | 1.2.36 -> 1.2.40 |
[ |
ee893db Update dependency @types/react-router-dom to v5... - renovate-bot
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @types/react-router-dom | 5.1.5 -> 5.1.6 |
[ | 26.5.3 -> 26.6.3 |
[ |
3cb3a9a Update dependency webpack-cli to v4.2.0 - renovate-bot
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| webpack-cli | 4.0.0 -> 4.2.0 |