#dev-log
1 messages ยท Page 76 of 1
Description
As we are already using contribution content of our website, the reason for first going to CONTRIBUTING.md file and then with another click, going to url seems unneeded.
In Python-discord bot we already have direct webpage link, so I think we can do it here too.
Proposed Implementation
Minor change...
It might be better to add some logical spacing here to facilitate reading :D

It might be better to add some logical spacing here to facilitate reading :D
@Objectivitix yeah that will give better readability indeed!
Great! I'll update it soon!
[python-discord/bot] New branch created: discord\.li\-invite\-filter
Discord.li is an alias for discord.io, a domain already on the denylist.
Relevant Issues
Closes #749
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Implemented the reverse command, which flips the users profile picture if no text is given, or the given text.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read the [contr...
Whats the status on this?
Everything looks good and our testing worked! Some commas missing here:


I feel like this is better named as flip_effect
Use may be none here if this call fails, we should deal with that similar to how the other commands do.
This line isn't needed, since you're already getting the avatar in this size
use if text is None instead?
No, I mean self._fetch_user() could return None, so you'd need to handle that case, otherwise the next line with error. The other commands in this cog already do it.
@Objectivitix the leading commas are not needed.
to my knowledge at least.
This hasn't been resolved.
Maybe capitalise rationals to keep consistency.
Hyper Text should not be separated by a space.
This could be changed to "Give one protocol that handles mail" as there are SMTP, IMAP and POP3 that are used today
Github seems to have added duplicate change requests, i did my best to remove them.
This should be mirror
This is done by just using ImageOps.mirror().
Shouldn't this update this page mentioned in the issue as well?
Sometimes, you want to add information to a nomination, possibly after getting to know the nominee better. This is currently not possible for helpers.
When a solution involving allowing staff to nominate the same member multiple times was proposed in #nominations, @wookie184 pointed out that the !tp edit command can be used to edit nomination reasons, but that it is currently restricted to moderators and admins. I propose that helpers should be allowed to use the command to update their ...
sure, will be resolved in the next commit
there is consistency - none of these non-lettered ones are enclosed in parentheses
The end-trailing commas are used almost everywhere in Python Discord's open-source projects, and is considered good practice. I would do it, at least, for the sake of consistency.
[python-discord/forms-backend] New branch created: unittest\_failures
0ab2668 Reports All Unittest Failure Reasons - HassanAbouelela
Implements this notion ticket.
Adds support for an optional allow_failures bool. If true, the backend will only return an error (500) if an internal error occurred. If false, the backend will return an error (403 or 500 depending on failure reason).
This PR also adds a model to aid in parsing the new options.
We should have commands the display why not to use heroku/repl.it to host bots.
This is what the discord.py server has, and I think we can do something similar. image and we would have something similar for Heroku.
[python-discord/bot] branch deleted: discord\.li\-invite\-filter
Connected!
The end-trailing commas are used almost everywhere in Python Discord's open-source projects
This isn't true, and I think that it's fine the way it is.
Couple of minor changes
Might be worth documenting when return code 99 happens.
# An error while communicating with the test runner
if test.return_code == 99:
More appropriate HTTP code.
status_code = 422
9b308d6 Uses 422 For Failed Tests
- HassanAbouelela
be70384 Documents Return Code
- HassanAbouelela
Description
There is currently no straight/ally flag in the .prideavatar command. The following image is the most recognised flag for this purpose. Let's add it to the command.
https://media.discordapp.net/attachments/551789653284356126/849589019364294657/image0.jpg
Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [x] Anyone can implement this feature
ee15cec Adds Missing Docstrings - HassanAbouelela
b9fe560 Refactors FormPage - HassanAbouelela
[python-discord/forms-frontend] New branch created: display\-test\-failures
if isinstance(value, dict) and len(value.keys() == 0):
This line took me longer than I care to admit to comprehend, something more explicit like this could be useful. Going to approve anyway, since it might just be me.
not value could work as well
[forms-frontend] Branch display\-test\-failures was force-pushed to `f74c074`
[forms-backend] Branch unittest\_failures was force-pushed to `5e64af5`
Wat- am i hallucinating then? I remember getting reviews telling me to do that on one of the pr's
Ok, so some are and some aren't; the inconsistency can be very misleading (just like as I got misleaded). If no trailing commas is considered the better way, we should modify that all over Lance
After the spring cleanup mess PR we concluded that things would be changed as and when needed, rather than in a batch of 60 files at a time (although I cant say I think removing trailing commas is a good idea, since they're useful and best practice I thought)
Feel free to remove this decorator.
@Kronifer are you planning on finishing this PR?
Either way, I approve of this occurring.
Move into constant at top of file.
The command does not work correctly when given a pride leader. Example: .pl Alan Joyce.

Additionally, I don't think the error embed should the wiki info for an unavailable leader. Perhaps a message saying to contribute to the list instead?

Neat work otherwise.
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
title=f"No search results found for {search_query}",
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
We may not want the title to have the user's query, as it'll take up some of the characters that can be used later.
With your current approach, you store the cached unloads into a dict, then remove successfully unloaded cogs from the dict in load_extension, then compare the dict with the cached unloads to find missing cogs.
A better solution would be to just go ahead with loading the extension (and checking presence in the cache before loading), and storing a set of successfully unloaded cogs instead. Then, you can get all the unloads from the cache and clean up the ones that were not in the successfu...
Are these for local testing? They should not be left in production.
Is this guaranteed to run after all the extensions have been loaded?
You should be able to get the message link for an extension straight from the rediscache without having to get the whole cache as a dictionary.
lak never responded- i'll think up a new question and replace it
@Kronifer @ToxicKidz all your changes have been implemented.
@vcokltfre Then we should have a vote. In any case, this inconsistency is not good. It's either "PURGE THEM ALL" or "TRAILING COMMAS 4 LIFE"
Here are my thoughts on these end-trailing commas:
- Some argue that such a miniscule change won't affect readability and instead simply adds extra stuff, but I think that it makes code more symmetrical and pleasant on the eyes (all lines will have the same format).
- Easy extendability: if one needs to add one more entry, this will largely decrea...
Description
There is a project-wide inconsistency within Sir Lancebot's code. For multiline data structures and function calls such as
foo = [
"yeet",
"cat",
"lololol"
]
, some people think we should add a trailing/"dangling" comma at the last line while others don't.
In the code, there are instances where the dangling comma is used and instances where it is not. This can be misleading for new people wanting to contribute (such as me, last time I was discu...
number 2 can just be avoided by not being stupid
copy-pasting code for an open source contribution is frowned upon unless you wrote it somewhere else
@Kronifer for number 2, everyone make mistakes. For number 3, I mean this kind of copy-paste https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
So there shouldn't need to be a discussion about this nor should we have to go back and update our codebase.
Dangling commas should be the standard, see PEP8. It also ensures the git blame is accurate if someone adds another option to an already existing list.
Our style guideline falls back to PEP8 for this, so there really isn't a need for a discussion about this.
Please see what PEP8 has to say about trailing commas: https://www.python.org/dev/peps/pep-0008/#when-to-use-trailing-commas. Our style guidelines falls back to PEP8 and regardless trailing commas are good since we use version control and they ensure the git blame is accurate.
@janine9vn currently it's not the standard. Should we do a project-wide refactoring?
No. Adding trailing commas isn't critical enough to warrant a project-wide refactoring. Those types of PRs are generally bad ideas and hell to review. While we try to maintain a standard this is still Sir Lancebot, which is a project designed for new people to learn how to contribute to open source projects. It's not critical that we follow the style guideline 100%, but when noticed we should try to follow it and make sure the code follows it.
alright, but regarding that code refactoring... currently there are a lot of places where the dangling comma is not used
alright, but regarding that code refactoring... currently there are a lot of places where the dangling comma is not used
And that's okay, it doesn't mean we need to go back and fix every small little mistake. We'll fix it moving forward as people open PRs to fix/change/update/extend existing code.
@janine9vn
While we try to maintain a standard this is still Sir Lancebot, which is a project designed for new people to learn how to contribute to open source projects. It's not critical that we follow the style guideline 100%
I noticed the same kind of inconsistency in our main bot project as well... would that be not worth a refactoring either? I'm sure this can be automated with some more Python Magic :tm:
Looks/tests good to me! Any issues I've missed should surface when we implement the bot side of things.
Yeah these are for local testing, I have hence left a comment over that and in the PR description. I will remove that before it gets merged.
Is this guaranteed to run after all the extensions have been loaded?
It should, yes, and while testing it did.
Yeah, the event loop gets ran after the bot instance is created
With your current approach, you store the cached unloads into a dict, then remove successfully unloaded cogs from the dict in
load_extension, then compare the dict with the cached unloads to find missing cogs.A better solution would be to just go ahead with loading the extension (and checking presence in the cache before loading), and storing a set of successfully unloaded cogs instead. Then, you can get all the unloads from the cache and clean up the ones that were not in the suc...
No, it's not worth refactoring on any of our projects.
Minor modifications like this can be amended as and when the code is touched, if we have automated PRs with hundreds of lines changed then it just results in conflicts that someone has to work out. It's the same thing as typehints, we're not going to retroactively upgrade them to 3.9 style (dict[str, str] vs. typing.Dict[str, str]) because it doesn't bring us anything, it just adds extra labour for the poor soul who has to ensure t...
If you normalize the leader name here, embed_builder still gets the unnormalized leader name. Example: .pl tim cook raises a KeyError.
I recommend taking in the leader dict instead of the name. Since the input validation gets the dictionary from the resource, you don't have to access it twice. Choosing a random dictionary (in pride_leader()) is also simpler than choosing a random name out of a list built from dictionary keys, then getting the same dictionary using the name.
Would that be an issue? It wouldn't be much unlike how you're getting the unloaded extensions after all. I'm not an async expert though
Would that be an issue? It wouldn't be much unlike how you're getting the unloaded extensions after all. I'm not an async expert though
Not really but I would need to add await/async in the some places (The extensions cog, and bot/__main__.py probably).
@jb3 alright. Thank you for explaining this, I didn't realize that this kind of refactoring can arise conflicts.
No, as im not sure this was explicitly approved.
I like the idea of having tags separated into meaningful groups. I'd like to be able to do !tags to get a list of all tags, separated by group, along with !groupname to get a list of tags in that group.
async def reverse_photo(self, ctx: commands.Context) -> None:
Same comment as above
After some discussions with other mods, we have decided that we don't like the idea of users being allowed to upload arbitrary images and have the bot parrot them. This is a policy decision we are going to stick to going forward, along with removing similar features like this that are already in the bot.
As such, could you please delete this part of the cog, update the doc string to reflect this changed behaviour, and remove the unused import.
async def reverse_text(self, ctx: commands.Context, *, text: str) -> None:
Since this cog is quite big already, I think we should namespace these function names, so we don't get into a similar issue as before with re-using a function name and having errors.
Since you have the name="test" part in the decorator, changing the function name here won't impact actual usage of the command.
Definitely agree, helpers are already allowed to add people to the talent pool so why not edit. If we really wanted to we could only allow helpers to edit their own nominees. But that's just an idea.
@InvisibleOS Hey so is this ready to be implemented, if so then feel free to make a pull request for the command so we can get it pushed.
@Xithrius removed guild_only and checked on local, seems good!
This PR was not discussed before opening in any capacity. Please do so next time by opening an issue. Must be approved by a core developer before proceeding further.
For more information, please look into our contributing guidelines.
Update on this: waiting on #1567 since it adds a bunch of stuff in redis that will be used for this too
c1bc176 fix: spell event correctly - vcokltfre
6259986 fix: lowercase coroutine - vcokltfre
GitHub Actions run 906227381 succeeded.
GitHub Actions run 906231556 succeeded.
GitHub Actions run 906231559 succeeded.
c8e7eec chore: ensmallen the star-imports tag - vcokltfre
[python-discord/bot] New branch created: vcokltfre/chore/star\-imports\-smallening
This PR removes a bunch of blank lines to make the star-imports tag smaller, discussed [here](#dev-contrib message)
Before:

After:

Any chance to make this absolute unit of a tag smaller is a great subtraction.
# Using a dictionary instead of conditions to check for the winner.
Why not just have the contents of this function be within the command?
[python-discord/bot] branch deleted: vcokltfre/chore/star\-imports\-smallening
Connected!
Early WIP PR, so people can comment on resource tags.
be9cb47 EH Tests: Created test cases set + already hand... - ks129
8229d21 EH Tests: Created test for CommandNotFound er... - ks129
28e8321 EH Tests: Remove class member cog + other sma... - ks129
3ea33bc Error Handler: Changed CommandNotFound error ... - ks129
28e962b Test Helpers: Added new attribute to MockContext - ks129
63c3f81 Removed unused import. - Xithrius
f168c05 Cooldown role only removed when help channel cl... - swfarnsworth
734e4ef Prefer using the package name as a prefix when ... - Numerlor
b6ccd03 Prioritize symbols depending on their group's p... - Numerlor
f00fe17 Add the doc group to FORCE_PREFIX_GROUPS - Numerlor
ec6aac5 chore: use new moderators role - vcokltfre
I have removed them in new commit. Thanks.
Connected!
have moved the code base to command directly.
if player_result == 0:
message_string = f"{player_mention} You and Sir Lancebot played {bot_move}, it's a tie."
await channel.send(message_string)
elif player_result == 1:
await channel.send(f"Sir Lancebot played {bot_move}! {player_mention} won!")
else:
await channel.send(f"Sir Lancebot played {bot_move}! {player_mention} lost!")
@RohanJnr do you still need this PR to exist?
Tested and all looks good to me!
Backwards compatible too, so can be merged before the bot PR
[bot] Branch ks123/goodbye\-talentpool\-channel was force-pushed to `3c4cbd3`
Tested and all looks good to me!
Backwards compatible too, so can be merged before the bot PR
Tested and all looks good to me!
Backwards compatible too, so can be merged before the bot PR
7df4b05 Add permanent, types, and expires_at filters to... - bast0006
ea5a20a Add tests for new filters on bot/infractions en... - bast0006
f53e275 Add a test for ordering infractions returned fr... - bast0006
e3696a3 Add tests for failure states of expires_before... - bast0006 [b9f2589`](https://github.com/python-discord/site/commit/b9f2589c7b2b5f171c47f1a614229ff999341b29) Raise ValidationError for new bot/infractions f... - bast0006
Relevant Issues
Description
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read the contributing guidelines?
In my test, this PR works. Needs more testing and more eyes.
Relevant Issues
closes #759
Description
Now our README.md will directly redirect to respective link of contribution instead of empty Contribution.md
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read the contributing guidelines?
Connected!
We should be using await ctx.send() instead of await channel.send() after setting channel to ctx.channel.
We should be using
await ctx.send()instead ofawait channel.send().
Yeah I think we can do that as this is kinda 1 time command. Great, I'll change it asap and recheck.
Pretty neat, I like the dict implementation for deciding the winners ๐๐ป
Just some minor comments
I don't think this is necessary, as you've not given move a default. So this case can never occur: if a move was not specified, a commands.MissingRequiredArgument error will be raised which will be handled by the error handler
Grammar nitpick, not really necessary to be changed
"""Load the RPS Cog."""
Turns out this got resolved the second I commented this ๐
Haha, I heard it from future and changed it before you mention!
5f7abe9 Add pride leader cog and resources. - Shivansh-007
9ff3d04 Add link to wikipedia in error embed and inform... - Shivansh-007
1c6bcfd Apply requested grammar changes. - Shivansh-007
8e6e27c Give more information in function doc-strings - Shivansh-007
f6d8a3f Remove redundant code - Shivansh-007
Connected!
0ed7df8 Install Poetry globally in Docker - ChrisLovering
[python-discord/sir-lancebot] New branch created: poetry\-in\-docker\-bug\-fix
Description
The previous way would error out when building due to not being able to find a file on the overwritten
path. https://paste.pythondiscord.com/alixoqaxuc.py
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] Ensure there is an issue open, or link relevant discord discussions?
- [ ] Read the [contributing guidelines](https://pythondiscord.com/pages/contributing/contributing-guid...
Connected!
This should come out as an error
raise commands.BadArgument(f"Invalid move. Please make move from options: {', '.join(CHOICES).upper()}.")
There are two things that should be changed:
- Single quotes are being used at the top of the file, however, our style guide says that we should prefer double quotes over single quotes.
- Change the spelling of
scissortoscissors.
Sentry Issue: BOT-136
The command may raise a LockedResourceError (perhaps among other things). Normally, the command error handler will take care of this, but I suppose the error handled doesn't get triggered because this is a manual ctx.invoke call. Not sure on the exact cause of this. In any case, it any errors raised should be redirected to the command error handler again.
"""Rock Paper Scissors. The Classic Game!"""
"""Play the classic game of Rock Paper Scissors with your own sir-lancebot!"""
8633eaa Update IntegrityError pattern for PostgreSQL 13. - jchristgit
[python-discord/site] New branch created: update\-integrity\-pattern\-for\-postgresql\-13
A more specific error is raised on higher PostgreSQL versions, for example, as
with the PostgreSQL version running on my local machine. This commit fixes the
error message pattern matching behaviour by adding an optional match to the
detailed error message.
Ideally we would not rely on comparing message strings, but there doesn't seem to be any other source of information that is more stable. At best, we might be able to get an error code, but still wouldn't know the column name.
https://github.com/psycopg/psycopg2/blob/master/lib/errorcodes.py#L236
c57c6c3 Fix content app tests not running on macOS. - jchristgit
[python-discord/site] New branch created: fix\-content\-app\-tests\-on\-macos
[site] Branch fix\-content\-app\-tests\-on\-macos was force-pushed to `46e9261`
macOS uses /var/... as its temp directory, causing issues with the hardcoded
usage of /tmp as the temporary directory. As /tmp is also used in some
tests (for now), population of the directory is done regardless.
I have also attempted completely removing the /tmp path in tests in favour of
the platform-specific temporary directory, however, with the current
implementation if directory traversal for wiki content, this is currently more
complicated to implement (in the tests) th...
Is it feasible to remove this and instead always populate the platform-specific dir? You'd have to change any uses of /tmp to self.os_tmpname but the tests should have access to that attribute without any trouble.
Yes, well, sort of. I've tried doing so, but it start looking into subfolders of the platform-specific directory. As mac has a nesting of folders in /var/, this crashes in test_get_context_data_for_category_with_page:
$ python manage.py test --no-input --force-color pydis_site/apps/content/tests/
System check identified no issues (0 silenced).
.E..................
======================================================================
ERROR: test_get_context_data_for_category...
Doesn't that mean that the populate function doesn't correctly populate that directory? In such case, this starts to feel a bit like a hack since the data is just good enough to not fail despite technically not being correct.
And what about your idea to use a subdirectory as the root?
Yes, but also no.
The problem is that when you make it populate the subfolder and the subfolder only (e.g. the result of tempfile.gettempdir()), it starts breaking because it expects an _info.yml in the top-level directory:
...
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/var/_info.yml'
...
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: 'var/_info.yml'
... so there doesn't seem to be a "one...
That said, I'd also be open to just skipping the test when tempfile.gettempdir() != '/tmp'.
e002c2c Include metricity database creation for local s... - jchristgit
[python-discord/site] New branch created: include\-metricity\-db\-creation\-for\-local\-setup
[site] Branch include\-metricity\-db\-creation\-for\-local\-setup was force-pushed to `ef3afdf`
This is later mentioned in the connection string, but in the local setup, the
SQL statement to create the database was missing.
that currently appears to be the most work
What does it involve? I was under the impression you'd just have to prefix all the paths used in tests with the subdir name.
That said, I'd also be open to just skipping the test when
Not sure, but I think it's preferable to run all tests if possible, and it is with the current solution; it's just the most ideal solution.
[python-discord/site] New branch created: update\-config\-docs
When I started the Django app in January 2019, I documented a setup guide and environment variables for local configuration of the app here. These were lacking the new $METRICITY_DB_URL environment variable. The setup.md file was also changed to simply be a symlink to the current contributing guide for the site.
What does it involve? I was under the impression you'd just have to prefix all the paths used in tests with the subdir name.
Yes, that's correct - more specifically, os_tmpname is just adjusted to be the complete path obtained from tempfile.gettempdir().
That said, I expect that moving into the temporary file directory to create the files in subdirectories and below should be a bit more involved, especially as the logic of the tests would need to be updated accordingly. That also ...
I will assume that you meant "it's just not the most ideal solution"
Yes, I did. Sorry.
That said, I expect that moving into the temporary file directory to create the files in subdirectories and below should be a bit more involved, especially as the logic of the tests would need to be updated accordingly.
I don't see why it would be more involved. It all seems straightforward to me, and there aren't even that many tests. I'll try to play around with it.
0c7a75a Move fake content under a subdirectory - MarkKoz
[site] Branch fix\-content\-app\-tests\-on\-macos was force-pushed to `9d59fd5`
Okay, that wasn't too bad. Let me know what you think of this approach. BTW we should probably just squash this PR when merging.
Connected!
current behaviour
if the bot tries to embed lines from a GitHub link with a line count over 15 or more than 2000 characters it silently fails, not responding with anything.

proposed behaviour
there should be a response with at least some lines, ideally containing some notification that lines were omitted
 as _: BASE_PATH = Path("res")
This code specifically was the missing piece for me.
I've tested this on my Mac and it works fine. Thank you!
Thanks for reporting and @MarkKoz for writing the fix. I don't have macOS so I can only test it on my machine but it works fine.
Connected!
[python-discord/site] branch deleted: update\-integrity\-pattern\-for\-postgresql\-13
Do we even need a docs/ directory at this point, since all of the configuration here is essentially duplicated in the contributing guide?
[python-discord/site] branch deleted: include\-metricity\-db\-creation\-for\-local\-setup
Yes, but also no. The setup.md now links to the contributing guide. However, the configuration information is not part of the contributing guide. That said, I'm not sure how important the configuration information is for someone starting to contribute, as the setup guide documents how to run the app locally & configuration.md mostly documents additional options.
Is configuration.md not essentially this section right here?
The only variables I see that are missing in the contributing guide are LOG_LEVEL and ALLOWED_HOSTS, both of which I doubt is much used for testing (although I have 0 qualms with adding them to the site guide).
Is configuration.md not essentially this section right here?
Partially, yes. config.md was made to explain what the environment variables actually do, whilst the setup guide mostly recommends what to set it to. I'd be open to moving the explanations of config.md to the contributing guide.
I'll discuss this with the core devs then get back to you, thanks for the other minor enhancements by the way!
Almost everything I've tried works to my expectation (almost merged it :x), but |silence forever only silences the channel for the fallback 10 minutes. I suspect this has something to do with dpy's parser, would you mind looking into it?
@Kronifer I've assigned you the issue that this PR addresses, so you can continue work on it whenever. I'm going to close this PR for now as I don't think a sponsor image addition warrants this many changes/commits.
@kosayoda thanks for your review, good catch! I missed adding in the behavior for that argument when redesigning the first argument, but I've fixed that in f92338ef.
Sentry Issue: SIR-LANCEBOT-5M
AttributeError: 'PrideAnthem' object has no attribute 'anthems'
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/pride/pride_anthem.py", line 42, in prideanthem
anthem = self.get_video(genre)
File "bot/exts/pride/pride_anthem.py", line 27, in get_video
return random.choice(self.anthems)
U...
Sentry Issue: SIR-LANCEBOT-5K
AttributeError: 'PrideFacts' object has no attribute 'facts'
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/pride/pride_facts.py", line 85, in pridefact
await self.send_select_fact(ctx, option)
File "bot/exts/pride/pride_facts.py", line 60, in send_select_fact
await target.send(embed=sel...
9bdd47a chore: Use constants instead of instance variab... - ToxicKidz
[python-discord/sir-lancebot] New branch created: fix/attribute\-errors
Relevant Issues
Closes #766
Closes #767
Description
When some instance variables were changed to constants, these were forgotten.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read the contributing guidelines?
5f7abe9 Add pride leader cog and resources. - Shivansh-007
9ff3d04 Add link to wikipedia in error embed and inform... - Shivansh-007
1c6bcfd Apply requested grammar changes. - Shivansh-007
8e6e27c Give more information in function doc-strings - Shivansh-007
f6d8a3f Remove redundant code - Shivansh-007
GitHub Actions run 909559869 was cancelled.
GitHub Actions run 909560387 succeeded.
812ab67 Collapse resources into one directory, migrate ... - swfarnsworth
[python-discord/site] New branch created: swfarnsworth/smarter\-resources/update\_labels
[python-discord/site] New branch created: md\-link\-fix
@jchristgit The consensus is in favour of removing the docs/ directory and moving the knowledge to the site contributing guide. Would you be willing to create a PR for that?
Connected!
Description
Over time, this project's test suite has grown to be very large, and so too has its operation time. On my machine, the test suite currently takes about 80s to complete. You can see a full breakdown here.
This issue proposes parallelization to help shorten the run time of tests.
Approaches
Naturally, there are many ways to go about doing this, each with varying degrees of difficulty.
Approach 1: [unittest-parallel](ht...
I'm fine with using it as just a runner.
As for using pytest fully, I'll paste what I wrote before in Discord:
We have developed a bunch of utilities that are tightly coupled to unittest, so we would have to maintain pytest equivalents where necessary unless we rewrite all existing tests. Maybe they would still work with pytest, not sure.
I think it'd be awkward to have tests written in two different libraries. Also my point about maintaining utilities (mostly mocking stuff) for...
This was tested on my linux machine as well, works as expected.
8633eaa Update IntegrityError pattern for PostgreSQL 13. - jchristgit
ef3afdf Include metricity db creation for local setup g... - jchristgit
a9df3b0 Merge pull request #518 from python-discord/upd... - kosayoda
14ba0e9 Merge branch 'main' into include-metricity-db-c... - kosayoda
27c2b9f Merge pull request #520 from python-discord/inc... - kosayoda
512bd17 Fix content app tests not running on macOS (#... - jchristgit
[python-discord/site] branch deleted: fix\-content\-app\-tests\-on\-macos
The django/python docs conflict has been solved in #1606. I've updated your issue to reflect the tag suggestion.
@mbaruh Are you still planning to work on this issue? The only point I see that it's worth adding currently is point 1.
With the current help channel idle minutes, this is a non-issue.
Is this still a feature that is wanted?
The stance on this as of now is that there doesn't seem to be a large pushing reason to do this change, even after 2 years.
If someone really wants to implement this, then this issue can be re-opened.
@ToxicKidz What's your status?
I'll go ahead and take care of this one. Already have a couple of ideas on how I want to address it.
@MrHemlock Do you still remember those couple ideas?
I think this feature should be implemented, and I'll probably just go ahead and do it.
Any other suggestions for file formats that would be zapped but still given the suggestion for our paste service?
Closing this as a new one will be opened for #1603 .
Closing PR as a new one will be opened for bot#1603
[python-discord/bot] New branch created: new\_zapped\_formats
a71d37b Allowed text format warning to have multiple fo... - Xithrius
Closes https://github.com/python-discord/bot/issues/943
Users sometimes post .csv or .json files without being redirected to the paste system.
This PR resolves that issue by still deleting their file, but mentioning what file got deleted, which file extension it contained, and how they can access our pasting service.
- [x] Functionally works after posting text, JSON, and Comma Separated Value files.
- [ ] Tests written.
@mbaruh Are you still planning to work on this issue? The only point I see that it's worth adding currently is point 1.
As far as I'm concerned we can close this and open a separate issue for point 1.
Agreed with Mark, while pytest would have been perhaps nicer at first switching now sounds pointless, having parallel tests would be quite handy.
How does the output looks with pytest-xdist? If if doesn't look like an hot mess because of parallelization, it should be good to go in my opinion.
Current behavior
If a !docs invocation cannot find the appropriate symbol, the invocation and the bot answer is deleted after a few second, even if the message was a ping reply or contained a ping, which lead to a ghost ping.
Suggested behavior
The bot answer is or is not deleted (maybe we can just have a :x: reaction instead?) but the message stays to avoid getting a ghost ping (only if it contained a ping).
@Akarys42 I included that in my original discord writeup, but omitted it here for brevity. In short, it really doesn't matter because the current output isn't all that great tbh. The only thing that truly sucked was unittest-parallel, but I won't be including it in this report. (You should really be looking to integrate some sort of proper test result display tool into your dev workflow regardless of the test runner)
Current unittest output is . to represent success, some other charact...
For the purposes of not anihlating this discussion thread, I've hidden my reply to Akarys' comment, but it's still there.
The output seems decent enough, it is better than our current one for sure
Any thoughts on moving the text like extensions to a resource file and dumping a longer list of text extensions that may show up? Or do we only want to handle the ones that pop up regularly in the server.
This should be changed to include the other text like files
The _str in the replacement field name feels redundant to me
Same as above, should include the other extensions in some way
@jchristgit The consensus is in favour of removing the docs/ directory and moving the knowledge to the site contributing guide. Would you be willing to create a PR for that?
Yes, I'd be happy to do so. I'll try to do that today, if that doesn't work, it'll chime in here next week
Sentry Issue: SIR-LANCEBOT-5N
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/halloween/scarymovie.py", line 27, in random_movie
selection = await self.select_movie()
File "bot/exts/halloween/scarymovie.py", line 50, in select_movie
params["page"] = ra...
[python-discord/site] branch deleted: update\-config\-docs
[python-discord/site] New branch created: move\-config\-docs\-to\-contributing\-guide
a56e02b Create issue template for resource suggestions. - swfarnsworth
[python-discord/site] New branch created: swfarnsworth/resource\_suggestion\_template
Here's a template for incoming resource suggestions. It prompts the individual to provide some information about the resource, though the information that I think can most easily be inferred (like topic or type) or which I think should be left up to the reviewers (like difficultly level) are omitted. We might go with a different template before we start actively encouraging people outside the staff to start submitting resources.
[python-discord/site] branch deleted: swfarnsworth/resource\_suggestion\_template
222b330 Change to unless-stopped restart policy - ChrisLovering
[python-discord/bot] New branch created: docker\-compose\-restart\-policy
7c2b74e Change to unless-stopped restart policy - ChrisLovering
[python-discord/sir-lancebot] New branch created: docker\-compose\-restart\-policy
Since we use the same port for redis, site and postgres on all out projects, having this always restart causes conflicts for people starting up docker and wanting to any of those for any other projects.
Description
Since we use the same port for redis on all out projects, having this always restart causes conflicts for people starting up docker and wanting to use redis for any other project.
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] Ensure there is an issue open, or link relevant discord discussions?
- [ ] Read the [contributing guidelines](https://pythondiscord.com/pages/contri...
[sir-lancebot] Branch docker\-compose\-restart\-policy was force-pushed to `ac50736`
LGTM! Should be good when Numerlor's comments are addressed
[python-discord/bot] branch deleted: docker\-compose\-restart\-policy
[python-discord/sir-lancebot] branch deleted: docker\-compose\-restart\-policy
Connected!
Connected!
For readability, I think the multiple-choice answers should be displayed on separate lines
Perhaps simply alpha would be good as an accepted value here too
This should probably also have the non-acronym version of the answer in case someone says it, so simple mail transfer protocol
ah right, to be consistent with "MX, mail exchange" as well.
i agree with the last part, the question should be phrased better.
@vcokltfre The changes will be implemented later, currently I gotta update my website lol :D
Resolved in a305d3983350fbf30b873fce76a44707b549fd55.
Resolved in aeaef8ff604c9ea62fdf1602200ee87f2adf7f6a.
Resolved in aeaef8ff604c9ea62fdf1602200ee87f2adf7f6a.
(It seems this comment was not added in the review)
This question doesn't make a lot of sense.
Got it, will replace
lak please explain
13442f8 Switches To Pytest As Test Runner - HassanAbouelela
[python-discord/bot] New branch created: xdist
Closes #1622
This PR makes a few changes to the way tests are handled:
- Switches to pytest purely as a test runner.
- Adds pytest-xdist
- Switches to pytest-cov to generate
.coveragefiles, but leaves coverage.py to process them.
The last point about pytest-cov is due to the simple fact that coverage.py doesn't support xdist as far as I could tell, and pytest-cov did not support manipulating the data after the fact. The intention here is to minimize any changes one might experie...
Converted this PR to a draft while I figure out why we lost 10% coverage
I figure it's because I've excluded tests from source, hence an overall decrease in coverage. I don't think it makes much sense to have that, since you aren't testing your tests, but I'm willing to hear other's opinions.
I've made another change. I split the test task into two: fast-test and test. test is unchanged, but fast-test has been added to run the tests without coverage, since including coverage can take up 2x the time.
As a sidenote, I now realize the original numbers in the issue are incorrect, as they included coverage for unittests, but not pytest. I've updated the numbers there to reflect that.
Can we have a link mentioning this new details section from the 2. Environment variables section?
Is this still true given our current STATIC_ROOT default?
Afaik the reason to include the tests themselves in the coverage report is that it becomes easier to find test code that wasn't used, or tests that didn't run, when they probably should have. You may also find yourself patching in a block of code that mocks something and is defined in the tests package; seeing coverage for it may be useful.
I don't know how compelling these arguments are to you, but I remember them from reading Ves' docs on the testing utils they had prepared.
The line above says "two scripts" but it is four now.
I think a resource file for textfile extensions would be overkill. In reality, even .csv and .json file uploads are few and far between, so I think this solution is perfectly fine for now.
Or maybe just three. :smile:
[python-discord/bot] branch deleted: new\_zapped\_formats
a71d37b Allowed text format warning to have multiple fo... - Xithrius
4edecf6 Added .txt file extension to antimalware test. - Xithrius
d510a6a Added subtests for .txt, .json, and .csv ... - Xithrius
aeaef8f Added new formats to unittest docstrings. - Xithrius
a305d39 Renamed blocked_extension_str to blocked_extens... - Xithrius
Rationale
If the !user command targets a non-moderator in a moderation channel, make the infraction history directly accessible using a reaction. Currently, we almost always combine !user with !infr search and this change would make the infraction history directly accessible from the !user embed while taking up less vertical space.
Connected!
- What part of python is currently dieing?
There is trailing whitespace at the end of this line which is causing the linting error.
Also you can check linting errors in the machine before committing to getting rid of them if there are any by running poetry run task lint.
Connected!
Thanks for the PR, can you please capitalize Python and Python Discord?
I'm not a fan of this question, would you mind either rewording it or removing it?
- What's your favourite aspect of python development? (Backend web dev/game dev/machine learning and AI etc)
Suggested change:
Is python your first programming language? If not, what is it?
Did you mean etc at the end? change it to etc. and you should be ok.
dieing is spelled wrong, it should be spelled dying
@ShakyaMajumdar Hello, are you planning on continuing work on this PR?
The current game loop is fragile.
DEFAULT_QUESTION_LIMITis hardcoded to 6 in 4430760c, which seems to be because there are only 7 questions in theretrocategory.- Using the default question limit bypasses the topic length check
- The game loop only ever exits if the number of done questions go above the question limit
- The current question is retrieved in an infinite loop calling
random.choiceon the available questions and checking if it's done
These points result in the...
Missing a space between Congratulations and on winning.
def mod_arith(q_format: str, a_format: str) -> QuizEntry:
These methods should be staticmethods. They're causing TypeErrors due to unpassed positional arguments.
Is this going to repeat indefinitely if for some reason the wikipedia API cannot be accessed?
I see no point in letting this sit further, so I'll be merging this. I wholeheartedly agree with Scale, so keep his points in mind for future PRs.
Connected!
Description

The !ttt history show command displays the past state of a game in an embed. Currently, the embed does not account for draws, and instead assumes that every game has a winner and a loser.
The embed should display a draw condition similar to how the !ttt history command itself does it.
Would you like to implement a fix?
- [ ] I'd like to implement t...
Description

The !ttt command currently has a is_requester_free check, which ensures that players cannot run more than one game at a time. To reproduce, run .ttt and then while the game is still running, run .ttt again.
However, the check does not check for games played against the AI class when getting the Discord user for a player in each game, resulting in an A...
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
I just added it so that the code doesn't raise the error, because practically no-one would ever hit this error. Probably.
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
logger.error(f'Status code is not 200, it is {response.status}')
await ctx.send(embed=ERR_EMBED)
return
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
stackoverflow_tag = environ.get('stack_tag', "<:stack_tag:*> ")
stackoverflow_views = environ.get('stack_views', "<:stack_eye:*>")
[python-discord/sir-lancebot] New review comment on pull request #583: Add the stackoverflow command
All setup docstrings should be consistent with Load the x Cog.
"""Load the Stackoverflow Cog."""
Two small comments left, rest looks good :)
This needs to be updated to match the new behaviour
I feel like this should be the default behaviour of .reverse so if a user doesn't so .reverse text <some text> it defaults to reversing their avatar, rather than requiring them to do .reverse image
Resource location
https://regex101.com/
Payment type
Free, but solicits donations
Why it should be included
We don't currently have any regex resources, and it looks like this one combines both regular expression testing (as a tool) and interactive regex tutorials.
I've always used pythex, which is just an expression tester with a syntax cheat sheet, but this seems to have more features and is the one I've seen more staff members using.
**Po...
194cc06 Update HTML Element handler comment - dawnofmidnight
Hello, good point, no, that's outdated, you're correct. This is from the very early pre-Docker times. I will update it.
ef59812 Address review comments. - jchristgit
I've added a link to the section from "Environment variables" and updated the static path.
Might it be worth mentioning that with Docker, certain environment variables aren't necessary and handled for you? (and list those)
Might it be worth mentioning that with Docker, certain environment variables aren't necessary and handled for you? (and list those)
Yes, I agree. However, isn't this already documented that way? The environment variable section is a subsection "Without Docker", and mentions that additional steps are needed there.
I don't understand the point about files in the tests directory not running. How does a test not run? How does that make it past review? Helpers make more sense, but I don't know if it's a compelling enough reason to add tests as a src.
Regardless, adding them is the path of least resistance, so... fb053e4.
Yes, I agree. However, isn't this already documented that way? The environment variable section is a subsection "Without Docker", and mentions that additional steps are needed there.
I forgot it was under "Without Docker", my bad.
e45843e Fix Script Count In Documentation - HassanAbouelela
Counting is hard. e45843e
a71d37b Allowed text format warning to have multiple fo... - Xithrius
4edecf6 Added .txt file extension to antimalware test. - Xithrius
d510a6a Added subtests for .txt, .json, and .csv ... - Xithrius
aeaef8f Added new formats to unittest docstrings. - Xithrius
a305d39 Renamed blocked_extension_str to blocked_extens... - Xithrius
GitHub Actions run 916006541 succeeded.
GitHub Actions run 916009585 succeeded.
GitHub Actions run 916012590 succeeded.
And now the coverage has jumped up 5 percent...
I'll just let it be for tonight.
I'm absolutely a beginner to open source but good with python. I figure I can solve this bug if assigned to this issue.
closes #1567
This PR is for the help channel participant DMs, me and Griff went on and tested this in and we ran into no problems at all, we even went as far as testing it with multiple people.
This is the embed that the user receives in DMs.

Also added feedback if the user already has help DMs turned on already(this is the same for when the user turns them off)
 == "on"
if requested_state_bool == await _caches.help_dm.get(ctx.author.id, False):
where requested_state is the string yes or no from the function args. This if wil...
Instead of overwriting the value with False, maybe we can just remove them from the dict entirely?
That way, this cache only includes those that have opted in
Just a few comments,. overall looks pretty good :D
We don't really need this else block now, it can be removed, and the code moved up to elif block above.
We should also remove the first if block in update_message_caches() since we now check it here.
c998d47 Move subdomains to query paths. - jchristgit
[python-discord/site] New branch created: subdomains\-to\-query\-paths
841efa3 Kill subdomains from configuration file. - jchristgit
[python-discord/bot] New branch created: kill\-subdomains
This will need a coordinated rollout with @jb3, in order to make the
appropriate changes in Kubernetes beforehand.
Needs coordinated rollout with https://github.com/python-discord/site/pull/526 and @jb3.
After reviews are OK on the pull requests, @jb3 needs to perform updates to the Kubernetes deployment.
Per our DM on Discord:
bot needs to be told to call site.default.svc.cluster.local and append /api onto that
we don't need a separate DNS record anymore because we're not doing subdomains
so we can do away with that ingress route and the internal API service
Adding as assignee to keep track of it.
@camcaswell thanks for your thorough review!
Here's a question I should have raised before: what topic does regex fall under? I'm thinking of putting it under both "other" (because they're useful in general but aren't a core programming skill) and "data science" (because I know I use them for data science). Do you think it belongs under any others?
Maybe UI/UX and Webdev Front-end, since regex is commonly used for user input?
@CasualCoder99 Go ahead!
There are two issues here
-
Firstly, on line https://github.com/python-discord/sir-lancebot/blob/0a6a355419d9382b35ac651117287d907e98af0c/bot/exts/evergreen/tic_tac_toe.py#L233 it access
game.channelwhich isn't an attribute theGameclass. -
Secondly, the one pointed out by the issue, a simple fix for that could be to add a
if isinstance(player, Player)when you are checking if the author exists in the game players or not.
Summing it up,
--- a/bot/exts/evergreen/t...
This issue can be closed, see #623
A possible way for doing this is by going through each message in the user DM history and checking if the message is an embed and if so it has the title of Bookmark.
This has been stale, as it is waiting for #1527 to be merged.
Unrelated to regex101, but what I used to learn was regexone.com - I feel like it is much more approachable as a beginner to get started with regex (it is an interactive course)
A simple and straight forward change, looks like the right idea. I don't comb through every single line of code but if tests are passing and manual testing looks good, this seems fine to me.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #771
Description
In tic_tac_toe.py, I changed the description being returned in the embed for the show_tic_tac_toe function from -
description=f"{game.winner} :trophy: vs {game.loser}\n\n{game.format_board()}"
to -
`description=f"{game.winner} vs {game.loser} (draw)\n\n{game.format_board()}" if game.draw else f"{game.winner} :trophy: vs {game.loser}\n...
Thanks for the contribution!
As stated in the linting error, this line is a bit too long because of the ternary, perhaps we can shorten it by extracting description into a variable.
if game.draw:
description = f"{game.winner} vs {game.loser} (draw)\n\n{game.format_board()}"
else:
description = f"{game.winner} :trophy: vs {game.loser}\n\n{game.format_board()}"
1827f5f feat: make quackstack package-ready - vcokltfre
[python-discord/quackstack] New branch created: vcokltfre/feat/package\-ready\-rewrite
This PR makes quackstack ready to be used as an importable package and ready to be distributed on PyPI. This is a draft PR for the time being because I intend to also add the command-line generation as part of this PR, in addition to writing substantially more documentation on how to use both the HTTP API and programmatic API.
Thanks for the help. I've made the commits removing the ternary operators.
Sorry I wasn't clear. This is invalid syntax, what I meant was:
if game.draw:
description = f"{game.winner} vs {game.loser} (draw)\n\n{game.format_board()}"
else:
description = f"{game.winner} :trophy: vs {game.loser}\n\n{game.format_board()}"
embed = discord.Embed(
title=f"Match #{game_id} Game Board",
description=description,
)
Other than the changes mentioned by Chris, this looks good!
This line needs to be indented to the same level as embed like before the change.
Yeah, my bad. I didn't pay attention to the syntax there. I've made the changes for you to review.
While setting up locally I didnโt see there are two projects that need to be cloned and initialized for the bot to initialize. Initially I thought it was one project (the bot) that would also include the site.. but the site required adding additional parameters to the .env file . i understood that after adding those environment variables to the .env the bot would also initialize the site with it .
can suggest adding a link to the correct repository to this page [site repo page](https...
That's not the best idea if the user has a long message history with the bot.
Agreed, a better way I just remembered as we had discussed in dev-contrib was to pin the bookmark messages in DMs of the user and then the bot could go through the pin history?
So quick question, why does await _caches.help_dm.get(ctx.author.id, False) return true. I am testing it out and it works, but I don't understand why that would return true.
True, that would also work
The second parameter defines what to return if the key isn't found in redis. So if ctx.author.id is in there, it will return the value, if it's not, it will return False
Since we now have Partners more integrated into our server and our spaces, I'd like to provide them access to some of the more useful bot functionality such as !poll. The main driver of this is to allow the black maintainers the ability to run quick polls in their dev channel.
This should be a fairly simple change since it's adding another role to the decorator.
Yup! we already have the python_community role in the constants file bot.constants.Roles.python_community. it would be a case of adding that to the has_any_role() call in the poll command.
If anyone wants to pick this up, post here and we can get you assigned!
Isn't this issue for the partners role, not the python_community role? Regardless, Roles.partners exists as well.
It's probably a good idea to enable it for both.
Before I push this, should I change anything? (I am going to add logging and the docstring)
@commands.command(name="helpdm")
async def helpdm_command(
self,
ctx: commands.Context,
state: allowed_strings("on", "off") = None
) -> None:
state_bool = state.lower() == "on"
requested_state_bool = state.lower() == "on"
if requested_state_bool == await _caches.help_dm.get(ctx.author.id, False):
if await...
How is this different than user = message.author?
description=f"You're currently helping in {message.channel.mention}",
What is message.message?
Should be message.jump_url I will change that.
There is no difference.
Right, so get_user shouldn't be used at all here.
This was unresolved in another commit.
All requested changes have been done.
That's pretty close to what I'd do, just 3 things
- I don't think making the default value be None is needed, we want the user to be required to give this arg.
- The extra if statements aren't needed inside the
if requested_state_bool == await _caches.help_dm.get(ctx.author.id, False):line. As this if statement is only entered if they are trying to set their status to what's already stored. So this could be simplified to just
if requested_state_bool == await _caches.help_dm.ge...
Repeated line of code?
https://github.com/python-discord/bot/blob/main/bot/constants.py#L262
Should this be using the colour from constants? so the colour is exact across the bot.
You could just use message.channel.mention for this?
Fixed that in the latest commit
Fixed that as well in the newest commit.
The color is the exact same color but the only difference is that I am not getting it from the constants.
If it gets updated in settings, I would want it to change across the entire bot.
Hey, @kosayoda @Shivansh-007 I'd like to give this a go.
@OculusMode do what you must.
Question: How will this get rid of the issue which we have as None Vs None? Because as the previous code (and author of the issue) suggests, there is apparently no winner & loser, So I don't think just putting extra (draw) in the string should be enough.
Just like the .ttt history command, there is no winner or loser in a drawn game, so the statement should use the players in the game, see: https://github.com/python-discord/sir-lancebot/blob/0a6a355419d9382b35ac651117287d907e98af0c/bot/exts/evergreen/tic_tac_toe.py#L301
Yeah, my bad. I'll commit the changes right away. Thanks for pointing it out.
Correct me if I'm wrong, but in the staff meeting didn't we decide that we should not delete but instead mark a name as "out of circulation", if so, this will require an additional site PR.
@jb3 I'm pretty sure that's what we decided. How should we approach this site PR?
@Senjan21 How's progress on this PR? Will you be able to finish it?
There are some backend changes for this at python-discord/site#490
99280de Adds Support For Github Webhooks From Labels - HassanAbouelela
[python-discord/workers] New branch created: label\-webhooks
5f0d79f Adds Support For Pull Requests - HassanAbouelela
Adds support for sending data to a webhook based on an issue label.
To configure, create entries in the labels KV namespace in the format:
:
Both PRs and issues are supported. Logs are added whenever we send to an extra channel.
Image:

This shouldnt make the background black.
The number 5 is hard coded but the number of questions are 7 in some cases.

A few questions have the info attribute set to a blank string in the json file (example: here and [here](https://github.com/python-discord/sir-lancebot/blob/0a6a355419d9382b35ac651117287d907e98af0c/bot/resources/evergreen/trivia_quiz.json#L...
I did some digging into this. This is caused by rest_frameworK replacing commas with spaces and then splitting the string:
def get_search_terms(self, request):
"""
Search terms are set by a ?search=... query parameter,
and may be comma and/or whitespace delimited.
"""
params = request.query_params.get(self.search_param, '')
params = params.replace('\x00', '') # strip null characters
params = params.replace(',', ' ')...
The close command has some aliases, and you can enter text after the close part too.
This line should be something like if self.bot.get_context(message).command == self.close_command: instead
Just one last change and the rest looks good. I've tested locally too and all seems well.
After the requested change is done, I'll merge in main and do a final test
GitHub Actions run 920867572 succeeded.
GitHub Actions run 923065769 failed.
GitHub Actions run 923066976 failed.
GitHub Actions run 923032884 failed.
GitHub Actions run 923103989 failed.
GitHub Actions run 923108654 succeeded.
78422b9 Update Github emoji to new icons - ChrisLovering
[python-discord/sir-lancebot] New branch created: new\-github\-emoji
Description
Github updated their icons, so we should update ours too.
Once merged, we should delete the old emoji form the emoji server to open up room
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] Ensure there is an issue open, or link relevant discord discussions?
- [ ] Read the contributing guidelines?
Here is a link to the emojis for anyone who doesn't have access to the emoji server, but wants to confirm the IDs.
[sir-lancebot] Branch new\-github\-emoji was force-pushed to `8e158c7`
Just a couple of naming nitpicks, looks good otherwise.
pull_request_merged = ""
issue_open = ""
I think open fits a bit more to describe the issue's state, it'll also be consistent with the PR open name
[sir-lancebot] Branch new\-github\-emoji was force-pushed to `32a4b6a`
Same goes for this one.
Current:

New:

Again, I could not find it in the octicon repo.
This emoji, pull_request_open, should be reuploaded.
Current one is below:

New one:

However, it doesn't seems like this is updated on the octicon repo yet
Looks good, just update the last two emojis.
Would it be clearer to prepend Avoid to every point in the list?
Now that we've covered what not to do, here is information that to maximise the chances of getting help, your question should contain:
I understand that you're trying to go for brevity, but should there be either a small example on what the traceback is, or a link to an explanation?
Connected!
Description
looking to add " Which recently discovered Python module has changed your general use of Python?"
as a question to the #python-general channel
Reasoning
i see it's a great topic to have a discussion about . I've just picked up sql alchemy and i've seen it makes a great difference in how i use python . i first heard about it in voice chat on the discord
Proposed Implementation
add " Which recently discovered Python module has changed your general use of ...
1d7527f Infraction: DM mention that the expiration is i... - Akarys42
[python-discord/bot] New branch created: infraction\-dm\-utc
We have a few users DMing ModMail to ask why they haven't been unmuted and their mute should have expired. Most of the time it is simply that they forgot to convert their local time to UTC time. This can hopefully avoid some of those instances.
Hey everyone, regarding the octicon repo I can find all of these, but none are in color
lmfao forget i said anything, read up in #dev-branding
e75a46a Tests: update infraction DM to mention UTC - Akarys42
Connected!
dce6930 Add transparent border to new Github octicons - ChrisLovering
Here's an updated image with the new icons

Doc item doc_item.symbol_id='environment-variables' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
Looks good and works foe me locally ๐
Does this and the lines below reintroduce the bug fixed in https://github.com/python-discord/bot/pull/1569
[python-discord/forms-frontend] New branch created: form\-metadata
Adds react-helmet to allow modification of head elements in react code.
Modifies the form page to display the form title and description in the title and description elements respectively.
[forms-frontend] Branch form\-metadata was force-pushed to `a9cf77b`
Closes #1588
Description


I have disabled the check for the minimum work time in the second test above.
Reasoning
The PR adds another scheduler to manage the modpings schedule feature sin...
I haven't experienced them myself, but I will change to .get just in case, after testing.
Instead of the user having to convert from UTC to their timezone, you can use an embed timestamp.
Here is an example.
Instead of the user having to convert from UTC to their timezone, you can use an embed timestamp.
Here is an example.
Yes, but I don't think it is possible to put two timestamps in a single embed.
This is unfortunately true.
Issue
When using the !user command I have found the if the user isn't cached the command can sometimes take upwards of 10 seconds to give a response. So for a fix I was thinking we can add async with ctx.typing just so it gives the user some sort of feedback so they know the command is in fact working.
I'm not sure this is necessary, if we are going to implement this, maybe we should add it, or if not we should remove it from bot and lancebot.
@ToxicKidz thinking about it, I am not too sure about the 0, 1 to toggle the command.
@ToxicKidz thinking about it, I am not too sure about the 0, 1 to toggle the command.
If you was to add 0, 1 would you add true, false etc. etc.
The only other means of changing I would say is having the base command !helpdm toggle your current state
I was thinking of adding the bool converter which is pretty useful, it's still case sensitive and supports on and off.
What about just having !helpdm and that will toggle it?
I was thinking of adding the bool converter which is pretty useful, it's still case insensitive and supports
onandoff.
That is a really good suggestion, ๐
Adds the black-formatter channel to the remind command overrides to
allow usage of the command in the channel. This isn't the cleanest
patch, ideally the whole OSS category would be whitelisted but the
filter currently doesn't support categories.
Co-authored-by: Hassan Abouelela
Signed off here: #black-formatter message
Connected!
Well usually we only have it on commands that might take awhile i.e. our profile picture commands, and I think that's necessary for this command since as I said before it can take upwards of 10 to give a response.
I'm not against adding it, as it can sometimes take a while, especially when the user has a lot of message that need enumerating.
However, this command taking >2s usually means there's something wrong with our postgres instance (too many connections for example) which we quickly resolve, since we get notified in a devops channel.
Description
A command, .colour that would allow people to input a given colour and Lance will show the actual colour in an embed/image.
.colour hex.colour rgb.colour hsl.colour cmyk
Reasoning
Especially with things like the pixels event, and in cases like Discord embeds, it would be nice to be able to see what a specific colour is, as well as being essentially able to convert colours.
Proposed Implementation
The commands would result i...
It seems like something like this already exists https://github.com/python-discord/sir-lancebot/issues/677
Hey @onerandomusername are you still looking to work on this? It seems like there are a bunch of people who would also like to help out.
How does this always happen aaaaa i look and it doesn't exist and I make an issue and then it does
A quick review for now as there are some things preventing the scheduling from fully working.
The functionality should account for users leaving the moderation team and remove the scheduling when that happens.
There should also be a command to remove the schedule for yourself.
Would need confirmation as I'm not sure if I got it right myself but I don't think the 16 hour limit was meant in this way, but the other way around (as a maximum). With a 16 hour minimum the moderator will alway...
This method is full of errors, attach an exception logging done callback to the task to see what needs to be fixed.
Why does this use the 12 hour clock? Where time is formatted on the bot side, the iso format is used which uses the 24 hour clock
The create_task util is used to create tasks which log their exceptions to make debugging easier, but with its current implementation it cannot be used to schedule tasks from the init of cogs as there's no running loop when they execute.
The loop kwarg allows the caller to pass in bot.loop in these situations to get a task with the same exception logging.
I held off on replacing the self.bot.create_task pattern with this function for now as it'd be a larger change so I'd like some confirmation beforehand, but making sure only the utility function is used where applicable will prevent future errors popping up on already existing uses.
I've asked this in https://github.com/python-discord/bot/pull/1471#discussion_r606778142 but the review didn't get addressed; thoughts on replacing this with an optional kwarg instead of a varag? When calling the function, the purpose of the passed in exceptions isn't immediately clear.
Thoughts on naming this loop to be consistent with the (deprecated) parameter in asyncio?
I agree with you about the clarity. On the other hand, it's kind of annoying to write the kwarg and wrap everything in a tuple/list, especially when there's only one Exception. I'll say this: as far as I am concerned, if you want to change it, you can. If not, that's fine too.
Why are you passing options to coverage through the command rather than letting it use the .coveragerc file? Does it not support reading from that file?
event_loop: t.Optional[asyncio.AbstractEventLoop] = None,
Aren't sets in redis more appropriate for this sort of thing? It would remove the need to serialise and deserialise. It wouldn't even need to retrieve all items since there are commands to check set membership.
Async Rediscache doesn't support sets.
I went with loop at first, but found event_loop to be a bit more explicit in what it is. The create_task interface also never used the loop kwarg so I didn't see a need to match the names for consistency
aioredis does support it and async-redis cache can trivially be extended to support it (yes I think it's worth doing that).
Note I'm not suggesting implementing the set operations with all the type conversion stuff. Just a basic SADD call or whatever that will store a string as given.
I removed it when it was no longer needed, and never added it back.
That's been reverted in e2064b4.
Can anyone confirm xdist works on all three major operating systems?
This doesn't have to be on a separate line any more but whatever.
How about this?
- Nicer to start it with "test"
- "nocov" is more meaningful than "fast" but perhaps no everyone will catch on to it meaning "no coverage"
test-nocov = "pytest -n auto"
I went ahead and moved it to a kwarg; I'm not too concerned about the small ease of use difference as it's not used that commonly
Those weren't there before.... But as soon as I push they show up.
I didn't particularly like "fast", but I didn't have a better name. I would usually just call this test, and have something indicating coverage in the other one, but I didn't want to break the existing convention.
nocov works, let's use that.
Might as well fix it.
Tested and can confirm the branch works on Windows 10 and Linux (ubuntu 20.04. CI also runs ubuntu).
You forgot to update the documentation.
- `poetry run task test-nocov` will run `pytest`.
43659c7 Renamed Test Task In Documentation - HassanAbouelela
Connected!
#1637 was just merged to replace the uses of self.bot.loop.create_task that swallow exceptions with scheduling.create_task(coro, event_loop=bot.loop) to log exceptions
I'm not too familiar with Redis can you please give more information about how I would implement this? Also I think it would be best to do this as a separate feature.
That's alright. Let's just leave your implementation for now. I can try to merge set support into async-rediscache in the future.
self,
ctx: commands.Context,
state_bool: bool
Connected!
I don't think many users would like to be message automatically if the bot noticed a pattern that is set by some constant.
I still think this is relevant. Not sure if the default should have this feature turned on or off.
d1a2d99 Switched back to default value getting. - Xithrius
Resolved in d1a2d9965fadc5292685d3ca78a75fd16f07af26
[python-discord/sir-lancebot] branch deleted: new\-github\-emoji
32a4b6a Update Github emoji to new icons - ChrisLovering
07a8f19 Update tense of icon constants - ChrisLovering
dce6930 Add transparent border to new Github octicons - ChrisLovering
210cd27 Merge branch 'main' into new-github-emoji - Xithrius
d195418 Merge pull request #774 from python-discord/new... - Xithrius
Connected!
What's the reason for suppressing the coverage printing?
fb4d167 Proposed alternative "available help channel" m... - swfarnsworth
[python-discord/bot] New branch created: swfarnsworth/help\_channel\_message
Having spent more time in the help channels lately, I don't think the "available help channel" message is having the intended effect. I suggest this version, which eliminates the part explaining that the channel will be allocated specifically for the one user (I think everyone knows this or infers as much), and more directly instruct them not to "ask to ask" and to avoid posting code as screenshots.
: Cannot send messages to this user
(2 additional frame(s) were not displayed)
...
File "bot/utils/lock.py", line 108, in wrapper
log.debug(
File "bot/utils/lock.py", line 108, in wrapper
log.debug(
File "bot/exts/help_channels/_cog.py", line 583, in notify_session_participants
await message.author.send(embed=...
My thoughts on how to deal with this is to turn off help dms for this user, and post an message in #bot-commands pinging the user telling them that help dms have been turned off since their dms are closed.
Double quotes are currently preferred by the style guide, but aren't enforced in any way in the project. This leaves the project in a bit inconsistent state ands adds more work for reviewers and contributors during the PR process.
The flake8-quotes plugin can be used to raise linting errors if the preferred quote type is not used. From testing, everything seems to work fine except for multi line strings with implicit concat https://github.com/zheller/flake8-quotes/issues/82, but this is ea...
@Xithrius Thanks! I'll get started on it tomorrow :D
I'm not sure if we really want to change them all at once, mainly for all the conflicts it will arise. We can just change them as we go on, and perhaps look at this once we only have a few double quotes remaining?
I am personally not a fan of the rule that enforces double quotes, I use each type of quote depending on the context. Also, this does not automatically change the quotes, which is pretty silly if you ask me, I'd rather have it as a precommit hook.
Poke @Xithrius, @jb3, @Hassa...
I'm not sure if we really want to change them all at once, mainly for all the conflicts it will arise.
From a quick replace I found conflicts when merging #1602, #1568, #1539, #1487 and #836; it affects less PRs than I thought it would, but still a considerable number. Although conflicts coming from here should be mostly trivial to resolve.
We can just change them as we go on, and perhaps look at this once we only have a few double quotes remaining?
I really doubt this will ever...
If you review the more in-depth contributing guide on the website, this is listed and can be avoided by using Docker.

@SebastiaanZ this is what I'd like to merge, though as it differs slightly from what is in your previous comment, feel free to veto.
I don't mind this solution. My personal preference would be to not emphasize those first words, but I also don't mind it.
Is not holding the Asking Good Questions link intentional?
Regarding the guide not being bolded, I think the fact that it's hyperlinked draws enough attention to it.
efbce1c Added python_community and partners role ha... - Xithrius
f2ef6c1 Merge pull request #1639 from python-discord/po... - jb3
141ff51 Modified the proposed message after discussion ... - swfarnsworth
211b228 Merge branch 'main' of https://github.com/pytho... - swfarnsworth
Connected!
If you review the more in-depth contributing guide on the website, this is listed and can be avoided by using Docker.
please provide a reference to where it shows the repository links in the contributing guide for the bot and the site.
When i used these guides i was between the pages for 4 hours , and i am sure there are not repository links directly on the contributing guide pages.
As i said, this is where i see the confusion stems from .
these are the pages
https...
please provide a reference to where it shows the repository links in the contributing guide for the bot and the site.

[python-discord/site] New branch created: cj8\_announcement
This Pull Request is just the basics required for the Code Jam announcement. It does the following things:
- Add in basic assets for the event
- Create the CJ8 pages
- Update the main events page and the main code jam page
There will be a second PR made this Sunday that will have more of the details and include the Qualifier release.
<li>Monday, June 15 - Form to submit theme suggestions opens</li>
cc0925e Update release date for theme suggestions form - janine9vn
Other than linting failure, all looks good, approving.
when the Qualifier is released you can join the server: <a href="https://discord.gg/python">discord.gg/python</a>.</p>
This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted YouTube video, Vimeo, etc.)
GitHub Actions run 937818368 failed.
GitHub Actions run 937820265 failed.
GitHub Actions run 937820272 failed.
23a3f67 Remove trailing whitespace and fix capitalization - janine9vn
[python-discord/site] branch deleted: cj8\_announcement
- Capitalise GitHub
- Change Monday to Tuesday to mirror date amendment
- Change wording of Discord invite
please provide a reference to where it shows the repository links in the contributing guide for the bot and the site.
i almost thought i missed this .
but
this hyperlink brings you to this page https://pythondiscord.com/pages/guides/pydis-guides/contributing/site/
that page doesn't have a link to the github repo, showing that it's two seperate projects.
can...
I saw the site was tied into the Bot repo and having the site "enabled" required additional steps that are listed on https://pythondiscord.com/pages/guides/pydis-guides/contributing/site/
Converted to draft for the time being


