GitHub Actions run 650064336 succeeded.
#dev-log
1 messages ยท Page 69 of 1
73b5818 Use .gitattributes to normalise line endings on... - MarkKoz
13abd6f Use .gitattributes to normalise line endings on... - MarkKoz
fab114d Use .gitattributes to normalise line endings on... - MarkKoz
1ba51ad Use .gitattributes to normalise line endings on... - MarkKoz
[python-discord/workers] New branch created: gitattributes
[python-discord/workers] branch deleted: gitattributes
I agree I agree it don't look that awesome
but it looks good enough in the place it is supposed to be in. ( server icon ).
I don't think this works, and after discussing it in the community I think we're going to consider this a failed experiment.
GIF limitations make implementing this difficult without looking noisy and bad.
Looks great! Thanks for this contribution. โค๏ธ
Check if this'll fit on 1 line
This also doesn't seem to be awaiting anything. Why's it under an async def?
As for your issue about the extension not being unloaded after too many tries, I think it is possible the error is here - a Cog isn't an Extension. You're trying to unload the extension by using the cog name, not the extension name (the extension name will be the file name - exts.evergreen.wtf_python)
Grammer here - f"Extension {ext} is already {verb}ed|
Was there a reason you chose to use *query here instead of using a keyword-only argument (which discord.py uses for a "consume-rest" behaviour)?
async def wtf_python(self, ctx: commands.Context, *, query: str) -> None
This will save you the line where you join them together.
https://discordpy.readthedocs.io/en/latest/faq.html#why-do-my-arguments-require-quotes
Does this really have to be a function of it's own, when it's used only once?
Everything looks good, except one small change.
Can you revert the full Pipfile.lock back to origin/main.
c180392 revert pip lock to origin/main - ChrisLovering
Could you put the new values in the config and constants.py in alphabetical order within their section? Also, lint before you push!
[python-discord/bot] branch deleted: gitattributes
Connected!
It could lock everything and rebuild the queue without the channel, but maybe a separate data structure to keep track of which channels to skip in the queue would suffice. In any case, the implementation of this has some nuance due to race conditions, so whoever implements this will have to keep that in mind.
Passing an empty dictionary to RedisCache.update produces a ValueError from inside the aioredis dependency.
This is inconsistent with the behaviour of a Python dictionary:
>>> d = {"A": 1}
>>> d.update({})
>>> d
{'A': 1}
If this is intended, it should be documented, as the update's method docstring can be misleading:
This works exactly ...
To clarify, I understand that RedisCache doesn't attempt to provide an identical interface to a dictionary anymore, for example update also doesn't take kwargs or no arguments at all. But this behaviour is clearly observable from the function signature.
In comparison, the empty dict behaviour is not visible from looking at the implementation unless one looks into aioredis. It feels natural to assume that update({}) no-ops. Perhaps the update could check for this case and exit early?
This should now be ready for review, but I'm keeping it in draft until the branding PR is ready too.
Added a couple of new tags relating to common questions in the discord.py channel:
customhelpis about how to create a custom help command, links to Stella's comprehensive gist on the topicintentsis about how to use intents in discordpy to receive more events like member events
Minor grammar mistake.
To enable one of these intents you need to first go to the [Discord developer portal](https://discord.com/developers/applications), then go to the bot page of your bot's application. Scroll down to the `Privileged Gateway Intents` section, and enable the intents that you need.
Right, will remove the async function.
To keep the code clean, I kept it separate.
Well it doesnโt seem to cause a difference, I will merge it with the wtf_python function.
It appears that you are missing a comma after the introductory phrase By default. Consider adding a comma.
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the `Members` and `Presences` intents, which are needed for events such as `on_member` and to get members' statuses.
[python-discord/site] New branch created: deploy\-environment
Implements a GitHub Environment to our deploy script to ensure only the main branch can be deployed to production.
You are logging fetch messages, but not the fetch successful messages. It would be great to log them to confirm the fetch was successful.
This can be done at all the other places of the code, which is doing something similar to this.
Cancels all the reviews.
Cancels the review of the nominee with ID `user_id`.
The files we are loading on startup by the bot are so small that this extra dependency isn't really worth benefit, if there is one.
Discussed this in dev-contrib and people agreed. Closing this issue for now.
ae0de17 Change repository owner in badge URLs - SebastiaanZ
Requested screenshots of how the embeds look:

6a68850 Link status badges to workflow file - SebastiaanZ
[python-discord/sir-lancebot] New branch created: split\-build\-deploy
- Split build stage into build & deploy
- Set environment for deploy stage
4fadbef Fixes Production URL Constant - HassanAbouelela
90ce6c0 Bump deepmerge from 0.1.1 to 0.2.1 - dependabot[bot]
9d7b0ca Use .gitattributes to normalise line endings - MarkKoz
e30b7cd Merge branch 'main' into dependabot/pip/deepmer... - HassanAbouelela
742eed9 Merge pull request #70 from python-discord/depe... - HassanAbouelela
fa277ca Bump sentry-sdk from 0.19.5 to 0.20.3 - dependabot[bot]
1457bac Sets Sentry SDK Environment - HassanAbouelela
d1c2299 Merge branch 'main' into dependabot/pip/sentry-... - HassanAbouelela
3f2f8ca Merge branch 'main' into dependabot/pip/sentry-... - HassanAbouelela
817d16a Merge branch 'main' into dependabot/pip/sentry-... - HassanAbouelela
[python-discord/site] Checks Successful on PR: #373 Add a validator for documentation package names.
GitHub Actions run 652436591 succeeded.
You should document in the viewset that a 400 will be returned by the POST due to the regex validator failing.
Isn't the current documentation pointing the user to see the response on 400s enough?
https://github.com/python-discord/site/blob/de7c6b37623464579794dcfb00db0ff106c7dc82/pydis_site/apps/api/viewsets/bot/documentation_link.py#L48-L60
I think the core approach we've taken is solid, so I don't anticipate any more fundamental changes to the mechanics. There are just some relatively minor and niche bugs to work out. Perhaps the most significant outstanding bug is the handling of the circular references.
I think this is the wrong approach. It makes it impossible to have multiple instances of references to the same node. I believe what we need to do is store the path of the node that contains the reference. However, I'm currently unsure of how to get that path. It doesn't seem possible to get it from the node or loader in _ref_constructor, but I've not dug to deep.
The set of paths may have to be populated by _update_mapping since it keeps track of the path, and it goes through all node...
An alternative to using this is making AttributeReference subclass yaml.YAMLObject. It's nicer since it's less code (we just need to set two class attributes after subclassing). The downside is that it uses a metaclass to register the constructor, so we have to do a strange thing where we import the module/class but don't actually use it. Thoughts?
I expressed concerns before about the inability to set values being unintuitive. The argument against that could be that it'd be confusing to allow setting values since we definitely have no plans of writing set values back to the config file.
I can say with confidence that at the least, this should raise a NotImplementedError. Whether we should actually implement it is still up to debate. I believe it could be implemented by using get_node to get the parent of the stored path, ensuri...
GitHub Actions run 652984792 succeeded.
GitHub Actions run 653004065 failed.
GitHub Actions run 653008828 succeeded.
[python-discord/sir-lancebot] branch deleted: split\-build\-deploy
[python-discord/site] branch deleted: deploy\-environment
Connected!
I can work with this.
I've played around with it locally. It seems solid. My only complaint is that it doesn't pick up some doc paragraphs for Django. For example, django.db.models.Model.__str__ and django.db.models.Model.pk.
This may not return a 404 for a missing message. Instead, it may return a 400 (?) with a code of 10008. Try the endpoint with purposefully invalid IDs and see what the response is.
If the channel is invalid, it may return 10003. However, we can probably live with the assumption that it exists since that's how the cog deals with the categories (granted, it does make sure they were at least prese...
Great stuff, thanks for doing this! Just a few minor comments.
Personally I think this check would be clearer as a function than using __contains__, something like
if not self.reviewer.is_scheduled(user.id):
but that might just be personal preference, so feel free to leave it as is
The reason may be empty, it should probably say something like *no reason given* if this is the case
I feel there's not really much point having the mention at all if it's likely it will just display "invalid user", displaying the user id and name would probably be better imo
e7302f0 Code block: remove null bytes before parsing AST - MarkKoz
[python-discord/bot] New branch created: bug/info/bot\-xr/code\-block\-null\-byte
ast.parse raises a ValueError complaining that source code strings cannot contain null bytes. It seems like they may accidentally get pasted into Discord by users sometimes. I couldn't manage to paste a null byte myself.
[python-discord/bot] Checks Successful on PR: #1467 Code block: remove null bytes before parsing AST
GitHub Actions run 655597393 succeeded.
[python-discord/bot] New branch created: bug/info/bot\-xk/defcon\-threshold\-none
[bot] Branch bug/info/bot\-xk/defcon\-threshold\-none was force-pushed to `089e4aa`
This works as a fix for the server command, but there's an underlying issue which is that self.threshold is set to None by default, but then becomes an empty relativedelta() upon reset. My plan was to replace the None's with a relativedelta(), as it is apparently false-y anyway, and then it's possible it's not needed to change the server command.
Yeah you could avoid it being None, but it still seemed to be an intentional choice to display the dash character rather than "0 days", so that is what I stuck to here.
I've played around with it locally. It seems solid. My only complaint is that it doesn't pick up some doc paragraphs for Django. For example,
django.db.models.Model.__str__anddjango.db.models.Model.pk.
Unfortunately we can't do much with those as the descriptions don't belong to the attributes but to t...
wait() does indeed only wait for one child. However, what we can do is keep calling wait() in a loop until it raises a ChildProcessError, indicating there are no more unawaited child processes. This is safe according to the documentation; this error would not be raised for any other reason.
I am also concerned about the implications of being a subreaper. If we somehow became the parent of a process that shouldn't be killed i...
The perplexing thing is that nsjail seems to handle all this for us in some (if not all) situations. This is what https://github.com/google/nsjail/commit/bb4e77686dfdae72dbaf1fa626519759f03de431 aimed to fix.
When it gets a fatal signal (not exactly sure on what this means), it does kill all child processes too. It seems like it keeps the loop going until there are no PIDs remaining, which accounts for children creating new processes while it is attempting to kill all children.
https://...
ffee0e4 Use value of enum member instead of member itself - ks129
8731e7d Split public fields constant to multiple lines - ks129
GitHub Actions run 656755248 failed.
GitHub Actions run 656755246 failed.
GitHub Actions run 656757022 succeeded.
Connected!
Due to #594 being essentially the same issue, this one can be closed.
This issue has been usurped by #608, and a solution is already in place.
This issue has been usurped by #470 due to more recent activity and being more detailed.
Description
Add a global points leader-board, for the points/coins which are earned by users while playing a game like Trivia Quiz, Tic Tac Toe, Connect 4, etc. Currently each game has its own leader-board, and not a combined one together for all games. In short, combining all the leader-boards into one.
Proposed Implementation
- [ ] Make a new redis cache in
bot/bot.pycalledLeaderboard(say). - [ ] Make a points system in all the games which make use of a leaderboard name...
The points scoring for the rest of the games would definitely have to be normalized. That might be as simple as changing 5 points to 50 in one game to match the rest. Either way, this would be a lot of work, but it's a really good idea!
fa277ca Bump sentry-sdk from 0.19.5 to 0.20.3 - dependabot[bot]
1457bac Sets Sentry SDK Environment - HassanAbouelela
d1c2299 Merge branch 'main' into dependabot/pip/sentry-... - HassanAbouelela
3f2f8ca Merge branch 'main' into dependabot/pip/sentry-... - HassanAbouelela
90ce6c0 Bump deepmerge from 0.1.1 to 0.2.1 - dependabot[bot]
270bdbc Adds Discord Request Helper - HassanAbouelela
094d125 Moves Webhook & Role Helper To Discord File - HassanAbouelela
b31a35b Adds Discord Direct Message Helpers - HassanAbouelela
fbe4c70 Changes User Typehint To Avoid Circular Import - HassanAbouelela
43b6441 Adds Discord Context Helper - HassanAbouelela
[python-discord/forms-backend] New branch created: dm\-message
cea171f Bump html-webpack-plugin from 5.2.0 to 5.3.0 - dependabot[bot]
7b1b311 Bump @types/react from 17.0.2 to 17.0.3 - dependabot[bot]
e6c1116 Opens OAuth In New Tab - HassanAbouelela
d198e16 Bump @typescript-eslint/parser from 4.16.1 to 4... - dependabot[bot]
15278ab Adds HassanAbouelela To Codeowners - HassanAbouelela
Description
After seeing a constant demand of songs music channel, An idea was given in #meta to have a command that suggest songs
This command can have multiple sub commands
- Random
- Search
- category
Reasoning
Helps getting more familiar by the medium of music taste <3.
Proposed Implementation
Currently I am thinking of using one of API that serves the purpose of music suggestion
Kinda similar how .movie command is made.
Would you like to implement...
Using zero width spaces and similar invisible characters, it is possible to easily bypass our token filter list.
We should strip such characters before running the regexes.
Thanks for the PR, these look great. Just one minor suggestion, "by subclassing the help command" would probably be more accurate as "by subclassing HelpCommand"
There are 1 failures, 0 warnings, and 0 notices.
Is this just going to be changing bot/pagination.py?
Closing this since the solution (as discussed in #dev-core) appears to be sending SIGTERM to nsjail which will in turn distribute SIGKILL to any child processes.
[python-discord/snekbox] New branch created: sigkill\-to\-sigterm
As of now, when an evaluation exceeds a write buffer limit we send SIGKILL to the nsjail parent process. This does not give nsjail a chance to perform cleanups such as removing generated cgroups. It also leaves child processes in a running state which then means that further removal of cgroups manually is not possible without becoming a subreaper and killing them manually (see #95).
This PR changes the signal to SIGTERM which triggers nsjail's cleanup logic such as removing cgroups and oth...
d587d9d Update flooding test to expect code 143 - jb3
6b9c954 Split out help channel idle time constants - ChrisLovering
ce86169 Set a reasonable default for idle_minutes_othe... - ChrisLovering [243d465](https://github.com/python-discord/bot/commit/243d4657bfeafe31bc3ba9666b35a88eeef74a92) Update help availible footer - ChrisLovering [b3c66a6`](https://github.com/python-discord/bot/commit/b3c66a6fb07ebc92c0b53d946cf10df6c1107303) Extend close time logic to differentiate betwee... - ChrisLovering
[python-discord/bot] New branch created: help\-channel\-closing\-delay\-changes
Closes #1451
This extends the closing logic for help channels to closed based on the claimant's last message time and last message in general.
This results in the help channel closing time being reduced if only others are chatting, and the claimant has already left.
I was there in VC watching this be implemented and tested, all seems good to me.
[python-discord/snekbox] branch deleted: sigkill\-to\-sigterm
9503a2e Improve trace message. - ChrisLovering
Closes #1454
This will remove reactions when someone adds it, even if they aren't whitelisted to do so.
Since #129 is blocked by this, I decided to include a simple Easter banner as part of the PR.
It is the evergreen banner adapted to use the Easter icon & colours:

It was created using the evergreen banner's SVG and both the SVG and PNG will be included in the PR so that we can play with this further in the future. For now, it should suffice. I'll leave the issue open for no...
Hi @dawnofmidnight, how is the banner coming along?
This PR will now also add the missing Easter banner (#127). It's a colour edit of the evergreen one to match the Easter logo:

PR includes both the SVG base & a rendered PNG.
Almost done with it, I'm just finishing up adding some effects in the background because the plan with the Os was not working very well.
Instead of saying being idle for some time here, it would be better to be more specific. Maybe include a short one line explanation of it.
Following the above style of overwriting the last_message by its datetime, even this should follow that.
I don't agree with these two names, as they don't show what they are assigned to:
last_messagemeans the last message and not the time of the last message,last_message_timecould be a better variable name here.claimantmeans the user who claimed that channel, while the it contains the value of the their last message's time,claimant_last_msg(message)_timecould be a b...
Could do:
* Channel moves to dormant category after
- `constants.HelpChannels.idle_minutes_other` minutes since the last user message, or
- `constants.HelpChannels.idle_minutes_claimant` minutes since the last claimant message.
This will make it easier to read the doc-string.
In the event the reaction is not whitelisted, the check should return False. Right now it's implicitly returning None.
This method call easily fits on one line.
Thanks for the PR! For future pull requests, you can run pipenv run precommit in the project's root directory to prevent yourself from being able to commit if the lint fails.
log.debug(f"Got reaction: {reaction_.emoji} from non-whitelisted user, reaction deleted")
Some additional clarification would be nice.
[python-discord/bot] branch deleted: bug/info/bot\-xr/code\-block\-null\-byte
[python-discord/bot] Checks Successful on PR: #1467 Code block: remove null bytes before parsing AST
GitHub Actions run 660597694 succeeded.
Connected!
we (chrisj, me, darr) all couldn't really come up with a one line explanation of the new system. if you would have one, that would be greatly appreciated.
Thanks for the PR! For future pull requests, you can run
pipenv run precommitin the project's root directory to prevent yourself from being able to commit if the lint fails.
I just doing pre-commit different? Because I ran that every time.
When you commit, there should be something like this:

You shouldn't have to run precommit every single time, just once when you setup the project.
When you commit, there should be something like this:
You shouldn't have to run
precommitevery single time, just once when you setup the project.
Oh so I only have to pipenv run pre-commit once?
I don't think that would improve the footer, as it's already long as it is. @Akarys42 thoughts?
Iโm fine with this current text :+1:
I don't think it's worth risking the footer being uninformative (I think it would just say invalid-user) if the bot, for some reason, weren't in their cache.
Personally, it seems far too wide. At the very least, add a \n character.
47ed233 Instructions to dispute an infraction vary by i... - swfarnsworth
75f2b9d Update the tests to reflect changes in expected... - swfarnsworth
96a369c Made multiline concatenated string conform to a... - swfarnsworth
b713a6c Merge branch 'master' into swfarnsworth/infract... - swfarnsworth
d498cc6 Merge branch 'main' into swfarnsworth/infractio... - Akarys42
[python-discord/bot] branch deleted: swfarnsworth/infraction\_message
Connected!
The fuzzy matching also seems a bit odd here, with
pstebeing matched tositeinstead ofpaste.
Yeah, I guessdifflib.get_close_matchesfinds multiple matches but we only chose the first one. With testing I found out that if the cutoff is0.8, then it only matchespasteand notsite.
This looks good! After numerous conversations in #media-branding, it seems like this is the best that it can be.
It also seems that the error handler doesn't try to make suggestions for tags, and !paste is a tag.
Thanks! Looks Good To Me!
I'm thinking we should squash this when we merge due to the messy history at the beginning.
Greetings @TrizzySaurus, I have checked out a couple websites (attaching link for the same) and according to them, the date entered here are correct.
https://www.britannica.com/topic/zodiac
https://www.cosmopolitan.com/uk/entertainment/horoscopes-monthly/a29383721/star-sign-dates/
I'm thinking we should squash this when we merge due to the messy history at the beginning.
Like a new PR?
61e17c8 Improve availible channel embed footer - ChrisLovering
I've slightly changed the wording of this line as discussed in #dev-contrib.
I think trying to explain how this new system works in a sentence would over simplify it too much, and cause confusion/more questions.
People who really want to know how it works will ask anyway, and we can then explain it properly.
Use asyncio.create_task instead. In fact, it would be even better to use scheduling.create_task since it logs exceptions. I believe that even with asyncio.create_task, any exception raised would eventually show up anyway as uncaught (typically when the bot shuts down), so it's worth handling it. In this case, we'd want to suppress the exception raised when the message no longer exists.
check_for_answer will never execute because all messages which must be checked for answers are inside the in-use category.
This needs to be done in claim_channel because from here you cannot be certain of whether the locks allowed the claim to go through.
Has it been decided to "take the hit" when the bot is offline and can't cache messages that get sent?
So pretty much I should change to scheduling.create_task and suppress discord.HttpException (or just NotFound)?
@MarkKoz might need to add a condition to the old method fallback, that checks for bot uptime smaller than idle_minutes_claimant so that there is at least that much time after a restart after which channels wont be unduly closed.
that is, if i understood correctly what you were referring to.
I was there in VC watching this be implemented and tested, all seems good to me.
We have the !pypi which is useful, and I think that a !github command can be useful to share repositories with others.
Usage
!github python-discord/bot Sends info about the bot (this one) repo.
!github search discord.py Shows search results for the term discord.py
Maybe some other command(s)
Additional Details
We can use the github api for this.
I would like to implement this command.
create_task doesn't raise the exception. It has to be suppressed within the coroutine being scheduled.
Like this idea, but maybe it could be a feature of Sir Lancebot, as it isnโt โessentialโ
create_taskdoesn't raise the exception. It has to be suppressed within the coroutine being scheduled.
So don't suppress it at all?
@MarkKoz might need to add a condition to the old method fallback, that checks for bot uptime smaller than idle_minutes_claimant so that there is at least that much time after a restart after which channels wont be unduly closed.
that is, if i understood correctly what you were referring to.
What I was referring to is the cache not having the latest times due to the bot going offline and more messages being sent in channels. Upon going online again, the bot may prematurely...
create_taskdoesn't raise the exception. It has to be suppressed within the coroutine being scheduled.So don't suppress it at all?
No. I explicitly wrote it has to be suppressed. You're just suppressing it at the wrong time/place.
create_task isn't where the coroutine is being scheduled?
A correct example:
async def coroutine():
with suppress(SomeException):
return await do_thing()
create_task(coroutine)
Oh, so I need to create a function that suppresses HTTPException?
Yes... unless you can think of a nicer way.
Description
A .github command that shows you information about a repository in github. A subcommand called search that searches repositories for that specific term.
Reasoning
I think it would be cool to see info about a repository in discord instead of having to find it myself on github, and to be able to show it to someone else.
Proposed Implementation
Using the github api to get info about that specific repository.
Would you like to implement this yourself?
...
Quick note, we already have a .github command for user info. My idea is, we could make it as a subcommand like .github user
Oh never noticed, and yeah, I agree it should be .github repo <reponame> and .github user <username>.
Yes... unless you can think of a nicer way.
Would a new utility function work since I'm using it multiple times?
Sounds good, feel free to work on this feature
But I don't see why suppress the exception if scheduling.create_task logs the exception and ultimately suppresses it.
Yes... unless you can think of a nicer way.
Would a new utility function work since I'm using it multiple times?
Yeah, sure. See how much you can turn into a utility function. Maybe some logic in the check could be moved to the utility function too.
But I don't see why suppress the exception if
scheduling.create_tasklogs the exception and ultimately suppresses it.
It suppresses the raising of the exception, but it does not suppress the logging of it. I...
@MarkKoz as it stands currently, it will fall back to the old behavior if the cache isn't available (empty/ returns None)
I am proposing extending the fallback conditions to always use the old method for a while after startup, as it does not rely on cache. This way, instead of channels being closed prematurely they might take a bit longer to close.
We have been limiting the channels where automatic linking issues can be used in (See #566).
Since we haven't seen any potential issue with it, we can allow it everywhere to avoid updating it every two days or missing some channels.
If you have any concern with this, feel free to leave a comment!
Connected!
The site commands tools, resources, help and home construct embeds from mostly static strings, with only the site url being variable. The url is already referenced in other tags so this won't bring any additional maintenance in the case it does change for some reason.
Moving them to tags will also allow the more direct fuzzy matching and per channel cooldowns to take effect.
With the other commands removed the only left will be the rules command; I think we should move it to the Informatio...
Sounds like a good idea. Iโve been missing it in quite a few channels.
If, for some reason, it turns out to have been a bad idea, it should be fairly simple to revert.
The code block here has looks like its embedded within a light grey rectangle. That shouldn't happen

The sidebar on the right does not appear in code jams 1-5 despite the page content still being narrower to accommodate for the sidebar.
If _message.is_empty(channel) returns True, this indicates that there isn't a message in the channel. So both cache's would be empty. This would mean we enter the if statement and return before this code is hit.
suppressed_exceptions would be a better name since the current name sounds more like a Boolean.
if exception and not isinstance(exception, suppress_exceptions):
Making this the first argument and non-optional breaks all other uses of this function. The coroutine should be the first argument and the function should not require callers to always specify exceptions. Consider using *args for the exceptions since it'd be more convenient for callers.
Making this the first argument and non-optional breaks all other uses of this function. The coroutine should be the first argument and the function should not require callers to always specify exceptions. Consider using
*argsfor the exceptions since it'd be more convenient for callers.
But it's already using *args. How about making it a kwarg?
It's not actually using it. It was just done this way to make it future-proof against changes to asyncio.create_task's signature, but this is unlikely to happen anyway.
That is incorrect because the cache doesn't get cleared when the channel goes dormant. is_empty doesn't mean the channel has no messages at all; it basically means the channel's latest message is the bot's embed.
@MarkKoz as it stands currently, it will fall back to the old behavior if the cache isn't available (empty/ returns None)
I am proposing extending the fallback conditions to always use the old method for a while after startup, as it does not rely on cache. This way, instead of channels being closed prematurely they might take a bit longer to close.
Yes, that could work. It'd have to reschedule it for the maximum time.
I added code to clear the caches when the channel is unclaimed in a recent commit, so would that mean it's now correct?
https://github.com/python-discord/bot/pull/1470/files#diff-c31098978b8d838eadb52b2bf23494072cc66686e738d7f99c4f59e6495bfe6fR380-R381
Maybe, but is there a way to fix it without relying on the cache being cleared?
How do you feel about returning early, within the if await _message.is_empty(channel): block?
Does this need a walrus operator? Why not just make a variable in front?
I doesn't need one, but is this not what the walrus operator is for?
@MarkKoz as it stands currently, it will fall back to the old behavior if the cache isn't available (empty/ returns None)
I am proposing extending the fallback conditions to always use the old method for a while after startup, as it does not rely on cache. This way, instead of channels being closed prematurely they might take a bit longer to close.Yes, that could work. It'd have to reschedule it for the maximum time.
What about clearing the caches on init, so the bot uses ...
#ot0-psvmโs-eternal-disapproval message is a good example for use cases where we may want to purge reactions on many messages in a channel. I don't think discord lets us remove reactions from a given user, but they do permit us to remove a specific reaction from a specific message.
I imagine usage similar to
!reactionclean [messages] [reaction1] [reaction2] [reaction3]
and
!rclean 10 pensive rofl clown
We should probably have a "ha...
I would like to work on this!
Connected!
I like this idea. Maybe we should introduce a maximum amount of points earned per game and per day, so spamming Quizzes alone wonโt get you to the top of the board?
Sounds good, go for it!
In a similar way the command suggestion works on Python, I donโt think we should limit it to #sir-lancebot-playground, what do you think?
I am going to close this issue since it would require quite a bit of rewrite that will be overwrote when smartconfig will be completed. The current behavior also makes development easier as you donโt need to have every settings pointing to a valid object, you only need what you use.
I agree with Numerlor proposal, we should only show #sir-lancebot-playground and the override channels. Are you still interested to work on that @ChrisLovering ?
[python-discord/sir-lancebot] New comment on issue #502: Riddle command should operate like the Quiz
Hello @aaravm4, have you managed to do any progress in it?
I think I might already have this fix in a branch on my fork. I'll dig it up over the weekend it PR it over here
[python-discord/sir-lancebot] New comment on issue #502: Riddle command should operate like the Quiz
Yea i'm about halfway done.
It should be either "cancels all reviews" or "cancels all of the reviews". The suggestion seems incorrect.
Most messages in the cog don't have full stops. Doesn't seem like too much of an issue
Mostly looks good to me, a few corrections.
await ctx.send(f"โ
The nomination with ID `{nomination_id}` was marked as reviewed.")
Perhaps it's better to use asyncio.create_task or scheduling.create_task which logs exceptions.
await channel.send(f"I tried to review the user with ID `{user_id}`, but they don't appear to be on the server ๐")
channel.send is a coroutine.
This won't work before the bot starts (meaning there's no event loop), for example when loading cogs.
bot.loop is defined the same way asyncio.create_task gets its loop
My bad, I thought create_task uses asyncio.get_event_loop
Yeah, that sounds a good idea, maximum per day points per game. Users would be able to play the game but wonโt earn points for them.
Right, I will keep it open.
I will open a PR once I get offloaded a bit (4 PRs open as of now).
69c49a8 Use ctx.send instead of ctx.channel.send - mbaruh
96003d7 Properly await coroutine in post_review - mbaruh
Hmm, both would be fine, as this doesn't happen too often. Marking as reviewed may be better though, as it would allow more context to be added to the unnomination if necessary, so yeah, mark as reviewed sounds good.
Ah ok, leaving it as it is is fine.
it may be that i just generally don't like the walrus operator. i have never seen it make the code more readable.
Relevant Issues
Closes #629
Description
I changed .github to .github user, and added the .github repo command, which fetches info for the repository that you choose.
Reasoning
Sometimes, it's useful the get info for github repos and not just users.
Screenshots

Did you:
- [x] Join the [Python Discord Community](h...
47ed233 Instructions to dispute an infraction vary by i... - swfarnsworth
75f2b9d Update the tests to reflect changes in expected... - swfarnsworth
96a369c Made multiline concatenated string conform to a... - swfarnsworth
b713a6c Merge branch 'master' into swfarnsworth/infract... - swfarnsworth
7a97eec Make the snowflake command accept many snowflakes - Akarys42
a7c8556 Review commands now use the user ID instead of ... - mbaruh
da72cff Merge branch 'mbaruh/autoreview' of https://git... - mbaruh
When on the https://pythondiscord.com/pages/resources/reading/ page, all the links are for the American amazon.
It is easy enough for a user to find their Amazon-specific, I'm from England so I just change the .com
Not a massive issue, but it may help users from other location than America find the book they can purchase etc.
There may be more cases than just Book links that this occurs with.
This might be as easy as changing the links to let Amazon redirect etc.
[python-discord/bot] branch deleted: mbaruh/autoreview
Does Amazon have a way to create international redirection links? I don't particularly like the idea of having to find the user's country code, replacing it in the URL ourselves, and hoping it doesn't 404. If Amazon doesn't have a way to do it, I think the best next thing is letting the user do it themselves.
Connected!
e69e918 Fix review formatting when there's only one inf... - mbaruh
[python-discord/bot] New branch created: mbaruh/review\_fix
Connected!
i have committed some changes that implement the cache clearing on bot startup to force fallback behaviour, and to write stats specifically for different reasons the channel could be closed.
https://github.com/laundmo/bot/tree/help-channel-closing-delay-changes
Please merge them if they are okay, i did not want to make a new PR for this.
Good job on your first PR to sir-lancebot.
You can just make repo a required argument and then you can skip this step, it would automatically be handled by the error handler.
Could do:
Not everyone calls repository by "repo" or are familiar with it, would be good if you could make it repository.
Good job on your first PR to
sir-lancebot.
Second but thanks ๐
Whoops sorry, this alias was for the github_group.
Connected!
Could do:
Fetches a repositories' GitHub information. The repository should look like `user/reponame`.
Should do:
I know this is not part of your PR, but it would be good if you could change these lines to follow our style guide i.e. each argument should be on a separate line.
Should do:
Use constants.Colours.soft_red instead, to maintain the similarity in Error Embeds.
https://github.com/python-discord/sir-lancebot/blob/a059eb2dc1caf2d8012629e311ac9b4a0b164692/bot/constants.py#L144
9e01d6b Only output override channels & bot commands ch... - ChrisLovering
[python-discord/sir-lancebot] New branch created: reduce\-channels\-output\-in\-error\-embed
Relevant Issues
Closes #556
Description
Remove all default whitelisted channels from the channel kwarg before building the output string
Reasoning
Previously this would output all channels, and could result in an error. This change ensures only the main bot channel & and any overridden channels are shown in the embed. We do this before the categories block as the categories kwarg itself is an override, so we want to include those in any output.
Screenshots
...
Might as well run
black
Yeah go ahead!
We donโt follow blackโs style guide, you may end up reverting more changes than you save.
Where are these style guidelines?
You can find them under the contributing section of the website:
Yep it was exactly Colour.blurple()
350f02f Added nomination voting channel to config - wookie184
[python-discord/bot] New branch created: add\-nomination\-voting\-channel
Also changed talentpool review cog to post there instead of mod-announcements
Connected!
Connected!
if ctx.channel.id in self.games:
winners.append(list(player_data)[index])
if all(c.isalnum() for c in raw_data["title"]):
I think this looks better, unless you want it to continue if raw_data["title"] is empty (if that's even possible).
Connected!
Oops it might need a not too.
Why are we closing the bot's http_session here?
eac2b1d Don't close bot's http session when getting image - ChrisLovering
Good spot, the previous cog I pulled this from made a new session here, so I changed it to the bot's session, without thinking about it too much!
[python-discord/bot] New branch created: limit\-nominate\-command\-channels
This limits the !nominate command to the nominations channel, adds a force nominate command so mods can override that, and also adds the moderators category to the config as a moderation category, so nomination-discussion and any new channels added in the future can have moderation commands run in them.
This looks good to me ๐ line 269 is annoying me but it's not part of this PR so that's ok
79bc8a9 Update eval to use SIGTERM for killed processes - Akarys42
[python-discord/bot] New branch created: snekbox\-SIGTERM
Due to a recent change in snekbox (https://github.com/python-discord/snekbox/pull/96) processes killed by cgroup limits will use SIGTERM instead of SIGKILL. This commit account for this change by updating the numerical value to 15 (SIGTERM portable value).
Description
I don't know whether this is a feature or a bug since I didnt read the source code; but the .topic command has been spilling out a lot of topics related to Easter. I don't blame the topics (its actually pretty good), its about how frequently the same topics are being sent by the bot. I know this is a one-time-thing where topics are more likely to be about a specific celebration (in this case Easter) but.... the same topics being sent SMH. (I've been told that random module i...
Iโd personally be for eviscerating all the Easter related questions, what do you think?
Or... just remove all pre-existing Easter topics. And add 5-7 new topics (related to Easter of course) and keep them till Easter ends. (afaik its 4th of April?)
Issue solved by #417 last year, closing.
Since those channels have been from here, they also need to be removed from bot/constants.py.
I don't think the ones I removed were in the constants.py (unless I'm missing something)
This is incorrect. SIGTERM is only used to stop the process when stdout is too large. Nsjail still uses SIGKILL for time, memory, and seccomp violations.
Another approach could be to store an optional month against each topic. Then on cog load, we only load the topics that don't have a month, or are from the current month.
Some users seem to not like this feature, from DM logs. It might be a good feature to have the ability to opt-out of receiving a DM from the bot when you open a channel.
This is incorrect. SIGTERM is only used to stop the process when stdout is too large. Nsjail still uses SIGKILL for time, memory, and seccomp violations.
Alright, I misunderstood the change then my bad. What about using SIGKILL and SIGTERM to trigger this message then?
If anything it should show an entirely separate message. SIGTERM will never have anything to do with the current message so it'd be inaccurate to use it.
Everything looks to be in order now.

Here is a close up


The Bulma logo is also a bit off, but it's close enough to not be visible at small sizes I think (I couldn't even notice until I zoomed ...
Of course the logos use different fonts, but I wonder if it's feasible to adjust their sizes such that the tops of the letters also somewhat align if they don't already.
Which browser are you using? It doesn't look like that for me in Firefox:

Chromium also seems fine. Bulma and Linode still look like they could go lower though.
Happens in Firefox on both Windows and Linux. Also happens in Chromium on Windows.
It looks fine on Firefox on Android in terms of alignment, but it instead has a different issue.

Looks similar for me, windows+chromium

I think a little icon in the bottom right would be good for a switch. It wouldn't be too intrusive in my opinion.
[python-discord/site] branch deleted: ks123/dewikification/event\-pages
[python-discord/sir-lancebot] New comment on issue #502: Riddle command should operate like the Quiz
Ok, I should be finished with both of my assigned stuff by the end of this week.
NOTE: This PR should target the dewikification branch!
This issue may be blocked by #393, so wait for that to be merged first.
At the top of an article in the content app, we should show an "Edit on GitHub" button which would lead to the view page for that file on GitHub - something like https://github.com/python-discord/site/blob/main/docs/configuration.md
The button should have a nice logo, maybe an edit pencil or a github icon.
90c5e62 Adds Streamyard Banner To Homepage - HassanAbouelela
[python-discord/site] New branch created: add\-streamyard
Adds the following banner to the homepage:

Tested on an android phone and an iPad, looks good!
[python-discord/site] branch deleted: add\-streamyard
fc53a53 Removes Gunicorn Import In Debug mode - HassanAbouelela
[python-discord/site] New branch created: move\-gunicorn\-import
The placement of the gunicorn import at the top of the manage.py file means the project is unable to start if gunicorn, or one of its dependencies isn't available. That is the case on windows, which makes starting the project completely impossible without using docker.
This PR moves that import below the start command for debug mode, so gunicorn will only be imported in production mode.
Connected!
Connected!
- **description:** Short, 1-2 line description of the page's content.
Aren't tables part of "standard" Markdown?
For consistency.
Pages, which include guides, articles, and other static content, ...
Each page must include required metadata, and optionally additional metadata to modify the appearance of the page.
You forgot to change these calls to use the new signature with *args.
Does this actually work? I'm thinking it might put an exception in place of the task argument.
If it's a problem then I think the fix would be to pass it as a tuple through a kwarg rather than unpacking it.
I'll just make it take a tuple since it's only going to be used once.
@MarkKoz as it stands currently, it will fall back to the old behavior if the cache isn't available (empty/ returns None)
I am proposing extending the fallback conditions to always use the old method for a while after startup, as it does not rely on cache. This way, instead of channels being closed prematurely they might take a bit longer to close.Yes, that could work. It'd have to reschedule it for the maximum time.
What about clearing the caches...
Whoops, I should have tested it more.
I get an error upon reacting with a different user
Traceback (most recent call last):
File "/home/mark/repos/python/bot-pydis/.venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/mark/repos/python/bot-pydis/bot/decorators.py", line 78, in inner
await func(self, ctx, *args, **kwargs)
File "/home/mark/repos/python/bot-pydis/bot/exts/info/help.py", line 68, in command_callback
await self...
Right, I forgot to append the _ after reaction, user, but I never saw that before.
It's not unless I'm mistaken, it's just that most markdown implementations support it.
This was a mistake; I accidentally touched the events app here.
I'm inclined to remove the docstrings then, given the test method names provide enough information about the tests.
Yeah that may be the case for many tests. Use your discretion. I'd rather keep them if they add to the readability of the code even if the English is a bit awkward. That being said, I think it's not enforced in this project to use docstrings in tests and there are tests elsewhere without them.
faccb5d Remove broken link from the April fool collection - Akarys42
[python-discord/sir-lancebot] New branch created: remove\-broken\-link
It would not, since that would result in a white <pre> background and a cramped <code> block.

As a workaround to avoid hardcoding, I reduced the padding of <pre> and increased the <code> padding so it looks the same, but doesn't rely on specifying a background color.
"""Commands for finding information related to GitHub."""
Could do:
You can set the icon_url (The URL of the footer icon) as the URL of the GitHub avatar of the owner
or you could even do this in the discord.Embed() (set_author).
- 2 nitpicks
- 1 item addition suggestion.
@MarkKoz The current tests run the markdown parser and rely on filesystem access. I am thinking of using pyfakefs to mock the filesystem and do a small refactor of the tests. What do you think?
I have seen people often getting confused !help command to help with their python code.
!help should mention on top, if they want help with python code they go to #how-to-get-help.
Connected!
Connected!
GitHub Actions run 683884418 succeeded.
GitHub Actions run 683903089 succeeded.
GitHub Actions run 683908633 succeeded.
That could be cool. But its pretty helpful if you forget your channel!
I'm not a fan of relying on cache behaviour like this. It feels too fragile and implicit.
Personally i think that clearing the caches is fine, as that solves exactly the issues we would have, which is outdated caches. The code has to handle non-existent caches anyway, and treating them as non-existent after a restart seems exactly the behaviour we want.
i understand that it doesn't feel clean since we have to manually clear them. If we were to handle that data as a python only variabl...
I'm not a fan of relying on cache behaviour like this. It feels too fragile and implicit.
Personally i think that clearing the caches is fine, as that solves exactly the issues we would have, which is outdated caches. The code has to handle non-existent caches anyway, and treating them as non-existent after a restart seems exactly the behaviour we want.
i understand that it doesn't feel clean since we have to manually clear them. If we were to handle that data as a p...
[python-discord/site] New branch created: lemon/frontend/update\_timeline
- Remove the 100K user banner.
- Update the timeline.
[site] Branch lemon/frontend/update\_timeline was force-pushed to `80e9569`
@MarkKoz The current tests run the
markdownparser and rely on filesystem access. I am thinking of usingpyfakefsto mock the filesystem and do a small refactor of the tests. What do you think?
I'm not familiar with it. What advantages would it provide? I don't currently have any problems with using actual test files in a real file system. After all, the tests rely on the content in the files too, not just on their existence. How would the content be specified with pyfakefs? ...
The primary advantage is all filesystem setup is in a single helper.py, including file content. That way, valid/invalid content can be reused for different files, and placed right next to the expected parsed content for use in the tests.
The content is specified like so:
MARKDOWN_WITH_METADATA = """
---
title: TestTitle
description: TestDescription
relevant_links:
Python Discord: https://pythondiscord.com
Discord: https://discord.com
---
# This is a header.
"""
...
Some suggestions to use f-strings everywhere, all other code looks good. After these changes have made and conflicts resolved, I will test locally.
footer_text = textwrap.shorten(f"Moved: {renamed_symbols}", 200, placeholder=' ...')
removed = f"- {removed}"
renamed_symbols = ", ".join(self.renamed_symbols[symbol_name])
closed_on shouldn't be specified here since report_complete_session will prepend it with auto. I guess it needs to be an empty string, since it's a required parameter. That's awkward though, so you should give the parameter a default value.
Do you think this should be removed now that the code for this has been moved elsewhere? on_message still technically causes this to happen, but it's no longer directly responsible for it.
Need to be careful mixing aware and naรฏve datetimes. They all need to be one or the other. I don't remember if it was for help channels that I chose to use aware datetimes somewhere. In any case, I don't believe it's strictly necessary as long as all the code is "on the same page" and using all naรฏve or all aware objects. Since it's dealing with times coming from discord.py, which gives naรฏve objects, the path of least resistance is likely to use naรฏve objects everywhere.
If you swich to n...
[python-discord/sir-lancebot] branch deleted: reduce\-channels\-output\-in\-error\-embed
Sorry to give a sort of non-answer, but I don't feel strongly one way or the other. I don't really mind an extra dependency since it's just for dev, even though I'm not entirely sold on it being necessary. If you really feel like it improves readability or maintainability of tests, then feel free to use it.
Also, it's late here, so I'll try to review your latest commits tomorrow.
Connected!
Relevant Issues
:man_shrugging:
Description
- Update white listed channels and categories of
,issuecommand.
Reasoning
Smh, ask Scaleios and Ks, I just did what they said.
Screenshots
none
this makes sure that auto is not prepended if the channel is closed by commend.
alternatively, get rid of this prepending entirely and explicitly pass "auto.cleanup" etc.
caller = f"auto.{closed_on}" if closed_on != "command" else "command"
it seems this would also check the author object against the id which even if discord.py handles that (not sure) is not as explicit as checking the id.
claimant_id = await _caches.claimants.get(channel.id)
if message.author.id == claimant_id:
await _caches.claimant_last_message_times.set(channel.id, timestamp)
return
yep, definitely should be claimant.
timeout = constants.HelpChannels.idle_minutes_claimant * 60
Attempting a regex search with !infraction search "a{3,5}b" hits the /bot/infractions/extended endpoint with {"search": "a{3,5}b"},
This is a valid regex search, however the site throws a 500 error inside the database, rejecting the regex with:
django.db.utils.DataError: invalid regular expression: braces {} not balanced
this needs to explicitly check for the closed_on reason being command
initially i had considered passing False or None for command closings, but since command now passes the string command explicitly, this check will never be true.
if closed_on == "command":
[python-discord/sir-lancebot] branch deleted: remove\-broken\-link
Connected!
I've removed the banner for now, but what @scragly had in mind was far more interesting and we should probably still do that. Meanwhile, the banner is at least gone.
Also, it's late here, so I'll try to review your latest commits tomorrow.
No problem.
4169d5a Use real names in the timeline - lemonsaurus
[python-discord/site] New branch created: lemonsaurus\-patch\-1
Using nicknames like Ves Zappa and Lemon doesn't always feel appropriate,
so I've replaced some of those references with real names.
I did this on purpose but I don't know, I guess I'm open to suggestions. Leon looks so weird to me. Nobody calls me that. But yeah maybe I should just let go and change this too.
Fixed, and squashed fixes into initial commit.
Sweet! I think Leon does make sense here, since lemon doesnโt appear anywhere on the timeline. That said, if you prefer lemon I really donโt mind haha
Looks great! I have one minor comment, but it's fine either way.
is created, and <strong>Leon Sandรธy</strong> (lemon) joins the owner team later in the year, when the community
What do you think about putting the nicknames inside parentheses, so people will be recognized on the server? This would go for all people mentioned.
I was actually doing that earlier, I just removed it. I don't know if it's necessary for joe and sebastiaan since their names are their nicknames.
b432512 Timeline: SeasonalBot -> SirLancebot - lemonsaurus
Yeah, that's true. I think it would be nice nice to have for you, though.
The idea is simple
!contribute/!contribution tag to link python-discord' projects and suggest reading https://pythondiscord.com/pages/contributing/
.
anyone can work on this one.
So you're looking for something like this? (Ignore the weird formatting, it was an online preview.)

That looks pretty good. I'd say that Python should be called utility bot rather than moderation, and the bot could be mentioned instead.
Yeah, it was just an idea. I think that would look better too.
One more thing, instead of adding the thumbnail as a asset from the branding repository, you should probably use the bot's avatar link.
Will do. That's just where I found it first, but I'll change it. Do you know where I can find that link?
Will do. That's just where I found it first, but I'll change it. Do you know where I can find that link?
self.bot.user.avatar_url
If we make it a tag, and i would say that we should, we can't customize the icon.
We could add this along with https://github.com/python-discord/bot/issues/1154 probably.
We could add this along with #1154 probably.
I'd say that the scopes are too different for that. This one is about creating a new tag, while the other one is about adding another subcommand to !sourceยฐ
Some suggestions to use f-strings everywhere...
I don't really see these as more readable, but it can be changed if others agree
After these changes have made and conflicts resolved
I don't plan on resolving the lockfile conflict until it's necessary as it doesn't involve any code and may result in a redundant merge
If anything it should show an entirely separate message. SIGTERM will never have anything to do with the current message so it'd be inaccurate to use it.
Alright, letโs do that in another PR then.
[python-discord/bot] branch deleted: snekbox\-SIGTERM
That could be cool. But its pretty helpful if you forget your channel!
Oh absolutely! My suggestion here is have them on by default, but offer an way to opt-out of the messages for those people who don't want them
For short strings simple concatenation can be ok, although I agree f-strings seem preferable.
I personally don't mind either string concatenation method, although the Pipfile will have to be fixed for the PR to be tested. Having a few main merges really isn't an issue at this point.
That would be a cool idea, welp sadly I have no say in anything so I guess just wait for there response lol. :)
How widespread is the dislike of this? I can't imagine people receiving more than 3 or 4 DMs per day for the heaviest help channel users, with others receiving much less.
I'm open to the idea but it's another data point to store and retain, and since we don't guarantee persistence on Redis I'm not sure of the best solution in case we lose persistence and start sending DMs again.
Okay okay hear me out.
Let's make a character creator (like the one on https://lemonsaur.us you ask? Yes. Like that one.) where you use a color picker to pick the color of:
- The duck itself
- The beak
- The wing
And where you can also select an accessory. Our list of accessories should be taken from all our existing duck SVGs. So, stuff like, the crown from the royal ducky, the ushanka from the russian ducky, or the party hat from partyducky.
To be 100% honest with you joe I don't think its a widespread dislike. If anything I think it was a good feature that a bunch of people enjoy and use daily. But if it could be implemented without being a pain in the you know what. Then I guess it would add some customization.
Can't say that I agree on it being necessary with only one small version change on a direct dependency but I've pushed the merge now
Still getting the same error. Can you please test this yourself before pushing the fix?
Still getting the same error. Can you please test this yourself before pushing the fix?
I've tested multiple times and haven't gotten that error, I did get a different one though.
Definitely still getting the same error... I think reaction.message.remove_reaction(reaction_.emoji, user_) needs to be reaction_.message.remove_reaction(reaction_.emoji, user_)
Definitely still getting the same error... I think
reaction.message.remove_reaction(reaction_.emoji, user_)needs to bereaction_.message.remove_reaction(reaction_.emoji, user_)
Yeah that makes sense. I'm just wondering why I didn't get any errors.
Ah it's because I reacted to it first so reaction got defined.
Okay, that's fixed, but now there is a different bug. I think the bot is detecting its own reaction as a deletion. It happens fast, so it's hard to tell what's going on. Enter !codeblock and observe that the message immediately gets deleted.
65c0097 Don't prepend command closes with auto - ChrisLovering
9f576bc Change help channel logic to use timezone naive... - ChrisLovering
258086f Remove unneeded cache clearing - ChrisLovering
b1b105a Check for close on command explictly. - ChrisLovering
b8eef95 Schedule channels just opened using claimant co... - ChrisLovering
If any of the variables within the all() call are falsely, we want to enter the if block and use the fallback behaviour. IE if the cog is initialising or if either cache is empty
Smh, ask Scaleios and Ks, I just did what they said.
@Shivansh-007 Please include context within this PR as well. If neither of them are online/available then it'll only make the process of reviewing more tedious.
Please re-open a PR with the appropriate body and contents.
Same as above, should we quote this user input before fetching a url?
Should we url quote the username here before appending it to the url and fetching?
It was working fine, but I took the opportunity to refactor it into a separate function.
I am a bit concerned about reactions being spammed, but I tried it and the bot seemed to be able to keep up.
discord.py still returns times in UTC; they're just naรฏve. It uses utcfromtimestamp. Sorry if my previous comment was misleading.
Right... ยฌ(A & B & C) == (ยฌA | ยฌB | ยฌC)
bae3d6a Create utc datetime objects from timestamps - ChrisLovering
This is now broken due to
# non_claimant needs to be set too, to satisfy the condition in `_channel.get_closing_time` the first time.
# Otherwise it will fall back to the old method if no other messages are sent.
await _caches.non_claimant_last_message_times.set(message.channel.id, message.created_at)
The value should be None when the channel is claimed, but then you'd need to fix the fallback logic.
Oh sorry, I didn't realise the diff was collapsed.
Redundant f-string? I'm not sure if it's needed in this case.
title=repo_data['name'],
Just a small review :slightly_smiling_face:
Could be simplified to:
if "message" in repo_data:
Why not use try-except catching KeyError? You can then optionally perform some logging.
try:
parent = repo_data["parent"]
embed.description += f"\n\nForked from [{parent['full_name']}]({parent['html_url']})"
except KeyError:
log.debug("Repository is not a fork.")
Relevant Issues
(No issues are opened for this, was discussed in #dev-contrib)
Description
- Update white listed channels and categories of
.issuecommand.
Reasoning
Was discussed in #dev-contrib, here is the [context](#dev-contrib message).
Did you:
- [x] Join the Python Discord Community?
- [x] Lint your code (
pipenv run lint)? - [x] Set the PR to ...
Is it still appropriate to link to markdown2 docs?
The information still holds, but now that we're using a separate library for frontmatter which uses pyyaml to build the metadata instead of whatever homegrown parser markdown2 uses, I'll remove the line.
Okay, this is a great start, and there's some pretty good code in here, but we need to figure out a few things.
@python-discord/core-developers, I want you guys to chime in on this with your opinions:
-
The last time we discussed this system, I remember people raising concerns about the name "Guides". Should it be called Guides, or something more generic? If we should call it something else, what do we call it? Maybe something like Content?
-
@ks129 How GitHub-Flavored Markdown compati...
We can also the put the share button on the article, like it is shown on the Microsoft docs linked you linked.
Can you add what is the PR actually changing and why to the PR body? Right now, no matter how hard Iโm looking at it I have no idea what this is doing and why.
When a user opt out of metricity, the opt_out field is set to True. This field should be returned by the /bot/users/$id/metricity_data, which can be achieved by adding "opt_out" to
The following docstring will also have to be modified.
Currently we have no way of knowing if the message count isnโt accurate because the user opted out of metricity. Once https://github.com/python-discord/site/issues/467 is resolved, the information will be available to the bot under user_activity["opt_out"] and can be added here:
Connected!
Relevant Issues
Description
Reasoning
Screenshots
Additional Details
Did you:
- [ ] Join the Python Discord Community?
- [ ] If dependencies have been added or updated, run
pipenv lock? - [ ] Lint your code (
pipenv run lint)? - [ ] Set the PR to allow edits from contributors?
Added the banner in .svg and .png formats to prepare for the branding manager. The improved design will be added later, this is a placeholder.
For context, this contribution helps unblock #129 and the design can be finished later.
Hey, thanks for your interest in contributing, but can you tell us more about this PR? What is the context behind opening it, and what are these resources? At the moment there isnโt much information to go off of.
Connected!
Description
When a really cool message is sent in the server, people want to bookmark it for future reference.
If many people want to bookmark the same message, the chat could be flooded with .bm 1231231231313 calls.
We should add a way for users to also bookmark the same message as another user, without having to send another command.
Reasoning
To reduce the amount of messages sent in a channel when many people are wanting to bookmark a message.
Proposed Implementa...
Duplicate of #341 which has... gone very silent
My thoughts on this is to change the .dm command to have the bot output a small embed with the context along the lines of <user> has bookmarked <message> from <author>. React with ๐ to also bookmark this message..
We use redis to store these embed messages linked to the bookmarked messages and a reaction add listener which checks the cache when a pin is added to a message.
An alternative is to use a wait_for to listen for reactions for ~5 mins and then delete the bot's embed.
Couple of minor things.
Super minor but can we not have a hyperlinked full stop ๐.
For more info about using intents, see the [discord.py docs on intents](https://discordpy.readthedocs.io/en/latest/intents.html).
Is it worth linking to the intents section of the Discord docs for a bit more info?
Is it worth linking to the intents section of the Discord docs for a bit more info?
That seems like it would be useful. The Discord dev docs explain it rather well.
Connected!
GitHub Actions run 690899022 succeeded.
GitHub Actions run 690922534 failed.
GitHub Actions run 690935893 failed.
[python-discord/site] Checks Successful on PR: #373 Add a validator for documentation package names.
GitHub Actions run 690953211 succeeded.
GitHub Actions run 690972145 succeeded.
dceb652 Test New Sentry Action - HassanAbouelela
[python-discord/forms-frontend] New branch created: sentry\-action\-test
Changes the action used in sentry releases to the one used in our other projects such as python-discord/bot, as the current one does not seem to be working. This is just a test for now.
Issue opened upstream at: https://github.com/getsentry/action-release/issues/47
ee9b0f3 Broken Code - HassanAbouelela
dceb652 Test New Sentry Action - HassanAbouelela
[python-discord/forms-frontend] New branch created: sentry\-action
[python-discord/forms-frontend] branch deleted: sentry\-action\-test
Description
When a user tends to use a command often, either by the user manually adding it, or have the bot automatically add through command tracking, add a ".bookmarks", and it will pull up all the bookmarked commands of that user.
Reasoning
For easier use and memorization of the bot commands.
- [ ] I'd like to implement this feature myself
- [ x] Anyone can implement this feature
I'm trying this out with the following config:
idle_minutes_claimant: 2
idle_minutes_others: 1
deleted_idle_minutes: 1
I simply claim a channel, and it correctly schedules it to close in 2 minutes. However, when the closing task runs, it calculates a wrong time. The log timestamps on the left are in UTC-8. Converted to UTC the times would be around 2021-03-26 20:58:06. Therefore, the time it calculates is off by 7 hours.
2021-03-26 13:58:06 | bot.ext...
It should be upside down and be wearing a hat.
dfe0e60 Allow automatic linking of issues everywhere - Akarys42
[python-discord/sir-lancebot] New branch created: akarys/630/automatic\-linking\-everywhere
[python-discord/sir-lancebot] Pull request opened: #642 Allow automatic linking of issues everywhere
We have been limiting the channels where automatic linking issues can be used (See #566).
Since we haven't seen any potential issue with it, we can allow it everywhere to avoid updating it every two days or because of missing channels.
Closes #630.
Maybe we should remove the unused constant (WHITELISTED_CHANNELS_ON_MESSAGE)?
d8ba0c7 Remove unused WHITELISTED_CHANNELS_ON_MESSAGE c... - Akarys42
[python-discord/sir-lancebot] Checks Failed on PR: #642 Allow automatic linking of issues everywhere
GitHub Actions run 693295571 failed.
[sir-lancebot] Branch akarys/630/automatic\-linking\-everywhere was force-pushed to `d03a41d`
The !raw command takes a link to a message in the discord, and then shows the message contents inside a code block.
This line tries to prevent the message from breaking the code block:
https://github.com/python-discord/bot/blob/76b3b5898dd4163d8bac6ff330209f27f437e3d6/bot/exts/info/information.py#L452
But consider the message: ````` (5 backticks). The first 3 will be replaced by the filter, but that's it. Finally giving this result: `` ```, and actually breaking out of the co...
I wouldn't replace it with a backlash, because it will look like \ inside the codeblock. The best way would be to replace it with an invisible character (\u200b`).
I'd also add something like this to escape mentions:
https://github.com/python-discord/bot/blob/main/bot/exts/utils/snekbox.py#L153-L157
And it looks like that's exactly what the function @HassanAbouelela suggested does:
https://github.com/Rapptz/discord.py/blob/a3f700c11f72202f6a7710ce07c7144a8b8c947d/discord/utils.py#L547
I'd submit a PR but I can't test this on actual Discord so I'll leave it
If you have some time to set up the bot, we have a contributing guide that walks you through the process. You can also ask in the dev-contrib channel for help. That being said, just reporting the issue is a significant contribution, thank you.
There's a discord.py utility to escape mentions, would that work here?
Wouldn't allowed mentions be better than escaping them?
Is that something we can configure per command?
They are in use, i just changed its name:
-WHITELISTED_CHANNELS_ON_MESSAGE = (
+WHITELISTED_CHANNELS_ISSUES = (
Channels.organisation, Channels.mod_meta, Channels.mod_tools, Channels.staff_voice
)
Description
This PRs wipes out the old DMRelay cog and its functionalities. We realize that relaying all DMs sent to the bot into a specific channel may come in conflict with Discord's ToS, so that feature has now been removed, along with the !reply command. I've replaced it with the !dmrelay command, allowing moderators to view DM history between the bot and a specific user when necessary.
Here is an [example message log](https://paste.pythondiscord.com/ogeromerur.txt?noredirect...
78b00dc Remove WatchChannel parent of TalentPool and mi... - ks129
dda3490 Use more accurate command names and docstring f... - ks129
f144bac Migrate nominations history command to non-watc... - ks129
807a27e Migrate Talent Pool Reviewer class to non-watch... - ks129
2d47640 Migrate unnominate command to non-watchchannel - ks129
[python-discord/bot] New branch created: ks123/goodbye\-talentpool\-channel
Closes #1422
- Migrated TalentPool cog to not use WatchChannel cog as a parent class.
- Migrated Reviewer class to apply changes from TalentPool cog migration.
- Renamed some commands (left aliases) so they are not referencing to watching anymore.
- Implemented cog's cache.
- Removed #talent-pool configuration.
Sorry but I donโt understand @Shivansh-007. Who changed what when, and what should this PR (#642) actually do?
I'd like to see some issues that came up during a cursory test addressed:
-
Duplicates

-
No limit on the number of issues grepped from a message

-
No ratelimit handling:
fetch_issuesreturnst.Union[FetchIssueErrors, str, list], two of which are error mess...
This seems like a major change in the scope of where we allow a feature. Is there some discussion surrounding the decision somewhere?
The current implementation of fetch_issues only handles responses 404 and 403, while assuming everything else is valid.
The issue endpoint called in the method returns other HTTP responses, all of which should be handled properly:
301 Moved Permanentlyresponses should be followed to get the issue at the repository the issue was ...
This seems like a major change in the scope of where we allow a feature. Is there some discussion surrounding the decision somewhere?
It has been discussed in #dev-core, in #organisation and the issue was left open for a week. Everyone seemed on board with the idea.
@kosayoda I agree that those changes should be done, but isn't it out of scope for this PR?
@kosayoda I agree that those changes should be done, but isn't it out of scope for this PR?
My opinion is after this PR, the scope of automatic detection and linking essentially goes from 3 non-staff channels located at the bottom of the server to every single channel in the server, which is a potentially huge issue given the number of problems still present in the feature.
Sorry but I donโt understand @Shivansh-007. Who changed what when, and what should this PR (#642) actually do?
- This is required by the
.issuecommand (rework permission) PR, that is #638. - It is used to restrict the command to those white listed channels and few other white listed categories.
- As the author of this feature, I would suggest to just remove the if...else check for channels/categories in the
on_messagelistener.
@kosayoda I agree that those changes should be done, but isn't it out of scope for this PR?
My opinion is after this PR, the scope of automatic detection and linking essentially goes from 3 non-staff channels located at the bottom of the server to every single channel in the server, which is a potentially huge issue given the number of problems still present in the feature.
Sounds good, will do that this afternoon ๐
Alright, I'd rather not leave an unused constant lying around, I believe Git should properly handle this merge. If not, it will be up to the last merged PR to handle conflict.
:pray:
Ready for review!
Ready for review! But please point your attention here first: https://github.com/python-discord/branding/pull/129.
A few minor things noted in the code, as well as the below bugs.
Does not handle client user
We should gracefully reject requests to relay the bot's DM history with itself.
Incorrect "no DM history"
After booting the bot and running this without sending any messages, the bot incorrectly identified me as having no history, after I sent a message to the (existing) channel it did identify that there was a history and uploaded it.
Maybe we should instead just use an asy...
return paste_link + "?noredirect"
Shouldn't extension not have a . here?
if extension == 'py':
"""Inspect messages sent to the bot."""
We already use allowed mentions after the ping incident with !raw last year, rendering this vulnerability not hugely damaging. From my testing, it appears that only individual user pings work or the roles that we have whitelisted here:
https://github.com/python-discord/bot/blob/60f410e488e8212f34c56b9353df0c97912d369c/bot/bot.py#L112
Therefore:
| Ping type | Safe | Demo |
|---|---|---|
| User | :x: | <img width="1241" alt="Screenshot 2021-03-28 at 13 01 08" src=... |
Connected!
This looks good, however it now uses 2 API calls instead of one, which I think we can optimise down to one.
Switching around the order of "no channel" with "fetch messages" means you can do something along the lines of:
found_messages = False
async for msg in user.history(...):
found_messages = True
if not found_messages:
await ctx.send("... no direct message hitsory ...")
I'm fine with this implementation though, since it's an infrequently used command anyway.
My only gripe is we're building the output string using += rather than having a list and using .join() at the end. Not enough to stop the merge though! :D
[python-discord/bot] branch deleted: feat/dmrelay
Does py need to be special cased here? the noredirect shouldn't change anything for it and the util isn't used anywhere where the compactness would matter
The case where the paste service fails and returns None needs to be handled here
metadata = (
f"User: {user} ({user.id})\n"
f"Channel ID: {user.dm_channel.id}\n\n"
)
Using implicit line continuation and joining looks a bit nicer to me; the textwrap import can also be removed if you decide to use this
Connected!
I guess not, but I still think it's nice to account for it.
Thank you for this information. I'll see what I can do.
I'll address these comments in a new PR.
@asleep-cult Will you be continuing this PR?
My idea exactly. Can I take this one?
I'd like to give this a go. Even though this is already approved, I just want to confirm my plans.
- When someone calls
.bmon a message the bot will:- Send a DM as normal (with the same error embed if DMs are disabled)
- Send 1 sentence embed explaining that you can react to the embed and also get sent a DM with a link
- Have a 5 min wait for listening for reactions
- On reaction, the bot will send the bookmark DM to the reactor
Changes
- Instead of adding a space between ``` (this was easily bypassed), replace each backtick with "`\u200b".
- If someone (somehow) bypasses the codeblocks, they cannot mention everyone because the message will use
AllowedMentions.none
that sounds great! however, i think we could use the reaction that is already added to the command.
@HassanAbouelela it looks like it added some extra april fools videos
My plan is to remove that reaction entirely, since it wouldn't be needed with this idea.
The reason for not using the reaction that's already there is due to it not being an obvious way to interact with this new system.

