#dev-log
1 messages ยท Page 45 of 1
Build 20200412.2 succeeded
Joseph Banks
00:03:11
Bot
Connected!
Build 20200412.3 succeeded
Joseph Banks
00:02:52
Bot
Connected!
I just remembered that some docstrings (at least the class's docstring) will need to be updated because the command is no longer solely role restricted as I believe it currently states. The message constants should maybe also be updated to mention the command, but that may require some discussion.
We'll need to update the guide on the site once this feature is ready.
Postgres backup completed!
c608963 Remove dormant invokation message after move. - Numerlor
1a58b34 Allow help session starters to invoke dormant. - Numerlor
7ccfa21 Reset cooldown after channel is made dormant. - Numerlor
c6355f6 Extend docstrings to include new behaviour. - Numerlor
acee84d Handle dormant invokation not being found. - Numerlor
Build 20200412.4 succeeded
Connected!
Build 20200412.5 succeeded
Joseph Banks
00:02:52
Bot
Connected!
@sco1 Was wondering if you could check this version out..?
priority set to high. critical implies this isn't usable without it, which is misleading since new versions for Bulma are typically very minor.
please note that nobody is assigned to this yet, and that this org has many other priorities that are higher at the moment.
Relevant Issues
Closes #300
Description
I added tictactoe command like described in issue, + added tictactoe history|log to show a list of current session games and tictactoe history|log show to show the board of the game.
Reasoning
Because there was approved issue.
Screenshots

![Screenshot 2020-04-12 at 19 22 ...
Build 20200412.1 succeeded
GitHub
00:00:58
Seasonal Bot
Build 20200412.2 succeeded
GitHub
00:00:50
Seasonal Bot
How would it deal with users which leave the guild? The roles do perist in the database but there would not be a way to know if the user's role should be re-added. Since the mapping of channels to users does not currently persist, it will not be possible to determine if the user's help channel went dormant. Should it just drop the role until some persistence is implemented?
I think it's fine for now to not persist the roles. It's a role that a user should have for a maximum of 15 minutes at a time anyway and if people try to abuse the non-persistence by leaving/joining to claim multiple channels (I don't think that will happen often), we can moderate them.
Still, persistence has come up a couple of times now for different elements of the help channel system; we should evaluate in due time if and how we're going to tackle that. Once such persistence gets imple...
Connected!
Build 20200413.1 succeeded
Joseph Banks
00:03:08
Bot
Build 20200413.1 succeeded
GitHub
00:01:19
Seasonal Bot
Postgres backup completed!
I've added a role (Help Cooldown - 699189276025421825) and set the appropriate permissions on the category.
ANN201 is giving the wrong line number if using a multi-line docstring. I assume all the ANN20x would fail for the same reason.
Related to #32, was not fixed correctly.
The logic is searching backwards from a function's body to find : to make the end of the function signature. This is easily broken by having a : inside a docstring, which is fairly common.
def foo(n: int):
"""Multi-line docstring.
Args:
n (int):
"""
return n
**Version ...
Sort of a continuation to #546 to get feedback before getting to it.
Before (trying to) implementing #447, duplicate items will be needed to be removed from the inventories dict to get only the relevant results. These were mentioned in comments of the aforementioned issues.
That will drastically decrease the amount of items and their used space so I thought we can also up the cache max_size in here
https://github.com/python-discord/bot/blob/3d25c790a69421e0ed9c7c7a29ca1d5833322169/bo...
Closes #77
Fixes wrong line number for doc-strings by searching for docstring opening """, rather than :
Can I get assigned to this?
Postgres backup completed!
@ks129 Can you please update this pull request with a proper description? It's not acceptable to just write "Closing #861" as your pull request description - the description is supposed to provide a high level overview over specifically what this pull request does.
I'd also like to suggest that this PR address two more related and fairly minor issues:
- If the ban does fail, for some other reason, it would be nice if we could reset the state properly so we don't get an erroneous state. ...
Sometimes channels get accidentally made dormant by staff. This command will undormant the channel and put it back in occupied pool.
Relevant details:
- Permission: Helper+
The current dormant message reads like this:
This help channel has been marked as dormant, and has been moved into the Help: Dormant category at the bottom of the channel list. It is no longer possible to send messages in this channel until it becomes available again.
Thus, there is no way of knowing whether it was manually made dormant, or automatically made dormant due to inactivity.
If a user mentions that a channel was mistakenly made dormant when they were not done with it, it...
I think an easy way of communicating that a channel was marked as dormant manually and making obvious by whom it was marked so is by reversing the bit that deletes the invocation message. That will also make it far more obvious than having to scan an embed message.
@lemonsaurus I fixed PR description. About tests, there are currently no tests for this moderation side.
<--snip --> reversing the bit that deletes the invocation message. That will also make it far more obvious than having to scan an embed message.
I second that idea.
@ks129 looks like you're right, I thought we had more tests for moderation. We do have the tests in here https://github.com/python-discord/bot/blob/master/tests/bot/cogs/moderation/test_silence.py but not for most of the other moderator commands.
It would still be nice to see a single test, specifically for this problem. Would you be able to write that? No need to write a complete suite of tests for the entire moderation cog, but we got to start somewhere, right?
ea81f3b Revert deletion of !dormant invocation messages - SebastiaanZ
Where would this be entered? Currently dormant channels are read-only for Helper, so that would need to be altered as well.
Description
The current usage for the .issue command looks like this:
.issue [repository=seasonalbot] [user=python-discord]
It would be useful to allow multiple issue numbers, resulting in one embed listing all of the issues.
Reasoning
Requesting multiple issues is a hassle, having to repeat the command for each issue. The resulting embed is also rather large and intrusive.
 rather than changing the existing ones? It would be good to be able to test multiple failure scenarios separately rather than having them combined into one test.
@lemonsaurus So I should write test only for these functions that have shortening?
Build 20200414.3 succeeded
GitHub
00:01:34
Bot
Build 20200414.7 succeeded
GitHub
00:01:19
Bot
Build 20200414.6 succeeded
GitHub
00:02:19
Bot
doesn't this just apply to bans?
+1 for the !open alias. I typically use !close for setting channels as dormant, so !open would be the easiest to remember.
@lemonsaurus I added truncation to ban, kick and ModLog entries. Should I write to test to every of them?
I can see this as quite useful, since I've seen a few times where people wanted to answer something from a dormant channel but had to use a new available channel instead.
I also like the !open alias, but that would conflict with our !open tag.
Yes, I'll add some additional tests.
I didn't dig too deep into the code, so I'm not sure if my python3.8 patch is the best approach.
Postgres backup completed!
How about extending this to all users? If their channel goes dormant and no one else has used it yet, they would be able to reclaim it. This may be useful if a channel is accidentally closed (even by the claimant). They may have unexpected follow up questions or find out shortly after their issue isn't solved after all.
This could be abused but it's no worse than users sending junk messages to keep their channel open. The amount of channels in the dormant pool shouldn't see a decrease sinc...
I like the idea. We may see some people being frustrated by their old channel having gone back into circulation, but there are obviously limits to what we can do.
Since users don't have permissions to type in dormant channels, they'd have to do run the command in another channel like #bot-commands. Invoking it in a different channel is not the greatest experience but I think it's better than having nothing. I'm not that concerned that it makes the system more complicated as this won't be...
Overwrites could work and we still have code that can be repurposed for it. It also has the advantage of being persistent. Sine categories aren't in the mix, it sounds more promising. However, I wouldn't be convinced and willing to invest in the approach without first testing to confirm it won't be buggy.
That being said, allowing them to type in a dormant channel introduces the problem of not wanting them to type anything besides the open command. It could delete messages like the verificat...
The concerns you raise are valid and I think I agree with you that the permissions play a big role in communicating that a channel is now dormant. Let's go with the out-of-channel command for now.
@MarkKoz
Okay, this does need figuring out I guess.
I think we should use mentions both on actor and on User, and that on User, we could probably include the display_name instead of the user ID. 99% of the time when you're viewing the result of an !infr search, you typed in the ID to get there, so I really don't think displaying the ID is that crucial.
It's also quite unlikely the actor won't be cached.
So, I think mentions on both and display_name (with descriminator) strikes a ni...
Yeah, that seems fine to me. They can all be in the same class, though. You're basically just testing truncation.
also, we should probably get tests up and running for moderation features. That's gotta be one of the most important cogs we have. It's funny that we have extensive testing for Duck Pond but we don't have any tests for our most crucial commands.
Connected!
Just an update: I've not made too much progress yet since it turned out to be a busy week for me. I am still planning on working on it once I am not so busy.
Postgres backup completed!
Build 20200416.1 failed
GitHub
00:00:51
Bot
Build 20200416.2 succeeded
GitHub
00:01:23
Bot
@lemonsaurus I added now removing infraction from DB when applying fail and moved DM sending to later, so this check is this failed before sending it. Also made tests, but ban and kick reason shortening is in one file, ModLog's one is in another file.
Let's call it Truncation, not Shortening. Do you mind changing all the occurrances in this file?
Build 20200416.3 succeeded
GitHub
00:01:25
Bot
After a discussion, this can also be done by adding a tag to the current tags, and it will be treated as a static tag instead.
This can be done very easily:
- Collect IDs with
discord.Greedy - Loop requests to get information
- Create embed that
descriptioneach line have one issue/PR
When this is gonna be approved, I'd like to work with it.
This PR add a temporary free tag that indicate how the new help system works.
Build 20200416.4 succeeded
GitHub
00:01:44
Bot
Very nice usage of the tag system!
I suggest changing the name to discord channel mention via id, that way if we ever decide to rename the channels, the content of the tag will be updated accordingly.
We recently moved to a new help channel system. There are always 2 available help channels waiting to be claimed in the **[#691405807388196926](/guild/267624335836053506/channel/691405807388196926/)**. In order to claim one, simply start typing your question into one of these channels. Once your question has been posted, you have claimed this channel, and the channel ...
**How to claim a channel**
We recently moved to a new help channel system. There are always 2 available help channels waiting to be claimed in the **Python Help: Available category**. In order to claim one, simply start typing your question into one of these channels. Once your question has been posted, you have claimed this channel, and the channel will be moved down to the **Python Help: Occupied category**.
Build 20200416.5 succeeded
Connected!
Build 20200416.7 succeeded
GitHub
00:01:20
Bot

It's time to get our wonderful emojis merged to branding. Before we do that, we need to sort out some legal stuff on this branch. Here's what needs to be done:
- [ ] We have remixed Twemoji's to make these, so we need to include attribution and explain which changes have been made. These are licensed under CC BY 4.0. Let's add thes...
72eea25 Add 17 lemojis in SVG+PNG. - manusaurio
f58729b Add 17 lemojis in PNG, now for real - manusaurio
1f941d8 Merge branch 'master' into lemojis - lemonsaurus
8413eeb Add attribution, and a compatible license for l... - lemonsaurus
d39a6b8 Merge pull request #49 from python-discord/lemojis - SebastiaanZ
Thanks for your input. What do you think about the following regarding the username + discriminator?
- Is it worth an API call to get the data or should it rely solely on the cache?
- Should it use the latest data from Discord or use the last-seen data stored in our database? Mainly relevant for users which have left the guild.
945e675 (Minesweeper): Added try-except block to reveal... - ks129
40f341f (Space): Added check is date in range 16th June... - ks129
3928c4b (Space): Fixed formatting of try-except block. - ks129
25d0741 (Space): Moved APOD command min date to constan... - ks129
005dfca (Minesweeper): Reverted KeyError catching in re... - ks129
Build 20200416.1 succeeded
GitHub
00:01:04
Seasonal Bot
Build 20200416.2 succeeded
GitHub
00:02:37
Seasonal Bot
Connected!
The new version introduces support for assignment expressions (changelog).
Currently when lint is ran with the expression in the code, pyflakes will crash flake8.
Updating the version fixes this but a noqa ignore is still necessary because pycodestyle did not yet receive an update and does not recognize the new syntax with a colon.
The update will introduce these lint errors: https://paste.fuelrats.com/rotukasohe.txt
where `F9...
Postgres backup completed!
How do we feel about F999? I recall a discussion in #dev-contrib regarding multi-line strings such as:
string = (
f"First line with some {param} "
f"second line without params"
)
If I remember correctly, the majority of our core devs are in favour of keeping the second f as it aligns the literals.
Thanks for fixing this!
Build 20200417.1 succeeded
GitHub
00:01:34
Bot
Build 20200417.2 succeeded
GitHub
00:02:54
Bot
Connected!
Looks like the joined f-strings are taken care of, taking your snippet we only get an error about param
D:\pycon>pyflakes splitfstrings.py
splitfstrings.py:2:29 undefined name 'param'
I don't know about the walrus but it can be nice to use in some simple cases without sacrificing any readability.
The pyflakes update still brings useful things so if the walrus is decided against; a notice could be posted or the flake8-walrus package can be used which forbids them.
Looks like the joined f-strings are taken care of ...
That's good to hear, thanks for the clarification.
For the record, I'm not opposed to this. I'm just hoping to get a discussion started to see whether we're all collectively on board.
I like the walrus myself, and I recently bumped pyflakes to 2.2.0 in one of my projects. It is, however, disappointing that even then, the lines still need to be noqa to avoid the problems you mentioned.
Already said by @ikuyarihS, but I think using a tag for this is a really good idea.
I think the tag is a little too long. It should mainly serve as a heads-up for users still trying to invoke the !free cmd - inform them that it's no longer necessary, and redirect them to an available channel. That is what they were used to invoking the command for, after all:

The tag shoul...
Alternatively if this is intentional (since None will evaluate to False anyway in the conditionals) the return type could be annotated as optional. But I think it's better if it always returns a bool.
I feel like this will return None if the category isn't found.
return actual_category is not None and actual_category.id == category_id
ee1d9ab Constants: add help channel cooldown role - MarkKoz
fd0aebe HelpChannels: remove ensure_permissions_synchro... - MarkKoz
80cd0aa HelpChannels: add helper function to check for ... - MarkKoz
fcb63ec HelpChannels: clear roles when resetting permis... - MarkKoz
ef308b1 HelpChannels: add/remove a cooldown role rather... - MarkKoz
Resolves #839
Using user overwrites on the category turned out to be flawed due to syncing issues. Channels would get out of sync with the category which would lead to users being able to claim multiple channels. Using a role should hopefully avoid sync issues since the bot will no longer be constantly adding/removing channel overwrites. Instead, it will be adding/removing roles from users.
For now, the roles aren't persisted. Once we have some better infrastructure for that (or we deci...
Build 20200417.3 succeeded
GitHub
00:01:43
Bot
Build 20200417.4 succeeded
GitHub
00:01:20
Bot
6f4213f (Syncers): Fixed wrong except statement - ks129
7434ed3 (Syncer Tests): Replaced wrong side effect - ks129
c608963 Remove dormant invokation message after move. - Numerlor
1a58b34 Allow help session starters to invoke dormant. - Numerlor
7ccfa21 Reset cooldown after channel is made dormant. - Numerlor
Build 20200417.5 succeeded
GitHub
00:01:43
Bot
100a903 HelpChannels: create a helper method for checki... - MarkKoz
8249ea4 HelpChannels: create helper method for checking... - MarkKoz
27ed536 HelpChannels: ensure is_in_category returns a... - MarkKoz
98726b3 Merge branch 'master' into bug/frontend/870/hel... - ikuyarihS
b7b48d0 Merge pull request #877 from python-discord/bug... - ikuyarihS
Build 20200417.6 succeeded
GitHub
00:02:45
Bot
Connected!
I don't know to test that the sync issues are gone.
Build 20200417.7 succeeded
GitHub
00:01:22
Bot
bbe7e47 Move code formatting detection to a separate ex... - MarkKoz
7741f70 CodeFormatting: add helper function to check fo... - MarkKoz
e414f32 CodeFormatting: add helper function to check ch... - MarkKoz
2d56e0c CodeFormatting: add helper function to check if... - MarkKoz
4496f82 CodeFormatting: add helper function to check fo... - MarkKoz
Fixes #829 by assuming a code block is highlighted if it has any word following the ticks and then a newline. This may incorrectly thing some are valid code blocks but I figured that is better than having false positives and showing the embed when it's not relevant.
This feature has been moved to its own cog/extension. I am refactoring its method to be narrower in scope and thus be more testable. I may end up writing unit tests too.
Build 20200417.8 succeeded
GitHub
00:01:21
Bot
Postgres backup completed!
Sorry, I did not properly read yesterday and didn't realize pyflakes has had a release. I thought we'd still have to grab the specific commit the adds assignment expression support. Let's do this then, I don't see a reason to wait, and apologies again.
Good news is that pycodestyle already supports walrus on master and is only waiting on a proper release: https://github.com/PyCQA/pycodestyle/issues/911.
The dormant command contains an error in the form of clearing the cache before resetting user permission, where the method for resetting the permissions relies on the cache being populated.
This PR fixes that, and adds logging for exceptions around the permissions reset to help differentiate between different errors instead of silencing them.
Build 20200418.1 succeeded
GitHub
00:01:24
Bot
The minesweeper cog does not currently handle the situation where a user invokes the start command, but doesn't have DMs enabled. Discord will return a 403 and the command will fail on this line.
The problem should be solved similarly to how the AoC cog handles it - by informing the user, in the channel where the command was invoked, that their DMs must...
Ah, looks like flake8 is incompatible with the newest pyflakes and the above missing placeholder error codes are wrong because of that, the only thing incompatible changes are the error codes which were fixed in this merge commit thatfixes it by simply updating a dict https://github.com/PyCQA/flake8/commit/6efb15cecb5a53e4f605cb0639ddd7f6f33c4a41
Do we care about the error codes enough to delay this until a release? Couldn't find any hints on when that may be.
ce0ec7d Tags: always use top-most folder for role restr... - MarkKoz
Made relatively minor a change to the file search. Everything is tested and working well on my end.
Build 20200419.1 succeeded
GitHub
00:01:35
Bot
Build 20200419.2 failed
GitHub
00:00:31
Bot
Postgres backup completed!
Problem
Right now, Discord have implemented a new feature where if a user pastes something over the 2000 character limit a text file is created and uploaded.

Solution
After a staff meeting, the consensus was that, for this special case ( when attachment is of type text in general ) we will add a bit in the message that gets posted by this filter about how text should be pos...
How should this detect this special case? And should this in same Antimalware cog?
Similar to how the cog is detecting if the file ends with .py you can add a list of extensions for text files and then check if the current attachments' types is in this list.
We'd like to have a new announcement channel added to the Information category, called #python-news. In here, we'd like to have stuff like new PEPs, new Python releases, and major Python event announcements posted automatically.
This can be achieved through listening to various Python mailing lists, and possibly to the python/cpython releases.
What to do
- The specific mailing lists we want are
python-ideasandcomp.lang.python.announce. - These can be handled via this API: ...
I think @kwzrd is making a lot of sense. I'd like to see us make those requested changes.
Simplify according to @kwzrds wishes
The PEP command uses the isdigit check for making sure the passed number is an int, this however is not always true; isdecimal or a try except should be used on the int conversion itself
https://github.com/python-discord/bot/blob/b7b48d0239afedbec31e8c05c90430a5b635cec0/bot/cogs/utils.py#L58-L60

Furthermore the pep command gives no indication whether it was invoked correctly when making the time consuming web request to fetch data...
Can I work with it? I want to do something big in Python bot too ๐
.
Description
Adds the dev contrib channel to channel constants and adds it to the issue command channel override
Implementation details
New PEPs
For new PEP information, there is an RSS feed available at https://www.python.org/dev/peps/peps.rss/
Mailing list
Mailing list messages are a little less trivial but still relatively simple to implement.
Please note that while the mailman API suggests that you can get threads through it a 500 error is returned on big threads. Another approach (detailed below) must be used.
There is a URL returning recent threads in HTML format: htt...
Build 20200419.1 failed
GitHub
00:01:01
Seasonal Bot
Build 20200419.2 succeeded
GitHub
00:00:45
Seasonal Bot
Build 20200419.3 succeeded
Joseph Banks
00:02:03
Seasonal Bot
Connected!
Why can't this be done on the bot side?
It's a pretty trivial site-side implementation and a non-trivial bot-side implementation.
6f4213f (Syncers): Fixed wrong except statement - ks129
7434ed3 (Syncer Tests): Replaced wrong side effect - ks129
c608963 Remove dormant invokation message after move. - Numerlor
1a58b34 Allow help session starters to invoke dormant. - Numerlor
7ccfa21 Reset cooldown after channel is made dormant. - Numerlor
Build 20200419.3 succeeded
GitHub
00:01:21
Bot
Build 20200419.4 succeeded
GitHub
00:03:05
Bot
Connected!
This PR schedule messages that triggered an offensive word filter to be deleted after 7 days
Closes #364
Original PR : #617
This will be implemented bot-side only (#326)
With the new help channel in effect, we want to change the rules for where the !eval command is permitted to be used. However, because our help channels are dynamically created on demand and because we also need to allow it for a few non-help channels, and for certain roles, we need a new decorator and some new constant groups to handle this.
When should the command be allowed?
- In all help channel categories, including Topical Help, Dormant, Available, and In Use.
...
I think the existing decorator could be used. Channel objects have a type attribute which can be checked. Remember, a category is just a specific type of channel.
With the 3.8 python update, the default event loop on windows is now the ProactorEventLoop; one of aiohttp's dependencies uses features which are not supported in this event loop leading to crashes on startup on windows with an undescriptive error
From cffi callback :
Traceback (most recent call last):
File "C:\Users\Numerlor\.virtualenvs\bot-K_QdelnW\lib\site-packages\pycares\__init__.py", line 91, in _sock_state_cb
so...
Postgres backup completed!
Perhaps technically a category is just a channel, but I think most people will intuitively make the distinction between the two, and that it feels a bit hacky to send category IDs into a channel_list. It just feels like poor UX on our API.
Seems like we're now hitting multiple points at which keeping a persistent cache of the claimants would be beneficial to the system (the other one being the channel->claimant mapping for the !dormant command). Sounds like a nice issue for future implementation.
Out of interest, why did you opt to make this (and remove_cooldown_role) a classmethod? Is it just preference because you're only calling a staticmethod or is there another reason behind it?
There's a slight drawback here because of the use of the discord.Object to represent the role: discord.NotFound will both be raised for the member not being found as well as the role not being found. It's (hopefully) not going to be a huge issue for us in production, but if someone forgot to set an ID for the role in a dev setting, the logger will give the misleading message that the member was not found, while it was actually the role:
2020-04-20 11:49:13 | bot.cogs.help_channels...
I agree about the API part and Mark's edit also plays into that:
As Mark's edit suggests, we'd still need to know if the ID passed relates to a channel itself or a category the channel could be in for the permissions check. This makes the implementation slightly less convenient. It means we'd have to "get" the channel object in the predicate from Context.guild to determine whether or not it belongs to a TextChannel or a CategoryChannel.
If we explicitly pass the IDs as separate kw...
This logging statement can be removed as we're no longer doing the ensure perm thing.
Hmm, I'd probably lean towards just waiting on a proper flake8 release then.
26cc394 Replace in_channel decorator by in_whitelist... - SebastiaanZ [debb83e](https://github.com/python-discord/bot/commit/debb83ec90c433f8d42c346948f9234f94c5ca08) Remove vestigial kwargs from MockTextChannel.__... - SebastiaanZ [96e1b8f](https://github.com/python-discord/bot/commit/96e1b8f1f1059ac0aa9d4b43cba5e82205b35735) Add tests for in_whitelisted_context decorator - SebastiaanZ [86e2df8](https://github.com/python-discord/bot/commit/86e2df8ab84bc930c999b3a6273609fdde90e129) Allow !eval` in help channel categories - SebastiaanZ
This PR implements the policy change we've agreed upon during the staff meeting: Allowing the !eval command to be used by regular members in help channels. However, as our help channels are dynamically generated up to a certain number of channels, using a simple whitelist based on channel IDs won't work. That's why this PR generalizes the in_channel decorator to be able to whitelist more aspects of the command's context, including the channel category. This means that we can whitelist cha...
Build 20200420.1 succeeded
GitHub
00:01:28
Bot
f48d32f Add statistics on whether a help session was cl... - jos-b
Create a dictionary to gather whether help sessions were closed with no input from anyone but the original claimant.
This should help build an understanding of how many channels are unanswered.
96ef7f7 Incorrect comparison, we need to check if we ar... - jos-b
Build 20200420.3 succeeded
GitHub
00:01:09
Bot
Yes, it is because it's only calling a static method. In retrospect, I don't know if it's worth the bother to use classmethod/staticmethod when this is all unlikely to ever be used outside the class.
383f5a7 HelpChannels: tidy up log messages - MarkKoz
b05b704 HelpChannels: pass coroutine func instead to _... - MarkKoz [7bb69f8`](https://github.com/python-discord/bot/commit/7bb69f8ef15f03d355dc114181ce27df5aee7cfd) HelpChannels: check if the help cooldown role e... - MarkKoz
Build 20200420.4 succeeded
GitHub
00:01:24
Bot
I've addressed this by making the function always get the role.
Okay. It's fine by me. I was just curious to know the reason for turning it into a classmethod instead of calling the staticmethod from a "regular" method. Maybe there was something to learn for me.
Sentry Issue: BOT-3D
HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.description: Must be 2048 or fewer in length.
File "discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "bot/cogs/utils.py", line 162, in charinfo
await ctx.send(embed=embed)
File "discord/abc.py", line 856, in send
data = await state.http...
Perhaps we should come up with something more generic than editing individual embed generation code whenever an exception happens to be raised.
I actually think this should be paginated. I don't know in what situation we'd want to simply cut off embed text at a specific boundary, let alone anywhere.
The bot can detect when someone is in the middle of typing a message and prevent the channel from going dormant if it was otherwise about to become dormant. This may prevent situations in which a user was trying to answer a question but the channel goes dormant and their WIP message is lost.
The bot could extend the dormant timer by a few minutes. Of course, should a message get sent, that would extend it by the normal 30 minutes. The extension of a few minutes would just be to address sit...
I like the suggestion, I'm less clear on what the proper way to implement this is. We can't "simply" check for an ongoing typing event when the timer runs out, as typing events time-out rather quickly and people tend to pause when typing longer replies; it would be rather easy to miss the typing event.
We could use an on_typing event listener and keep track of the most recent typing event for that channel happened. The event includes a timestamp by default (when), so it should not be t...
Neat, looks good. I also like that you've kaized in that !close mention in the available message. I think we should consider making !close the main name of the command and !dormant the alias, as !close is the way most people refer to it.
I like the generalised approach you went with. However, I do have complaints about how long the decorator call has become. I dislike splitting up decorator calls into multiple lines and the fact that it's practically impossible to use it as one line now, even for the simplest of calls, rubs me the wrong way. My ideas:
- Remove the
whitelisted_prefix from kwarg names. I think redundant given the decorator name. - In most cases, there is a redirect channel and it's the same value for a...
d5aef24 Add different emoji for different channel statu... - jos-b
Build 20200420.5 succeeded
GitHub
00:01:08
Bot
Can you leave a short comment explaining what's in this dict?
This should be moved to a separate function. It will keep the function sizes more manageable and make it easier to write tests down the road.
2b8bc72 Extra documentation + split out to separate fun... - jos-b
Typehinted + commented both this dictionary and the dictionary above.
Build 20200420.6 succeeded
GitHub
00:01:10
Bot
Build 20200420.7 succeeded
GitHub
00:01:15
Bot
b842bfe HelpChannels: add logging to answered check - MarkKoz
Works perfectly. Added some logging while testing and figured I may as well commit it.
Build 20200420.8 succeeded
GitHub
00:01:11
Bot
f48d32f Add statistics on whether a help session was cl... - jos-b
96ef7f7 Incorrect comparison, we need to check if we ar... - jos-b
d5aef24 Add different emoji for different channel statu... - jos-b
2b8bc72 Extra documentation + split out to separate fun... - jos-b
b842bfe HelpChannels: add logging to answered check - MarkKoz
Build 20200420.9 succeeded
GitHub
00:02:49
Bot
Connected!
I realised the command doesn't account for a user having multiple channels claimed. Going to look into it, but at a glance there doesn't seem to be an simple way to address this currently.
Added news to allowed setting names, made migration for it. Part of Python bot upcoming Python News feature.
Build 20200421.2 failed
GitHub
00:01:27
Site
Build 20200421.1 failed
GitHub
00:01:41
Site
Build 20200421.3 failed
GitHub
00:01:58
Site
Postgres backup completed!
Closes #890
Site issue (stalled until it merged): python-discord/site#352
Summary of what is done
- Added 2 new dependencies:
feedparser(used in PEP news fetching) andbeautifulsoup4(used in maillist news fetching) - Set the log level of logger
chardetto warning to avoid log spam. bot.cogs.newsextension loading added to__main__.py- Added news config entries + constants
- Created
Newscog- Added fetching PEP news
- Added fetching maillist news
- Adde...
Build 20200421.1 succeeded
GitHub
00:02:14
Bot
I dislike splitting up decorator calls into multiple lines and the fact that it's practically impossible to use it as one line now, even for the simplest of calls, rubs me the wrong way.
1. Remove thewhitelisted_prefix from kwarg names. I think redundant given the decorator name.
I don't mind that a decorator spans over multiple lines, as the kwarg names make explicit what each individual kwarg does and it's highly readable. From that perspective, I don't think they're necessa...
The note on the privacy page needs removing once we have got a PR merged for this.
Build 20200421.2 succeeded
GitHub
00:01:13
Bot
Build 20200421.4 succeeded
GitHub
00:02:28
Site
After experiencing a reconnect from Discord, the channel cache we were using in the help cog began to fall apart and claimed there were 29 channels in the available category and no channels elsewhere.
(Blue line marks disconnect)

This PR forces retrieval of the channels in the guild from the bot cache in the get_category_channels method through the usage of bot.get_guild...
Build 20200421.3 succeeded
GitHub
00:01:28
Bot
Alterations look good to me, thanks for your work!
Yes, looks good.
Just to add some context to those wondering what was going on: The channels cache we accessed through the guild attribute of a reference to the Available category was completely out of sync with actual channel lay-out of the guild. This started happening after a disconnect/restart of the shard's websocket/gateway connection:
2020-04-21 01:18:47 | discord.gateway | WARNING | Shard ID None has stopped responding to the gateway. Closing and restarting.
Som...
Build 20200421.4 succeeded
Connected!
Resolve #891
- Made
pep_numbertype hint tointto avoid unnecessary manual converting. - Added
ctx.trigger_typingcalling to show a user that bot is responding.
Notes
- I made it automatically convert PEP number to
intinstead of manual (less secure) conversion. This save some lines of code.
Build 20200421.6 succeeded
GitHub
00:01:13
Bot
d58f237 Use Github Actions for PyPI releases. - scragly
Good call to just use an int converter.
d3d8711 Remove builds from azure, move to ubuntu 18.04. - scragly
To simplify some of our processes, and to bring this project in line with the release methods used by flake8-annotations, I've added a Github action for releases.
The azure config that previously built assets and published the release has been removed.
The repository already has a new project-specific PyPI token added to secrets.
As a small adjustment, I've moved azure to use the ubuntu-18.04 environment, to bring it in line wi...
Build 20200421.1 succeeded
GitHub
00:00:28
Django Crispy Bulma
If a user manages to take part of multiple filter violations, the cog will attempt to punish() them for each of those violations. While punish() does check for the muted role before applying the infraction, the asynchronous nature of the code can mean a second punish() is called and passes the role check before the first punish() has gotten a chance to apply the mute. This would result in an attempt to apply a second mute infraction, which will ultimately fail and display a message st...
How do we feel about caching the web responses to lower the load and response time with the async_cache decorator as talked about in the issue?
While not in the scope of what was talked about in the issue the code of the function can also be improved in some parts; the logging could use a bit of info on the PEPs it's working with, the found_pep variable seems to be redundant and probably could find a bit more with a more thorough read if you feel like doing that.
I had already approved the PR that was closed. Just re-adding it to this one.
I don't mind that a decorator spans over multiple lines,
A difference of opinion, but I think it's quite unsightly.
the kwarg names make explicit what each individual kwarg does and
Being explicit is good but it can become overly verbose, like here.
it's highly readable
In terms of understanding what it does, I agree. However, I think it's length/size due to its verbosity makes it difficult to read as it really catches one's attention, whereas one could be focusing on mo...
Postgres backup completed!
And if we make the first 3 not kwarg-only:
@in_whitelist(EVAL_CHANNELS, EVAL_CATEGORIES, EVAL_ROLES, redirect=Channels.bot_commands)Now even the longest of invocations fits on one line, and it's still readable to me. I don't need kwargs because the constant names already tell me what the types are. Maybe if it was 3 tuple literals instead it'd be harder to look at (i.e. to visually spot the boundaries of the tuples). However, I think it should be up to the...
Okay, just to chime in here with some quick input:
- Shortening the kwarg names to drop whitelisted prefix is nice.
in_whitelistis a good decorator name.- I agree with @SebastiaanZ about positional arguments being too error prone to be justified.
The reason I did not make bot-commands the defacto default is because a command may only be whitelisted by role (meaning that a member without that role should also be unable to use it in bot-commands) and/or to allow for a different ch...
We already have
with_rolefor that, do we not?
Maybe we should not have.
So my suggestion is to default to #bot-commands, but to allow the user to pass either None for no redirect message (instead, some generic "you can't use this command" message would be shown), or some other channel ID to redirect to that instead.
Sounds good, that was the direction I was heading as well, so I agree.
Maybe we should not have. An in_whitelist(roles=ROLES) would do as well.
maybe. with_role arguably has better readability for this case, and it sounds like handling this well introduces a little more complexity to the decorator.. but I'm not violently opposed to generalizing around this decorator, I guess.
maybe.
with_rolearguably has better readability for this case, and it sounds like handling this well introduces a little more complexity to the decorator.. but I'm not violently opposed to generalizing around this decorator, I guess.
Why would it add complexity?
The only reason I currently see that would warrant additional complexity is if we'd want to raise a specific exception so that our error handler could handle the check failure in a different. However, in that case, we could...
This might be good idea, but Core Devs have to decide it.
I just tried to use the module with Django 3.0 and I noticed that the email input is not working as expected. It gets rendered to
<input type="email" name="email" maxlength="254" class="emailinput" id="id_email">
Though on the bulma webpage the CSS-class is solely "input". Could someone please check this?
Besides, django-crispy-bulma 0.3 seems not to be on pipy is the intentionally?
6fe18c6 Use selector event loop on Windows - MarkKoz
aiodns requires the selector event loop for asyncio. In Python 3.8, the default event loop for Windows was changed to proactor. To fix this, the event loop is explicitly set to selector.
Build 20200422.1 succeeded
GitHub
00:01:18
Bot
Copying https://github.com/python-discord/django-crispy-bulma/pull/32#issuecomment-617921850 to this issue
I just tried to use the module with Django 3.0 and I noticed that the email input is not working as expected. It gets rendered to
<input type="email" name="email" maxlength="254" class="emailinput" id="id_email">Though on the bulma webpage the CSS-class is solely "input". Could someone please check this?
@keans we can keep track of that problem in #31. Regarding version 0.3, it's not on PyPI because our release pipeline is currently broken. We are working on fixing it.
Postgres backup completed!
As there are still members trying to use the !free cmd and receiving no response, we'd like to have this merged sometime soon.
@Akarys42, do you think you'll be able to address the requested changes? If not, then that's ok, but please let us know. Thanks!
I'll try to find some time to rephrase it this afternoon
Closes #882
This PR add a temporary free tag that indicate how the new help system works.
Build 20200423.1 succeeded
GitHub
00:01:21
Bot
@lemonsaurus @kwzrd @ikuyarihS tag updated, let me know what you think
Build 20200423.2 succeeded
GitHub
00:01:18
Bot
Decided to just fix up the typo myself. Thanks a lot for rewriting this, I think it works a lot better.
Build 20200423.3 succeeded
GitHub
00:01:14
Bot
Build 20200423.4 succeeded
GitHub
00:01:17
Bot
Build 20200423.5 succeeded
GitHub
00:02:51
Bot
Connected!
Build 20200423.6 succeeded
GitHub
00:01:57
Bot
Build 20200423.7 succeeded
GitHub
00:01:16
Bot
I realised the command doesn't account for a user having multiple channels claimed. Going to look into it, but at a glance there doesn't seem to be an simple way to address this currently.
Right, if a member claims two channels (respecting the 15-minute cooldown), they role they received after claiming the second channel will also be removed if the first channel was made dormant as it only does an "is_claimaint" check that has no knowledge of for which channel the role was assigned. I ...
Works well. Happy with the final API.
Tests are a bit sparse. There's only tests for check failures. Some other interesting test cases would be for a DM context (i.e. channel has no category and user has no roles).
You should add these comments to the test cases so they can be shown as the subtest message.
Should either all be using Azure or all be using GH Actions. I prefer Azure cause it's consistent with other projects. However, that isn't preference is not something I hold strongly. Either one is fine, as long as just one is used rather than both.
Furthermore, I liked the ability to trigger on version bump. I think that feature should stay. If not, then the files in the scripts folder are obsolete and can be removed. That being said, Azure (and possible GH Actions) has a GH release t...
I agree with Mark here, I'd like to see two changes:
- Remove Azure completely, and handle linting in the Action as well.
- Only push new release if the version number in setup.py has been bumped up.
@Numerlor sure, why not? I'm in favour.
Postgres backup completed!
Build 20200424.1 succeeded
GitHub
00:01:46
Bot
Sometimes discord.Forbidden errors are raised due to the bot being lower in the role hierarchy than the user they are trying to edit. An example of this is joe trying to superstarify himself (see BOT-3C).
Depending on which groups of users this affects, we should try to gracefully handle such error. If this only affects the server owner (as in, true ownership, not just the role we have), the...
Sentry Issue: BOT-39
As documented here, it has to be MINYEAR <= year <= MAXYEAR which is effectively 1 <= year <= 9999
ValueError: year 104039 is out of range
File "discord/ext/commands/core.py", line 425, in _actual_conversion
ret = await instance.convert(ctx, argument)
File "bot/converters.py", line 220, in conve...
Sentry Issue: BOT-1Z
This could be handled by create a paste link like snekbox does or by paginating the response.
HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.
File "discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "bot/cogs/eval.py", line 197, in eval
await self._eval(c...
Sentry Issue: BOT-2B
It may raise a ReadTimeout or ReadTimeoutError, so let's consider rescheduling it to be refreshed later, especially if times out during automatic initialisation from the cog being loaded.
Sentry Issue: BOT-33
Strange issue that has happened 6 times in which a attachment fails to be uploaded due to a 415 (unsupported media type) error.
My suspicion is that it's not due to a misconfigured Content-Type header as one would expect but rather Discord's API using that error to reject certain files. I don't know how Content-Type could possibly be wrong.
This has happened for both `....
The 3.8.0 release of flake8 is approaching, bringing support for the walrus operator along with a smรถrgรฅsbord of other enhancements. See: alpha release notes.
Running flake8-3.8.0a2 doesn't seem to introduce any regressions with our current release, but we can keep an eye on the alphas & bump the dependency once there is a proper release.
Let's just wait for the flake8 3.8.0 release. The alpha is out and it doesn't make sense to add a bunch of manual dependency pins just to chase the walrus.
The log reads:
Failed to re-upload attachment message.txt from message <message ID> with status 415.
The relevant file is:
https://github.com/python-discord/bot/blob/687f2c4c5875e9de2abeeb122eeee529816ee204/bot/utils/messages.py#L100
Error message:
('intersphinx inventory %r not fetchable due to %s: %s', 'https://flask.palletsprojects.com/objects.inv', <class 'requests.exceptions.ReadTimeout'>, "HTTPSConnectionPool(host='flask.palletsprojects.com', port=443): Read timed out. (read timeout=3)")
Postgres backup completed!
Build 20200425.1 succeeded
GitHub
00:01:33
Bot
@MarkKoz @Numerlor I implemented caching now and refactored PEP command.
Another problem is that the ManyToManyField does not seem to be rendered correctly. In the default rendering the layout breaks with following fields. Adding the is-multiple seems to fix the issue:
<div class="select"> โ <div class="select is-multiple">
It gets even worse when enforcing a CheckboxSelectMultiple:
admins = forms.ModelMultipleChoiceField(
queryset=User.objects.all(),
widget=forms.CheckboxSelectMultiple(),
)
In this case nothing is...
3527b58 Converters: handle ValueError when year for dur... - MarkKoz
Fixes #906
datetime objects only support a year up to 9999. To prevent the exception from propagating, it is now caught and the converter raises a different error which will be handled elsewhere to ultimately display an message to the user that their argument has some stupidly high duration.
Build 20200425.2 succeeded
GitHub
00:01:22
Bot
Going to take a swing at this and submit a PR in the following days as I'm interested to take a dive in the codebase.
Since there seems to be two ways for the custom BadArgument exception to be raised from this method, I would recommend explicitly testing for each of them in test_converters.py with assertRaisesRegex() to ensure the correct one occurs. There seems to be an existing test for the former in:
(Note that the above msg kwarg in assertRaises() does not test the...
If the user trying to start Minesweeper has DMs disabled
then warn him in the channel where the command was
invoked.
Relevant Issues
Closes #399
Description
To fix this we check for discord.errors.Forbidden after sending the DM and inform the user if he has DMs disabled.
Reasoning
Currently if user has DMs disabled the script fails silently without informing him of any issues.
Did you:
- [x] Join the [Python Discord Community](https://discord.gg/python...
Build 20200426.1 succeeded
GitHub
00:00:51
Seasonal Bot
Postgres backup completed!
The ANN101 and ANN102 rules, have a footnote which says to see some other documentation about how to annotate self/cls. However, the very first sentence of the first link says:
In most cases the first argument of class and instance methods does not need to be annotated, and it is assumed to have the type of the containing class for instance methods, and a type object type corresponding to the containing class object for class methods.
It then only shows an example of annotating self, ...
Thank you for the contribution ks, I've left a couple of proposals on improvements to the feature.
This embed should have a footer. We intend to have the webhook be relayed to subscribing servers and we lose author data when that happens.
I propose an embed structure similar to:


This maintains the context when a message is crossposted, a similar footer should be used for PE...
We should publish these messages.
Once sent they should be fetched using this ID and the .publish() method should be used to crosspost this to any subscribing servers.
Build 20200427.1 succeeded
GitHub
00:01:21
Bot
Resolved in 547de1a , but I made send_webhook returning message and publish this message.
Postgres backup completed!
Build 20200427.2 succeeded
GitHub
00:01:16
Bot
whenever on_typing is triggered, if there's less than 5 minutes left, we set the timeout to 5 minutes. that should keep it from timing out if someone is working on a long message.
Are there people that have the bot running on Windows and can review this?
Works great @SebastiaanZ
I will. I'll push them in half an hour from now.
yeah, I added persistance to the road map today, so we'll do it soon.
Yeah I think we can make an API call, it's not like !infr search is used that often, we're talking about maybe a couple dozen times a day at most. I think having the most up-to-date info here has actual moderator utility, and that we don't need to skimp on this particular part of the code.
adc75ff Tags: explicitly use UTF-8 to read files - MarkKoz
36c3535 Create temporary free tag - Akarys42
271da4a Add a title at the top of the free tag - Akarys42
af2c216 Use IDs instead of hard-coding category names i... - Akarys42
80d8c7e Merge branch 'master' into bug/info/869/tag-enc... - MarkKoz
Build 20200427.3 succeeded
GitHub
00:01:40
Bot
5416280 Constants: add help channel cooldown role - MarkKoz
9e67ebe HelpChannels: remove ensure_permissions_synchro... - MarkKoz
06d12a0 HelpChannels: add helper function to check for ... - MarkKoz
427c954 HelpChannels: clear roles when resetting permis... - MarkKoz
efc778f HelpChannels: add/remove a cooldown role rather... - MarkKoz
Build 20200427.4 succeeded
Connected!
Build 20200427.5 succeeded
GitHub
00:01:26
Bot
5416280 Constants: add help channel cooldown role - MarkKoz
9e67ebe HelpChannels: remove ensure_permissions_synchro... - MarkKoz
06d12a0 HelpChannels: add helper function to check for ... - MarkKoz
427c954 HelpChannels: clear roles when resetting permis... - MarkKoz
efc778f HelpChannels: add/remove a cooldown role rather... - MarkKoz
Build 20200427.6 succeeded
GitHub
00:01:32
Bot
1140e96 Replace in_channel decorator by in_whitelist... - SebastiaanZ [00291d7](https://github.com/python-discord/bot/commit/00291d7d5f859e4131cb5c94541a90f80f358376) Remove vestigial kwargs from MockTextChannel.__... - SebastiaanZ [57e6992](https://github.com/python-discord/bot/commit/57e69925af9a941dfe32acc0431a9699eda027f5) Add tests for in_whitelisted_context decorator - SebastiaanZ [0924744](https://github.com/python-discord/bot/commit/092474487d75ef6430e533b85fe386d837fbf3a6) Allow !eval in help channel categories - SebastiaanZ [b20bb74](https://github.com/python-discord/bot/commit/b20bb7471b8d1d01f217f0620f8597bf1bae4456) Simplify in_whitelisted_context` decorator API - SebastiaanZ
Build 20200427.7 succeeded
GitHub
00:02:50
Bot
Connected!
Works fine locally when tested.
A channel has been made, you can change this ID:
python_news: &PYNEWS_CHANNEL 704372456592506880
Build 20200427.9 succeeded
GitHub
00:01:21
Bot
Build 20200427.8 succeeded
GitHub
00:01:26
Bot
Build 20200427.11 succeeded
GitHub
00:01:12
Bot
From @SebastiaanZ:
Finally,
discord.pycurrently "hides" errors/tracebacks that happen in event listeners as we only have a custom error handler for commands. This isn't too bad locally, sinced.pyprints those exceptions to stderr, but it obviously means they'll never show up in Sentry, as they are not actually logged with the appropriate level.
Right, thanks. I should have added this myself.
Background
We've been seeing lots of KeyError exceptions occur in groups at intervals of 3-4 hours. A log sample can be found here: https://paste.pythondiscord.com/uzokiserux.py
These errors happen every time a new message is sent in an occupied channel. The on_message listener calls a function to check if a channel has been answered (i.e. someone other than the claimant has typed something).
Analysis
The check_for_answer only attempts to get the claimant if
- The ...
This PR reintroduces the bottom-sorting behavior that we tried before, but with a different strategy that is reliable in the way it sorts the channels and minimizes the number of glitches visible in the channel list. The strategy utilizes the same "bulk channels update" endpoint as discord.py uses to move channels, but builds the payload in a different that minimizes the number of required position integer changes. It does use the discord.py http methods to send the payload to ensure `dis...
Build 20200427.12 succeeded
GitHub
00:01:16
Bot
Works great @SebastiaanZ
Thanks. I think @LordHemlock also tested this PR, so if they leave a review, we can get this merged.
Looks good to me, works excellent when tested locally.
Postgres backup completed!
Okay, it looks good to me. I would've probably sorted new ones to the top, but I buy the argument that we want older ones at the top so we can get more attention to them.
Build 20200428.1 succeeded
Connected!
I haven't tested yet, but I can already spot a problem: this fix will prevent the Forbidden error, but it won't stop the game from starting. As the user cannot play minesweeper with closed DMs, the game shouldn't start - similar to how it will exit early if the user is already playing.
This message was copied over from AoC, but it doesn't make much sense in this context.
It should be adjusted to something along the lines of "please enable DMs to play minesweeper".
Build 20200428.2 succeeded
GitHub
00:01:18
Bot
Ouf, that should teach me to open PRs during evenings. I'll follow up with changes to address this issue and the one mentioned above.
@kwzrd, regarding exiting early, should I look into a way to check if the user has DMs enabled before we add the game to the list or just when messaging him that his DMs are disabled?
That's a good question - I personally think that just trying to send the message is fine.
If we look at what the function is doing, it's roughly these steps:
1. Check if the user is playing, exit if so
2. Some initial setup
3. Dispatch guild message
4. Dispatch direct message
5. Start the actual game
The order of 3 and 4 seems to be fairly arbitrary - it's not a logical succession, just two things that need to be done. We could therefore switch their p...
Build 20200428.3 succeeded
GitHub
00:01:31
Bot
1e4766d Fix exception message assertions in converter t... - MarkKoz
Good catch, thanks. Didn't realises there were even any tests for converters.
Build 20200428.4 succeeded
GitHub
00:01:14
Bot
Where the internal references don't show up as inline codeblock
Do inline codeblocks within embeds not work on mobile at all or what's the deal? I agree this should be fixed if possible.
we collect all the signatures of functions but some have aliases and others group them by category. How should this be handled if at all?
There isn't a reliable way to distinguish aliases, is there? I don't think having aliases shown is that bad of a thing anyway.
In the first instance I just had the function return early if DMs disabled (as well as not initializing the board).
I'll look into improving the exception handling in general in a future PR.
Build 20200429.1 succeeded
GitHub
00:00:55
Seasonal Bot
Do inline codeblocks within embeds not work on mobile at all or what's the deal? I agree this should be fixed if possible.
inline codeblocks alone are shown and work properly but the internal references are translated to (invalid) links through the converter and that is handled differently on the mobile client.
The secrets embed has this description
description: New in version 3.6.
**Source code:**
[Lib/secrets.py](https://github.com/python/cpython/...
Good idea w/ using IsolatedAsyncioTestCase, I was actually just revisiting the PR and about to suggest using it instead of asyncio.run(). asyncio.run() has a fair bit of additional overhead that isn't needed for testing purposes, especially when you call it multiple times (it creates and closes a new event loop each time it's used, in addition to some other cleanup calls related to tasks, async generators, and in 3.9 the default executor).
Encountered this locally and getting the error every time !close is invoked.
With trace logging the issue seems to be on_message for the invokation message being received and then the channel moved after that happens.
After adding a few additional logging points added the logs look like this
https://paste.fuelrats.com/ecekeratas.txt
With call order like this the channel gets removed from from help_channel_claimants but remains in unanswered. Then the category check passes beca...
Thanks for looking into it. That makes more sense than my conclusion. I think we should use proper locks for the command rather than relying on the claimant being deleted from the dict. I was already looking into using locks but haven't gotten too far. I was thinking each channel should have its own lock. I've already made a change locally to group channel data into a dataclass rather than many dictionaries, so the lock could be stored there too.
My idea for fixing the links is to parse them as markdown to find links and then check if they start with a valid schema (just http or https in this case). It could be taken a step further by trying to resolve the relative links and making them absolute. I don't know feasible this parsing is in practice.
For the dunders, in that specific case, I think they should all be included since they are all relevant to the documentation text, as you stated yourself.
@lemonsaurus To be clear, this change will apply to all mod logs, not just infraction searches. Infraction searches may not be common but infraction logs are relatively more common. Still, I think your point stands that they don't happen frequently enough for the API calls to be a huge hit. But on the other hand, it may not be as important to have logs with the most up to date name compared to when a staff member is explicitly trying to retrieve information like with !infr search. I rem...
That sounds like a reasonable implementation to me. What do you think @SebastiaanZ? We can remove the planning label if there's going to be a consensus that 1. this should be a feature and 2. there's a reasonable way to implement it.
Problem
Right now, when doing !user the avatar is always set to png, even if the user's avatar is a gif.
Proposal
Similar to how we are handling avatars in other places, instead of using the format keyword, we can use the static_format keyword instead, as documented in discord.py
The code responsible for the command can be found here:
https://github.com/python-discord/bot/blob/fe325adc66e9...
Looks good, and it is working properly for !remind.
It is working great on Windows 1909!
Postgres backup completed!
hm. well yeah, it's less relevant for mod log items. if possible, I suppose we could do lookups only for infr search?
Looks great! I will test this locally before I put my approval on it, but I think this is a good fix.
As a side note, I probably wouldn't use the else clause here. Everything in the function after this point will also be only executed if no error is raised. Visually, it would make more sense to me to just end the try-except part with the return, and have everything after indented at the same level.
We recently had an issue with users reaction spamming the !silence message, in my opinion it would be smart to also disable emojis when a channel is silenced. The following lines might be of interest:
https://github.com/python-discord/bot/blob/fe325adc66e9621ea970abd83db58df4b792caa5/bot/cogs/moderation/silence.py#L121
https://github.com/python-discord/bot/blob/fe325adc66e9621ea970abd83db58df4b792caa5/bot/cogs/moderation/silence.py#L141
What is the proposed solution for this?
Removing the permissions is fairly easy, but then they can't be restored reliably with some channels allowing them and others forbidding them (or following the category)
I think we should store the previous state (no override or allow) in memory to put it back exactly how it was, and in case of shut down when the cog is silenced, note the previous state in the alert and allow the unsilencer to specify the emoji reaction state, through and ID or something
Currently when calling the !eval command the bot formats the result from the command as a python formatted codeblock. This can lead to a badly coloured result if the result is not python code (which it rarely would be).
For example, if the result had an apostrophe:

The proposed solution would just to make it return a code block without python formatting.
Here is the relev...
Depending on how needed this is from a moderating standpoint, I think it'd be better to wait for persistence on the bot
Silenced channel will now be stored in the database? Well I guess we should
better wait then. I cannot find any corresponding issue or PR though, have
I missed it?
Don't think there's an issue for it and don't know how near it is but there were a few messages in dev contrib for using something like redis as a persistent cache.
Not a fan of expanding the command for manually specifying allowing/forbidding emoji perms as an arg for when the bot restarts
Problem
When issuing a !tempban, the bot will not allow banning the user again with a !ban and will return an error saying According to my records, this user already has a ban infraction. See infraction

Solution
The bot should overwrite the current tempban and upgrade it to a permanent ban instead.
The code responsible for checking if user has an active infract...
Yes in that case I agree with you, we would be better using a permanent
storage for that
Quick question on this. Are we only wanting the behavior to be overridden when we're wanting to replace a temporary with a perma ban? Or can it/should it go the other way as well?
When the snekbox output contains a pattern from the ESCAPE_REGEX [`\u202E\u200B]{3,}, the otput is not displayed (and unnecessary work is done)
https://github.com/python-discord/bot/blob/fe325adc66e9621ea970abd83db58df4b792caa5/bot/cogs/snekbox.py#L160-L161
The output can still be uploaded to the paste service, as the contents won't affect anything on there, to provide it in some form to the user.
The findall method used can also be changed to search since we don't care about the...
The .txt suffix could also be added to the output url from when the code gets uploaded to https://paste.pythondiscord.com, it has its own engine for guessing what format the contents are but for simple text it'll mostly detect a few keywords and then highlight it semi randomly with for example SQL syntax highlight
f043d94 Log unhandled errors from event listeners - MarkKoz
Fixes #911
By default, discord.py prints them to stderr. To better help detect such errors in production, they should instead be logged with an appropriate log level. Some sentry metadata has also been included.
Build 20200429.2 succeeded
GitHub
00:01:14
Bot
Connected!
Build 20200430.1 succeeded
Joseph Banks
00:02:55
Bot
As a bit of an unrelated question, what's the reason for forbidding zero width spaces?
Dunno, it's always been there so I assumed it's important.
Postgres backup completed!
I assumed the same thing during my sneak box refactoring, but according to a git blame, @gdude2002 added this in the commit 766faffa607ea973ec83590e0a28eb49be29bdb0, surely he would know why ๐
Nope, can't remember. All I know is there was a good reason for it.
This is a two year old commit after all!
Well, if there was a good reason then perhaps adding \u200c (ZERO WIDTH NON-JOINER) and \u200d (ZERO WIDTH JOINER) to the characters would also make sense
0c1c59c Added news to allowed bot setting names. - ks129
36f9f1f Created migration fo Python News feature on bot - ks129
0ab9761 Merge branch 'master' into news-bot-setting - ks129
86538bb Fixed migration 51 file end (create_news_setti... - ks129 [0dbc6e9](https://github.com/python-discord/site/commit/0dbc6e9165d188c55966eb267752eda42d274a0c) Fixed migration nr 51 down` function object ge... - ks129
Build 20200430.1 succeeded
Joseph Banks
00:03:44
Site
I've got some concerns on how well this will scale. If we have 100 posts in the channel (not an unachievable number) and there are 10 new ones without any caches in the bot (not unlikely since we restart a lot) we will be making 1,000 API calls. A better way to do this is not use Discord for this and instead store the ID of the thread, using the thread_id property of the mailman API (see below) and compare against that.
Should we have a cog unload method to stop these tasks? If the cog is reloaded presumably these tasks will be running twice?
Fetching all the messages on every new post seems like it won't scale well. Why can't we use the ID returned from the mailing list API? thread_id: https://mail.python.org/archives/api/list/python-announce-list@python.org/thread/M2CB6LG65LMXR4FJTRVGTW2IWUZRUJA5/
Another problem for BooleanFields: the input field for the checkbox seems to be rendered twice. For example:
<div id="div_id_is_active" class="field">
<input type="checkbox" name="is_active" class="checkboxinput" id="id_is_active" checked="">
<label for="" class="label">Is active</label>
<p class="control">
<input type="checkbox" name="is_active" class="checkboxinput" id="id_is_active" checked="">
</p>
<p id="hint_id_is_active" class="help">Only acti...
We recently had some complains about people not managing to make their re-eval working because of the very short window for editing your code, which is set to 10 seconds right now. I think it wouldn't hurt to increase it to something like 30 seconds, as it has a very low footprint, and making substantial changes to the code in 10s is almost impossible.
Here is the line where it is hardcoded for now :
https://github.com/python-discord/bot/blob/cfc5720925b6bbc40c45507f8579145a0014a6eb/bot/...
How about making the reaction appear right away (maybe on the output message ?), right now without seeing it work or going through !help there's nothing to indicate the feature exists which is a bit more confusing when the message is edited after the timeout
Build 20200430.2 failed
GitHub
00:00:43
Bot
I think putting the reaction everywhere will be noisy, and could lead to people spamming the reaction, without it doing anything, which would be even more confusing imo. The best way to make people know about it would be a message in #announcements tbh, would it be possible to get one (without pinging anyone of course)?
Putting the refresh on the output message would work (and removing it after 30 seconds), but we need to keep track of the invocation message in that case.
We already put the trashcan emoji on there so an additional 1 emote would not be disastrous.
To inform users we could put a little note at the end, like in the following mockup (we could remove the note from the end when we remove reactions):
<img width="845" alt="image" src="https://user-images.githubusercontent.com/20439493/80746...
Currently, users need to either need to read the help description for the command or have the intuition to edit their message in order to discover the feature. It's a good idea to always react with the emoji since it will make the feature more prominent. However, I believe reacting on the user's message rather than the bot's output will be more intuitive.
Joe's suggestion of including a message at the end would be effective but I am concerned it may detract from the results so I am against...
On the right of this issue, you can assign yourself if you'd like to work on it @wookie184. Numerlor's suggestion is also a good idea if you want to throw it in.
ba442e1 Display animated avatars in the user info command - MarkKoz
Fixes #914
A simple argument change makes discord.py preserve the avatar's format if it's gif and only convert everything else to png.
Build 20200501.1 failed
GitHub
00:01:02
Bot
Build 20200501.2 succeeded
GitHub
00:01:13
Bot
Postgres backup completed!
Not sure how to assign myself, but for reference, I would like to work on this issue
Build 20200501.3 succeeded
GitHub
00:01:18
Bot
Build 20200501.4 succeeded
GitHub
00:01:20
Bot
Build 20200501.5 succeeded
GitHub
00:01:09
Bot
I was thinking of putting the reaction on the output message to keep the vertical space a bit tidier, but would need to see some real examples or user feedback to know which one would be better there.
I think it should be clear with both of the positions that the option is there to reevaluate the invoking message (with edits)
During testing the only way I was able to prevent my bot from sending me the DM was by blocking it, in which case I couldn't message it either. Disabling DMs from members of all guilds that I share with my bot wouldn't stop it - not sure whether this is because we already have a message history, or perhaps because it's my bot? Anyway, the reason why I mention this is that I was originally concerned about the case where a user will invoke the command in DMs (therefore ctx represents the `D...
Build 20200501.6 succeeded
GitHub
00:02:32
Bot
Connected!
We need to specify an encoding here to prevent errors which I've experienced locally. I think utf-8 will do the trick?
data = feedparser.parse(await resp.text("utf-8"))
9c20a63 Remove the mention command - MarkKoz
It was made obsolete by a new Discord feature. Users can be granted a permission to mention a role despite the role being set as non-mentionable.
Build 20200501.7 succeeded
GitHub
00:01:31
Bot
Reproduced this locally with setting up Big Brother watch and sending text files.
The problem is with discord.py's handling of the use_cached=True kwarg here
https://github.com/python-discord/bot/blob/687f2c4c5875e9de2abeeb122eeee529816ee204/bot/utils/messages.py#L80
For getting cached, it uses the proxy_url of the attachment which in case of text (non media) files seems to be invalid as they are not processed on the media server to be shown to the user.
How should this be handled? ...
Postgres backup completed!
Build 20200502.2 succeeded
GitHub
00:01:18
Bot
Build 20200502.1 succeeded
GitHub
00:01:06
Bot
Should the config for this also be removed? Doesn't look like it's being used anywhere.
Build 20200502.3 succeeded
GitHub
00:01:27
Bot
Will address the stylistic comment later today.
-- Serban Constantin
On Fri, May 1, 2020, 14:33 kwzrd notifications@github.com wrote:
@kwzrd approved this pull request.
During testing the only way I was able to prevent my bot from sending me
the DM was by blocking it, in which case I couldn't message it either.
Disabling DMs from members of all guilds that I share with my bot wouldn't
stop it - not sure whether this is because we already have a message
history, or perhaps...
I'll take a stab at this with the paste link, as paginating the repl output doesn't sound nice
I agree. In that case, look into re-using code from snekbox; it could make sense to move it into a separate utility module.
@wookie184 let me know if/when you plan on implementing the paste file extension mentioned in #916 so we can coordinate a bit as it'll be editing a bit of the same code
Better comment:
# When a <p> element is present in the response then the mailing list
# has not had any activity during the current month, so therefore it
# can be ignored.
Getting very close with this one now, looking almost ready!
Build 20200503.1 succeeded
GitHub
00:01:17
Bot
Postgres backup completed!
@Numerlor I'll look into trying to set up snekbox and I guess the pastebin too on my computer today along with the bot so I can get started and it shouldn't take too long to make the changes. If you wanted to get started now then tell me, I wouldn't mind working around you. I'll keep you updated with my progress.
You shouldn't need snekbox for internal eval, as the evaluation happens in the bot. It's the unsandboxed eval version only admins+ can use. I think that you can also use the external paste site for testing and I don't think we care that much for a few test entries in the database. @jos-b cleans it from time to time when it gets out of hand anyway.
Postgres backup completed!
I mean, we would have a reaction that does basically nothing until the message is edited, it sounds pretty misleading to me
A related issue recently occurred while searching the infraction history of a user with an infraction message that presumably exceeded the limit.
Command: !infr search ... (specific user ID omitted)
Error: RuntimeError: Line exceeds maximum page size 998
The halloweenify cog will generate a Halloween-themed nickname for the invoking user, and then attempt to set it as a guild nickname.
It does not currently handle the following situations.
Lacking permissions
When invoked by a staff member, the bot lacks the required permissions, and a discord.Forbidden exception silently kills the command.
T...
@Akarys42 Absolutely, I've assigned you. Thanks!
Relevant Issues
Closes #402
Description
This PR adds proper fallback messages when the halloweenify command is invoked by a member staff or through DM.
Reasoning
The bot doesn't have enough rights to modify staff nicknames, and can't change it when it is invoked through DM neither.
Screenshots

In-server usage.
 but also in #meta a few times, and the consensus seemed to be that the primary focus should be the .txt file extension as there was no reason to unblock .csv, .json, or like file types.
Also, as for the message to display, I wanted to cover both case scenarios (someone who uploaded code, and someone whose message was too long) and writing a longer embed was the least expensive way to do so ...
Build 20200504.3 succeeded
GitHub
00:01:07
Bot
This looks great! I really like the language in that message, especially the word zapped.
I'll look into working on this issue when I get the chance (should be within the next couple of weeks or so), so I'll assign it to myself. Seems relatively simple enough and would be a good first PyDis issue for me to work on. If it needs to be fixed more immediately and I don't have the time, someone else can feel free to take over.
That other issue is only related in concept. The causes are in two different places.
With handling it locally we can also attempt multiple requests easily for timed out connections, but it does take away info of what kind of error is happening when one does happen. But all things considered it'll probably be better to do it in the function as the handling would be somewhat repetitive.
What do you think about returning the status code/error message if an error does happen? Not sure there as it would need to differentiate between a successful return and a failed one for the me...
The causes are in two different places.
Yeah, but the fix should fairly similar for both, no? Other than the character limits differing, the problem seems to be virtually identical. If not, I can open a separate issue for the infraction messages (which happens to be the one I'm primarily interested in).
Let's not pre-emptively over-engineer it. I don't believe callers currently rely on specific error information, so no need to return it. Nor should they, cause such specific info is not going to be helpful for end users.
Should embed be also truncated in some way? Not sure when those get generated.
Maybe - I'm not sure. One is due to Discord's limitations on embeds (no paginator involved). The other is due to our configured max length for an page in a paginated embed.
One is due to Discord's limitations on embeds (no paginator involved). The other is due to our configured max length for an page in a paginated embed.
Ah, okay. It seems that I likely misunderstood the original issue; I had assumed the solution to that would also involve pagination. For simplicity, I'll just open a separate issue for the infraction message problem and work on that separately. That's the one I'm primarily concerned about and more motivated to fix since it has a direct imp...
Sentry Issue: BOT-3Q
RuntimeError: Line exceeds maximum page size 998
File "bot/pagination.py", line 158, in paginate
paginator.add_line(line, empty=empty)
File "bot/pagination.py", line 72, in add_line
raise RuntimeError('Line exceeds maximum page size %s' % (self.max_size - len(self.prefix) - 2))
Failed to add line to paginator: '===============
Status: Inactive
...
Relevant screenshot of how the above error occurred (courtesy of Lemon):

I believe the preferred way of addressing this error would be via an improvement to the infraction message pagination. If the contents of a single message would exceed the character limit for a single page (998), it could be changed to overflow onto the second page. The boundaries of the infraction would be indicated by the existing separator ===============, and potentially with a new (Continued) line at the top of the overflow page to show that it's a continuation of the last message.
...
A general improvement to the paginator would be to move a line to a new page if it would cause the character limit for the page to be exceeded.
I feel splitting an infraction across two pages would be somewhat confusing to follow. How about we raise the character limit to the maximum (around 2000) for infraction search embeds? If it's still not enough, the infraction could be moved to its own page without any other infractions. If that's still not enough, then continue it on the following ...
Postgres backup completed!
Hello, I have a suggestion for this bot. Its to add a rich presence that shows the prefix of this bot. I think that it's a good idea because there's a lot of people struggling, including me.
By the way, it would be cool the rich presence to be like this: Prefix: {prefix}
I think it may be nicer to copy what Python (the bot) does: Commands: .help
That way, it's consistent, hints at the help command, and still shows the prefix.

Build 20200505.1 succeeded
GitHub
00:01:15
Bot
bc47848 Update extension filter to distinguish .txt in ... - Savant-Dev
0ce4b2f Update extension filter to distinguish .txt in ... - Savant-Dev
b6ebfb7 Update antimalware to filter txt files in cases... - Savant-Dev
fdf2d71 Merge branch 'master' into antimalware - LordHemlock
3533b06 Merge pull request #925 from Savant-Dev/antimal... - LordHemlock
Connected!
Build 20200505.2 succeeded
GitHub
00:02:57
Bot
For example

Don't know if there is a "natural" way to get that without assigning the _ name or if that's the intended way as I got a bit lost in the code but should those also be shortened in some way?
I feel splitting an infraction across two pages would be somewhat confusing to follow. How about we raise the character limit to the maximum (around 2000) for infraction search embeds? If it's still not enough, the infraction could be moved to its own page without any other infractions. If that's still not enough, then continue it on the following page.
That sounds reasonable to me. I agree that continuation onto the next page should probably be used as a last resort, so if we can increa...
Resolving the links shouldn't be much of an issue in itself, just need the url of the page it's from. But don't know how viable its is to plug that into the markdown converter instead of doing that on the already formatted string, which would be more welcome
cfc5720 Run a category check before logging that we are... - jos-b
ba442e1 Display animated avatars in the user info command - MarkKoz
b43379d Tests: change avatar_url_as assertion to use st... - MarkKoz
bc47848 Update extension filter to distinguish .txt in ... - Savant-Dev
0ce4b2f Update extension filter to distinguish .txt in ... - Savant-Dev
Build 20200505.3 succeeded
GitHub
00:01:12
Bot
I came back to this and added ctx.prefix to the pr.
Build 20200505.4 succeeded
Connected!
It doesn't necessarily have to be parsing Markdown. That was just my naรฏve suggestion, being unfamiliar with the internals of the cog.
The cog uses a subclassed MarkdownConverter from markdownify to parse the html into markdown. Should be able to do it there but haven't look at the source yet to know how easy it'll be with the modularity of the super class
First, to answer your direct question: it's not worth the trouble worrying about it, so follow the path of least resistance. I outline below why I think it's useless to begin with.
I had to look at the code to understand what you mean. For anyone else reading, I will sum it up:
It looks for a variable named _ and returns it if it exists (after awaiting it if it's awaitable). When formatting the code block, it artificially appends <Embed> to the output if it detects the return value ...
A general improvement to the paginator would be to move a line to a new page if it would cause the character limit for the page to be exceeded.
Based on my local experimentation so far and looking over the code, it looks like the paginator already does this in LinePaginator.add_line(). When attempting to add an additional line to the current page and it would exceed the the limit, it is closed, and the line is instead appended to a new page. See https://github.com/python-discord/bot/bl...
I've been thinking further about a reasonable character limit for the infraction messages. Although upping it to 2k would help to ensure it fits most messages, there is something to be said about having a condensed infraction paginator. Frequently in the #mods channel, we search for a user currently being discussed and then talk about it. I've found that the existing limit of 1k can already get in the way sometimes by taking up too much space, so a 2k one would be even worse (especially for...
Based on my local experimentation so far and looking over the code, it looks like the paginator already does this
Sorry, I missed that when looking over the code.
I also added a dashed line --- to more clearly separate the (Continuation) header from the actual content, which makes it significantly easier to read multi-page messages.
Good idea. I like the look of it.
I'm not sure what the upper bound limit as far as max continuation pages would realistically be
While it is...
there is something to be said about having a condensed infraction paginator
I considered this but didn't suggest a solution cause I felt it was getting a bit complex. My idea is to keep it at 1k but allow it to go to 2k if the message is already on its own page and still too long. I upping the limit to potentially preserve the infraction on a single page is preferred over splitting it to maintain the shorter char length limit.
Implements a new util function for uploading strings to paste service.
Truncates internal eval responses in a similar fashion to snekbox's eval and updates snekbox to use the new function.
Build 20200506.1 failed
GitHub
00:01:04
Bot
I suggest moving the reason to the end. This way all other infraction fields can stay on the same page to maintain context for the reader.
Good idea, I think that will further improve readability by a significant amount. I'll work on it next.
My idea is to keep it at 1k but allow it to go to 2k if the infraction is already on its own page and still too long. I think upping the limit to potentially preserve the infraction on a single page is preferred over splitting it to maintain th...
Postgres backup completed!
So, the consensus so far seems to be going w/ a default of 1k for 1+ infraction messages, scaling up to 2k if needed, and then using the continuation as a last option. I'll work on that next, finish up the tests, and open a PR (within the next week or so).
Thanks for the feedback @MarkKoz and to everyone in #mods that chimed in.
This looks good to me! Seems we've handled most of the oddities provided by the PEP URL and the mailing list API!
With the new wait_until_guild_available method we have in Bot, I don't think we need to fetch channels explicitly anymore. We can simply get it from the cache instead of making additional API calls. (Note: We should probably check the rest of our bot to see if there are more unnecessary fetch_channel calls.)
The ID of the webhook is not aligned with the other IDs in this section; it's missing one space character.
Also, for the other aliases/IDs, we typically align them on a tab stop (with the first character of the alias/ID starting at a column that's a multiple of 4). For these constants, this would mean this:
talent_pool: 569145364800602132
big_brother: 569133704568373283
reddit: 6354083...
I think there's already been some discussion about this, but personally I feel that names like News and news.py (bot.cogs.news) do not explicitly communicate the purpose of the cog or the extension. In our extension system, the extension is now just "news", which does not communicate that it's the Python News relay feature we have instead of, say, a file/extension/cog for posting server announcements.
Build 20200506.2 succeeded
GitHub
00:01:13
Bot
Build 20200506.3 succeeded
GitHub
00:01:19
Bot
Build 20200506.4 succeeded
GitHub
00:01:13
Bot
Build 20200506.5 succeeded
GitHub
00:01:17
Bot
Due to the structure of the regex & validation for detecting Discord tokens, there is a chance that the filter can be triggered for values that cause the validation step to raise.
ฮปx.ฮปy.x, for example, matches the regex pattern but causes the is_valid_user_id method's base64.b64decode call to raise a ValueError when attempting to decode the lambda character.
This...
Build 20200506.6 succeeded
GitHub
00:01:26
Bot
1ec46c7 CodeFormatting: load the extension - MarkKoz
14a6c79 CodeFormatting: fix find_code_blocks iteration ... - MarkKoz
c067ecd CodeFormatting: fix formatting of example code ... - MarkKoz
255f864 CodeFormatting: fix missing space between words... - MarkKoz
ab7eb15 CodeFormatting: fix formatting of the additiona... - MarkKoz
Build 20200506.7 succeeded
GitHub
00:01:24
Bot
Postgres backup completed!
f805a07 CodeFormatting: add trace logging - MarkKoz
e3877ea CodeFormatting: fix valid code block being pars... - MarkKoz
8c31040 CodeFormatting: move instructions deletion to a... - MarkKoz
7c92b68 CodeFormatting: move instructions retrieval to ... - MarkKoz
18f882c CodeFormatting: move bot message retrieval to a... - MarkKoz
Build 20200507.1 succeeded
GitHub
00:01:22
Bot
Build 20200507.1 failed
GitHub
00:01:15
Snekbox
Currently, if the _has_invites catches an invalid/expired/etc. link it returns True, which motors down the filtering logic to a point where we're expecting a dictionary (a valid guild response from Discord's API):
Since booleans don't have items, this will ...
Can I get assigned to this one?
Worked without issue when I did the test on Win 10 Pro. Good go go.
36c3535 Create temporary free tag - Akarys42
271da4a Add a title at the top of the free tag - Akarys42
af2c216 Use IDs instead of hard-coding category names i... - Akarys42
5416280 Constants: add help channel cooldown role - MarkKoz
9e67ebe HelpChannels: remove ensure_permissions_synchro... - MarkKoz
Build 20200507.2 succeeded
GitHub
00:01:15
Bot
Build 20200507.3 succeeded
GitHub
00:02:53
Bot
Connected!
Not everything has been updated to use the new filename
This needs changing to the new name
bot.load_extension("bot.cogs.python_news")
Build 20200507.5 succeeded
GitHub
00:01:12
Bot
Build 20200507.4 succeeded
GitHub
00:01:19
Bot
Please document this new parameter in the docstring. It can just be put on a separate line
Move this log inside the if statement.
This only retrieves one infraction at most so use singular rather than plural.
Since you explicitly check for None elsewhere, should you be doing that here too?
Yeah. The intention is to make them separate infractions so that we can see what triggered the initial ban and what ended up breaking the camel's back causing the perma.
Build 20200507.6 succeeded
GitHub
00:01:24
Bot
Build 20200507.7 succeeded
GitHub
00:01:04
Bot
@AG4lyf This has been stale for a while now, has all feedback been addressed? Do you need help resolving the conflicts here?
Build 20200507.8 succeeded
GitHub
00:01:03
Bot
Build 20200507.9 succeeded
GitHub
00:01:07
Bot
Addressed in most recent commit
Addressed in most recent commit
Addressed in most recent commit
Addressed in most recent commit
Addressed in most recent commit
Addressed in most recent commit
This line is now too long - it won't pass our linter. Please adjust so that it fits into 120 characters (only need to move the "draw" word on the next line).
The reason why the checks didn't trigger here is due to the conflict with master.
You can also run the lint locally using pipenv run lint.
Looks excellent, but we'll need to resolve the conflict with the master branch. It's here because the seasons directory was renamed to exts. I believe that's the only thing that needs adjusting.
If you need help doing this, let me know.
Additionally, on line 948, I just noticed the link to gitlab is broken / outdated. I think it'd be great if we could adjust it to point to https://pythondiscord.com/pages/code-jams/code-jam-1-snakes-bot/. Thanks!
Build 20200507.10 succeeded
GitHub
00:01:21
Bot
Although or but should be removed to make this read well. Overall this could be written better, e.g.:
It looks like I cannot change your name, but feel free to change it yourself.
I'd prefer if only the line that we expect to raise was in the try block, e.g.:
if isinstance(...):
try:
await ctx.author.edit(...)
except Forbidden:
# append no permissions message
else:
# append success message
else:
# append DM message
This way the logic for both cases (guild / DM) is clearly separated, and we see exactly which lines may raise.
I like the comment on line 49 - helps see why we're branching there.
Looks great, thanks for jumping on it. I like the way you incorporate the information into the response embed - it's exactly what I had in mind when writing the issue.
The solution is functional, but I'd like to request two style adjustments.
Build 20200507.11 failed
GitHub
00:00:54
Bot
Build 20200507.12 succeeded
GitHub
00:01:30
Bot
Build 20200507.13 succeeded
GitHub
00:01:22
Bot
Build 20200507.14 succeeded
GitHub
00:01:17
Bot
Build 20200508.1 succeeded
GitHub
00:01:22
Bot
@kwzrd no that was a bad idea XD
I will refork and make a new PR
Changed Prefix in .snakes about from ! to .
https://github.com/python-discord/seasonalbot/issues/374
Relevant Issues
Closes #374 and #376
Description
Changed prefix from ! to .
Reasoning
The prefix used to be ! but the commands were using a . prefix
Did you:
- [x] Join the Python Discord Community?
- [x] If dependencies have been added or updated, run
pipenv lock? - [x] Lint your code (
pipenv run lint)? - ...
Build 20200508.1 failed
GitHub
00:00:57
Seasonal Bot
Changed Prefix in .snakes about from ! to .
https://github.com/python-discord/seasonalbot/issues/374
Relevant Issues
Closes #374
Description
Changed prefix from ! to .
Reasoning
The prefix used to be ! but the commands were using a . prefix
Did you:
- [x] Join the Python Discord Community?
- [x] If dependencies have been added or updated, run
pipenv lock? - [x] Lint your code (
pipenv run lint)? - [x] Set th...
I deleted patch-2 instead of patch-1 ๐ก Check #406
Build 20200508.2 failed
GitHub
00:00:52
Seasonal Bot
Build 20200508.3 succeeded
GitHub
00:00:53
Seasonal Bot
97ebde1 Code block: send instructions for non-lowercase... - MarkKoz
f5f8bb6 Code block: add function to create the instruct... - MarkKoz
61d6d42 Code block: fix message content being edited in... - MarkKoz
c5bcf78 Code block: join bad language instructions by s... - MarkKoz
30486d6 Code block: fix lowercase check for languages w... - MarkKoz
Build 20200508.2 succeeded
GitHub
00:01:21
Bot
Build 20200508.3 succeeded
GitHub
00:01:19
Bot
Build 20200508.4 succeeded
GitHub
00:01:28
Bot
Build 20200508.5 succeeded
GitHub
00:01:29
Bot
Looks good to me. Nice work.
Postgres backup completed!
Please don't make 3 PRs for the same feature next time - just fix the first PR. Like kwzrd said, we could've helped with this if you didn't know how.
Looks good and clean to me
6fe18c6 Use selector event loop on Windows - MarkKoz
5e477ba Fix awaiting non-coroutine when closing the sta... - MarkKoz
2c48aa9 Log unhandled errors from event listeners - MarkKoz
bc47848 Update extension filter to distinguish .txt in ... - Savant-Dev
0ce4b2f Update extension filter to distinguish .txt in ... - Savant-Dev
Build 20200508.6 succeeded
GitHub
00:01:23
Bot
Build 20200508.7 succeeded
GitHub
00:02:38
Bot
Connected!
Lookin' good, screenshot:

Just asking for a small adjustment, then we'll be ready to merge. The content of the first two lines (947, 948) will comfortably fit on one line, but I don't care particularly much about that.
f"walked away as grand champions. Make sure you check out `{ctx.prefix}snakes sal`,"
Excessive space sneaked in here.
I'll grab this one - would be cool to have.
d84c949 Show bot prefix in rich presence - kwzrd
Closes #404
This will hint users at the help command, while also showing what the prefix for SeasonalBot is. We emulate the main bot's message for the sake of consistency:

Build 20200508.4 succeeded
GitHub
00:00:55
Seasonal Bot
You're not directly testing the following code works correctly. It may make sense to make it a separate function you can test.
file_extensions = {splitext(attachment.filename.lower())[1] for attachment in message.attachments}
extensions_blocked = file_extensions - set(AntiMalwareConfig.whitelist)
Also, note that the prevailing code style in our projects is to always put all items/arguments on separate lines when they're split into multiple lines. Parenthesis/brackets should a...
It'd be safer to either mock STAFF_ROLES to ensure whatever role you use is included, or just pick a role from STAFF_ROLES. While it is highly likely moderators will be in that constant, it isn't guaranteed.
"""A message containing a .py file should result in an embed redirecting the user to our paste site"""
This seems redundant since it always returns None.
I think this should be outside the loop.
I get an error testing it locally.
2020-05-08 12:59:35 | bot.utils | ERROR | An unexpected error has occurred during handling of the request, trying again (3/3).
Traceback (most recent call last):
File "/home/mark/repos/python/bot-pydis/bot/utils/__init__.py", line 36, in send_to_paste_service
response_json = await response.json()
File "/home/mark/repos/python/bot-pydis/.venv/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1026, in json
raise ContentTypeEr...
Build 20200508.8 succeeded
GitHub
00:01:16
Bot
Build 20200508.9 succeeded
GitHub
00:01:10
Bot
Build 20200508.5 succeeded
GitHub
00:00:59
Seasonal Bot
Build 20200509.1 succeeded
GitHub
00:01:21
Bot
Postgres backup completed!
Looks fab thanks for taking core of this!
Build 20200509.1 succeeded
GitHub
00:00:56
Seasonal Bot
Build 20200509.2 succeeded
GitHub
00:00:54
Seasonal Bot
Maybe we should use bot-settings endpoint to storage permissions (int of permission code) during channel is shhh-ed. After deactivating, this should delete this. When this is OK, I'd like to work on it.
Yet another embed that needs truncation
HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.description: Must be 2048 or fewer in length.
File "discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot/cogs/moderation/modlog.py", line 720, in on_message_edit
await self.send_log_message(
File "bot/cogs/moderation/modlog.py", line 122, in send_log_message
log_message = await channel.send(content=content, embed=embed, file...
At least one of the event handlers in the modlog do not properly account for messages being sent in DMs & attempt to perform a guild ID comparison, which doesn't exist in a DM. This should be guarded against across the cog.
AttributeError: 'NoneType' object has no attribute 'id'
File "discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot/cogs/moderation/modlog.py", line 555, in on_message_delete
if message.guild.id != GuildConstant.id or channel.id...
Filters that attempt to delete offending message(s) should check whether or not the message was sent in a DM, since the bot cannot delete others' DM messages.
Forbidden: 403 Forbidden (error code: 50003): Cannot execute action on a DM channel
File "discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot/cogs/filtering.py", line 114, in on_message
await self._filter_message(msg)
File "bot/cogs/filtering.py", line 176, in _filter_message
await ms...
Linking this here since this PR reimplements the code block detection & handling.
Sentry issue: BOT-43
Postgres backup completed!
b06c60b Filtering: don't delete messages in DMs - MarkKoz
Fixes #933
Bots are incapable of deleting direct messages authored by others. The bot will still notify mods for filters triggered in DMs. This change just prevents the bot from attempting to delete the message. The use also won't be notified because the notification message won't really make sense to read when no action is actually being taken.
Build 20200510.1 succeeded
GitHub
00:01:19
Bot
I don't think it is a good idea to store it on bot-settings since it isn't really a setting, it is generated at runtime and is meant to disappear after a few minutes. Also, I'd like to work on this myself if you don't mind ๐
@Akarys42 But then maybe we should hold permission values in dictionary during channel is shh-ed and then restore same perms? And this is your issue, so no problem
I'm currently using the alpha, but I'm not seeing any flake8-annotations errors. Is that due to the dependency mismatch?
67702dc ModLog: ignore DMs in the message delete listener - MarkKoz
Fixes #932
I've gone over all other uses of the guild attribute in the cog and they all appear to be appropriately handling DMs when applicable.
Build 20200510.2 succeeded
GitHub
00:01:28
Bot
55b8aed Filtering: don't attempt to send additional emb... - MarkKoz
Invalid invites won't have data available to put in the embeds, so don't send them! Moderators will still be notified the filter was triggered. However, I'm open to changing this since it was suggested invalid invites could be could be outright ignored.
Fixes #929
Fixes BOT-3Z
Build 20200510.3 succeeded
GitHub
00:01:26
Bot
ea02de3 Token remover: catch ValueError when non-ASCII ... - MarkKoz
The token uses base64 and base64 only allows ASCII characters. Thus, if a match has non-ASCII characters, it's not a valid token. Catching the ValueError is simpler than trying to adjust the regex to only match valid base64.
Fixes #928
Fixes BOT-3X
Build 20200510.4 succeeded
GitHub
00:01:24
Bot
Build 20200510.5 succeeded
GitHub
00:01:12
Bot
Upon further inspection, the extant tests are not written correctly so I will have to fix them.
Small contribution to add an alias of !remindme to the !remind command
Build 20200510.6 succeeded
GitHub
00:01:21
Bot
Build 20200510.7 succeeded
Leon Sandรธy
00:02:45
Bot
Connected!
Build 20200511.1 succeeded
GitHub
00:01:20
Bot
The Utils cog feels a bit crowded with all the PEP methods around; I think they could be moved to a separate class, with only the command handled in the cog. Or at least grouped in the cog so they're not all over the place.
Is the periodic check on the inventories worth here? I don't think the command gets enough use to make it better over the two checks done previously, and the new caching helps a bit too. But would like some other opinions on that
The cache would also fit in the `ut...
This can be safely made into a normal (static) method now
The guild is not needed in this method and the client is set on login, so wait_until_ready can be used instead of waiting for the guild
Could use a bit more logging in this method if it stays.
Postgres backup completed!
Build 20200511.1 succeeded
GitHub
00:00:54
Seasonal Bot
Excellent, thanks for fixing this!
We would still have to drop the permissions somewhere to recover it later if the bot reboots in the meantime, I think we should have a new database model for that, maybe we could also use this opportunity to make a more general model to store small data that need to persist across reboots.
Basically bot-settings is exactly this. This name don't refer to it, but this still is. Python News will use it to storage already sent news.
Basically
bot-settingsis exactly this. This name don't refer to it, but this still is. Python News will use it to storage already sent news.
The long term solution for this will be persistent storage using Redis. I've setup Redis on our host server and I believe @lemonsaurus wanted to tackle the idea soon. In the meantime though, bot settings does work (however be careful of race conditions, it can easily overwrite itself)
Overall I approve of the PR, thanks for your work! I've made a small suggestion though relating to the trace logs that I don't personally consider a must.
if active_infraction:
if is_temporary:
log.trace("Tempban ignored as it cannot overwrite an active ban.")
return
if active_infraction.get('expires_at') is None:
log.trace("Permaban already exists, notify.")
await ctx.send(f":x: User is already permanently banned (#{active_infraction['id']}).")
return
log.trace("Old tempban is being replaced by ...
d1af9cd Restructure apply_ban() logic
- LordHemlock
6fe18c6 Use selector event loop on Windows - MarkKoz
5e477ba Fix awaiting non-coroutine when closing the sta... - MarkKoz
2c48aa9 Log unhandled errors from event listeners - MarkKoz
bc47848 Update extension filter to distinguish .txt in ... - Savant-Dev
0ce4b2f Update extension filter to distinguish .txt in ... - Savant-Dev
Build 20200511.3 succeeded
GitHub
00:01:14
Bot
Build 20200511.4 succeeded
GitHub
00:02:45
Bot
Connected!
Idea behind this issue is to lower the time until a channel becomes dormant/closed when original claimer deletes their messages if there are no replies to their question.
Currently channel will only go dormant after 30 mins of inactivity or when someone closes it manually.
There are cases in which some people will claim a channel and find a solution to their problem before anyone will even reply and due to not knowing they can close channel manually, they might delete their messages which...
Build 20200511.5 succeeded
GitHub
00:01:18
Bot
6d97e88 Token remover: split some of take_action into... - MarkKoz
990f02a Token remover: use a string template for the lo... - MarkKoz
df67aa2 Avoid instantiating the cog when testing static... - MarkKoz
174ec0d Simplify token remover's message mock - MarkKoz
8a12193 Test token remover's message deletion - MarkKoz
Build 20200511.6 succeeded
GitHub
00:01:09
Bot
Build 20200511.7 succeeded
GitHub
00:01:21
Bot
I like this idea because it will still give them some time to send a new message if that was their intention. It would work well with #898 too.
I've been looking into this but since two of the strings use variables that aren't available at that point I was thinking of moving the embed creating to their own functions and mocking the return value of those.
Build 20200511.8 succeeded
GitHub
00:01:33
Bot
flake8 3.8 is out, so this can be unstalled & added to the next release.
Thanks for addressing the feedback! Tests are perfect now as far as I am concerned.
Postgres backup completed!
2e6c22b Update Game Jam from upcoming to most recent - Den4200
Updated the More drop-down menu in the nav bar to say Most Recent: Game Jam 2020 instead of Upcoming: Game Jam 2020 since the Game Jam is now over.
Build 20200512.1 succeeded
GitHub
00:02:11
Site
Build 20200512.2 succeeded
Leon Sandรธy
00:03:44
Site
Connected!
Partially related to #77, the logic used to identify the column location for the end of the function definition (aka the colon) is likely to fail in a number of cases.
The logic currently works by starting on the line where the function body begins & rewinding until a colon is found:
As illustrated by #77, this fails (with Python < 3.8) in the pr...
Since the #reddit channel has moved to the new News category we should convert it to an announcement channel and use the .publish() method on messages sent there so users can subscribe to daily reddit updates.
Connected!
Build 20200513.1 succeeded
GitHub
00:03:26
Bot
Postgres backup completed!
Build 20200513.2 succeeded
GitHub
00:02:06
Bot
ecb777b Created News cog - ks129
9e586ef Added #python-news channel ID to constants Cha... - ks129 [b99a767](https://github.com/python-discord/bot/commit/b99a767b8bde01c730fec0ceb1ddf6fdb31bb983) Added News cog loading - ks129 [bb48c5e](https://github.com/python-discord/bot/commit/bb48c5e6fea14bc8ec42b1188ceb5008fa259463) Added helper function News.sync_maillists - ks129 [b6450b5](https://github.com/python-discord/bot/commit/b6450b57207341d5cf9b581b0e56a579a154cae4) Added new dependency feedparser` - ks129
Connected!
Build 20200513.3 succeeded
Nothing big, just bot check is its news channel and when it is, publish webhook message.
Resolves #940
Build 20200513.4 succeeded
GitHub
00:01:28
Bot
Can I work with this + #898 at once?
Issue is now available if anyone wants to work on it.
Contributions should take into account reviewer feedback from the two PRs:
https://github.com/python-discord/seasonalbot/pull/349
https://github.com/python-discord/seasonalbot/pull/386
Issue is now available if anyone wants to work on it.
Contributions should take into account reviewer feedback from the two PRs:
https://github.com/python-discord/seasonalbot/pull/349
https://github.com/python-discord/seasonalbot/pull/386
Hi, can I work on this issue and #338? :grin:
@Akarys42 Sure, go for it. I've assigned you on both.
Description
I have read several times documentation and PEP 484 and PEP 563 but did not get a clear idea how to get rid of these.
It would be very helpful to see any example of fixing this warning.
Please provide a clear & concise description of the proposed feature.
Rationale/Use Case
I've defined a model in Django:
from django.db import models
class Content(models.Model):
name = models.CharField(max_length=255)
def __str__(self) -> str:
...
Hello, please see the discussion in #75
Per #81, this issue required a broader refactor which conflicts with the methodology proposed by this PR.
The changes will be merged by #82, please let us know if anything was missed, thanks!
I'm not sure how the is_valid_timestamp works as I couldn't find anything about how the token structure works but it doesn't seem to be behaving as expected.
With the int struct unpacking, the resulting number can be negative which just seems invalid if it's a timestamp.
Then the "snowflake" + TOKEN_EPOCH gets passed to snowflake_time where the value gets right shifted into some small number and a datetime is returned from that, as that's supposed to work with the id that's in th...
Not much of an issue but the isnumeric can cause some potential false positives as it matches whole unicode for with numeric tag, isdecimal matches only valid integers (still whole unicode) or matching could be used just for 0-9
Could use a space after the comma. The channel name can also be handy in the bot logs
Don't know what the initial idea behind the regex was and if it should match more than the b64, but it could be changed to only match valid b64/b64 urlsafe chars instead of catching errors here