GitHub Actions run 1094847429 succeeded.
#dev-log
1 messages · Page 79 of 1
Looks fine to me, nice work!
Relevant comment on this topic on the server: #community-meta message
Basically, while it definitely isn't a great option, there aren't really any better free options. So for people who are making a simple bot for them and a few friends in a small server, which they are happy just about working most of the time, and are happy to put up with a bit of extra setup work, it might be the best option for them - and I think that's ofte...
587e52e Add commands to turn automatic review posting o... - wookie184
3bdec8e Small code improvements and added 'ar' alias - wookie184
792c5a4 Rename commands from on/off to enable/disable - wookie184
5aa0022 Remove bot prefix from docstring and change sin... - wookie184
def62f6 Add check for redundant change - wookie184
GitHub Actions run 1095130882 succeeded.
Sentry Issue: BOT-130
The response doesn't include an encoding in the headers, so aiohttp has to guess. It sometimes guesses incorrectly, leading to decoding errors. The API does not document what the encoding of responses is. Would it be safe to assume it's always UTF-8?
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1009: character maps to
File "discord/ext/comma...
Connected!
GitHub Actions run 1095144157 succeeded.
b305874 Force utf-8 decoding when querying metabase - ChrisLovering
[python-discord/bot] New branch created: force\-utf\-8\-decoding\-for\-metabase
Closes #1713
Some discord usernames contain unicode characters, which causes an decoding error as chardet isn't 100% and can't falsely detect the response text as Windows-1254.
GitHub Actions run 1095201814 succeeded.
Sentry Issue: BOT-135
If the cog is reloaded while there are less than the maximum amount of available channels, it makes some channels available until the limit is reached. When a channel is made available, it updates the available_help_channels set. The update_available_help_channels() function will not update this set if it sees that the set already contains elements. This results in onl...
It's still a method, see the following examples
https://github.com/python-discord/bot/blob/4aaf2bbe3f0a866451cf9fc91e771dfd7c54d029/bot/converters.py#L91-L92
https://github.com/python-discord/bot/blob/4aaf2bbe3f0a866451cf9fc91e771dfd7c54d029/bot/converters.py#L107
...
https://github.com/python-discord/bot/blob/4aaf2bbe3f0a866451cf9fc91e771dfd7c54d029/bot/exts/moderation/silence.py#L367-L368
https://github.com/python-discord/bot/blob/4aaf2bbe3f0a866451cf9fc91e771dfd7c54d029/bot/exts/moder...
[python-discord/bot] New branch created: bug/info/bot\-13b/code\-snippet\-msg\-404
In the examples they might have been called with self but the context was different. In case of silence for example it was called directly there (async def silence(...)) which in fact is not a staticmethod but a normal method. But in my case, I'm calling a staticmethod inside a staticmethod.(Which in fact is strange, but I could not put it into the helpers unfortunately, so I put it directly into the cog as a staticmethod.).
But if you prefer those staticmethod decorators to be removed...
Fixes BOT-13B
The 404 error was not being caught when trying to edit the message to remove embeds. However, I figured that it shouldn't send the snippets at all if the message is deleted.
I also refactored a few things.
[python-discord/bot] branch deleted: force\-utf\-8\-decoding\-for\-metabase
GitHub Actions run 1095309008 succeeded.
Connected!
GitHub Actions run 1095320454 succeeded.
@MarkKoz sorry for taking so long to review it.
The appended advisory looks good. The feature itself looks solid.
As for expired or inactive infractions, I think replacing the expiry value with Expired should be enough. This has the disadvantage of not telling the user when their infraction expired, but this isn't really a case we're planning to use the command in.
Oh sorry, I see now. You do not have self as an argument
GitHub Actions run 1095457046 succeeded.
4772c5e Revert "Fixes Issue Matching Regex" - Vthechamp22
671be99 Revert "Fixes Issue Matching Regex" - Vthechamp22
b4ee10a Add stackoverflow cog with answers - Vthechamp22
5066446 Merge branch 'master' of https://github.com/pyt... - Vthechamp22
37ae939 Merge branch 'master' of https://github.com/Vth... - Vthechamp22
Connected!
GitHub Actions run 1095481418 succeeded.
[python-discord/sir-lancebot] New branch created: add\_stackoverflow\_emojis
38add14 Added emoji IDs to constants.py - Xithrius
Adds IDs for the .stackoverflow command, replacing the placeholders that I forgot to replace.
GitHub Actions run 1095511389 succeeded.
My name is ChrisJL and I approve of this PR
38add14 Added emoji IDs to constants.py - Xithrius
32b6d0e Merge pull request #796 from python-discord/add... - ChrisLovering
[python-discord/sir-lancebot] branch deleted: add\_stackoverflow\_emojis
Connected!
GitHub Actions run 1095524569 succeeded.
935b9c6 Time: fix discord_timestamp for relativedeltas - MarkKoz
d8f467b Time: support ISO 8601 and naïve/aware datetime... - MarkKoz
67520a9 Time: remove RFC1123 support - MarkKoz
afa3504 Time: describe input types in discord_timestamp... - MarkKoz
d7d72ad Time: support ISO 8601 strings for discord_time... - MarkKoz
[python-discord/bot] New branch created: enhance/backend/time\-util\-refactor
587e52e Add commands to turn automatic review posting o... - wookie184
3bdec8e Small code improvements and added 'ar' alias - wookie184
792c5a4 Rename commands from on/off to enable/disable - wookie184
80861ff Add virtual environment (venv) tag (#1702) - Zedeldi
5aa0022 Remove bot prefix from docstring and change sin... - wookie184
[python-discord/bot] branch deleted: bug/mod/1706/infr\-append\-no\-reason
GitHub Actions run 1097358619 succeeded.
Connected!
GitHub Actions run 1097369955 succeeded.
Whether you are the help-channel owner(the one who claimed the channel) or the helper, if the helpdm is on(for the helper), than dm when the channel is closed for any reason to detect wether the channel is closed or not
Just for my understading, the issue here is that log.exception opens an issue on Sentry? as functionality-wise it seems to be working fine already.
Is there a consistent rule for capitalized or un-capitalized "python"?
Lines 26, 31, 32, 33, 35 are un-capitalized, but the others are capitalized.
For line 36, The wording seems a bit clunky. Maybe "What Python level/skill/knowledge do you think you are at: Beginner, Intermediate or Advanced?"
(Just chiming in, wanting to get started with contributing!)
Wdym? They are not capitalized which is incorrect spelling, the others are capitalized because it is the correct spelling because it is a name. Unless I misunderstood you?
- What do you plan on eventually achieving with Python?
- Was Python your first programming language? If not, what was?
- What's your favourite aspect of Python development (e.g. backend, web dev, game dev, machine learning, ai)?
- In what ways has Python Discord helped you with Python?
- Are you currently using Python professionally, for education, or as a hobby?
- What is your process when you decide to start a project in Python?
- Have you ever been unable...
Wdym? They are not capitalized which is incorrect spelling, the others are capitalized because it is the correct spelling because it is a name. Unless I misunderstood you?
I was just unsure if there was some un-written rule of when to use "python" vs "Python". For example I could say I have a python script written in Python. When it is an adjective lower case seems fine, but as a noun it seems more proper to use the capitalization.
Currently, when the bot encounters an error, it sends an error embed containing the error itself, and another embed containing the help for the current command.
To make this consistent, I think we should put those two into one single embed. Like in Sir-Lancebot:

- We no longer allow arbitrary user inputted images to be rendered and parroted by the bot
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `a5f6b89`
587e52e Add commands to turn automatic review posting o... - wookie184
3bdec8e Small code improvements and added 'ar' alias - wookie184
792c5a4 Rename commands from on/off to enable/disable - wookie184
c1fcab3 Fix TypeError when infraction append is not giv... - MarkKoz
80861ff Add virtual environment (venv) tag (#1702) - Zedeldi
c390ca4 Suppress 403 error when sending DEFCON reject D... - MarkKoz
[python-discord/bot] branch deleted: bug/mod/bot\-137/defcon\-reject\-dm\-403
[python-discord/bot] Checks Successful on PR: #1711 Suppress 403 error when sending DEFCON reject DM
GitHub Actions run 1098313971 succeeded.
Connected!
GitHub Actions run 1098327772 succeeded.
GitHub Actions run 1098357923 succeeded.
roles = ", ".join(role.mention for role in reversed(user.roles))
I find this easier to read, so it's clear what this is doing to people coming across this code in future.
This also has the benefit of just being a generator, rather than making a whole new list
I agree, but we'll still need a slice for removing the @everyone role, right? That's why the [1:] was there and that's why I didn't do [::-1], but I did [:0:-1]
If we need a slice, THEN a reversed iterator, I believe everything in a slice is better.
Perhaps this can be resolved with a comment explaining the slice, so we get the best of both worlds?
Ah right, yea that would make sense why the :0 is there then. Could you add a comment to explain that? :D
Seeing [:0:-1] just looked wrong to me, but it makes sense now. So I think a comment could really help the next person that glances at this and may think the same
GitHub Actions run 1098483137 succeeded.
This makes it seem like you sort them. Just say that it reverses the order.
Well, it is sorted - from lowest to highest. -1 makes it highest to lowest. I'll add "instead of the other way around" to the end of the comment to clear any possible confusion.
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `c6666ef`
I hate to keep complaining about comments like this..
But I was thinking something more like:
# and the -1 is for reversing the order of the roles (highest to lowest)
It should probably also mention that it's highest to lowest in hierarchy.
GitHub Actions run 1098606988 succeeded.
7586276 Reorder user roles in !user command from highes... - Objectivitix
587e52e Add commands to turn automatic review posting o... - wookie184
3bdec8e Small code improvements and added 'ar' alias - wookie184
792c5a4 Rename commands from on/off to enable/disable - wookie184
c1fcab3 Fix TypeError when infraction append is not giv... - MarkKoz
80861ff Add virtual environment (venv) tag (#1702) - Zedeldi
Connected!
GitHub Actions run 1098647076 succeeded.
[python-discord/bot] branch deleted: bug/bot\-1jd/backend/wait\-for\-deletion\-404
GitHub Actions run 1098647558 succeeded.
I don't like the debug mode being false as the config default as it should almost always be set for dev; what do you think about making it an env var with defaulting to enabled?
That's a decent idea. The downside is it goes against the concept of the default config being the default values for production, but I don't see a simple way around this.
We could have it as an env var that gets set in the compose file, since that isn't use in prod
Connected!
GitHub Actions run 1098659619 succeeded.
I don't like the debug mode being false as the config default as it should almost always be set for dev; what do you think about making it an env var with defaulting to enabled?
That's a decent idea. The downside is it goes against the concept of the default config being the default values for production, but I don't see a simple way around this.
We could have it as an env var that gets set in the compose file, since that isn't use in prod
It's a parti...
I don't like the debug mode being false as the config default as it should almost always be set for dev; what do you think about making it an env var with defaulting to enabled?
That's a decent idea. The downside is it goes against the concept of the default config being the default values for production, but I don't see a simple way around this.
We could have it as an env var that gets set in the compose file, since that isn't use in prod
...
Do we really need to find a fix? We can just tell people to set the value like we do for most other values. The biggest downside I see is that it’ll leave a possible security vulnerability if the user doesn’t set it, and nothing will tell them so. That being said, I imagine most people are already running these bots in their own test servers, or with people they trust.
I read back the whole issue, starting from the beginning.
I believe most of the times showing one embed with the usage (like in Sir Lancebot's error handler.) is more consistent than the current one (Showing two embeds)
But we can make specific cases for specific errors, like not showing the usage just the error message!(Although, at that point, I don't...
Description
The proposal is that we allow tags to be specified as another argument for the stackoverflow command. Stack Exchange API allows filtering by tags with the query, so if the user would like to specify the tags for a certain query, i,e. .so JSON [tags], the stackoverflow command would add the additional tagged parameter with the Stack Exchange API with the query 'JSON'.
Reasoning
The current stackoverflow command will search for the top 5 results, but it can't ...
@janine9vn Thank you. I will proceed to throw this issue into the sun.
I would guess a flag would be the best way to do this? Maybe -t <tag> <tag> <tag>
Then a user would do .so <search terms> -t <tag> <tag> <tag>
I would guess a flag would be the best way to do this? Maybe -t <tag> <tag> <tag>
Then a user would do .so <search terms> -t <tag> <tag> <tag>
That's true. I can update it to take a flag instead.
c034729 Add codeql workflow - ChrisLovering
[python-discord/sir-lancebot] New branch created: ChrisLovering\-patch\-1
Description
Add the codeql workflow, this is mostly auto-generated from the github interface.
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 and agree to the contributing guidelines?
GitHub Actions run 1099278272 succeeded.
Could you give context for others why we want to implement this?
I'm not even proposing me merge this at all, currently just test running the workflow to see if it's useful. Probably should have said that in the description.
[sir-lancebot] Branch ChrisLovering\-patch\-1 was force-pushed to `7cf2898`
GitHub Actions run 1099312395 succeeded.
[sir-lancebot] Branch ChrisLovering\-patch\-1 was force-pushed to `3244fa2`
GitHub Actions run 1099328495 succeeded.
GitHub Actions run 1099349690 succeeded.
[python-discord/bot] New branch created: add\-codeql\-workflow
Add the codeql workflow, this inspects the source code for possible vulnerabilities.
I'm not proposing me merge this at all, currently just test running the workflow to see if it's useful.
GitHub Actions run 1099379228 succeeded.
We have decided the extra 4-5 minutes of CI wait time isn't worth the minimal benefits this brings
[python-discord/bot] branch deleted: add\-codeql\-workflow
We have decided the extra 4-5 minutes of CI wait time isn't worth the minimal benefits this brings
[python-discord/sir-lancebot] branch deleted: ChrisLovering\-patch\-1
a6effc6 Remove "Return Home" button at the bottom of a ... - Bluenix2
[python-discord/forms-frontend] New branch created: remove\-return\-home

Reasoning
The previous Return Home button was placed at the bottom of the form, a user would only see this after filling in the whole form. Why would someone return home after filling in a whole form?
Improvements
I didn't touch the Submit button's style much. It looks visually nice like this in my opinion. Should the button be enlarged to make up for the bigger b...
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `5467af4`
This is my first shot at it, definitely could clean up the string combination as well as having an embedded error message for more than 5 tags.
async def stackoverflow(self, ctx: commands.Context, *, search_query: str, ) -> None:
"""Sends the top 5 results of a search query from stackoverflow."""
def tag_parse(query: str) -> str:
list_query = query.split()
if "-t" in list_query:
stop_index = list_query.index("-t")
...
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `1025fe8`
259d1c0 Time: remove broken enum type check in discord_... - MarkKoz
The implementations had some redundancies. Furthermore, the functions were commonly being used with either datetimes or ISO 8601 strings, but some functions only accepted one of them rather than both types. This resulted in ugly call sites because callers had to perform conversions themselves. Lastly, some functions were more tightly coupled (mostly naming-wise since the switch to Discord timestamps) to infractions than they needed to be.
The changes are described well by the commit hist...
GitHub Actions run 1100105585 succeeded.
This is the branding for the Free Comic Book Day event which is on the 14th of August.
Could you add another line here describing that it's usually on on the first Saturday in May, but has been rescheduled for Aug 14th for 2021?
This will help us figuring out what date to change it to each year.
In an event the server icon will only update every 3 days (iirc we had it lower at one point but it caused strange cache problems). I think that means we'll only see one of the icons (chosen randomly) in the event. This is fine, just wanted to make sure you were aware of this.
If you had a favourite and wanted to make sure that appears, you could remove the other two, or you could also replace them with a gif cycling through them all, although either of those ideas should probably be discu...
GitHub Actions run 1101746662 succeeded.
GitHub Actions run 1102140965 succeeded.
Description:
The tag informs why YouTube or any tutorials are not good to be followed.
Motivation:
There are a lot of users asking for help on code that they were spoonfeeded or simply do not understand and I think this is a good way to tell them to stop and try and understand since all information you want about making a command can be found in docs.
Tag content: (can of course be shortened since this is fairly long)
Tutorials are fundamentally flawed in concept when it com...
Description:
The tag informs why YouTube or any tutorials are not good to be followed.
Motivation:
There are a lot of users asking for help on code that they were spoonfeeded or simply do not understand and I think this is a good way to tell them to stop and try and understand since all information you want about making a command can be found in docs.
Tag content: (can of course be shortened since this is fairly long)
Tutorials are fundamentally flawed in concept when it com...
I have to strongly disagree on this one. I don't see it helpful in any way to say "hey, the way you prefer to learn is not good". I see this as injecting a personal opinion on tutorials/videos and passing it off as canonically accepted. At worst, it's a harmful opinion. In terms of benefits, I don't see this being as constructive in any way. I believe content of specific tutorials or other works, if to be addressed, must be addressed on a case-by-case basis.
Instead, we should encourage ...
Closing as duplicate of #1722
Resource name
ExplorePython
Resource location
https://explorepython.org
Payment type
Free
Why it should be included
As opposed to some other python courses and tutorials, it gives the lessons in bite sized pieces with comprehension tests at the end of each lesson to test their learning. This helps with retention, as well as makes it more fun and entertaining to do.
Also, Kat said it should be here.
Potential limitations
It is missing some vital content ...
When you type in an invalid argument for the docs command and it says "No documentation found for the requested symbol.", it also lists down the closest matches to what you type so you can see what the name of the argument is. Or could take this a step further and make the bot list the closest matches with corresponding number beside it to which the user can write the number/react to the emote showing that number and it would show the docs for that argument
If you had a favourite and wanted to make sure that appears, you could remove the other two, or you could also replace them with a gif cycling through them all, although either of those ideas should probably be discussed in dev-branding if you want to change to that.
I have replaced the three images with a single GIF that cycles through all three images.
GitHub Actions run 1105549931 succeeded.
[python-discord/sir-lancebot] New branch created: remove\-gpl\-deps
Closes #794
I'm not sure why aspecific scorer was specified in the old code here, https://github.com/python-discord/sir-lancebot/commit/8e653f4f6fc64ad78809e5ec1943ee38865bf221#diff-2b56425c5b483af73a4eaf13d49e54eca49dd8338d3b3f6cad5201ecad8d0366L162. The default seems fine, although I can change to use fuzz.ratio if necessary.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure ther...
GitHub Actions run 1105625336 succeeded.
Description
A user command to search Real Python for a relevant article. The command would take user input and return a short list of articles with the search terms in the title of the Real Python articles. This is heavily inspired by the recent Stackoverflow search command.
Reasoning
Similar to the Stackoverflow command, this would give a shortcut to the information existing on the Real Python website from within the Python Discord server.
Proposed Implementation
N/...
I like this idea as well. Will both tags as commands be pointing to this one embed?
I'm interested in this idea. Does anyone else have thoughts?
Do we just go for the easy, but tedious, solution and update the doc strings?
@ChrisLovering this is probably the best way to do it for now.
@mbaruh status on this PR?
With https://github.com/python-discord/bot/pull/1663 adding tag metadata, at some point we could probably allow tag aliases, but for now I think the only way of having two names point to the same tag is just duplicating the contents.
That's not ideal, but it would probably be confusing to remove one of the names.
looks good to me, tested and works well!
7049a00 Create join_role_stats function in helpers - D0rs4n
a8e30f6 Add Leads role(s) to the server information e... - D0rs4n
bb961b2 Merge branch 'main' into pr/serverinfoleads - ChrisLovering
b2b9d23 Handle non-existent roles in join_role_stats - D0rs4n
ed00aad Modify error handling in join_role_stats and mo... - D0rs4n
GitHub Actions run 1106575386 succeeded.
Connected!
GitHub Actions run 1106583794 succeeded.
Mailing lists embeds don't escape markdown which means Dunder methods are underlined, this PR tries to fix it.
(This is my first PR sorry if I'm making something wrong)
19c796a Refactor endpoint paths - Bluenix2
429bf73 Merge insecure.py into general.py - Bluenix2
1ab8d88 Merge branch 'python-discord:main' into main - Bluenix2
52979f6 Move inline comment to line above - Bluenix2
f6321d1 Remove unneccessary tags kwarg to APIRouter - Bluenix2
19c796a Refactor endpoint paths - Bluenix2
429bf73 Merge insecure.py into general.py - Bluenix2
1ab8d88 Merge branch 'python-discord:main' into main - Bluenix2
52979f6 Move inline comment to line above - Bluenix2
f6321d1 Remove unneccessary tags kwarg to APIRouter - Bluenix2
GitHub Actions run 1106707111 succeeded.
GitHub Actions run 1106708040 succeeded.
GitHub Actions run 1106708959 succeeded.
Explanation
It's like SQL injection, but for URLs. Carelessly formatting user input into a URL template can allow attackers construct a specific string to do something nasty.
To fix
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/movie.py
URL formatting partially using f-strings (line 145). I wasn't able to find a vulnerability, but no check is made to ensure that the substitution is safe
https://github.com/python-discord/sir-lancebot/blob/main/bot...
51e6314 Fix type annotations - decorator-factory
[python-discord/sir-lancebot] New branch created: decorator\-factory/typehints\-fix
This PR aims to improve type annotations (type hints) in the project, including:
- change old-style annotations (like
typing.List[int]) - fix annotations that are just wrong
- replace weak types (like
dict[str, Any]) with strong types (like making a dataclass)
GitHub Actions run 1107029204 succeeded.
Description
I want to change some type annotations
Reasoning
Good type hints make code easier to understand, and bad type hints are misleading and should be fixed.
Would you like to implement this yourself?
- [x] I'd like to implement this feature myself
- [ ] Anyone can implement this feature
WIP PR
Several users have expressed a desire to interact with files with their executed code. I believe such feature is in scope and that it would be a great feature. Supporting it would require a way to mount an isolated, size-capped r/w directory for each NsJail instance. Implementation details need to be investigated to determine the feasability of this feature.
Someone made me realise that shared memory could be accessed across NsJail instances. Can you think of a way have isolated mounts for each instance?
@Xithrius It still lives, just taking me a bit to get to it.
I don't think I am having enough time to look into this and it has been stale for quite a while now, so whoever wants can take over the PR, and deliver the feature!
I'm unassigning myself. The issue is waiting for #1527 to be merged and can then be worked on, I'm not sure how soon I'll have time.
How could that happen? We create a new tmpfs for every nsjail instance — it's not shared.
Looks good. Simple design but it's effective.
I may investigate in the future converting it to a table so we can enable :hover properties.
I see nothing wrong, but perhaps instead of saying "GitHub" (they're all hosted on GitHub) it could say either simply "Repository" or the repository name (as in n0remac/Acute-Alligators-2021-Summer-Code-Jam or BoraxTheClean/adaptable-antelopes)
This isn't great for accessibility. Text readers will read out loud the link text, which is "GitHub" for every team. Can we also include the team name?
You mean duplicate the team name?
Yes, or give them a title attribute
6a7e4b2 "That can mean a lot of things" -> "It's usuall... - swfarnsworth
How could that happen? We create a new tmpfs for every nsjail instance — it's not shared.
Is it really a new one or is it just mounting the same directory over and over?
Is that what is_bind false does?
Is it really a new one or is it just mounting the same directory over and over?
If this works the same way that it would in the equivalent fstab, it will be a new tmpfs instance for each execution. I'm having trouble reading through how nsjail actually allocates this though, I can't tell if it is doing something special or just mounting a filesystem in the typical way.
...
I'd like to grab this! 👍
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `9629d83`
GitHub Actions run 1108429560 succeeded.
That's a good approach. In in favour.
From what I remember, the package does sometimes produce table classes instead of models (for non-trivial situations). Still, it should get us 90% of the way there, and we probably convert those tables manually.
The end goal was always to have a solid base migration that we can then use as the basis for future migrations. This means that @jb3 doesn't have to be our human migration manager.
GitHub Actions run 1108488287 succeeded.
<p class="has-text-centered"><a href="https://github.com/n0remac/Acute-Alligators-2021-Summer-Code-Jam" title="Acute Alligators' Repository">GitHub</a></p>
The chairs' repository (plural, possesive).
This needs to be done for all links
Looks good, I think I only caught 1 or 2 things that could mistakes, but you be the judge of that.
I approach this as a PR that intends to make better use of PEP 585. Therefore I was mostly looking for regression; I haven't verified that all existing hints are correct.
I think segment_length_range should be tuple[int, int]. That is the default & indices 0 and 1 are touched in the func's body.
Why have you decided to keep the str annotation on the line above?
I believe these can be list[int]? They are drawn using randint above. Same on L295.
Lgtm, waiting on @Bluenix2's change to be applied to merge
Relevant Issues
Closes #801
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
I applied the built in tools from aiohttp wherever I could to properly sanitize the inputs, in case of the GithubInfo Cog, because of the API architecture I had to use a different approach, but by switching to quote_plus I managed to fix the issue.
The cogs fixed:
- Movie
- Githubinfo
- Wikipedia
- Hacktoberstats (get_october_prs function in...
GitHub Actions run 1108640958 succeeded.
I think you should add a check that movie is actually an integer, either here or after line 135 where it's fetched, but not validated
I would use a literal: {**WIKI_PARAMS, "srlimit": 10, "srsearch": search} or WIKI_PARAMS | {"srlimit": 10, "srsearch": search}
GitHub Actions run 1108682003 succeeded.
The biggest downside I see is that it’ll leave a possible security vulnerability if the user doesn’t set it, and nothing will tell them so
Yeah, that's the concern, and I think it's a completely valid point. I'm thinking that production could just "take the hit" and set the env var to False explicitly. It has to set other env vars anyway.
The indentation here looks messed up.
This looks good, thank you for the PR
That's a visual indent.
That said, I do guess you could do a hanging indent like this:
embed.add_field(
name="Gists",
value=f"[{gists}](https://gist.github.com/{quote_plus(username, safe='')})"
)
Fair point, I wanted to pass the linting. I'll push a change shortly.
GitHub Actions run 1108728078 succeeded.
oh yeah I missed that, looks like something an autoformatter would do :eyes:
What Bluenix showed is the way it should be done. This is what's specified in our style guide, but I am not sure how strict this project is with enforcing that. In any case, I'm not going to make you push a second commit.
Yeah I agree with Mark, I prefer the hanging indent over visual
I can push another commit, it's not a problem! :)
GitHub Actions run 1108759095 succeeded.
embed.add_field(
name="Gists",
value=f"[{gists}](https://gist.github.com/"f"{quote_plus(username, safe='')})"
)
I'm not very familiar with URL injections, but you may have missed some:
There are three different places in the wolfram cog; this is just one of them
https://github.com/python-discord/sir-lancebot/blob/32b6d0e386350ea12ab9e745e2bede844d289d07/bot/exts/evergreen/wolfram.py#L111-L122
This one might be okay since there's no user input, but it could still be passed via the params kwarg
https://github.com/python-discord/sir-lancebot/blob/32b6d0e386350ea12ab9e745e2bede844d289d07/bot...
I see, as for the Wolfram, I was told that it was out of the scope of this issue, but I'm happy to push patches to all of those.
Does anyone know why it is out of scope? I wasn't involved in that discussion.
Because, there were other kind of sanitization measures applied.
In case of wolfram that was parse.urlencode.
b9f2733 Time: fix format_with_duration passing None to ... - MarkKoz
@D0rs4n
Feel free to fix these consistency issues if you want to
GitHub Actions run 1108785192 succeeded.
[bot] Branch enhance/backend/time\-util\-refactor was force-pushed to `b7ead8f`
Because, there were other kind of sanitization measures applied.
In case of wolfram that wasparse.urlencode.
Well, that was also the case with the movie cog but you made changes anyway.
GitHub Actions run 1108788993 succeeded.
Are these standard semantics for tmpfs? For the sake of my curiosity, is it even possible to mount the same tmpfs under different directories?
As for expired or inactive infractions, I think replacing the expiry value with
Expiredshould be enough. This has the disadvantage of not telling the user when their infraction expired, but this isn't really a case we're planning to use the command in.
Can we defer this to after #1721 is merged? I think it would make this slightly easier.
I realised that the advisory may get truncated if the reason is too long. I might have to add a separate parameter for an advisory than ap...
You can achieve that through symlinking, I don't think there is a "same tmpfs" due to the nature of tmpfs allocation (a new tmpfs for every mountpoint, as far as I understand).
Okay, great. Just need to address the comments I left a couple weeks ago.
If this is copied from discord.utils.escape_markdown, why aren't we using it?
Doc item doc_item.symbol_id='environment-variables' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
Actually I removed most of the code it's not really the same function anymore. We don't because apparently we want to keep some markdown
#dev-contrib message
I should remove this comment
Because, there were other kind of sanitization measures applied.
In case of wolfram that wasparse.urlencode.Well, that was also the case with the movie cog but you made changes anyway.
Fair point, I pushed some changes to improve consistency! Hopefully everything's going to be fine! :)
Sounds like a Polish surname if you ask me
I think STACKOVERFLOW or SO makes more sense
[python-discord/bot] New branch created: bug/message\-404
GitHub Actions run 1108865997 succeeded.
GitHub Actions run 1108867901 succeeded.
GitHub Actions run 1108875853 succeeded.
What alternative to tutorials do you propose? Make people learn the tools they need using the reference? That is not effective teaching, and that's not how we teach anything else.
In elementary school, you didn't learn addition from first principles, that would be ridiculous. You started off with doing simple examples by help, and only then you learned "how it actually works".
People learn by recognizing patterns and doing things in practice...
Our staff team decided that we will not seriously consider this tag.
I can't really test hacktoberstats since the event isn't going on right now.
This somehow broke the command. It fails to find the repo with .gh repo python/cpython, but that works fine on the main branch.
Yeah, I should have only used it when we are looking up usernames, this piece of code right now encodes the / sign.
GitHub Actions run 1109018742 succeeded.
9ffd7c8 Update the movie cog to use aiohttp get params - D0rs4n
8532b40 Update the Wikipedia Cog to use aiohttp get params - D0rs4n
fd33adf Use quote_plus instead of quote in the Githubin... - D0rs4n
7adb181 Update Hacktoberstats' get_october_prs function... - D0rs4n
22abc00 Improve code consistency in Movie, Wikipedia an... - D0rs4n
Connected!
GitHub Actions run 1109028388 succeeded.
@Xithrius It still lives, just taking me a bit to get to it.
Thank you for the update! :heart:
Setting this to low as the last code jam that needed these utilities occurred not to long ago, and the next code jam probably won't happen for a while.
Good stuff. Tested, works well.
I'm glad! 👍 Shall I open a new issue to keep things consistent?
I'm going to go ahead and close this as regex101 is now included in a development branch for this project.
@anand2312 feel free to open a new issue for regexone.
This is loaded incorrectly (not according to what we want it to be) as : syntax makes it a dictionary.

- "How good would you say you are at Python so far: beginner, intermediate or advanced?"
Isn't web dev included with backend? You cannot do frontend with it...
Doesn't follow the python discord style guide, this section.
await ctx.send(
embed=self.error_embed(
f"There was an error when communicating with the {error.api}",
NEGATIVE_REPLIES
)
)
Good addition, can we add status_code and an optional argument that contains the error message received by the API too?
This can be paired up with the above log into a single log, also the language this has sounds a bit like user forward, where it is telling them to try it again.
Maybe something like this, (add a := to if statement, if error:=raw_data.get("errors"):)
log.info(f"Got an error while communicating with Wikipedia API: {error}.")
And this doesn't follow the python discord style guide, [this section](https://pythondiscord.com/pages/guides/pydis-guid...
The user is not necessarily python-discord and would be different repo_issue.organisation is specified.
Good point, right now it's too specific to the Wikipedia API
(that returns 200 even if it sends back an error :D )
Discussed and approved in [server](#dev-contrib message)
Reasoning:

[python-discord/bot] Checks Successful on PR: #1727 change dockerfile python version to latest 3.9.x
GitHub Actions run 1110153594 succeeded.
Connected!
GitHub Actions run 1110172859 succeeded.
Tag Name- VPS
The tag covers what is a VPS and some examples of good ones
Tag content:
If you need to run your bot 24/7 (with no downtime), you should consider one a cheap VPS.
The following is a list of recommended services that many people on the server have used.
They are reliable and good value for money. Their specs should be sufficient for running Discord bots.
- Cheap VPS
- Based in Europe.
- Cheap V...
GitHub Actions run 1110192485 succeeded.
9bb4c5b Create tag about arrays vs lists. - swfarnsworth
[python-discord/bot] New branch created: swfarnsworth/tags
This PR would add a tag explaining the difference between lists and arrays and why the two terms shouldn't be used interchangeably.

How about translating the site into Korean?
There is no discord.py guide in Korean, so many beginners are having a hard time. How about translating the discord.py guide to Korean for beginners?
GitHub Actions run 1110264831 succeeded.
I believe we have a pin to this effect in the discord-bots channel.
I am following the holy PEP 8
Be consistent in return statements. Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as
return None, and an explicit return statement should be present at the end of the function (if reachable)
You're right, I'll change it to dict[str, Any]. That's what is expected to be returned from this function.
On the other hand,
69is valid JSON too.
Yes, that's right. I think the lack of validation of received data is a bit of an issue across the whole project, but that's out of scope here.
On the next lines, floats are added to the these lists. And points has floats in it because it's populated by floats on line 303.
That's a mistake on my part, I'll fix it
5ef8026 Fix type annotation inconsistencies - decorator-factory
9ffd7c8 Update the movie cog to use aiohttp get params - D0rs4n
8532b40 Update the Wikipedia Cog to use aiohttp get params - D0rs4n
fd33adf Use quote_plus instead of quote in the Githubin... - D0rs4n
7adb181 Update Hacktoberstats' get_october_prs function... - D0rs4n
22abc00 Improve code consistency in Movie, Wikipedia an... - D0rs4n
GitHub Actions run 1110307973 succeeded.
Mmm I wasn't aware of this, thanks for explaining.
Thanks for clarifying.
Looks LGTM to me, good changes overall.
The notion of imposing better validation on data coming from external sources is attractive, though on the other hand Lancebot is primarily aimed at beginners. I don't know whether it'd make sense to put in the effort of making existing features more resilient if the same level of resilience isn't required from new contributions.
I think it's a good idea to teach beginners about validation, security and all that stuff. Lancebot being a learning project, we want to teach people good practices. Second, the bot is running on our hardware and has access to some of our secrets, so we wouldn't want to introduce vulnerabilities (#801)
According to PEP 585, just like with List, Dict, etc. importing this kind of type from typing is also deprecated; collections.abc should be used. You should refer to that PEP for the full list.
This is still not following the style guide, look at the above comment.
Looks like when you where resolving git conflicts, you merged both the changes. Kindly remove one.
There wasn't a need to change this line as it is in one line and doesn't fall over to the next line. Basically what I meant was, instead of:
await ctx.send(embed=self.error_embed("This is a long message",
argument_2)
And it should rather be:
await ctx.send(
embed=self.error_embed("This is a long message",
argument_2
)
Oh dear god, you are correct. That's a big list. I'll implement that tomorrow
GitHub Actions run 1110447246 succeeded.
As a pure code review, this looks good to me
Thank you for you review! I should've paid more attention to the style guide! 👍
Learned my lesson!
Technically web dev could just be frontend, but for clarity I think I'll just replace web dev with frontend
To be honest i'm not quite sure of the use of this tag, in many online tutorials array and list are used interchangeably, and I don't see the benefit of making this distinction.
I would probably say most of the time when people say array in PyDis they're referring to a Python list, unless they've already explicitly said they're working with numpy.
The code example there is also a bit confusing imo as it suggests the different multiplication behaviour is a feature of a list vs an a...
GitHub Actions run 1110548758 succeeded.
We discussed this in a staff channel and don't agree on the intended use case, so I'm going to withdraw this.
[python-discord/bot] branch deleted: swfarnsworth/tags
Isn't it just adding a condition at https://github.com/python-discord/bot/blob/d914046dc5b661d144537715dbf80ae6b361b0e8/bot/exts/moderation/infraction/_utils.py#L219 checking two fields in the infraction object?
Maybe I'm missing something
GitHub Actions run 1110752391 succeeded.
@NIRDERIi @Shivansh-007 fixed up.
@NIRDERIi So just to be clear if you have help dms on or you are the channel claimant you should receive and dm when the channel is closed?
Yes, keeping track of channels you helped with, can be really helpful if you don't know where the channel went. If you were helping, maybe a message will be sent: #channel-mention is not closed, Thank you for helping and for the channel claimant it'll be Your help channel was closed due to inactivity or something like that
Hey, thanks for the suggestion! I will have to shoot this proposal (as well as other translations) for a few reasons:
- A translation is a lot of work, from finding people to do the initial translation, to finding reviewers so people don’t slip in their own “thoughts” in there.
- Maintenance is going to be very hard, because each change would require the same requirements as the initial conversion.
Translation and providing people with good content is a good cause, but it isn’t feasibl...
Why would anyone but the channel's claimant care about the channel being closed? If anything, I think this DM should only be sent to claimants.
Isn't it just adding a condition at
https://github.com/python-discord/bot/blob/d914046dc5b661d144537715dbf80ae6b361b0e8/bot/exts/moderation/infraction/_utils.py#L219
checking two fields in the infraction object?Maybe I'm missing something
I'd like to do something nicer where the expiration date, duration, and whether it's expired are all included.
I know that when I help, I go back and see if the other user still needs help, and if the user closed the channel, I will kinda have to search for the channel. I think it's a nice feature, and again, if you didn't really care, you can just turn DM help off in a simple command
The project currently enforces typehinting, but discord.py uses annotations for its own purposes which makes some annotations on command callbacks invalid typehints.
@MarkKoz proposed in #dev-contrib that converters could inherit from the type they return to alleviate this issue, but this is more limited than normal typehinting (although still better than the current hints which are just wrong and cause warnings during development).
The typing.Annotated type allows us to attach metada...
I know that when I help, I go back and see if the other user still needs help, and if the user closed the channel, I will kinda have to search for the channel.
But won't they receive a notification for the new message? Receive a DM for a new message = this person still needs help. Don't receive a DM = they probably don't need any more help.
if you didn't really care, you can just turn DM help off in a simple command
What if the helper cares about the current notifications but not...
Wdym for the new message? And what current notifications? Isn't help dms only for when you write the first message to help in a channel?
Very cool; I like this approach. I'm fine with patching discord.py since the precedent has already been set (implementing root aliases). This patch isn't that bad anyway because it's not really dealing with any internal/private APIs. That being said, we would have to ensure the setter is in sync for all the special cases (like the greedy converter).
How do you think we should name the typing.Annotated aliases and the converters? I'm thinking that call converters should be named like `Dat...
Wdym for the new message? And what current notifications? Isn't help dms only for when you write the first message to help in a channel?
You're right. I misread the code.
Still, I don't see this as particularly useful for helpers but then again I never though the helpdm command was that useful to begin with. I think you should shove aside by opinion and instead gather thoughts from people who actually use that feature.
A) Not related, but how do you respond to a specific line?
B) The same thing could be said about if we did the channel closed instead of the initial message, which is why both seem to be same importance level because they both keep you tracking the help channels. Personally, the channel closed is a much important feature, because you know when you type a message in a certain channel.
A) Not related, but how do you respond to a specific line?
Copy and paste that line, then prepend a > to it.
And for example, while commenting here, I helped three people with their problems. Took me a little while to find out where the channel is, because I first tried to look in open channels, and only then go to the dm and see the channel.
Copy and paste that line, then prepend a > to it.>
Thanks
That being said, we would have to ensure the setter is in sync for all the special cases (like the greedy converter).
I don't anticipate any more cases like that as we're really just modifying what's in the loaded params, with the greedy being some kind of an early fail according to a comment in the source. When I looked at the current master branch it looked like it was still the only piece that immediately acts on the changed annotation. But if something does pop up it shouldn't be har...
GitHub Actions run 1110940053 succeeded.
GitHub Actions run 1110942316 succeeded.
GitHub Actions run 1110955630 failed.
Do you want to go ahead with a PR or wait for some more voices?
GitHub Actions run 1110960242 succeeded.
GitHub Actions run 1110969953 succeeded.
GitHub Actions run 1110970607 succeeded.
GitHub Actions run 1110974937 succeeded.
Is there any way to enforce the annotated type to be correct, such as preventing Annotated[int, DateConverter]? Not sure if that's necessary, but would be nice.
I found this hack: https://gist.github.com/decorator-factory/718a6b6bf514c496baf385f0c0cfcdaa
It doesn't require monkey patching discord.py, and it makes sure the converter class actually produces the desired type.
But unfortunately, it only works on pyright. If anyone could make it work with mypy, that would be great
Do you want to go ahead with a PR or wait for some more voices?
I'll start working on it tomorrow.
What module would be the most fitting place to define and apply the patch in? The bot module's init?
Yeah, that's where the other patch is., though some are not fans of having significant amounts of code in init. You could consider creating a patch module and defining functions like "apply_x_patch" that get called from init. We used to have a similar system to patch a bug in d.py, but it was all removed once it got fixed upstream. You could also try to find that for inspiration. I don't have a concrete idea of the best approach.
The format of the templates was discussed a long time ago in python-discord/organisation#268 but never actioned. I don't think we really came to a conclusion. I personally think some templates need changes. We should also invest in https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository as Chris mentioned in that issue.
I don't have much experience with the file previews, but they sound like the perfect solution for this feature. It gives a lot more headroom compared to the message length limit. I know they work on Desktop, Web, and Android.
GitHub Actions run 1112598113 succeeded.
b45e6a0 feat: allow all origins, methods, headers with ... - vcokltfre
[python-discord/quackstack] New branch created: feat/vcokltfre/cors
This PR allows quackstack to be used in javascript frontends
This looks like it should work. LGTM.
[python-discord/quackstack] branch deleted: feat/vcokltfre/cors
When going through the code I realized we should be able to redefine the types under a typing.TYPE_CHECKING guard, which ought to work for everything apart from allowed_strings
Does anyone want to say their opinion about it?
9ffd7c8 Update the movie cog to use aiohttp get params - D0rs4n
8532b40 Update the Wikipedia Cog to use aiohttp get params - D0rs4n
fd33adf Use quote_plus instead of quote in the Githubin... - D0rs4n
7adb181 Update Hacktoberstats' get_october_prs function... - D0rs4n
22abc00 Improve code consistency in Movie, Wikipedia an... - D0rs4n
f72bb8a Pinned aioredis to 1.3 and relocked dependencies - wookie184
8e653f4 Replace fuzzywuzzy with rapidfuzz - wookie184
fac37b2 Modify code to comply with new linter error N818 - wookie184
78f1cd5 Merge branch 'main' into remove-gpl-deps - Akarys42
67caea1 Merge pull request #799 from python-discord/rem... - Akarys42
[python-discord/sir-lancebot] branch deleted: remove\-gpl\-deps
GitHub Actions run 1113244112 succeeded.
Connected!
GitHub Actions run 1113249577 succeeded.
Looks great! Thank you so much for working on this. It's a fun logo and it was really nice to see the process and see it evolve in dev-branding.
GitHub Actions run 1113577006 succeeded.
I had an idea in the original PR, maybe you could allow people to search using the stackoverflow search syntax:

and use a regular experession to get and pass in the tags, authors, etc. This would not only make it neater, but also provide support for other filters like authors and whether or not the question is answered.
eeb07ce Add valid thread archive times enum - ChrisLovering
041d75e Archive threads when the parent message is deleted - ChrisLovering
31aa3e1 Strip back intents to just what's needed - ChrisLovering
7842ed4 Disable coloured logs as it doesn't play nicely... - ChrisLovering
8c32446 Archive thread when original message is deleted - ChrisLovering
GitHub Actions run 1113735027 succeeded.
GitHub Actions run 1113752650 succeeded.
I had an idea in the original PR, maybe you could allow people to search using the stackoverflow search syntax:
and use a regular experession to get and pass in the tags, authors, etc. This would not only make it neater, but also provide support for other filters like authors and whether or not the question is answered.
That would be pretty cool to be honest, I can work o...
Did you mean splitting?
[thread-bot] Branch add\-nomination\-cog was force-pushed to `9c0db9e`
GitHub Actions run 1113757748 succeeded.
I had an idea in the original PR, maybe you could allow people to search using the stackoverflow search syntax:
and use a regular experession to get and pass in the tags, authors, etc. This would not only make it neater, but also provide support for other filters like authors and whether or not the question is answered.That would be pretty cool to be honest, I ...
[thread-bot] Branch add\-nomination\-cog was force-pushed to `c9e8d0b`
GitHub Actions run 1113864309 succeeded.
Adds proper typehinting to converters by assigning the names to the converter return values during type checking.
I've also fixed the message for _snowflake_from_regex where it raised an error with the str class interpolated instead of the argument in 7eac90e05e30cd4ce702a3933ee7fa61bdc1f2d6
closes: #1730
4625841 Change link titles to indicate possession - mbaruh
I wasn't trying to convey possession but sure, changed in 4625841
GitHub Actions run 1114270233 succeeded.
[thread-bot] Branch add\-nomination\-cog was force-pushed to `07ffe7d`
GitHub Actions run 1114402590 succeeded.
You already know what is incoming haha
When the limit was raised, the error message was not edited to reflect the change.
https://github.com/python-discord/bot/commit/6f45d6896adb3f05962733cec8e5db199def20bc
GitHub Actions run 1114564147 succeeded.
Hey are you still planning on working on this? Someone sent me this link for Discord Flags: https://pypi.org/project/discord-flags/might be helpful to use these for all of the parameters? Could default most of them to None.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #800
Description
Implemented a Real Python searching function, similar to the Stackoverflow search command.

Did you:
- [X] Join the Python Discord Community?
-...
GitHub Actions run 1115228777 succeeded.
Instead of chopping off 5 articles, you could add a limit parameter to the URL, so that the API returns at most 5 articles.
ERROR_EMBED sounds better to me. Just use full nouns, this is not C :)
Don't leave comments like that in real code. If you want to ask whether this is a good way to do this, you can ask in #dev-contrib. In this case, I think the template URL is a better approach
Hey are you still planning on working on this? Someone sent me this link for Discord Flags: https://pypi.org/project/discord-flags/might be helpful to use these for all of the parameters? Could default most of them to None.
Hey @brad90four, I was thinking that there is no need for using flagged arguments, as I have mentioned here.
Hey are you still planning on working on this? Someone sent me this link for Discord Flags: https://pypi.org/project/discord-flags/might be helpful to use these for all of the parameters? Could default most of them to None.
Hey @brad90four, I was thinking that there is no need for using flagged arguments, as I have mentioned here. This would even add functionalityfor more filters.
So I presume we...
GitHub Actions run 1115361876 succeeded.
GitHub Actions run 1115370595 succeeded.
GitHub Actions run 1115387753 succeeded.
Good catch! Thanks for this PR!
Connected!
GitHub Actions run 1116644636 succeeded.
[python-discord/sir-lancebot] New branch created: love\-command\-checks
After some research I found a library SQLAcodegen that works just like reflecting the current database in SQLAlchemy, except it actually generates the models. (As an additional bonus, it produces a PEP 8 compliant code). This way the API doesn't have to reflect the database every time the it starts up.
Naturally, it would still require a review to make sure everything's generated properly, but it would make a whole lot easier to setup an alembic pr...
Description
This makes a few changes to the .love command to make it slightly less creepy, more consistent with other lovefest commands and also makes it give consistent output, regardless of input order.
The changes I have made are:
- Added and
in_monthcheck, to ensure the command can only run during February (valentine season) - Require that both members have opted into the love fest event (by checking roles)
- Sort the members to be checked before hashing, to ensure sym...
GitHub Actions run 1116782842 succeeded.
raise BadArgument("Both members must have the lovefest role!")
How about this?
raise BadArgument("Both members must have the `Lovefest` role!")
actually, never mind. It's referred to as lovefest in other commands, so lets stay consistent.
298f8fc Update love calculator error output to be consi... - ChrisLovering
GitHub Actions run 1116959134 succeeded.
fa4b469 chore: remove some newlines in the blocking tag - vcokltfre
[python-discord/bot] New branch created: chore/vcokltfre/blocking\-tag\-newlines
Originally the tag had some excess new lines which made it bulkier than necessary, this is a simple PR to remove them. [Discussion & permission here](#dev-contrib message)
Before:

After:

I see, yeah there is indeed one, though, well, this is more informative in my opinion.
GitHub Actions run 1117022411 succeeded.
To be honest, I quite like this idea.
My way of implementing this is using the on_message_edit tag to get the message
and use bot.process_commands (Not tested yet I'm not sure will it work or not)
to run the message.
To be honest, I quite like this idea.
My way of implementing this is using theon_message_edittag to get the message
and usebot.process_commands(Not tested yet I'm not sure will it work or not)
to run the message.
Note that this will also run other edited commands. not just !eval if you want it to only run on !eval or !e
you can check if the message starts with !e (!eval contains !e so it should work on both alias).
I've pinned a variation of this in the discord-bots channel. Thank you for the suggestion!
Many people have problem with discord.py giving them none outputs in this server because they didn't enable the intents, so can we make a command !intents which shows how to enable intents from discord dev portal and how to implement them in code
This exact idea already exists, with the same command name
This should fit the line length?
return # Votes could be split into multiple messages, create the thread on the final message
"""Cog for creating and archiving nomination threads when votes are posted/archived."""
Could we not word this better?
Do you mean that when this string is sent to Discord, it converts the unicode to :thumbsup: equivalent?
[python-discord/bot] branch deleted: chore/vcokltfre/blocking\-tag\-newlines
Connected!
If a user attaches a file to the message he wants to send the message will be deleted and there will never be a pinned issue.
Can you give some more information on what the commands would be?
It's not required, and doing so actually causes the raise e line to be included in the traceback.
Sometimes. It's not consistent nor something that's being enforced.
Well here I would say it makes sense?
I don't really think this is much worse; it's not worth it for me to make a new commit to change this at this point. I have mixed feelings on it anyway, but I'm not gonna get into that if I don't have to.
I'll work on this if this is approved :)
From the dpy side, bot.process_commands should work. But, if the edited message would not be a valid one, there might be a chance an error message would be shown. The best way I can think about is:
ctx = await self.bot.get_context(after)
if not ctx.valid:
return
await self.bot.process_commands(after)```
As [suggested by Lemon](#community-meta message) in #community-meta, this will insert the correct category names into the DORMANT_MSG that's sent when a channel is moved to the dormant category.
By the solution you showed in #dev-contrib, it seems ok to me!
[python-discord/bot] New branch created: dynamic\-dormant\-message
f038479 Update DORMANT_MSG to allow kwargs in str.format() - TizzySaurus
Can you give some more information on what the commands would be?
well was thinking like in a particular channel when a person messages, at random a Pokemon appears then when they guess the Pokemon name correctly they will be added to their pokedex..in future I will add battles and gym
ae0d725 Update embed sent when channel moves to dormant... - TizzySaurus
Could a tag which describes how to use custom/default emotes in embeds or in messages by a bot be made? It can include that if you want to put a default discord emoji, you can use the charinfo command and otherwise, it shows how to get the emoji ID and use:
Static custom emote -
Animated custom emote -
Or it shows how to use the bot.get_emoji(id) function
I've seen many users ask how to make the bot display a emote whether in embeds or normal messages, and think this can be useful
Solves #1736
DORMANT_MSG now has the category names dynamically set.
I'm not sure whether/how to handle the get_channel(constants.Categories.help_available) returning None (since not in cache).
GitHub Actions run 1119291481 failed.
Maybe try to somehow get the GuildChannel object and check its category? Not sure why it wouldn't be in cache tho
Here, it's simply unconditionally added:
It should be fairly simple to check if a string ends with a common list of punctuation (string.punctuation ought to do), and in those cases not add the extra ..
d6c92ad Make DORMANT_MSG a string instead of f-string - TizzySaurus
GitHub Actions run 1119308441 succeeded.
You should probably check for None and in that case add a log, and default to the old Dormant channels text.
e77a0d9 Change bot.get_channel to utils.channels.try_ge... - TizzySaurus
I've instead used utils.channels.try_get_channel, as suggested by Chrisjl on discord, which will always get the channel
GitHub Actions run 1119413606 succeeded.
If it's up for grabs, I'd like to grab this. (Although, the Issues cog will be moved into the Github cog, so we have to wait until that PR is merged.
The updated code should be working fine by the looks of it!
Testing this locally, it seems the channel object here isn't actually updated with the new category when it's moved on the lines above, so the embed reads as below. As you can see, it still references the in use category.

Do you have a proposed fix/improvement to this? afaik it's not possible for bots to delete only attachments from user messages. I guess we could try and detect if the pinned message was deleted and try and pin the next message from the author if it was, not sure how easy that would be to implement, or if it would be worth the effort.
99bfb15 Fetch dormant category rather than use channel.... - TizzySaurus
Re-tested, all works 👌
GitHub Actions run 1119877933 succeeded.
This looks good, thank you
For what it's worth, looks good to me
10c3b34 Update DORMANT_MSG to be compatible with str.fo... - TizzySaurus
f038479 Update DORMANT_MSG to allow kwargs in str.format() - TizzySaurus
ae0d725 Update embed sent when channel moves to dormant... - TizzySaurus
d6c92ad Make DORMANT_MSG a string instead of f-string - TizzySaurus
e77a0d9 Change bot.get_channel to utils.channels.try_ge... - TizzySaurus
[python-discord/bot] branch deleted: dynamic\-dormant\-message
Connected!
GitHub Actions run 1120030211 succeeded.
A small question / suggestion for sending the user the character that raised the un-supported character error.
Should the Bad Character be sent back to the user so they know they used an Un-Supported Character?
raise commands.BadArgument(f"The given character: {character} cannot be used! Please enter a valid character.")
[python-discord/site] New branch created: smarter\-resources
This PR will do the following things:
-
[X] Make the following search options be ticked by default
- General
- Tutorial
- Free
- Beginner
-
[ ] Split the
Topiccolumn into two -
[ ] Center the
SearchandClearbuttons
GitHub Actions run 1120112483 failed.
I don't have much experience with the file previews, but they sound like the perfect solution for this feature. It gives a lot more headroom compared to the message length limit. I know they work on Desktop, Web, and Android.
I don't have file previews on Android at the moment, tried on latest stable and also alpha build (88202). Not sure if it might be a partial rollout, or maybe older devices aren't supported?
Personally I still wouldn't mind using file previews for this, as...
I believe discord.Object was how you infracted users who weren't in a guild before discord.py V1.6, however 1.6 introduced lazy-fetching which will get the discord.User object even when the user isn't in the server.
If I'm wrong and it is still possible for user to be a discord.Object we should change user.mention to <@user.id>, since discord.Object does have an id attribute, and this is what user.mention would return.
On the other hand, if I'm correct and the user will ...
I will look into it if it would be quick solution otherwise I'd agree that it will not be worth the effort.
@ks129 specifically you meant the token wrapper, correct?
Does this include the SEARCH_API, STATS_API, YOUTUBE_VIDEO_URL, and YOUTUBE_SEARCH_URL constants too? Or are those fine as is considering that their names are self-explanatory compared to the RESULT f-string.
This was discussed in dev-contrib. Decision was that we should just not add punctuation, so I'll PR this now
aef5584 Remove added punctuation from reminder - TizzySaurus
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
GitHub Actions run 1120551567 succeeded.
@Akarys42 has okayed-this on discord, so I'll start removing the now redundant methods.
[python-discord/bot] New branch created: remove\-redundant\-converters
6dfe5eb Remove redundant converters - TizzySaurus
Should work great, nothing should really go wrong
691e86c Remove redundant converters - TizzySaurus
[python-discord/bot] branch deleted: TizzySaurus\-patch\-1
456e920 Update to new converters - TizzySaurus
Connected!
GitHub Actions run 1120717092 succeeded.
43acd17 Update to new converters - TizzySaurus
8faf1f3 Update to new converters - TizzySaurus
0cf1ab2 Update to new converters - TizzySaurus
7d08514 Update to new converter - TizzySaurus
64a69bd Remove unused imports - TizzySaurus
c9c71d7 Update to new converter - TizzySaurus
I believe, replying to the original message where the reminder was invoked is more consistent than using a jump url.
For that we would have to modify jump_url to be message_id instead
reminder = await self.bot.api_client.post(
'bot/reminders',
json={
'author': ctx.author.id,
'channel_id': ctx.message.channel.id,
'jump_url': ctx.message.jump_url,
'content': content,
...
aad4fa8 Remove unused import - TizzySaurus
006eca4 Update to new converter - TizzySaurus
c42e2c8 Remove unused import - TizzySaurus
Sounds like a great idea! But notice, if the message was deleted, and you try to reference it, you will get discord.HTTPException error saying Unkown Message. The best way I can think about handling it is:
partial_message = TextChannel.get_partial_message(message_id)
try:
await channel.send(content=content, embed=embed, reference=partial_message)
except discord.HTTPException:
await channel.send(content=content, embed=embed)```
While the variables `message_id` is the message i...
Indeed. however... it should be
partial_message = channel.get_partial_message(message_id)
(As get_partial_message is neither a staticmethod nor a classmethod)
And then in a try except block we could actually try to reply to this message, as it's guaranteed that it's the same channel.
Oh yeah you are correct, forgot about that.
Closes #1681
Removed converters that were made redundant by discord.py V1.6's change to UserConverter which fetches from API when user not in the cache (server).
Also renames bot.converters.FetchedMember to bot.converters.MemberOrUser to better represent its value.
GitHub Actions run 1121100731 failed.
GitHub Actions run 1121108577 failed.
GitHub Actions run 1121130396 failed.
GitHub Actions run 1121150256 failed.
@Arnab1181412 go ahead.
GitHub Actions run 1121206918 succeeded.
GitHub Actions run 1121272042 succeeded.
GitHub Actions run 1121277426 succeeded.
GitHub Actions run 1121346496 succeeded.
GitHub Actions run 1121350025 succeeded.
GitHub Actions run 1121369903 failed.
GitHub Actions run 1121385129 failed.
GitHub Actions run 1121393717 succeeded.
GitHub Actions run 1121398169 succeeded.
Seems fine to me. Should be functional and operate properly.
Great work so far! I forgot to mention: I'd also like for there to be a specific "error message" if the user doesn't check any options for a given parameter (as this will cause an intersection with the empty set and yield no results for the whole query). If this must be handled by the backend, let me know in what way and I'll adjust it accordingly.
I'm not sure what this adds? Since the above if statement returns anyway, so if that's true this if will never be evaluated.
Not much actually, usually I do like to use elifs in these cases to be clear that "Either this happens, or this".
I think we can leave it as is though yeah.
[thread-bot] Branch add\-nomination\-cog was force-pushed to `c2f3403`
GitHub Actions run 1121656217 succeeded.
939535d fix: update urls in site cog - dawnofmidnight
[python-discord/bot] New branch created: dawnofmidnight/site\-urls
Some urls in the site cog are currently outdated and lead to the wrong pages. Some of them (like the Resources page) have redirects, while others (like the Asking Good Questions page, do not). This changes the constant to the site base url and updates the rest of the urls to be valid.
GitHub Actions run 1121722612 succeeded.
"""Check if the thread_starter_message of `thread` references the given `message_id`."""
# Amount of elements in each chunk of a sequence when using bot.utils.helpers.chunked_find
2e8797e Improve comments and docstrings in nomination c... - ChrisLovering
GitHub Actions run 1121752836 succeeded.
Yeah this looks good now, thank you Chris
[thread-bot] Branch add\-nomination\-cog was force-pushed to `f025e31`
Yeah this looks good now, thank you Chris
GitHub Actions run 1121773028 succeeded.
GitHub Actions run 1121778996 succeeded.
Connected!
GitHub Actions run 1121782181 succeeded.
edfe60a Remove role pings when a helper vote is posted - ChrisLovering
[python-discord/bot] New branch created: Remove\-role\-pings\-on\-nomination\-votes
We have just deployed thread-bot, which pings these roles inside a thread for better focused discussion. To avoid with duplicated pings, I have removed them from here.
GitHub Actions run 1121795057 succeeded.
Are _snowflake_from_regex or RE_USER_MENTION used anywhere else? If not, delete them too.
Note that it will no longer be possible to look up deleted users by their ID. Is that a use case that needs to be supported?
c4e0fae change dockerfile python version to latest 3.9.x - onerandomusername
ec04cb7 Merge pull request #1727 from onerandomusername... - jb3
3d395b2 Fixed error message to match true value - SuperstalkerX
9fe677a Merge pull request #1732 from SuperstalkerX/pat... - Xithrius
fa4b469 chore: remove some newlines in the blocking tag - vcokltfre
[bot] Branch remove\-redundant\-converters was force-pushed to `241164d`
[python-discord/bot] branch deleted: bug/message\-404
5fc4b67 Incidents: catch 404s - MarkKoz
b8d959c Code block: catch 404s when editing or deleting... - MarkKoz
dde617e Duck pond: abort if reaction's message or autho... - MarkKoz
e88df8f Merge branch 'main' into bug/message-404 - MarkKoz
6bfc7a9 Merge #1726 - catch various 404s from message o... - MarkKoz
_snowflake_from_regex isn't but it seems RE_USER_MENTION is used in UserMentionOrID here https://github.com/python-discord/bot/blob/main/bot/converters.py#L475
Connected!
GitHub Actions run 1121843304 succeeded.
I forgot that I use the beta app on Android.
RE_USER_MENTION is still used but not _snowflake_from_regex so will remove that :+1:
Good catch! Discussed this internally in the mod-meta channel and we decided we still want this ability, so I'll revert this change.
GitHub Actions run 1121944974 succeeded.
Should be fixed with this commit (also removes the _snowflake_from_regex function)
5fc4b67 Incidents: catch 404s - MarkKoz
b8d959c Code block: catch 404s when editing or deleting... - MarkKoz
dde617e Duck pond: abort if reaction's message or autho... - MarkKoz
e88df8f Merge branch 'main' into bug/message-404 - MarkKoz
6bfc7a9 Merge #1726 - catch various 404s from message o... - MarkKoz
4d62dad Remove role pings when a helper vote is posted ... - ChrisLovering
[python-discord/bot] branch deleted: Remove\-role\-pings\-on\-nomination\-votes
GitHub Actions run 1121977358 succeeded.
Connected!
GitHub Actions run 1121987110 succeeded.
Note to past self: list comprehension is faster, I am not in the join-list-comprehensions squad
@HassanAbouelela has valid points regarding this issue and which cannot be implemented as of now or in the near future. I will be closing this issue.
I created a calculator using python ( i learned python in a week). please do add this as this would be a big achievement and I hope the users will also benefit from this. ( my discord id: 762215365446598666 )
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] E...
Hello @imranshaji7, thank you for your interest in our projects.
Congratulation on finishing your first project! Our bot uses the discord.py library though, and can't be used to add various unneeded scripts. Please make sure to be assigned to an issue before submitting a PR, or come discuss this with us in the #dev-contrib channel.
Since your pull request doesn't fill the various requirements for this project, I'll be closing this PR.
GitHub Actions run 1123219651 succeeded.
Connected!
It is what you would think it to be: A calculator . 2 numbers, 5 operations
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
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 and agree to the [contributing guidelines](https://...
GitHub Actions run 1123222059 succeeded.
88500a5 Add git to the Docker image - ChrisLovering
96d0345 Pin discord.py rev to avoid breaking changes in... - ChrisLovering
GitHub Actions run 1123251602 succeeded.
Connected!
GitHub Actions run 1123253553 succeeded.
I agree, if that's feasible with our current infrastructure let's do this!
In fact, duplicate of #447
Narrator: it wasn't implemented tomorrow.
I'll allocate some time later, I suppose this is not a very high-priority task
GitHub Actions run 1123441454 failed.
GitHub Actions run 1123526203 failed.
160d037 fix: Nomination message now checks historic and... - ChrisLovering
[python-discord/bot] New branch created: fix\-nomination\-archive\-check
Previously nomination messages had role pings in them, now they don't as we moved them into a thread.
Due to this, we need to detect both in the interim of historic nominations existing.
A 'proper' fix for this is to store the nomination message IDs when we post them against the
nomination object in the site api. We are planing to work on this soon, this commit is a
short term fix.
GitHub Actions run 1123729791 succeeded.
GitHub Actions run 1123803209 succeeded.
Ran into a bug where it would delete all messages in the channel under some circumstances...investigating a fix
Ok, false alarm. The issue was caused due to me copying the text from another nomination to test, rather than using post_review or get_review. Due to this, the message contained a bunch of spaces that caused the regex to fail. This would also happen with the current system, so the proper fix is to upgrade to storing the message IDs, rather than use regex. This will do for now though.
Updates to nomination review system posting conditions
There are a few changes we'd like to make to the nominations review system.
Features we want:
- A limit to the maximum number of reviews active in the channel at once.
- A limit on the frequency reviews are posted (e.g. one a day).
- A check to ensure the user has been active recently, to hold off the review if they haven't and possibly unnominate after a while.
Implementation:
General Idea:
These changes do...
Dunno if there's any need for approving again, but I will anyway, lgtm!
GitHub Actions run 1124135125 failed.
First, thank you all for suggesting this idea and implementations!
I'm afraid we decided to reject it. The main reason being if a command gets edited and ran half a minute after the original message has been sent, it is hard to get who used what command. We break this immediate process of invocating a command and getting the answer.
We thought about using replies, but this isn't possible unless a major refactoring is done to add that to every command, which doesn't sound worth it. We ...
I could work on this feature
Connected!
Hey buddy, did you read through these and check that they were done?
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 and agree to the contributing guidelines?
A github search for pythondiscord.com brings up another case of a redirect link (not in the site cog): https://github.com/python-discord/bot/blob/d5ee28133f8e792526716b07d25cbf6e4faba3a1/bot/exts/help_channels/_message.py#L15
There are also a few other locations where pythondiscord.com is used rather than the constant e.g. https://github.com/python-discord/bot/blob/c1c6286fb2225a463533ba17d823b2e6a393f8ad/bot/exts/moderation/infraction/superstarify.py#L21
Do you think these would be w...
Duplicate of #807.
Hey! Once again thanks for your suggestions, but these projects are not something we can integrate into our bots.
The bots are discord.py bots which interact with discord, with no real place for standalone scripts such as this one.
Im going to close this issue, as well as #808 which has the same problem. Please do not open any more PRs without talking to the core devs about your ideas on server.
Thanks!
I propose that when we detect a webhook that's been posted in the guild, we call DELETE on that URL, so that the webhook is deleted.
This is to protect users against themselves, since there is the chance that their message was scraped before we deleted it, and someone now has that webhook url.
Implementing this would be as simple as calling DELETE on any webhook URLs that we detect.
I am in support of this, but just wanted to add that we should also let the user know that this happened through a message in that channel.
Alternatively or additionally, we could send one message with the webhook that explains what has happened.
I'm against executing the webhook ourselves, but yea we should update the message that gets sent in the channel.
Our channels are often rather crowded, if we send a message with the webhook they can read the message clearly themselves without scrolling.
It can also prove as a better lesson, "Look, we were able to send this message because you leaked the url!", rather than talking hypothetically.
Yes, but executing a webhook without consent seems bad, treading on against ToS. I do not think we should do it.
I am in favor of deleting the webhook. We can update our DM message (do note it falls back to being inside the channel if the user has DMs disabled) to say it has been deleted and a new one should be generated.
If this feature were to be implemented, can I get to which form the output of the closest matches would be? I was thinking if there is more than one result, it will add reactions and according to which one you react to it will edit the message accordingly.
Our channels are often rather crowded, if we send a message with the webhook they can read the message clearly themselves without scrolling.
It can also prove as a better lesson, "Look, we were able to send this message because you leaked the url!", rather than talking hypothetically.
I'm going to be very against anything other than deleting the webhook and adding information in our normal DM/in-channel message. It's not our responsibility to provide lessons to users about...
Might be worth mentioning how to get the lovefest role, something like
raise BadArgument("Both members must have the lovefest role! You can get this by running the `.lovefest sub` command.")
if the who or whom is the invoker we probably wouldn't need to require the lovefest role, but the current behaviour is fine.
Could add a footer to the embed sent saying you can unsubscribe with .lovefest unsub, but you could also not do that, I don't' mind.
The NICKNAME_POLICY_URL seems to be correct already, but I can fix the other.
The
NICKNAME_POLICY_URLseems to be correct already, but I can fix the other.
Yeah that one is the correct URL, just not using the site's name constants. There were a few others like that but I think the ASKING_GUIDE_URL is the only one with a redirect url. Just changing that one is fine if you think the others are out of scope, replacing the text with constants isn't particularly important.
spitting image is correct, https://www.merriam-webster.com/dictionary/spitting image. splitting image would be a great pun for the .mosaic command though, thinking about it 😄
[sir-lancebot] Branch love\-command\-checks was force-pushed to `9542ec7`
[sir-lancebot] Branch love\-command\-checks was force-pushed to `446c86f`
On top of what's in the original issue description, we should also change the alert that's posted in mod-alerts to include whether the DELETE was successful or not.
i am not sure if this is current behaviour, but we should also run this filter against staff posting webhooks, since a mod may want to delete a webhook found in a grabber script.
The link to monthly data reviews on the timeline doesn't exist anymore. https://github.com/python-discord/site/blob/93be3f40a07f988d63cacb2dc24ca35c17fee76a/pydis_site/templates/home/timeline.html#L114
new link is https://www.notion.so/6784e3a9752444e89d19e65fd4510d8d?v=69268794b9d2454a9c28e1550e2923c2 for anyone who wants to make this change
Could I make this change and open a pull request?
Sure! I've assigned you to the issue too.
aa94576 ignore meta constants when checking channels on... - ChrisLovering
GitHub Actions run 1125100864 succeeded.
Connected!
GitHub Actions run 1125103670 succeeded.
I updated the URL on the timeline for data reviews from https://pythondiscord.com/pages/data-reviews/ to https://www.notion.so/6784e3a9752444e89d19e65fd4510d8d?v=69268794b9d2454a9c28e1550e2923c2.
GitHub Actions run 1125117404 succeeded.
Hey @ethansocal, thanks a lot for the PR! After internal discussions, we decided to instead use the notion.site link to avoid domain blocks. Sorry 😅
Feel free to apply directly from GitHub or from your computer!
href="https://pythondiscord.notion.site/6784e3a9752444e89d19e65fd4510d8d">monthly data reviews</a>.</p>
GitHub Actions run 1125285649 succeeded.
Great! Thank you for your contribution
d10564c Validate that an access token isn't used to gen... - Bluenix2
GitHub Actions run 1125685343 succeeded.
Mainbly fixes some bugs introduced in #124 as well as polishes some rough edges from those changes..
GitHub Actions run 1125687771 succeeded.
GitHub Actions run 1125691500 succeeded.
GitHub Actions run 1125692521 succeeded.
I'm gonna be getting back to this after an eternity, sorry for keeping y'all hanging
I don't see a case where this is used, maybe remove it. Sorry if this is wrong, I'm reviewing code from my phone
@Xithrius so sorry, I've been caught up in stuff but I'll be getting back to this shortly
If @aphkyle isn't interested I'd like to take this PR
Line 40 is where it's used if an error comes up during the API call. I could be more specific about what kind of error, maybe HTTP_ERROR or RESPONSE_ERROR ?
@Xithrius so sorry, I've been caught up in stuff but I'll be getting back to this shortly
No problem. Remember to solve the conflicts in poetry.lock!
This pull request means that refresh tokes now refresh when generating new access tokens.
Currently I have set the lifetime of a refresh token to be the lifetime of 6 access tokens (6 hours). This means that 6 hours after a refresh token has been generated, it will be refresh when trying to generate a new access token. When this happens the old is invalidated, but this is not done automatically. So you can wait several days, and the refresh token won't be invalidated until you try to gener...
GitHub Actions run 1125933207 succeeded.
GitHub Actions run 1125942744 succeeded.
GitHub Actions run 1125951356 succeeded.
GitHub Actions run 1126038256 succeeded.
Still just a code review; haven't tested anything locally yet.
Is it not better to display this information over just an ID?
These getattr can be replaced with normal attribute access
The following code should be removed from this function
Some places re-annotate the argument to avoid warnings from type checkers. This is no longer necessary. Ideally, all these should be removed.
For example:
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modpings.py#L90
For what it's worth, bot.exts.moderation.infractions._utils.Infraction exists. I don't think being slightly more specific with the dict types really adds much when it comes to JSON though.
What exactly relies on this?
I suppose it's okay to move these over for consistency's sake, but we should eventually have a discussion on this. I don't think it makes sense to define converters here which are unlikely to be used in multiple places. For example, Duration is generic and is indeed used in many places. But OffTopicName? That isn't used in more than one place nor will it likely ever be. We don't move cog-specific utlities to the utils directory, so why move such converters?
I like this enhancement. An API changing can be avoided by making the bot parse the message ID from the URL. However, I think it's better to adjust the API to store a message ID. It should be possible to make a migration that preserves extant reminders since, as mentioned, the message ID can be extracted from the URL.
When .mosaicing ur avatar with some wrong input u get an example with .avatar_modify Mosaic and not .mosaic
Hi @melodicht, are you still interested in finishing this off?
Hi! To be frank, I completely forgot about this. I am working on something else at the moment. If it isn't an issue, I can finish this off once I am done with my other project.
Hi @melodicht, are you still interested in finishing this off?
Hi! To be frank, I completely forgot about this. I am working on something else at the moment. If it isn't an issue, I can finish this off once I am done with my other project.
No problem. Good luck with your project!
Thinking about this a bit more, it would probably make more sense to remove the current scheduler completely and add another check that they've been in the pool long enough along with the check for recent activity.
I agree we should remove the current scheduler entirely. The hourly task you mention can then run the two checks you mention, and if they pass it should just make an API request to the site api to get the next one to review, which then does the required calcs to work out which user to return (as the site has all the message history & nomination details). No need for a scheduler at all then.
Have now pushed fixes for all of these bar the type annotation.
This does still give this information just via an isinstance check instead (see the new L221).
I am about to do a commit to add the escape_markdown though as I forgot that, which edits how this works to
if isinstance(user, (discord.Member, discord.User)):
user_str = escape_markdown(user.name) + user.discriminator
else:
...
GitHub Actions run 1127138862 succeeded.
Yes, that's true. Didn't think about it. I was told to put this issue on halt, until they approve the change in the API, but extracting the ID from the URL would make the process faster. So I think we could go with that method.
(Also I'd like to pick up this issue )
GitHub Actions run 1127333984 failed.
I like this enhancement. An API changing can be avoided by making the bot parse the message ID from the URL
You mean because it is in that format:
https://discord.com/channels/guild id/channel id/message-id
And than somehow jump_url.split('/')[-1]? Tho I think that we should just store the message-id so it'll be more clear for other users who look at the source.
That would involve changes in the API, that might not be approved.
GitHub Actions run 1127448385 succeeded.
PR Author
Workflow Run
Source Branch
alter-alertmanage...
GitHub Actions run 1127490879 succeeded.
The SourceType return typehint in SourceConverter is imported conditionally under TYPE_CHECKING to prevent a cycle
I have wondered about this before; with this PR I decided to move them so the type reassignments are all in one place. I agree that it'd make more sense if they were in the modules of the cogs that use them though
How does this work over midnight, considering it is only time.
Something I am a bit on the fence about, do we prefer 0.0 here?
I think this sentence needs revising.
time.time is seconds since the epoch, https://docs.python.org/3/library/time.html#time.time
If I was writing it myself i'd probably write 0.0, but both ways are valid and I don't think our style guide indicates any preferred way, so probably doesn't need changing.
I'm fine with an API change if someone wants to tackle it. As I said, it would ultimately be better to store the ID than a URL, since it's the more direct piece of data that we need. However, URL parsing is fine for now; changing the API can happen at any time down the road.
The API will be ported to FastAPI anyways, from then it'll be way easier to change on such things.
Until then I'd gladly implement this URL parsing method.
#1731 would fix annotations of converters. Anyway, I suppose the extra validation from Snowflake isn't really necessary. I think the group command uses it to disambiguate reasons that look like IDs.
@TizzySaurus You misunderstood me. The lines I commented were only used when a discord.Object was passed. In that case, all it has is an ID, and it sucks to only display an ID. Instead, it relies on the last known information in the database, if it exists. If not, then it can fall back to just an ID.
Furthermore, what you had previously was sufficient when it's a Member or User. They have already have a __str__ which does exactly what you changed it to.
Right yes, I understand your point now of displaying just id vs name#discrim. I'll add this functionality back.
In regards to the Member/User's __str__ method, it doesn't escape any markdown which is why I put it to this (what it was before I changed anything).
Wouldn't escape_markdown(str(user)) be simpler at least?
I suppose we'd want something like
if isinstance(user, (discord.Member, discord.User)):
user_str = escape_markdown(user.name) + user.discriminator
else: # is discord.Object instance
if infraction_list: # can get the name#discrim from DB
user = infraction_list[0]["user"]
user_str = escape_markdown(user["name"]) + f"#{user['discriminator']:04}"
else: # can't get name from DB so just use the id
...
Yes but I believe the first case can be simplified to escape_markdown(str(user)) (you forgot the # anyway).
Right yes, escape_markdown(str(user)) would be easier so I'll go with that.
if isinstance(user, (discord.Member, discord.User)):
user_str = escape_markdown(str(user))
else: # is discord.Object instance
if infraction_list: # can get the name#discrim from DB
user = infraction_list[0]["user"]
user_str = escape_markdown(user["name"]) + f"#{user['discriminator']:04}"
else: # can't get name from D...
GitHub Actions run 1128782158 succeeded.
GitHub Actions run 1128932649 succeeded.
[python-discord/site] branch deleted: dawnofmidnight/smarter\-resources/filtering\-system
Currently the reminder feature is restricted to #bot-commands for non-staff which makes it a bit less convenient to use quickly and be able to jump back to the conversation itself without copying the message link manually.
We can allow them everywhere with reminders being sent in #bot-commands instead of the channel the reminder was set in, to prevent unnecessary out of context messages from popping up (which already happens to some degree from remainders by staff)
An additional staff onl...
I see no reason why to enable it to every channel, I don't see how reminder, which is not a real Python-related command, should be enabled in Topical/any other channel other than bot commands, which is the most suited place for this command.
Closes #1741
I implemented the changes mentioned, I also added a fallback to use a jump-url if something goes wrong when trying to get the partial message.
Actually, I can't find the time to work on this going to be pretty busy in the upcoming days
Yeah, I'd like to go with our "allow everywhere until proven problematic" policy. The only channel I might be iffy about enabling it is in python-general, but I can be convinced otherwise.
I frequently see people trying to set themselves reminders to check in on an issue, or come back to some resource, or whatever else only to get told by the bot to go to bot-commands. I think having reminders available in non-py-gen channels will be a better experience for people.
I'm not even that so...
GitHub Actions run 1129100870 failed.
The remind command is used quite functionally, at least within staff and contribution channels from my experience. If you check the git history for the latest change to that decorator, you’d see we were enabling it for open source channels.
I’d like to see it be global, though in slower channels (topical, open source, development, staff, etc), I think I don’t mind having it show up in channel.
GitHub Actions run 1129116517 succeeded.
The reminders display the relative time when the reminder is scheduled, but the relative duration was already given by the user when they scheduled the reminder. It's also unlikely that someone will look at the reminder scheduled message in the past (apart from jumping to it when the reminder is sent) so in most cases the relative timestamp only restates what the user already knows; I think using the DAY_TIME (F) or DATE_TIME (f) would make more sense in this case
Some places re-annotate the argument to avoid warnings from type checkers. This is no longer necessary. Ideally, all these should be removed.
For example:
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modpings.py#L90
Do you think you can go through the code base and remove these? Otherwise, this PR looks good to me.
Yes, that looks right. Test it for good measure before checking it in.
I agree. I don't have a preference for which of the two proposed formats to use. I suppose it doesn't hurt to throw in the weekday.
This is a good suggestion as it will really improve the usability of the command for the masses. A few points which are open to discussion:
- In cases where it's not sending it to the same channel, is it feasible to first try to DM before resorting to sending it in
#bot-commands? This might get complicated when multiple roles/users are mentioned in the reminder, but note that the feature is limited to Helpers+. - It should never send a reminder in a help channel, even if invoked by st...
I guess we could try and detect if the pinned message was deleted and try and pin the next message from the author if it was
It'd be fairly simple to make it pin the next message it receives. However, this doesn't necessarily mean the first extant message will be pinned, since a message can be deleted after more are sent. A compromise could be reached where it only pins the next message if it's going to be the first extant message for that help session. However, that would require lookin...
A check to ensure the user has been active recently, to hold off the review if they haven't and possibly unnominate after a while.
This may seem like an innocent thing to add, but how do you propose to actually track user activity. Doesn't that also get into privacy issues?
apologies. The name is fine iirc, you can change it if you want but I noticed you forgot to set the color, so there is some inconsistency with the other embeds, maybe consider red
GitHub Actions run 1130191152 succeeded.
This may seem like an innocent thing to add, but how do you propose to actually track user activity. Doesn't that also get into privacy issues?
By user activity I mean something like "has at least 10 messages in the past week", which we already track through metricity, which is integrated with site https://github.com/python-discord/site/blob/d038076b5034d14ce2b8dabcb929eacb0e837540/pydis_site/apps/api/models/bot/metricity.py, so would just r...
I think it could be worth it with a TypedDict in the infractions package
GitHub Actions run 1130588943 succeeded.
Some places re-annotate the argument to avoid warnings from type checkers. This is no longer necessary. Ideally, all these should be removed.
For example:
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/modpings.py#L90Do you think you can go through the code base and remove these? Otherwise, this PR looks good to me.
did a regex search with ^ *\w+: [\.\[\]\w]+$, removed the two it found in the last commit but it seems a bit low so let me know if ...
Ahh I did forget the color, just added it!
GitHub Actions run 1130620590 succeeded.
I'm open to any suggestions.
Is "If a single argument matching a group name is given, list accessible all tags from that group." better?
Alright so basicly this is done correct?
It just occurred to me why this didn't originally use the normal converter. The problem is that discord.py's converters also support username and nickname strings (without a discriminator). This makes it impossible to search a reason for a string which happens to be a user's name. In practice, users are rarely, if ever specified this way, so it's preferable to prioritise the reason search.
7bdc8e5 Archive hacktoberfest branding - ChrisLovering
[python-discord/branding] New branch created: Archive\-hacktoberfest\-branding
We have decided not to participate in hacktoberfest this year. As such, the
assets created for this events have been archived, to a folder that will
not be picked up by the branding manager in @Python.
An issue will be created for generic Halloween branding to be created and
formalised to work with the branding manager.
GitHub Actions run 1131244377 failed.
[branding] Branch Archive\-hacktoberfest\-branding was force-pushed to `046b916`
GitHub Actions run 1131248255 succeeded.
As part of https://github.com/python-discord/branding/pull/161 we removed the Hacktoberfest branding, as we will not be taking part in Hacktoberfest this year.
As such, some generic Halloween branding should be made for our events calendar.
There are some assets in halloween/assets/ that you are free to use for this.
A PR for this issue should include a new Halloween event in events/ and should also remove the halloween/ directory.
[python-discord/branding] branch deleted: Archive\-hacktoberfest\-branding
GitHub Actions run 1131258398 succeeded.
GitHub Actions run 1131336328 failed.
I don't think these need int() casts.. do they?
No need to check for None here, as webhook_embed_list should never contain None.
I think we should specifically handle a few cases here that have been missed:
- if a message has been deleted, the converter will raise NotFound. We should have a special message for this case
- When it's deleted, we can search through #message-change-log in our message cache looking for the appropriate message id: {id} string, to link there and extract content from there instead.
- since incidents is within helper view, we should at the very least restrict this converter from accessing me...
That makes sense.
Would it be more logical to instead use UserMentionOrId here, since then that will remove the need of the Snowflake converter? We'd likely have to add a try/except around the call to the UserConverter though -- so UserMentionOrId becoming something like
async def convert(self, ctx: Context, argument: str) -> t.Union[discord.User, int]:
"""Convert the `arg` to a `discord.User` or `int` in the case of a deleted account."""
match = self._g...
I also just found this so will fix that as well I guess (typehint says it'll be a list but it's actually a tuple)

GitHub Actions run 1132620297 succeeded.
Hey @Shivansh-007! What is the state of this PR? Is it ready for re-review?
Try not adjusting code if there are tests failing and you can't figure out how to reproduce the test failure with manual code. message.id should never be non-int, so if you're having to cast there you're having other problems (such as with the test). Otherwise the tests become part of your code, and are not really suitable as tests any longer.
This issue is because the Mock being used isn't having .id set appropriately. Try using breakpoint() or another debugger when this errors to fi...
I think here (and in other docstrings) the param typehint alone should be enough without further explaining it in the docstring; if necessary the comment above the type alias explains where exactly the types come from
A region to collapse the overloads would be useful
Sending a new message when a channel is closed has no use, but if we could keep the DM message in cache and then edit when a channel is closed that would be the best.
Sending a new message will trigger a notification, which would get the person helping's attention, just to tell them that their help is no longer needed.
Editing the message will allow someone to look back over all channels they've helped in, and quickly get a nice status of who still needs help.
But the entire purpose of this is that when a channel is closed you'd get notified about it, not a message edit, because than you can easily know when a channel was closed. Tho your idea can also be great
Why would you want to be notified when a channel was closed? There is nothing needing your attention, and nothing more you can do.
Editing the message would be the best for the scenario you explained here:
I know that when I help, I go back and see if the other user still needs help, and if the user closed the channel, I will kinda have to search for the channel.
Oh ok then ig, nice idea!
The discord Markdown timestamps introduced in #1666 are invalid in some embed fields like footers where they will render as plaintext leading ton on human readable data being sent.
The watchchannel send_header method tries to use a timestamp in the footer
https://github.com/python-discord/bot/blob/4d62dadc4d19f0c17d5cda8748c3fc520f2adccf/bot/exts/moderation/watchchannels/_watchchannel.py#L285-L296

And a reminder that's late tries to use a timestamp as ...
GitHub Actions run 1133264011 failed.
Perhaps we can move this down and remove the index assignment, we only need it in the loop.
Specifically I was first talking about "list accessible all tags", but I like what you suggested better than what is currently there. So "If a single argument matching a group name is given, list all accessible tags from that group." it is
for _target in _targets:
while index < len(_target) and _search[current] == _target[index]:
current += 1
index += 1
index = 0
Oh I didn't even notice that, will fix
Seems like I reviewed this but never actually approved, lgtm!
We need to double check that this doesn't affect the back end logic in any way.
[python-discord/bot] branch deleted: fix\-nomination\-archive\-check
Connected!
GitHub Actions run 1133341933 succeeded.
There's a parameter you can pass to .group() to accomplish this. See invoke_without_command.
Can't we use the \N{UNICODE_NAME} style?
I don't think this doc-string is true anymore?
To be clear, I didn't modify this. I just moved the function. What this does is search for a category that isn't filled yet, and if there is none creates another one.
Not familiar with it, I just went with what we use elsewhere in the bot.
I did not modify this, I just moved the function.
And yes it being case sensitive seems fine to me, as it creates category with specific names.
GitHub Actions run 1133373490 succeeded.
Doesn't make sense to me grammatically. Shouldn't it be "Display", if anything?
Hmm, it makes the most sense in a complete sentence
Delete all code jam channels, displaying a confirmation with the categories and channels to be deleted.
I guess we could just leave this as-is? Or reword it to be more along the lines of
A confirmation message is displayed with the categories and channels to be deleted.
When you accept it, it already adds a checkmark reaction a few lines below. Adding an "aborting" message sounds fine.
It seems we're in agreement on this. I'll approve the issue.
I'd like to try to solve this issue.
Would it be more logical to instead use UserMentionOrId here, since that will remove the need of the Snowflake converter? We'd likely have to add a try/except around the call to the UserConverter though to still allow for searching of deleted accounts etc. -- so UserMentionOrId would become something like:
The Snowflake converter has some code that improves the likelihood of a converted input actually being a snowflake. This would further disambiguate snowflakes from reasons that look ...
GitHub Actions run 1133441191 succeeded.
I don't know... I think it doesn't hurt to keep these docstrings just to be safe on the clarity of what it is.
There's a similar issue with this log message
From this and my experience with #1721, it's become evident that #1666 was not thoroughly reviewed and tested. It's a bit concerning that several obvious errors were missed, but that might just be me having the power of hindsight. I think it's worth reviewing all uses of these Discord timestamp utility functions to make...
Perhaps we want to keep track of this, or maybe just a bool. So that you know when running the command that some members were omitted?
I found two nit-picks, feel free to disregard those unless you're changing other things.
I have not tested or ran these changes myself, at the earliest I can do that tomorrow if necessary
You return in the except, no need to have this in an else.
This was raised in the PR which added this command, but out of scope for this one.
I know, but I personally like the explicitness of the flow.
GitHub Actions run 1133489240 succeeded.
[python-discord/bot] branch deleted: mbaruh/jam\-management
I believe, as a temporary workaround (until the migration to FastAPI) this could be solved by using a pre_delete signal, that unassigns the Role assigned to the User's ArrayField, then performs the process as usual.
(That's purely a suggestion, I faced the same issue in a previous code jam)
Connected!
GitHub Actions run 1133496190 succeeded.
Why are the other chars being escaped? The docstring only mentions underlines.
With strikethrough I'd just let it apply the Markdown as that was most likely the intention
I guess spoilers are fine although I don't think they've ever shown up, and why are the backslashes being escaped?
Also, please use double quotes as stated in the style guide
return re.sub(r'[_\\~|]', lambda match: '\\' + match[0], content, flags=re.MULTILINE)
being explicit with flags instead of passing in the unnecessary positional reads better to me
return re.sub(r'([_\\~|])', r"\\\1", content, 0, re.MULTILINE)
We can create and reference a group in the replacement string instead of creating a lambda, the triple backslashes could be confusing though so I'd like some other opinions
Actually, why is the MULTILINE flag used?
Description
The current unittests fail on windows, when using the default test command:
python manage.py test --no-input
Cause
The following is the failing test: pydis_site.apps.content.tests.test_views.test_get_context_data_breadcrumbs
https://github.com/python-discord/site/blob/512bd175cffbc3463679f3e165bea6d0a486f6fa/pydis_site/apps/content/tests/test_views.py#L163-L177
The reason is in the following line:
https://github.com/python-discord/site/blob/512bd175cffbc346367...
Thank you for your review, I'll change the code to reflect this as I have no objection. I'll keep the lambda for the time being.
Actually, why is the MULTILINE flag used?
I used discord.py escape markdown util as a basis, I don't think it needs to be there right now
2871fe1 Removed mobile-only banner showcasing 100K members - doublevcodes
ffb7af7 Make timeline look better on mobile - doublevcodes
1b99709 Added button without github functionality yet - doublevcodes
eac5994 Merge branch 'main' into main - doublevcodes
9e4c177 Merge branch 'python-discord:main' into main - doublevcodes
[python-discord/site] New branch created: github\-button
