#dev-log
1 messages ยท Page 44 of 1
I originally had the linuxfs on the host filesystem - having it in the Pipfile meant I could rapidly redeploy just the linuxfs without having to touch anything else. You're right though, I've reworked the logic and there's no reason for it to be there anymore. I'll move it straight into the Dockerfile.
right, I see it now, I just had to look at the whole file. ironically, I think I wrote that watchlist stuff.
anyway okay, this is a good refactor then.
Description
This system will contain a few checks that will be triggered on the event on_message, the display_name of the message author will be checked, and if found abusive to our rules, will be reported or logged.
The checks should be fast and simple (for example using isalpha()) to prevent long and heavy calculations that are triggered on each message, but we can also expand them to fit our needs.
The convention is to capitalise enum members.
I like this approach. Decorators are a clean way of doing it though down the line it may prove worthwhile to add a way to apply it to the whole cog in one go (kind of like cog_check, but for listeners too). I think a month is an adequate granularity for our needs. I think I like it more now that the season info is all in one file. It's almost like a config file even though it's still Python.
Code quality is great and the docstrings are very thorough. I also liked how your write-up in the...
Convention is to use upper case names for enum members.
Why is this gone? I imagine you mentioned this in the commit message but GitHub doesn't properly show the commit history for this file because it's been moved. I figured it's faster to ask you than to try to find it within the 129 commits.
Is there a reason why you introduce an entirely new constant for this feature?
After invoking .bm now every message will have 2 emojis instead of one. Other user when reacting with envelope will not receive anything at all, and that is very confusing.
I do not think that we need to introduce a new constant and add a totally new emoji to do it, envelope will do just fine.
By doing this, now when someone do .bm instead of getting a help message, the bot will bookmark the message with .bm instead like here


There need to be a stricter check here to prevent this to happen.
This should be moved much further down, so we only log when we successfully help someone bookmark the message.
A failing case example will be when we cannot send the DM to user, even after logging that "user bookmarked message". Either change the logging message or move this line further down.
Also I do not think that initial commit is a good commit message. If we have 400 PRs and each one of them have an initial commit then we will have 400 commits with that same messages, which is definitely not helpful at all.
This part can use extra logics check, checking for the highest score might not always work.
However, currently it is working pretty well with all the test cases I provided, so you can argue otherwise that being practical is better in this case. Still, I am keen on seeing a suggestion on this part,
What is the purpose of this migration if it has no operations?
Capitalise the second element of each tuple - those are the human-readable names.
("invite", "Invite"),
("extension", "Extension"),
("channel", "Channel"),
("role", "Role")
Not sure if this requires a migration.
This function does not need to be async at all, consider turning it back to be a normal sync method.
Consider overwriting cog_unload() so you can also call for
self.get_rovers.cancel()
as well.
Every looks pretty good! I only have some small nags, and this should be good to go.
This should be renamed to more clearly express that it's a file extension and not, say, a Discord extension. My suggestion: ("file_ext", "File Extension"),
Send a standard message rather than an embed. The typical style used in the bot is an ๐ or โ followed by the message.
The whitelist group should use type converters for the supported types. This would allow things like mentions to be used rather than forcing users to get the IDs. It would also allow it to infer the type rather than requiring it to be specified explicitly.
The set command should be turned into separate commands for each of the types so something like !whitelist invite discord.gg/... is possible. I don't think set should turned into a subgroup because that'd make invocation too ver...
Do some local error handling for when the ID doesn't exist. Send a message with an โ like I described elsewhere.
"""Manage whitelists used by filters."""
Build 20200331.1 succeeded
Requested by
GitHub
Duration
00:01:06
Build pipeline
Seasonal Bot
Maybe one thing that this should check is the first letter?
As @sco1 said
I don't think it makes sense from a UX perspective to utilize the same reaction for multiple purposes when one of those purposes silently disappears after a timeout. This is already barely discoverable functionality, and with this implementation a user that does know of its existence doesn't know if it has timed out or if it's broken. A second emoji solves half of the problem, which might be sufficient.
And i agree on this rather than using same emoji.
If that's the case, you might want to think about how to avoid the confusion that is having 2 emojis, and one does not do anything at all, from the user's perspective.
If the envelope is purely for visual confirmation that the command worked, it might not be needed anymore since it is not adding anything else.
It will be more complicated than that, for example when you do .games and you will actually get Point and click and you will not see hack-and-slash because the check grab the first result already.
Granted that no one should ever search for a genre called and this is something we can do to to improve user's experience.
An example of what we can do, is that if all returned results have scores greater than 0.6 we can list all of them instead, like when searching for tags and there ...
I mean the envelope emoji doesn't get sent when it fails to dm . But pin still work and it give author an another chance to bookmark it.
I like how it is now myself.
An unknowing person will press both.
Or we can make it so it remove react when someone react with envelope.
Postgres backup completed!
I mean anyone can use .help bm to get the usage.
For now it looks clean and easy to remember. One cannot remember a special word for just a command.
Or maybe you can suggest some better checks ?
The problem is not that we have a .help bm - the problem is that .bm by itself, without any arguments, will work.
So going by that, you can definitely check the part where there is no message being passed to it - when it is None
Build 20200331.2 succeeded
Requested by
GitHub
Duration
00:00:55
Build pipeline
Seasonal Bot
I added now this check. Is now better?
It does sound better in theory, I suggest modifying get_best_results() to accept an optional argument for score, then you only have to check for the length of the list it returns, that'll simplify the checks outside!
I suggest changing this to
import asyncio
then you can do
except asyncio.TimeoutError
To avoid shadowing the base TimeoutError.
Since object msg is not used anywhere else, you can combine the send and the handle_trashcan_react() together, and rename it to something like send_with_thrashcan() or something, that way we do not have to create a variable outside. Think of a wrapper on top of ctx.send() and we simply pass what we want to send to it.
There should be a blank line between the function and the try:
That is the scope of #338 and that is why it is there.
Right now it is not doing what is said in #338 at all, like in the screenshot, it is bookmarking the current message invoking the command which is the message with .bm
Build 20200331.3 succeeded
Requested by
GitHub
Duration
00:01:00
Build pipeline
Seasonal Bot
I don't see reason for the additional argument, so I hardcoded it, due this is used only in one place. I also simplified checking in .games command side.
I was told in my first contribution to log even though we fail to send DM . In that case I should use Tried to bookmark.
That's true.
In your new code,
display_possibilities = "`, `".join(p[1] for p in possibilities if p[0] >= 0.40)
Will practically be the same as
display_possibilities = "`, `".join(p[1] for p in possibilities)
Because the function only returns genres with ratio >= 0.6 - the check for >= 0.4 is redundant.
Build 20200331.5 succeeded
Requested by
GitHub
Duration
00:02:17
Build pipeline
Seasonal Bot
Build 20200331.4 succeeded
Requested by
GitHub
Duration
00:01:36
Build pipeline
Seasonal Bot
So what was the conclusion of the discussion?
Right now PR #386 is bookmarking the message invoking the command, will send this to the command invoker as well as everyone who reacted with the pin message:

I do not think this is a good design, because everytime I look at it, I have no idea what it is bookmarking.
So, what should the bot bookmark when someone invokes `.bm...

as the example given here we can do is bookmark the message with id 334, and one can always get the same bookmark by reacting.
What do you refer here as "same bookmark" though? Because in everyone's DM they will see a single .bm like in the image above, which, 3 days later, will make no sense to them.
no i mean bookmark whose target message is m_id 334
Build 20200331.6 succeeded
Requested by
GitHub
Duration
00:01:14
Build pipeline
Seasonal Bot
In that case are you going to bookmark the message with content This is a cool post or the message with .bm? Because right now the PR is bookmaking the one with .bm instead.
This is a cool post one, I can make some changes in PR. also that one will make more sense.
Build 20200331.7 succeeded
Requested by
GitHub
Duration
00:02:08
Build pipeline
Seasonal Bot
In that case, what if the chat is like this
USER1 [id 1]: This is a cool post
USER2 [id 2]: This is cool! I love it
USER3 [id 3]: Nice one!
USER2 [id 2]: .bm
Which message will be bookmarked?
id 3
ofc
USER3 [id 3]: Nice one!
Active Season: Evergreen
Build 20200331.1 succeeded
Requested by
GitHub
Duration
00:01:56
Build pipeline
Bot
@ikuyarihS Made fixes for these things.
sure @vivax3794, go ahead.
@MarkKoz Any specific PRs we're waiting for? I feel like this is gonna cause conflicts no matter when we do it, because we're never gonna have 0 PRs.
Also, I like the suggested subfolders. I'm not sure I like exts very much. extensions seems fine, but I don't really get why cogs is so bad.
Ok after internal talking that we need to use union
so now
.bm @USER1
will bookmark the last message by USER1 in that channel
also that way you can use hints also
Build 20200331.2 succeeded
Requested by
GitHub
Duration
00:02:06
Build pipeline
Bot
This allowed me to avoid dealing with ambiguities such as banner.png and banner.jpg both being present.
Good point, I don't really think it's worth adding the support at that cost, so I'll resolve this.
Fair point, we did add a link, that'll do.
Let's get this merged, it looks great.
When passed a date not in the range of dates supported by the NASA Astronomy picture of the day a KeyError is raised.
We should confirm that the date passed is between June 16th 1995 and the current date.
Additionally, to be more fault tolerant we should handle API errors completely, I'll attach an example of an error response for people to work with should they want to take this issue on.
Sentry Issue: [SEASONALBOT-B](https://sentry.io/organizations/python-discord/issues/1589477958/?refer...
Build 20200331.8 succeeded
Requested by
GitHub
Duration
00:01:07
Build pipeline
Seasonal Bot
An error response from the API looks like this:
{
code: 400,
msg: 'Date must be between Jun 16, 1995 and Mar 31, 2020.',
service_version: 'v1'
}
If we handle invalid dates and return any other errors we can eliminate KeyErrors.
Since git F it up
so commit message for this ^ are this
Added functionality to bookmark using user mention , basically search for the last message by that user in that channel renamed target_message to target
Build 20200331.3 failed
Requested by
GitHub
Duration
00:01:20
Build pipeline
Bot
Build 20200331.9 succeeded
Requested by
GitHub
Duration
00:00:59
Build pipeline
Seasonal Bot
Sorry been flat out. Took me ages to work out why the category names weren't showing up - including diving into d.py internals, before realising bot.cogs returns a dict not a list...
I pushed the cutoff for fuzzy down to 80, which seemed to help a wee bit. My only issue is that 99% of the time it's just a typo - and most people will know it's a typo - would pulling it down to 40-50 or so help to make some half-decent suggestions?
Build 20200331.4 succeeded
Requested by
GitHub
Duration
00:02:02
Build pipeline
Bot
@lemonsaurus I have some question/notes about this:
- Can I work on it?
- About security: In Patreon webhooks documentation is:
By creating a webhook, you can specify a URL for us to send an HTTP POST to when one of these events occur. This POST request will contain the relevant data from the user action in JSON format. It will also have headers
X-Patreon-Event: [trigger]
X-Patreon-Signature: [message signature]where the message signature is the HEX digest of the ...
4d33b9f Initial pass on log severity reduction - sco1
81d2cdd Logging severity pass from review - sco1
608f5c5 Use debug log level instead of warning in post... - MarkKoz [cc153e0](https://github.com/python-discord/bot/commit/cc153e052b765ddd8ee1494ad3eea2a552d9459c) Increase syncer logging level - sco1 [bd0df4b`](https://github.com/python-discord/bot/commit/bd0df4b93486ae343c828d67ab383b735b2dac36) Merge branch 'master' into update-logging-levels - lemonsaurus
[python-discord/bot] branch deleted: update\-logging\-levels
Build 20200331.5 succeeded
Requested by
Leon Sandรธy
Duration
00:03:37
Build pipeline
Bot
Connected!
Can I work on it?
Yes, but get an approval from @scragly first, because I seem to remember scrags claiming it at some point, a while back.
So my idea is to use X-Patreon-Signature for verification.
That seems reasonable.
Environment variables: I think this should have 2 new environment variables: DISCORD_PATREON_WEBHOOK_URL, to where will be processed result sent and PATREON_SECRET (+ other keys when required) that will be used to identify a request.
Yep, sounds good.
...
we do not need a listener if the task is removed? guessing this is the reason.
Build 20200331.1 succeeded
Requested by
GitHub
Duration
00:02:21
Build pipeline
Site
Though I agree with Marks reviews comments and due to this behemoth of a PR, maybe one could make those changes separately? any way is fine by me.
@eivl I'm planning to address Mark's feedback today - it won't take much time. There's no need to rush this PR.
Build 20200331.6 succeeded
Requested by
GitHub
Duration
00:02:07
Build pipeline
Bot
a184b30 (!zen Command): Added exact word check before ... - ks129 [a1a6b56](https://github.com/python-discord/bot/commit/a1a6b560e22504ac981b9642c81b8985981baf84) Merge branch 'master' into zen-match-fix - Akarys42 [95dae9b](https://github.com/python-discord/bot/commit/95dae9bc7a7519c723539382848c02b9748d067f) (!zen Command): Under exact word match, change ... - ks129 [114565e](https://github.com/python-discord/bot/commit/114565e65c9ca0e0127dae3891dca1122042b57e) Merge remote-tracking branch 'origin/zen-match-... - ks129 [69ad34b`](https://github.com/python-discord/bot/commit/69ad34b76b24bdcfa7cc975a8f1c824590cfef6b) Merge branch 'master' into zen-match-fix - sco1
Connected!
Build 20200331.7 succeeded
Requested by
GitHub
Duration
00:03:12
Build pipeline
Bot
Relevant Issues
Closes #331
Description
Added a new command .wikipedia (with alias .wiki) that uses the Wikipedia api to get a search result.
I decided to make the bot just print the wikipedia link instead of making a custom embed, since discord comes with a nice embed for wikipedia nativly. This can of course be changed if we think it is needed.
Screenshots

...
Build 20200331.10 succeeded
Requested by
GitHub
Duration
00:00:52
Build pipeline
Seasonal Bot
@vivax3794 First, I think this should have more features than just link showing. This should use its own embed with parsed HTML (to MD). Additionally, this should have .wiki search <search> command, that uses LinePaginator and shows all results that Wikipedia returns. Also, one feature is supporting custom wikis, because all/most wikis that use MediaWiki have open API. So like .wiki custom <base_url> <article> and .wiki custom search <base_url> <search_term>.
One thing that I want ...
High code quality! However, I do agree with @ks129 that added cog and got it working are not suitable commit messages, as when the PR is merged, the commits will be merged into the master branch as well, so something like
Initial commit for wikipedia Cog
Fixed command breaking when API return no result
are considered much better.
In general, to avoid the line being wrapped, a commit message should be 50 characters or less, and each line in the description should be 72 characte...
I believe this can use more logic to check the results we got, otherwise we can have this

In case we got too many like when we hit a may refer to as the first page, maybe wikipedia does not have it and so we can list the results instead?
We can definitely use some logic here instead of relying on the very first result, specially when they are sorted alphabetically and not by how close the match is, for example when searching for Avenger I got this:

And the first hit is this:

I mean, when searchin...
The returned API does contain the amount of hits, and using this is much more accurate, specially when the API can cut off the amount of results it return, like in this case:

I think showing this number is cool as well, as well as the suggestion that wikipedia suggested!
Something that was missed earlier, while we're already making changes to this, can you please make this loop duration longer:
https://github.com/ks129/seasonalbot/blob/game-fuzzy/bot/seasons/evergreen/game.py#L141
I don't think new game genres are created so quickly that we need to refresh it every hour. Once a day is fine.
Build 20200331.1 succeeded
Requested by
GitHub
Duration
00:04:35
Build pipeline
Snekbox
Build 20200331.11 succeeded
Requested by
GitHub
Duration
00:01:10
Build pipeline
Seasonal Bot
@sco1 Okay, I changed this now.
Build 20200331.12 succeeded
Requested by
GitHub
Duration
00:00:59
Build pipeline
Seasonal Bot
@ks129 about parsing that html, as far as I see it looks like all the html returned (at least in the snippets) are just <span class=\"searchmatch\">something</span> so maybe it would just be easieste to use str.replace to remove those?
I suggest using markdownify. It's a very good tool for this. @vivax3794
A function for this already exists here.
There needs to be more logic to this. Currently the message may be misleading by still showing ๐. Furthermore, a mod log will still be sent even if nothing was actually changed.
How is this different than #303? I know you were talking to me while creating this issue but IIRC I was distracted by something else at the moment, sorry.
Tbh I was tired and had already forgotten the existence of 303 also, but the scope of this is definitely wider than the original.
Build 20200331.8 succeeded
Requested by
GitHub
Duration
00:01:56
Build pipeline
Bot
Thanks for the quick updates. This is working well. Your original timeout was 60 seconds but the util function's is 5 minutes though I suppose 5 minutes is fine too.
Build 20200331.13 succeeded
Requested by
GitHub
Duration
00:00:55
Build pipeline
Seasonal Bot
Build 20200331.9 succeeded
Requested by
GitHub
Duration
00:01:49
Build pipeline
Bot
Yes, this could be added to the if isinstance(callable_, Command): clause:
if hasattr(callable_, "invoke_without_command") and callable_.invoke_without_command:
However, I'm not sure how to handle such a situation. A warning-level log probably wouldn't be good - there currently exists [one place in the code base where the param is set to True and the decorator is used](https://github.com/python-discord/seasonalbot/blob/83f5b0c7b62df74edc0e58b67f535bfb11284c26/bot/exts/hall...
Was _fact_publisher_task removed in another PR then?
@MarkKoz I made this early exiting when an infraction expired and no reason provided.
Commit: f229b442ef4d474737fe5edd0d5a2ff142effc8d
The referenced _fact_publisher_task method simply didn't exist. I'm not sure what happened there, or why it wasn't caught earlier. It was removed in 70d2170a0a6594561d59c7d080c4280f1ebcd70b, which dates back to 2018. Notice that the on_ready isn't even a registered listener at this point.
Yes, it does hide. Do you think that's a problem?
I do personally think it is cleaner. In some cases, having both the annotation and definition on one line becomes lengthy and visually cluttered. I find that I'm usually looking for one, or the other. My workflow for larger classes is to first annotate the attrs, and then start implementing. Since I've already decided on the types, my IDE will alert me if I violate a promise I made earlier.
No, it isn't. That's exactly what it should do.
I seem to remember scrags claiming it at some point, a while back.
It's mostly that I mentioned we don't need it to be a site thing. Instead a simple reactor event on our linode would suffice; at least, assuming there's no extra features required.
a simple patreon command
I don't this is necessary. They'd have a role in-server, so we'd easily be able to see patreon counts by doing a role member count instead in the case someone asks, but it's not often they do and they can just ...
Adjusted the terminology in 3902f9d. Figuring out a good, succinct summary was giving me some trouble, but I think it's overall better now. Thanks.
It bothers me that all names had bot capitalised besides this one.
bot_name = "MerryBot"
You're right, I'm not sure why I didn't just go for pop: 7a596bd.
Adjusted in 466ce98 (pretty_files too).
Out of interest, where do you draw the line? I have a tendency to approach these as: if it can be async, then it should be. They're never used outside of an asynchronous context. Is there a point where the function is so simple that making it a coroutine is just not worth it?
Will we ever want to intentionally have seasons overlap?
It is not something that the current system accounts for. It will log a warning, and return the season at index 0. In retrospect, this isn't good design - we should probably check all seasons for collisions statically (right after all seasons are defined), and raise if they collide. This will make sure that the collision is caught before the bot connects. If I add such a check, I can then simply rely on len(active_seasons) alwa...
I cannot imagine how we could add support for overlapping seasons. There isn't really a good way to "merge" the attributes they provide: names, descriptions, or branding paths.
I was thinking just have one take priority and the other would simply be there for some extra available commands. But forget it, it'd make more sense to create subdirectories within seasons if we wanted to separate large groups of cogs.
I do not see much of a benefit in using integers over booleans, as you can't really "peek" at the value anyway. The iterator construction becomes a lot cleaner in your example, but then we cannot simply check whether should_cycle is truthy. I see it as a bit of a trade-off, but ultimately I think your approach looks better.
With integers, it's clearer to me where the truthiness is coming from since the comparison against the cycle frequency is visible.
Do we really want to delete successful tag hits?
I think this may help in a situation when a user accidentally uses a command in wrong channel. And this is just a small reaction under a message, nothing big and breaking so I think this should okay.
I'm interested in looking into this but before any searching is done on the inventories we need to clean them up.
Briefly touched upon this in a comment for #546 :
The inventories we get from some sources contain link to generated content which seems to be duplicated or at least unreachable through the bot because of the current parsing
([pandas-core-groupby-groupby-transform](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.GroupBy.transform.html#pandas-core-...
Okay, in that case, I'm closing this issue and we'll handle this in saltstack. I've opened a ticket here: https://github.com/python-discord/salt/issues/18
7180ef7 (Games Cog): Created new helper function get_b... - ks129 [ece3b4a](https://github.com/python-discord/seasonalbot/commit/ece3b4ae490d2ce19d5006b49cf6272356cdba62) (Games Cog): Added wrong genre matching to .ga... - ks129
7cc9644 (Games Cog): Removed unnecessary parameter from... - ks129
6e3cd45 (Games Cog): Fixed matching not found message - ks129
4ba21db (Games Cog): Added check is there more than 1 p... - ks129
Build 20200331.10 succeeded
Requested by
GitHub
Duration
00:03:35
Build pipeline
Bot
Build 20200331.14 succeeded
Requested by
GitHub
Duration
00:02:06
Build pipeline
Seasonal Bot
Build 20200331.11 succeeded
Requested by
GitHub
Duration
00:03:25
Build pipeline
Bot
Connected!
Build 20200331.12 succeeded
Requested by
GitHub
Duration
00:01:46
Build pipeline
Bot
f9fa3e6 (Tags): Added helper function handle_trashcan_... - ks129 [b37f221](https://github.com/python-discord/bot/commit/b37f221b9b68efed48409a64a802ea0df009627f) (Tags): Added trashcan handling to !tags get ... - ks129 [307aacb](https://github.com/python-discord/bot/commit/307aacbf1b7304ebb52d5193f19b5a12623cdbfd) (Tags): Fixed trashcan handling check. - ks129 [6f273e9](https://github.com/python-discord/bot/commit/6f273e96714c6de4738ec5ed2026e17cd3668594) (Tags): Modified helper function handle_trashc... - ks129
e28a580 (Tags): Fixed TimeoutError shadowing with `as... - ks129
Build 20200331.13 succeeded
Requested by
GitHub
Duration
00:03:14
Build pipeline
Bot
Connected!
await ctx.send(":x: Cannot edit the expiration of an expired infraction.")
OK, this is a good workaround. Just need to change the phrasing of it.
Build 20200331.14 succeeded
Requested by
GitHub
Duration
00:01:43
Build pipeline
Bot
@MarkKoz I applied change now.
You're welcome to work on it. Sorry if this will sound dismissive, but I don't understand what kind of issues the parsing has. In any case, you can clean up whatever is needed to make it work better.
Build 20200331.15 succeeded
Requested by
GitHub
Duration
00:02:02
Build pipeline
Bot
5d24f9a (Infraction Edit): Don't let change expiration ... - ks129
7954c75 (Infraction Edit): Don't change infraction when... - ks129
ad16fa8 (Infraction Edit): Changed already expired and ... - ks129
bb883f7 Merge branch 'master' into infraction-edit - sco1
ebd9815 Merge pull request #852 from ks129/infraction-edit - sco1
The generated mostly miss an # at the end which is needed to get the HTML tag to search from, but we don't need to preserve them since they should be duplicates and nobody is going to search for a simple with a / in its name.
Looking more at the symbols with spaces there's only around a hundred of them and they are mostly terms (binary file, generator expression) bit out of scope here but should the arg be changed to a greedy one? Or taking it as with the / that nobody is going t...
Build 20200331.16 succeeded
Requested by
GitHub
Duration
00:03:22
Build pipeline
Bot
Connected!
What kind of drawbacks would a greedy arg have? If none, then why not?
Would be more convenient if it aggregated all conflicts rather than aborting at the first sight of one. I'm fine with this though.
... it's clearer to me where the truthiness is coming from since the comparison against the cycle frequency is visible.
That's a good point. I think it's nicer from the daemon's perspective to simply be fed True/False, and not have to worry about anything else. Overall, however, using range leads to cleaner code. I implemented this in d7c413b. Thanks for your insight!
09c6140 Create generators.md - decorator-factory
[python-discord/bot] New branch created: decorator\-factory\-add\-generators\-tag
Build 20200331.17 succeeded
Requested by
GitHub
Duration
00:01:46
Build pipeline
Bot
Think a good idea would be to check if the user has any Unicode, to begin with, before checking how many ASCII characters they have. I would just require a simple check if their entire name is ASCII why bother counting it. Just reduces the number of times calling a loop, altho minor.
Discord doesn't support markdown headers. The best it has is bold.
**Python Generators**
that is, it applies a function to each element in a list:
Serial comma!
1. Initializing a list, appending to it, and returning it is noisy boilerplate code.
The check for any Unicode by itself requires a loop over the string, so in that light might as well reduce it to a single loop of counting how many mentionable alnum in my opinion.
The deal breaker will be how we can make it not spammy, so it will trigger once per user per day perhaps.
wouldn't just <name>isascii() work for skipping over that loop? if the username is MyUsername#6621 it will be true, so we could just do if not <name>isascii() then check using the loop
Okay, so I've discussed this with the admins and moderators, and we have several comments. @F4zii Please use these comments to reformulate the original issue text and change what this issue is going to solve.
- We don't care about detecting names which are hard to mention. It's overkill, todays current system works fine. Let's not do that.
- However, we might want to detect nicknames that have bad words in them. You can use the same wordlists we have in the regex filters.
- On that no...
[python-discord/bot] New branch created: decorator\-factory\-mutability\-tag
Build 20200331.18 succeeded
Requested by
GitHub
Duration
00:01:52
Build pipeline
Bot
8302c35 apply suggestions for generators.md - decorator-factory
028781a header->bold in mutability.md - decorator-factory
Build 20200331.19 succeeded
Requested by
GitHub
Duration
00:01:40
Build pipeline
Bot
Build 20200331.20 succeeded
Requested by
GitHub
Duration
00:01:41
Build pipeline
Bot
8e6c6f8 apply suggestion to generators.md tag - decorator-factory
Added in the latest suggestion.
Build 20200331.21 succeeded
Requested by
GitHub
Duration
00:01:44
Build pipeline
Bot
Discord templates are now live. Does this change things at all? We could provide a base server and create a template that users can use when they want to bootstrap a server.

So would this use the main server or one we maintain separately? If it's the latter, then we're probably going to want to have something automated anyway since we're never going to remember to keep the template server in sync & provide tooling to make changes when we do. I feel like that ends up being the same tool regardless.
Definitely neat though.
Discord doesn't render these either but it still kind of works as a separator I guess.
Don't hard wrap the text because it becomes tedious to adjust whenever a revision needs to be made. Let your editor take care of that with soft wrapping.
Also, please write more detailed commit summaries in your commit messages. "Apply suggestions" and "Update x.md" are not adequately descriptive.
The content itself is good. However, as mentioned in the other PR, don't hard wrap.
`int`, `float`, `complex`, `tuple`, `frozenset` are other examples of immutable data types in Python.
Is it possible to sync an extant server with a template? If not, then the templates are only useful for initial creation. Regardless, they do not alleviate the tedious task of changing every ID in the config.
Postgres backup completed!
Build 20200401.1 succeeded
Requested by
GitHub
Duration
00:02:23
Build pipeline
Site
About the cooldown itself @lemonsaurus
the check cooldown will be per user ? or just the cooldown of being notified?
per user, yeah. We don't want to be notified of the same user every time they send a message, right? that would just be spam.
@MarkKoz As per our discussion on Discord, in a74debb I have added a __str__ implementation for the Month enum.
As a result, the logs now look nice:
Command lovefest will be locked to February
InMonthCheckFailure - Command can only be used in February
Listener CandyCollection.on_message will be locked to October
Guarded CandyCollection.on_message from invoking in April
Starting seasonal task PrideFacts.send_pride_fact_daily (June)
Seasonal task PrideFacts.send_pride_fact_d...
Build 20200401.1 succeeded
Requested by
GitHub
Duration
00:01:01
Build pipeline
Seasonal Bot
Can I work on it? Also, discord.py v1.3.2 is released with small bug fixes. We should use this version.
Things I think should be used:
- Commands calling: Now you can call commands like
await self.command_function(ctx, kwargs)and no need for invoking and command getting. Should be used especially inside same Cog commands. utils.sleep_until(already mentioned)- Use
await ctx.send_help('command')insteadctx.invokefor sending help.
Currently, I can't find more then these and t...
Build 20200401.1 succeeded
Requested by
Leon Sandรธy
Duration
00:03:41
Build pipeline
Bot
Connected!
Could use just some simple dictionary with a timestamp to keep it quick and just check if timestamp diffrence is past a certain point
Build 20200401.1 failed
Requested by
GitHub
Duration
00:01:16
Build pipeline
Snekbox
a946842 Fix hard-wrapping in mutability.md - decorator-factory
Build 20200401.2 succeeded
Requested by
GitHub
Duration
00:01:48
Build pipeline
Bot
26f0a07 Merge branch 'master' of https://github.com/pyt... - closure-reference
d864a8a add generators.md - closure-reference
5459dfd fix punctuation and formatting in generators.md... - closure-reference
6fb5379 rearrange paragraphs in generators.md tag - closure-reference
[python-discord/bot] New branch created: decorator\-factory\-add\-tag\-generators
Build 20200401.3 succeeded
Requested by
GitHub
Duration
00:01:46
Build pipeline
Bot
Something like that. Honestly, cooldowns are a solved problem in the bot, so just do it however we're doing it in other cogs. Ideally in a DRY way.
Thanks for making a list. Yes, you can work on it. Will send_help work with our current help cog or will we need to wait for the PR that's open to be merged? Currently we don't subclass the discord.py help class.
Yes, ctx.send_help should wait until help command PR get merged. But I think I can add this and I hope PR get merged before my PR is ready.
`string.upper()` creates and returns a new string which is like the old one, but with all the letters turned to upper case.
That's because strings in Python are _immutable_. You can't change them, you can only pass around existing strings or create new ones.
Would it perhaps be better to show an interactive session here?
>>> string = "abcd"
>>> string.upper()
'ABCD'
>>> string
'abcd'
This demonstrates that the new string is returned, and needs to be assigned to string.
I just got a really good idea. I saw something similar to this in one of my server . Here is link how it looks in working
https://ag-1436.xyz/indinet
Very funny. Please don't shitpost in GH issues.
60 seems to work a lot better.
result = process.extractBests(string, choices, scorer=fuzz.ratio, score_cutoff=60)
This is good to go now as far as I'm concerned. Thanks!
Build 20200401.5 succeeded
Requested by
GitHub
Duration
00:01:42
Build pipeline
Bot
Build 20200401.4 succeeded
Requested by
GitHub
Duration
00:01:43
Build pipeline
Bot
The mutability tag is also included for some reason. Have you messed up some git operation?
83e49c2 Check partially hidden words against the wordlist - AnonGuy
e731db9 Update spoiler regex to support multi-line spoi... - AnonGuy
def24f5 Expand spoilers to match multiple interpretations - AnonGuy
61df1d6 Merge branch 'master' into spoiler-check - AnonGuy
afeb920 Merge branch 'master' into spoiler-check - AnonGuy
Build 20200402.1 succeeded
Requested by
GitHub
Duration
00:01:42
Build pipeline
Bot
Build 20200402.2 succeeded
Requested by
GitHub
Duration
00:03:39
Build pipeline
Bot
Connected!
Postgres backup completed!
To-do list:
- [ ] Commands directly awaiting: From
await ctx.invoketoawait cmd(ctx, ...). - [ ] Use
discord.utils.sleep_until. - [ ] Use
Context.send_help(stalled until #519 get merged) - [ ] Replace
fetch_*withget_*(need more discussion) - [ ] Remove unnecessary patch
When you have any ideas, what should be added, post them to #734 . I'll regulary check this issue to see is anyt...
Build 20200402.3 succeeded
Requested by
GitHub
Duration
00:01:55
Build pipeline
Bot
message.clear_reaction(emoji) has been also introduced in 1.3 and can be used in some places to have a more precise emoji clearing, such as here, in snekbox, where we could only delete the ๐ emoji.
Build 20200402.4 failed
Requested by
GitHub
Duration
00:01:59
Build pipeline
Bot
Build 20200402.5 succeeded
Requested by
GitHub
Duration
00:01:47
Build pipeline
Bot
What's wrong?
Right now, when issuing a ban ( !tempban for example ) if the reason is greater than 512, it will fail because discord only allow 512 letters.
However, the bot will still add the infraction to our DB and register it as an active ban, and thus subsequent ban will fail, saying that user is already banned.
Expected behaviour:
When the reason is greater than 512, either send a warning / confirmation that the reason is greater than 512 and so reason will be cut off to b...
I suggest trying to test as thoroughly as you can first. Here are a couple of issues when I tested:
This will fail when doing a .bm @seasonalbot raising an error AttributeError: 'ClientUser' object has no attribute 'channel' - You will need to check if target is a bot as well.
There should be another special check here, otherwise trying to bookmarking your last message will result in the command message being bookmarked, like this:


In practice user may want to bookmark their "other" latest message instead.
setting title as the title of the embed will break discord's special format, such as when bookmarking using a channel as the name, like this


You may want to put it in the description instead.
I don't understand: Should this fail when reason is longer than 512 chars or should this cut this to 512 chars when applying ban?
It is up to debate:
The 512 chars limit is only applied to discord, in reality it should not affect us if we ever want to make a thorough ban reason, and limiting ourselves to 512 just because of Discord does not feel right, right?
However, if we decide to open the limit to more than 512, we might want to truncate the message to be used as reason for discord. In that case, a confirmation / warning that the reason will be truncated will be nice.
I donโt think we care if the ban reason sent to Discordโs API is truncated, I can only think of maybe a handful of situations where weโve ever read the reason in the audit log vs. what we have stored on site, and 512 characters should give us a good enough understanding of why the member was banned.
You want me to break the symmetry how it used to work previously
if yes What you think title will be so that it is easy to find ?
Build 20200402.1 succeeded
Requested by
GitHub
Duration
00:01:06
Build pipeline
Seasonal Bot
I suggest that the test_ prefix is changed and that we talk about the rest.
I'm not aware of what get group is, this is a fault of my own, but maybe there should be a comment about this in the docstring?
I'm not saying it should be changed, it's more for a discussion than anything else.
There probably are some test_ prefixes scattered around in non-test code. But I personally use the test_ prefix for only test cases.
My suggestion is that we change the function name to something that does not use the test_ prefix.
also, returning both bools is pretty smart. I like it.
What's up?
Thanks to @scragly, we have a beautiful icon for the upcoming game jam [2], but its shape / theme diverges from the usual snake logo [1]. Using this as the server icon could therefore be confusing to our users, as they would no longer recognize our guild in their guild list.
Solution
Despite this, we would like to use it. @SebastiaanZ has come up with a brilliant idea to create an animated combination of the two, where the first frame is the usual [1], but then it morphs...
[python-discord/seasonalbot] branch deleted: seasonal\-purge
Build 20200402.2 succeeded
Requested by
GitHub
Duration
00:02:39
Build pipeline
Seasonal Bot
get group is basically get <group>, where group can be tags, docs. Really tags group command doesn't exist, just group is in the alias function name. I'll add this info to docstring.
Build 20200402.6 succeeded
Requested by
GitHub
Duration
00:01:45
Build pipeline
Bot
Connected!
Build 20200402.7 succeeded
Requested by
GitHub
Duration
00:03:36
Build pipeline
Bot
Connected!
Why
Simplicity of being able to undo a command that was done
Task
Add a command that tracks the last commands used (that are reversible), and by whom used it. If done right this could be great tool for undoing mistakes like a typo in an ot-name.
It would achieve this by having a look up of the reversible command, and keep track of the input given. So if you undoed a ot add, it would keep track of the name added, and call ot remove with it.
It could undo a ban, if that was by m...
Thanks for the proposal! Theoretically it's a great concept but I don't think it can be robustly implemented within our framework.
While many of the commands have a simple "undo" mapping, others are not so straightforward. The moderation commands, for example, are one where the opposite action is not always going to be the same; we might want to edit the infraction that was just created, or pardon it, or even void it (when this functionality is added). This would require the undo command t...
Infractions could map to edit, and i can see the command becoming a moster real fast. It was mostly for simple add/remove concepts. Like ot-add/remove
Why is this labelled as stalled? The site PR was merged almost 4 months ago.
We need a new one to allow PATCH requests, I've been pretty busy lately
because of the covid and stuff, but I'll be back soon(tm)
[python-discord/site] New branch created: fix\-link
After https://github.com/python-discord/branding/pull/46, the location of the Game Jame 2020 asset has changed, breaking the link on the frontpage of pythondiscord.com.
This PR fixes the link:

Build 20200402.1 succeeded
Requested by
GitHub
Duration
00:02:09
Build pipeline
Site
lgtm, I'm going to merge this
[python-discord/site] branch deleted: fix\-link
@ikuyarihS One thing about this reordering actions: I think this is not a good idea, because after this when banning success, but adding to DB not, the situation is not good. I think better is when order stay like it is. The only change should that this cut reason.
Build 20200402.2 succeeded
Requested by
GitHub
Duration
00:03:38
Build pipeline
Site
markdown metadata wouldn't really fit as we will have a problem with segregating the tags. I mean we will have to look into a file to know to whom it is restricted.
Should we just merge this? It looks like you've tested everything thoroughly, I'm not sure what else could be done. I agree with the decision to drop support for partial hits, but I don't have nearly enough knowledge to give a good review here.
@RohanJnr But there is possible to read an MD file on tags getting and cache it.
Nobody is arguing whether it is or isn't possible. The point is that adding metadata for the sake of adding it is unnecessary. If this can be done without having to add our own markdown processing then that's how it should be done.
83e49c2 Check partially hidden words against the wordlist - AnonGuy
e731db9 Update spoiler regex to support multi-line spoi... - AnonGuy
def24f5 Expand spoilers to match multiple interpretations - AnonGuy
61df1d6 Merge branch 'master' into spoiler-check - AnonGuy
afeb920 Merge branch 'master' into spoiler-check - AnonGuy
Build 20200402.8 succeeded
Requested by
GitHub
Duration
00:02:24
Build pipeline
Bot
Build 20200402.9 succeeded
Requested by
GitHub
Duration
00:03:31
Build pipeline
Bot
Connected!
sorry for not working on this, something has happen in my life and dont have the motivation to code right now, and this quarantine is not helping... so sorry.
Build 20200402.3 succeeded
Requested by
GitHub
Duration
00:01:03
Build pipeline
Seasonal Bot
@lemonsaurus
Any specific PRs we're waiting for?
No, not really. Perhaps the help channel system. Anyway, I can just take responsibility for resolving conflicts on all PRs myself.
I'm not sure I like exts very much. extensions seems fine, but I don't really get why cogs is so bad.
In a sense, "extensions" is more correct since the package contains modules which Discord considers extensions. In turn the extensions contain the cogs. So the package contains extensions, not cogs....
Actually, you can definitely use .clean_content of the message, that should escape and show the name of the channel properly.
If you need to escape markdown as well, you will need to look at discord.utils.escape_markdown
[python-discord/django-crispy-bulma] New branch created: feat/deps/o138/pre\-commit\-hooks
My idea is to make ConfigSync cog. This should check each channel, role, webhook and when this can't get it based on ID, this should use discord.utils.get(items, name='name'), so this first try to get by name. If this is not working (can't get an item from there), then this should create a new item (channel | role | webhook).
Relevant Issues
python-discord/organisation#138
python-discord/organisation#153
Description
New hooks were added for pre-commit and they will run in CI too. pep8-naming was added as a flake8 plugin to ensure names comply with PEP 8.
Hooks added
A couple of these hooks automatically apply fixes. However, they still report failure and leave any changes they make uncommitted. Therefore, the user has to commit the automatic fixes.
check-merge-conflict- Check fo...
Build 20200403.1 succeeded
Requested by
GitHub
Duration
00:01:42
Build pipeline
Django Crispy Bulma
Need thoughts on if it's OK that pre-commit relies on the local environment for flake8.
Postgres backup completed!
Build 20200403.1 succeeded
Requested by
GitHub
Duration
00:01:26
Build pipeline
Bot
My idea for the new directory layout that applies Scragly's sorting:
bot/
extensions/
filters/
__init__.py
antimalware.py
antispam.py
filtering.py
token_remover.py
webhook_remover.py (added by my recently, but should be here)
__init__.py
security.py
error_handler.py
I didn't included every category currently, but this should how I see this. __init__.pys should h...
I think you mean
https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.escape_mentions
But that does not contain channel mention.
Guess we can't make everything work.
It is linked in the comment above.
And as I've said, you can certainly use .clean_content to escape mentions for user / channels.
clean_content can only be applied on message object not string I can do that on target.clean_content not title.
Should compare message.id rather than message object.
IDK is that an issue comparing message object not working as it should be.
I think you can, you are forgetting ctx.message in this case. Either way, the format on the title should be addressed, as #bot-commands does not make a great title.
I can trick discord.py actually but i don't feel like that is a good way to do that
basically change ctx.message.content = title
that way I can use clean_content
Maybe should better remove title as title and use:
**Title:** {title}
{content}
as description?
Added in 58cc573415969af9fcba236aa230649476424216.
Ohh this got a good story
If a message is exactly discord message length
this will crash the command as now description is higher than limit
Hmm. Yes. For this you should make length check, like 1900 characters (2000 is Discord max).
Right now, we've got copies of specific versions of Bulma and Bulma-Extensions in this repo, which is license permissable but adds maintenance in that we have to manually update these files to in order to "update" to a new version.
Perhaps we could include bulma and bulma-extensions as submodules to ensure these stayed up to date, and that we did not need to manage these files ourselves?
#337 you should read this ,
And i don't think there is need to change how people are familiar with bookmark, for example if you see all the bm at once and they are different it can be hard to understand,
That sounds like a good option. If we don't, we should make sure to include the proper licensing information for Bulma and Bulma-Extensions, though. That's a requirement of the MIT license.
You will have to check the docs if the class supports equality checking, for example discord.TextChannel supports it

But discord.Message does not, so yes you need to check via .id
Build 20200403.1 succeeded
Requested by
Leon Sandรธy
Duration
00:01:36
Build pipeline
Django Simple Bulma
@MarkKoz alright, and besides your argument about how it's technically more correct to use extensions than cogs, it also makes it clearer to users unfamiliar with the term cog and with discord.py what the folder contains.
consistency with seasonalbot would be nice, I guess. I'm just generally allergic to abbreviated names for things. I think extensions is better than exts and wish we had the former on both repos, and with https://github.com/python-discord/seasonalbot/pull/329 recently ...
hmm, these imports with from bot.exts... look familiar. Is exts used in discord.py or something? If there's an established use for this, I'd be more inclined to agree we use it.
Added a check. so resolving this convo
@lemonsaurus discord.py have commands and tasks under ext (from discord.ext import commands)
Hey, yea I decided to go with exts in SeasonalBot. I was looking for something to replace seasons (as the extensions within no longer bind to seasons), and exts seemed the most appropriate. As @MarkKoz mentions, it is technically more correct than cogs (plus I really don't like the word cog), and I personally find extensions unnecessarily long and verbose.
As @ks129 notes, d.py uses the terminology although they drop the plurality. I personally think it's better in plural, but I ...
in plural it's less ambiguous - ext could be external, but exts has fewer possibilities. extensions has the fewest of all. I don't like ambiguity, but I guess we'll go with exts everywhere then.
I agree with @lemonsaurus. My preference would have been extensions as I don't really like abbreviations when they're not really necessary, but consistency is also important. So, let's go with exts in that case.
About setup functions, should these in __init__.py files or in each cog file?
Good call on splitting up the nsjail tests. However, I'm not certain on how I feel about the API tests. on one hand, it's a simple way to do it. On the other hand, I think the tests should be in a separate class/mixin which both test cases use. This makes more sense than having one test case subclass the other. Furthermore, the base class is creating both mocks when each test case only needs one of them. One way to solve this would be to pass arguments to setup() in the subclasses.
Clean up shouldn't be necessary since the setUp fixture is executed separately for every test. In other words, the nsjail instance is re-created for each test rather than shared among them.
"Python process" is not accurate for this.
I think these should be subtests like the Python 3 test. It'll give a better output upon failure (like which directory failed).
Build 20200403.2 failed
Requested by
GitHub
Duration
00:01:01
Build pipeline
Bot
Build 20200403.4 succeeded
Requested by
GitHub
Duration
00:01:19
Build pipeline
Bot
Can anyone check, am I missed something somewhere? Basically, all that I know is ready (this get vs fetch should it's own issue/PR). I also found this is not waiting for help command PR: everything works currently too:

So I'm taking this out of draft and reviewing can start. Sorry when I included some commits here that shouldn't be here.
Thanks for the comments, I'll get on them.
In https://github.com/python-discord/seasonalbot/pull/329, the SeasonManager cog was removed. It was responsible for dispatching a greeting message to the #dev-log channel, much like Python does:

SeasonalBot does therefore not currently dispatch any such message. I think this is a regression, as the message lets us know that the bot has successfully connected after deployme...
Setting up a cog for sending messages to the
#dev-logchannel could be useful in the future
I agree, and there's something planned for this actually in Python botto that is very likely able to be transferred over to this botto once complete in the form of an extension.
For now, we don't have a pressing need for any dev-log output other than the startup and we actually [already have a helper method on the bot instance to send a message to the devlog channel](https://github.com/python...
Add an attribute to flag when the initial message is sent to avoid sending on additional
on_readyevents
Alright, sounds good.
... there's something planned for this actually in Python botto ...
Exciting, looking forward to it!
I think (when this is gonna be approved again) this should storage emojis images + image file name and emoji name pair JSON in branding, under seasons. Loading/removing reactions is not hard then. JSON should there because we can't get directory listing easily. This looks really interesting issue.
[python-discord/seasonalbot] New branch created: greeting\-message
Closes #390
The issue gives a fairly though explanation. Implementation is simple, as we already have a method for dispatching embeds to the #dev-log channel. In 6af47f8, we first ensure that the cache is ready before grabbing the devlog channel instance.

The author field is always populated with SeasonalBot - the seasonal nickname isn't used.
Build 20200403.1 succeeded
Requested by
GitHub
Duration
00:00:53
Build pipeline
Seasonal Bot
Looks fine but I've suggested the same thing I mentioned in-server.
There's no need to store the task; it's never referenced later and it's a fire and forget type of thing.
I have a tendency to assign in case something wants to check in on the task later on, but I guess in this case it really isn't necessary. I will remove it.
Build 20200403.2 succeeded
Requested by
GitHub
Duration
00:00:58
Build pipeline
Seasonal Bot
Build 20200403.3 succeeded
Requested by
GitHub
Duration
00:02:03
Build pipeline
Seasonal Bot
dc6493f Try to fetch devlog channel if not found in cache - kwzrd
[python-discord/seasonalbot] New branch created: fetch\-devlog\-channel
Sometimes, wait_until_ready() passes even if the cache isn't ready yet.
In such a case, we attempt to fetch the channel via an API call.
Build 20200403.4 succeeded
Requested by
GitHub
Duration
00:00:57
Build pipeline
Seasonal Bot
Build 20200403.5 succeeded
Requested by
GitHub
Duration
00:02:11
Build pipeline
Seasonal Bot
Connected!
Description
The bot should check that there are no channels missing from the guild which are present in the bot constants.
Reasoning
As discussed in #342 this will help prevent issues like #335 and has already been implemented for bot.
Proposed Implementation
With the current implementation of the constants as simple classes (not sure why they're NamedTuples) without any annotations or being an object that holds more info about itself, we can check their contents through the...
Postgres backup completed!
Context
It is a common pattern to have a task wait until the bot connects, perform some action, and send a message to Discord. An example is the greeting start-up message added yesterday in #391.
Problem
Because it takes some time for the bot to populate its internal cache with data from Discord (e.g. guilds, channels, users, ...), discord.py provides a convenience coroutine wait_until_ready....
Because it takes some time for the bot to populate its internal cache with data from Discord (e.g. guilds, channels, users, ...),
discord.pyprovides a convenience coroutinewait_until_ready. However, in some cases (probably due to API latency), the coro will finish before the chache is ready, and any calls such asget_channelwill returnNone.
Just to provide a little more background: Discor...
In order to avoid circumvention of the existing URL filters by using a link shortener, or a redirect, unfurling shortened URLs and following redirect checks should be implemented into the existing URL filter.
The proposed APIs for unfurling and following redirects are:
- https://wheregoes.com/ (primary preference)
- https://unshorten.me/api
In addition, although URLs posted might not be in the blacklist, they might lead to sites with explicit content, malware, or other content that ca...
Build 20200404.1 succeeded
Requested by
GitHub
Duration
00:01:26
Build pipeline
Bot
This can add a ... to the middle of a word, like "See you ne..." - You will want to truncate at whitespace, textwrap will be of use here.
Should we put this in a try except and move it before we call utils.post_infraction()? It will be rare, but there can be situation where the actual discord ban / kick failed, but since we've already put the infraction in the DB the bot will think that the ban is active.
Also, I can't move to add into DB to end of the function: infraction is required for applying infraction, and in coroutine creation, this will not raise an error. An error will be raised on self.apply_infraction, but this need DB returned infraction.
Closes #394
Introduction
The above linked issue gives an explanation of the motivation to port over this functionality from the Python bot repository. Additionally, @SebastiaanZ has provided an excellent technical explanation of the problem that we're dealing with - thanks Ves!
What I've done
In df17366, I have adapted Mark's implementation from the bot repo. I've decided to simplify the implementation a...
Build 20200404.1 succeeded
Requested by
GitHub
Duration
00:01:01
Build pipeline
Seasonal Bot
Description
Currently flake8-annotations will report an error if the self or cls parameters are not annotated. It is not clear what flake8-annotations wants from the source code in order not to report these errors, and neither PEP 484 nor PEP 3107 offers any guidance as to how self or cls should be annotated. In fact PEP 484 suggests in Annotating class and instance methods that such annotati...
This means that the out-of-the-box behaviour of
flake8-annotationsappears (at least at first glance) contrary to the guidelines of the PEPs it is supposed to be enforcing.
The purpose of this package is not to enforce the related PEPs, as they make no mandates regarding full annotation coverage. Its purpose is to detect the absence of these annotations; all errors are exposed and we leave it up to the developer to determine what subset of these errors to enforce for their project. Thi...
Regarding URL unfurling, are there any security concerns with having the bot follow the shortened link itself, rather than using an API?
The purpose of this package is not to enforce the related PEPs, as they make no mandates regarding full annotation coverage. Its purpose is to detect the absence of these annotations; all errors are exposed and we leave it up to the developer to determine what subset of these errors to enforce for their project. This project, for example, currently ignores 6 of its own errors.
Fair enough. Thanks for the clarifications :-)
If it would be helpful we can include the links to these PE...
[python-discord/django-simple-bulma] New branch created: feat/deps/o138/pre\-commit\-hooks
Relevant Issues
python-discord/organisation#138
python-discord/organisation#153
Description
New hooks were added for pre-commit and they will run in CI too. pep8-naming was added as a flake8 plugin to ensure names comply with PEP 8.
Hooks added
A couple of these hooks automatically apply fixes. However, they still report failure and leave any changes they make uncommitted. Therefore, the user has to commit the automatic fixes.
check-merge-conflict- Check fo...
Build 20200405.1 succeeded
Requested by
GitHub
Duration
00:01:55
Build pipeline
Django Simple Bulma
Postgres backup completed!
Typically, embedded links limit the text to just noun, and not the entire subject. I.E. "guide on asking good questions" or just "asking good questions" instead of "check out our guide on asking good questions".
What is the reason for this iterating through a copy of _scheduled_tasks?
After cancelling the tasks, you may also want to consider propagating an exception for any task that couldn't be cancelled; it can help to make subtle errors more apparent. We use this in the implementation for asyncio.run(). For an example of how this could be done, see https://github.com/python/cpython/blob/909f4a30093f74d409711e564f93a43167ca0919/Lib/asyncio/runners.py#L62-L73.
Hi, @MarkKoz Thanks! for the detailed review. I need clarity on a few things:
- Even if we split set command to separate commands for each type, how does it improves the invocation? For invocation, we still have to use the same syntax
!whitelist invite ... - How can I infer the type based on the input, as there some type which takes free form text like the extensions type? For supporting the mentions, my plan is to use the regex to take out the ids from the mentions. Is this the right...
I am working on the bot side changes which will possible to some changes in this PR. I will incorporate the review changes with the API changes.
I don't mind either way, although I think the noun-only version looks slightly better.
Maybe we should implement this in the cancel_task method instead; that means that any task that gets cancelled but was already marked one with an exception will log that exception, not only the tasks that are cancelled in bulk. It's indeed a good point to propagate or at least log exceptions that happen in tasks so they don't go unnoticed.
What do you think, @MarkKoz?
We will be removing !free in https://github.com/python-discord/bot/pull/786, so this is no longer necessary.
We will be removing !free in https://github.com/python-discord/bot/pull/786, so this is no longer relevant.
As per @aeros 's suggestion, it would look like this:
check out our guide on [asking good questions]({ASKING_GUIDE_URL}).
Suggestion as per @aeros 's comment above:
through our guide for [asking a good question]({ASKING_GUIDE_URL}).
Can't reproduce with the given example.
Build 20200405.1 succeeded
Requested by
GitHub
Duration
00:01:45
Build pipeline
Bot
Build 20200405.2 succeeded
Requested by
GitHub
Duration
00:01:33
Build pipeline
Bot
[python-discord/bot] branch deleted: feat/frontend/o200/help\-channels
1ec0a10 Resources: add JSON with array of chemical elem... - MarkKoz
3e5bd73 HelpChannels: create boilerplate extension and cog - MarkKoz
439c0dd HelpChannels: load element names from JSON - MarkKoz
01bf328 Constants: add constants for HelpChannels cog - MarkKoz
73d218b HelpChannels: add constants for active/dormant ... - MarkKoz
Build 20200405.3 succeeded
Requested by
Joseph Banks
Duration
00:02:58
Build pipeline
Bot
Connected!
Build 20200405.4 succeeded
Requested by
GitHub
Duration
00:02:44
Build pipeline
Bot
Connected!
Build 20200405.5 succeeded
Requested by
GitHub
Duration
00:01:16
Build pipeline
Bot
It's catching the other TimeoutError. Simple fix is to change the exception being caught.
https://github.com/python-discord/bot/blob/master/bot/cogs/sync/syncers.py#L125
72768b4 Add feature to restrict tags to specific role(s) - RohanJnr
[python-discord/bot] New branch created: restricted\_tags
Closes #778
Implementation
as suggested in the issue.
Details
- Created folders for 3 roles: Helpers, Moderators, and Admins.
- When a user uses the
tagcommand, a new method calledcheck_accessibilitychecks if the user has the necessary role to access thattag. - If the user does not have the required role, no message is displayed, the user assumes no such tag exists.
Additional
Implemented this to the methods which search tags by content.
Build 20200405.6 succeeded
Requested by
GitHub
Duration
00:01:34
Build pipeline
Bot
I think it's pretty good. Some small notes.
Why is this required? Isn't easier to make tag["restricted_to"] = file_path[3]?
I'd suggest joining these if statements to one.
Build 20200405.7 succeeded
Requested by
GitHub
Duration
00:01:22
Build pipeline
Bot
@aeros All tasks have a done callback which retrieves exceptions from tasks. When a task is cancelled, it is also considered done. Did I cover all bases here or am I still missing some scenario?
Oh I think what you're getting at is when task.cancel() is called but task.cancelled() still returns False, meaning it wasn't actually cancelled.
Even if we split set command to separate commands for each type, how does it improves the invocation?
It has the advantage of verifying that types are valid. If the type is an argument, you'd have to write a custom converter to validate. They will also show up in the list of subcommands in the help command. I don't have a strong feeling for it either way but I do think I prefer them being separate for that reason.
It also allows for each command to use a separate converter for the va...
@MarkKoz
Oh I think what you're getting at is when task.cancel() is called but task.cancelled() still returns False, meaning it wasn't actually cancelled
Yep, that's what I was referring to. It's specifically when task.cancel() is called, task.cancelled() returns false, and task.exception() contains an exception of some form. Your _task_done_callback() does cover this for the most part (I hadn't looked over it), but indefinitely running tasks may still be a concern with that impl...
cancel_task() essentially just calls task.cancel() for each task. I thought task.cancel() didn't block, so how would a timeout help?
Oh and I forgot that a task is also considered done when an exception is raised inside it, so presumably that means the done callback would also trigger if an exception was raised when there was an attempt to cancel a task? In that case, yeah, I do believe you're right that the callback is covering it.
I thought task.cancel() didn't block, so how would a timeout help?
I was just about to correct the above, sorry: you'd have to modify cancel_all() slightly (or add it in cog_unload) to wait for task.done() to be true for each task that still isn't cancelled after attempting to call task.cancel().
But the above is only needed if you think indefinitely running tasks might be an issue (which you'll likely have a better idea than I do, based on what the tasks are doing). It might not be a realistic concern in your case.
No, not indefinite, but there can be long sleeps (30 minutes). In any case, I think it's safe to leave it alone for now but I will keep this in mind if it turns out to be a problem. Thanks.
Oh and I forgot that a task is also considered done when an exception is raised inside it, so presumably that means the done callback would also trigger if an exception was raised when there was an attempt to cancel a task?
Yep, it's only an issue when the exception is in the process of propagating/being handled, but hasn't been cancelled yet. If it finished raising, the task is considered done, so it should trigger the done callback when the exception was raised.
As mentioned above, ...
I can work on the async and concurrency tags when I get the chance. It would potentially save me the trouble of answering some commonly repeated questions in the #async channel.
We should add an explanation for the difference between a class and an instance in the !class tag
By far the most requested feature in #help-channel-feedback is to allow the original claimant in a help channel to mark the channel as !dormant. After considering the drawbacks vs the benefit, we have agreed that we should do this.
We'd also like to make one small related change in the same pull request - Whenever !dormant is called, the bot should delete the invocation message. This keeps our help channels from filling up with !dormant invocations, which prevents unfamiliar users fr...
Can jump at this unless you had someone familiar with the system in mind
Something to note: if the command is used, their cooldown for claiming a channel should also prematurely end.
@Numerlor You're welcome to it, as long as you're able to address it quite soon. We'd like this merged maybe within a day or two, since there's an ongoing evaluation of this system going on.
If that's a bit sooner than you were thinking, we'll handle it among the core devs.
We have a GitHub token in SeasonalBot. Why can't we do an API request to get folder listings.
curl -H "Authorization: $GITHUB_TOKEN" https://api.github.com/repos/python-discord/branding/git/trees/58cc573415969af9fcba236aa230649476424216\?recursive\=true
Maybe a warning over dm or in channel could be issued to the user with the inappropriate nickname as well?
Resetting the cooldown completely seems to be a bad idea because it would allow users to repatedly make one channel at a time in use and put it back into the dormant state.
I think cancelling the initial task and creating a new one that will reset the permissions in a (potentially) shorter time would be fitting here, does a minute sound like a good cooldown if this is wanted? And should that be in the config or just a literal/module const?
The width will ensure the new string will never be greater than the limit, after appending placeholder so you can change it to this
action = user.kick(reason=textwrap.shorten(reason, width=512, placeholder=" ..."))
I suggest adding a space for placeholder as well.
You can do the same for ban and it'll look good to go.
Looking good, one more nag and it'll be good to go.
Build 20200406.1 succeeded
Requested by
GitHub
Duration
00:01:25
Build pipeline
Bot
Build 20200406.2 succeeded
Requested by
GitHub
Duration
00:01:18
Build pipeline
Bot
Postgres backup completed!
Description
This role mention is supposed to be @PyDis Core Developers if im not wrong.

I feel like this statement could just be ask in #dev-contrib, because some of the non-core dev can also answer questions
This has not been solved yet, when I do .bm @seasonalbot hi I got this traceback
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "/bot/bot/seasons/evergreen/bookmark.py", line 46, in bookmark
permissions = ctx.author.permissions_in(target.channel)
AttributeError: 'ClientUser' object has no attribute 'channel'
After discussing this with the core developers, we're gonna close this issue for now. It seems like a needlessly complicated solution to a problem we don't have - we have bucketloads of emoji slots available right now, and we don't really have any seasonal emojis to put into this system.
With the concept of seasons being less prevalent this year than last, I also don't think it makes as much sense. Right now we're in easter season, but nothing eastery is really happening - we're doing the ...
Maybe a warning over dm or in channel could be issued to the user with the inappropriate nickname as well?
This sounds like automoderation, which we don't want to do. Our bad word filter has false positives, and I don't want it DMing users when that happens. It's better to let our moderators make these kinds of decisions.
This issue is now fixed, closing this..
My though was about writing "feel free to ask in the #dev-contrib channel in the server. We're always happy to help", if I misspoke, I apologize. :smiley:
@Numerlor we've discussed that hypothetical edge case among the core devs, and feel like it's not really necessary to solve it here and now. If someone does that, it'll be plainly visible (lots of subsequent embeds in some channels), it won't really disrupt anything, and we'll moderate it. If it happens a lot, we'll come back to implementing a solution for this, and yeah, a short cooldown would probably be the right move.
For now, let's just reset the cooldown to zero for the channel owner...
I added this third task to the original issue description, too.
closes: #867
Implements the requested feedback from the linked issue for the dormant command, allowing claimants to close their own channel, restore their send permissions to available channels and delete the invokation message.
I'm not entirely satisfied with the check here but couldn't think of a nice way to make it a decorator, so I'm open to other ideas if there are any.
await self.available_category.set_permissions(member, send_messages=None)
Was not sure if th...
Build 20200406.3 succeeded
Requested by
GitHub
Duration
00:01:40
Build pipeline
Bot
The tag cog leaves out encoding when opening files, assuming the default is UTF8 but that is not the case on some OSs and fails with the UnicodeDecodeError.
The offending block of code can be found here:
https://github.com/python-discord/bot/blob/7571cabe65e39d231523e713923cd23b927225bc/bot/cogs/tags.py#L43-L48
paging @kmonteith25 here as they mentioned the issue in #dev-contrib
@Akarys42 Oh no worries about that, I discussed about that issue there, then was told to change it myself
f13f8b8 Allow PATCH requests on the OffensiveMessage model - Akarys42
[python-discord/site] New branch created: offensive\-messages\-patch
The fix is the same as https://github.com/python-discord/bot/commit/1509d3b1c39fac825d5e5a09fd0caf780db7c91c. I just overlooked applying it to help_channels.py too.
Ignoring exception in on_message
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "/bot/bot/cogs/help_channels.py", line 516, in on_message
if channel.category and channel.category.id != constants....
I've added a couple notes to #73, so we'll have them available once the new version is released.
Thanks very much for the feedback!
Thanks to you for the explanation and the README tweaks! :-)
[python-discord/bot] New branch created: help\-channel\-system\-minor\-improvements
This PR aims to make two changes to our help channel system:
1. Add status emojis to help channel names
The new help channel system appears to be intuitive to most of our members. One comment that has been made a few times is that it would be clearer if the channel names would indicate the status of the channels as well. It still happens that people don't notice the existence of two different categories and add their question to an already claimed channel.
By adding emojis to the...
Build 20200406.4 succeeded
Requested by
GitHub
Duration
00:01:24
Build pipeline
Bot
I like the novelty of using large int pushing newly claimed channels to the bottom. This can somewhat help indicating what channels have been in-use longer.
I like the novelty of using large int pushing newly claimed channels to the bottom. This can somewhat help indicating what channels have been in-use longer.
The ints won't be preserved; Discord automatically resizes them to max + 1 in a category.
The prefix is configurable so "help-" shouldn't be hard coded.
dfbecd2 Use configurable prefix to clean help channel n... - SebastiaanZ
Build 20200406.5 succeeded
Requested by
GitHub
Duration
00:01:32
Build pipeline
Bot
to I agree with Marks feedback but otherwise it looks good.
I agree with Marks feedback but otherwise it looks good.
It should be addressed in the latest commit
Relevant Issues
Closes #388
Closes #387
Description
Added a try-except block to Minesweeper and date check to APOD command.
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 the PR to allow edits from contributors?
Build 20200406.1 succeeded
Requested by
GitHub
Duration
00:00:56
Build pipeline
Seasonal Bot
The ValueError can only be raised by
apod_date = datetime.strptime(date, "%Y-%m-%d").date()
right? In that case, you can move the try block up and put it there only, since the rest will not raise ValueError, so something like this
try:
apod_date = datetime.strptime(date, "%Y-%m-%d").date()
except ValueError:
await ctx.send(f"Invalid date {date}. Please make sure your date is in format YYYY-MM-DD.")
return
now = datetime.now().date()
if datetime(...
Build 20200406.2 succeeded
Requested by
GitHub
Duration
00:01:02
Build pipeline
Seasonal Bot
get_used_names or create_name_queue needs to be edited to account for the emojis.
Here's a partial dict of celebs from Forbes top 10 along with links to wiki pictures. If anyone wants to continue it.
Build 20200406.6 succeeded
Requested by
GitHub
Duration
00:01:25
Build pipeline
Bot
Do we want to remove the channels from the cache when the command is invoked and before they are moved to make sure users can't run it twice before the bot has a chance to do the move and discord to pick up the change?
Build 20200406.7 succeeded
Requested by
GitHub
Duration
00:01:36
Build pipeline
Bot
Do we want to remove the channels from the cache when the command is invoked and before they are moved to make sure users can't run it twice before the bot has a chance to do the move and discord to pick up the change?
Yes, that would be a good idea. It would also clear up useless items in the cache. My only concern is that should resetting permissions fail, the only recourse to reset them would be to wait it out or manual intervention by editing the category overwrites.
If the chann...
Name is too verbose. how about reset_claimant_send_permission?
Use overwrite=None as done in revoke_send_permissions. Otherwise, "blank" overwrites will pile up in the category. I realise this means any other permission will be reset. However, I didn't think they were ever set neither manually nor automatically for other reasons so it's a compromise I was willing to make.
I think the order should be different:
- Delete the command so message lingers for as short as possible
- Reset permissions so it still happens in case moving the channel fails
- Move the channel
Also, put blank lines between groups to make the code more readable.
on an unrelated note, does that mean we can also throw them away in the Silence cog?
Have to admit that my creativity went out for the day and I spent most of the time on wording, thanks for pointing these out.
Will also change the cache dict to remain similar with this change
Doesn't that operate on a role basis rather than on individuals? If yes, then there's only 1 role and it won't cause any harm to leave it.
Sorry, I keep mixing up users and the main role here; came to the same realization quite a few times now... deleted the previous message before I got the response.
Was the send_messages in reset_send_permissions intentional? This will cause the same issue after the bot loads up if I'm understanding it correctly
https://github.com/python-discord/bot/blob/7571cabe65e39d231523e713923cd23b927225bc/bot/cogs/help_channels.py#L547-L550
An oversight. Would appreciate if you fixed that.
Will do, this lead to my initial confusion on which was to be used
I considered moving it somewhere else as the command itself is doing a bit now but thought it'd be better to leave the move_to_dormant method to do only the things relevant to it
Build 20200406.8 succeeded
Requested by
GitHub
Duration
00:01:20
Build pipeline
Bot
@MarkKoz To be clear here, how do we want the error handling to pan out?
Is the issue described in the comment also present now if the task fails?
So we want to remove from the cache as early as possible to make sure it can't be ran more than once, then try to reset the permissions and if that fails move the channel and attempt it again?
Got a bit confused here
If the channel remains intact, then at the least the dormant command could be invoked again by staff. I say staff because ther...
Sorry, meant to write "if the cache remains intact". I don't have a clear idea of how to do it. Ideally if something fails, it'd still be possible to repeat the command to try again. If the cache is cleared, then repeating the command wouldn't work for resetting permissions. Furthermore, the operations should be independent of each other. If the permissions can't be reset, still move the channel and vice versa.
Postgres backup completed!
Build 20200407.1 succeeded
Requested by
GitHub
Duration
00:01:28
Build pipeline
Bot
4cb5030 Add channel status emoji to help channels - SebastiaanZ
ae49def Change bottom sorting strategy to using a large... - SebastiaanZ
dfbecd2 Use configurable prefix to clean help channel n... - SebastiaanZ
e3d7afa Use clean help channel name for used name set - SebastiaanZ
c4015d8 Set the ID of the new Help: In Use category - SebastiaanZ
[python-discord/bot] branch deleted: help\-channel\-system\-minor\-improvements
Build 20200407.2 succeeded
Requested by
GitHub
Duration
00:02:55
Build pipeline
Bot
Connected!
How should it be handled for the instances where the channel can be moved but the permissions aren't reset? Currently the command will only work for channels that are in use, skipping execution outside of them so we can't attempt it again to reset the permissions after it has been moved in case of some kind of an api error.
Right. My idea was to have staff use it in dormant channels but that's not really going to work out it seems. Maybe nothing can be done besides waiting it out in that case.
The least we could do is notify staff but I'd like more opinion on that.
Why not just build a date object directly?
date(1995, 6, 16)
I'd probably make this specific date a constant and perhaps explain why it's needed, but it's not necessary.
While the minesweeper fix works, it only applies to a single command. The end_command defined just
below (and potentially others) suffer from the exact same, unsafe look-up. I'd propose that this PR addresses all of these.
This is merely a suggestion, but rather than catching the KeyError every time, I'd probably do:
game = self.games.get(user_id)
if game is None:
...
return
...
Alternatively, a d.py check preventing the command from being invoked ...
- If I'm not mistaken, this instructs the user to provide the date in an unsupported format.
- The current format string produces
07th April 2020today. - I think
Date must be between 16th June 1995 and todaywould be sufficient.
If this is made a constant (or at least a local variable), then it can be referenced in the error message for requests exceeding the allowed range.
Hi!
I am a member of the team developing monocodus โ a service that performs automatic code review of GitHub pull requests to help organizations ensure a high quality of code.
Weโve developed some useful features to the moment, and now weโre looking for early users and feedback to find out what we should improve and which features the community needs the most.
We ran monocodus on a pre-created fork of your repo on GitHub https://github.com/monocodus-demonstrations/bot/pulls, and it f...
This line currently isn't getting truncated because it's not using the reason variable. https://github.com/python-discord/bot/blob/c4f7359d2e301e6ab19666a6867c9cb69892da0b/bot/cogs/moderation/scheduler.py#L131
deactivate_infraction needs to have the reason truncated too. Also look at watch channels and superstar to see if they need reasons truncated.
Isn't 1900 cutting it a bit too close? That's only a bit over 100 characters for everything else.
If you put the reason in a separate variable above you could avoid having to break up the function arguments for ban().
I don't think these logs are necessary.
Hello, thank you for reaching out.
We already have a nice CI setup which checks with flake8 for PEP8 violations and a few other tools to ensure high code quality so I'm not sure how the service you are offering provides any benefits over the current system we have.
We'd rather not receive issues like this on GitHub, as we tend to try keep GitHub issues to bugs and feature proposals, so for further discussion please see https://pythondiscord.com/ and feel free to bring it up in the #dev-...
Why is being done here? The truncation should be happening in the methods that are sending the messages, e.g. utils.notify_infraction and mod_log.send_log_message. This way you can use the actual character limit instead of having to guess at how long it needs to be in order to not raise an error.
Build 20200407.1 succeeded
Requested by
GitHub
Duration
00:01:19
Build pipeline
Seasonal Bot
[python-discord/bot] New branch created: mitigate\-permission\-unsynchronization\-available\-help\-channels
This PR aims to mitigate the issue that available help channels fail to synchronize their permissions with the Help: Available category despite our best efforts. As we have not yet identified the root cause of the issue, I've implemented an ensure_permissions_synchronization helper method that is called to check and, where needed, remedy available help channel permissions synchronization issues.
I've also changed the category name Help: In Use to Help: Occupied to reflect the curre...
Build 20200407.3 succeeded
Requested by
GitHub
Duration
00:01:29
Build pipeline
Bot
Would it be worth doing this in parallel like with a gather?
Good point; we could do that. (Although it's currently max. two channels as we only apply it to the Available category.)
Oh never mind then. I thought it was doing it for all categories.
So basically every time a permission changes or a channel is moved, it ensures permissions are synced in the available category. This sounds like a fine workaround especially given there aren't many channels in that category anyway. I haven't tested but I trust you have.
I haven't benchmarked but I try to avoid that attribute because it sorts. That's why I made self.get_category_channels().
Technically it's all kwargs not just permissions but I can live with it.
This appears like a logical mitigation to me, although it's odd that it'd be necessary. Perhaps the extra logging will allow us to see a pattern & understand the circumstances which cause the channels to desync. I haven't ran this code, but I've seen it tested on the dev server.
[python-discord/bot] branch deleted: mitigate\-permission\-unsynchronization\-available\-help\-channels
Build 20200407.4 succeeded
Requested by
GitHub
Duration
00:03:03
Build pipeline
Bot
Connected!
Postgres backup completed!
@sco1 I applied this to utils.notify_infraction, but I can't do this in mod_log.send_log_message, because this take argument text, where is the full content of embed description (that include reason).
Build 20200408.1 succeeded
Requested by
GitHub
Duration
00:01:28
Build pipeline
Bot
@MarkKoz Now this should be fixed.
Moving in the right direction, but there are still a few things that should be addressed. Once the error handling is improved, I'd be happy to merge.
This is an interesting approach that I did not consider, but I like it a lot. There are, however, a few changes needed.
- There are still places in this cog where the look-up is unsafe and fails on a
KeyError. Theflag_commandis an example. Please review the entire cog to ensure that this PR addresses all unsafe look-ups. - I'm a little bit on the edge about blanket-catching any
KeyErrorthat falls out of the commands. While it's probably ok, my personal approach would have...
Build 20200408.1 succeeded
Requested by
GitHub
Duration
00:01:04
Build pipeline
Seasonal Bot
@kwzrd I changed all unsafe lookups in commands. I didn't change it in helper functions, because commands already check these and don't let reach code to there.
Yes, thatโs the point. Youโre focusing on truncating only the reason, arbitrarily guessing at the length you need to truncate to, when you can just truncate the entire string that these methods generate before sending.
@sco1 But like when reason is too long, this will cut Expiry (apply_infraction) from ModLog entry, because this is after reason. To make this, I have to put everything else first and after this reason.
Build 20200408.2 succeeded
Requested by
GitHub
Duration
00:01:19
Build pipeline
Bot
@sco1 I now made changes, but problem is, I can't change pardon_infraction. This buildup and log text generating don't allow this way.
Why do you need to change pardon_infraction?
Don't modify a list while iterating it. You'll need to make a copy or use a comprehension.
return tag["restricted_to"].lower() in [role.name.lower() for role in user.roles]
This is not cross platform. You should stick to using pathlib's API. I believe something similar could be accomplished with the .parents attribute, though you'd probably need to ditch checking for length.
end_msg = f" (reason: {textwrap.shorten(reason, width=1500, placeholder='...')})"
Watch channels have some things that need to be truncated
Any maybe this, but it gets paginated....
This is not ideal but I recognise this case is more troublesome than others. Do you think there is a simple way to ensure the reason will be at the end given this gets merged with another dict may have additional keys added by pardon_infraction? I suspect it will involve having to delete the reason from the dict then add it back in. Maybe just not worth the trouble.
This is hard to read. Split them up by assigning the dedent to a variable above.
Exceptions raised within a d.py command will be wrapped in CommandInvokeError which carries on original attribute with the specific exception. As a result, this doesn't catch the UserNotPlayingError, as error isn't an instance thereof - error.original is.
The error handler cog gets around this via [safely getting the original](https://github.com/python-discord/seasonalbot...
Maybe should this overwrite Reason in pardon_infraction to put this as the last key? And after this, textwrap.shorten whole ModLog embed description?
Build 20200408.2 succeeded
Requested by
GitHub
Duration
00:00:54
Build pipeline
Seasonal Bot
12c80fb Stop setting positions when moving help channels - SebastiaanZ
Looks excellent. Thanks for working on this, it's a great fix!
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 20200408.3 succeeded
Requested by
GitHub
Duration
00:03:46
Build pipeline
Bot
Connected!
Build 20200408.3 succeeded
Requested by
GitHub
Duration
00:02:22
Build pipeline
Seasonal Bot
Connected!
Postgres backup completed!
Build 20200409.1 succeeded
Requested by
GitHub
Duration
00:01:33
Build pipeline
Bot
@MarkKoz Now should OK.
[python-discord/bot] New branch created: send\-logs\-via\-webhook
Replaced TimeoutError with asyncio.TimeoutError. Closes #865
Build 20200409.2 failed
Requested by
GitHub
Duration
00:00:58
Build pipeline
Bot
Build 20200409.3 succeeded
Requested by
GitHub
Duration
00:01:29
Build pipeline
Bot
I'm not sure if I'm really worried if a permissions update doesn't work out; the worst that can happen is that the user has to wait the normal period of 15 minutes, right? Could be annoying, but it's not the end of the world for the people involved.
A far greater issue at the moment is that the overwrites system doesn't work reliably. Despite there being no reason for it, as far as I can see, channels keep getting out of sync with the category permissions **even with the resent mitigation ...
Build 20200409.4 succeeded
Requested by
GitHub
Duration
00:02:30
Build pipeline
Bot
Sorry, didn't get the time to look at this yesterday.
Pushed in changes without the handling now.
In here would it make more sense to cancel the task after moving the channel, in case the moving fails?
https://github.com/python-discord/bot/blob/12c80fb664e612a2319dfde7d341737159934e9c/bot/cogs/help_channels.py#L197-L198
Did you confirm that these need to be shortened and that the paginator doesn't help?
Yes, because this takes it as one line.
Something has gone wrong with the formatting:

All the truncation seems to be fine though.
[python-discord/bot] branch deleted: send\-logs\-via\-webhook
In here would it make more sense to cancel the task after moving the channel, in case the moving fails?
Yes.
Build 20200409.5 succeeded
Requested by
GitHub
Duration
00:01:22
Build pipeline
Bot
I'm not sure if I'm really worried if a permissions update doesn't work out; the worst that can happen is that the user has to wait the normal period of 15 minutes, right? Could be annoying, but it's not the end of the world for the people involved.
OK let's just delete the channel from help_channel_claimants and leave it at that.
Okay, it's time to bump this issue and increase the priority of it. We've now got a couple of days worth of experience with the current system based on permission "overrides" (see note 1) and it's not working well in ways we did not anticipate.
For those not familiar with the current mechanism, we use permission overrides to stop members from claiming a second help channel within 15 minutes of claiming their first (see note 2). We do that by adding a member-specific permission override to ...
Pushed in a fix for logging on win with this cog in the latest commit.
Should be ready now without the handling, but not sure how to handle the discarded config change that went through the merge with master.
Build 20200409.6 succeeded
Requested by
GitHub
Duration
00:01:32
Build pipeline
Bot
not sure how to handle the discarded config change that went through the merge with master.
Add a new commit or rebase. I've already reviewed and no one else has yet. There haven't been any comments left on code since the merge. Up to you.
I'd always delete when a channel is main dormant - not just in the dormant command. But it's not important.
On second thought this could be a race condition but I'm not too worried about it.
Build 20200409.7 succeeded
Requested by
GitHub
Duration
00:01:21
Build pipeline
Bot
Is there anything that's always ran when moving except the move_to_dormant itself that could be used?
Not losing out on much here through the few extra dicts pairs and as I mentioned in a previous conversation I think it makes more sense to just leave the move method to only do stuff directly relevant to it when possible with the command itself grouping the actions now.
No, I don't think so. But my point wasn't to move the delete just for the sake of moving it. It was so the dictionary would also be cleared when a move happens automatically. Really, the only benefit is that it prevents it from accumulating useless values. However, I imagine the memory footprint will still be insignificant which is why I said it's not important
Postgres backup completed!
However, I imagine the memory footprint will still be insignificant which is why I said it's not important
That's my intuition as well. Since we're keeping a mapping of channels to members, we should have a maximum of "max help channels" mappings in the dictionary under normal circumstances. Even if all channels go dormant with command invocation, the number of additional object references should be manageable.
Just to document, could you describe the race condition you were thinking of? Could be relevant if we do notice something going wrong in the future. (Although I'm not worried about that as you're not too worried about that as well.)
self.cancel_task should only be called once move_to_dormant returns, which I think is after it has done its work (in the current implementation), I think. There are currently no create_task or other non-awaited scheduling methods involved.
Due to #873 being merged, there's now a help method that tries to ensure that channels stay in sync after a permissions overwrite change has occurred on the category. I think we should use that instead here, although we're planning to change to a role-based permissions system soon anyway. Still, for now, we should probably keep it consistent.
Build 20200410.1 succeeded
Requested by
GitHub
Duration
00:01:21
Build pipeline
Bot
Maybe race condition is the wrong term. If the command is invoked when the channel is about to automatically go dormant, then it may attempt to move an already dormant channel. I am not sure what the consequences of that are. This problem would still exist anyway even if the order was flipped back around. A robust solution would probably require some sort of lock, but that would mean one lock per channel which gets relatively complex.
[python-discord/bot] Pull request review submitted: #860 discord\.py 1\.3\.x Functionality Migrating
I cannot reproduce the same results for the help command. It uses the default help command on my end.
adc75ff Tags: explicitly use UTF-8 to read files - MarkKoz
[python-discord/bot] New branch created: bug/info/869/tag\-encoding
Fixes #869
Not all operating systems use UTF-8 as the default encoding. For systems that don't, reading tag files with Unicode would cause an unhandled exception.
Build 20200411.1 succeeded
Requested by
GitHub
Duration
00:01:37
Build pipeline
Bot
Postgres backup completed!
Thanks, I see what you mean. I guess we'll found out, but this is bound to happen occasionally.
Build 20200411.2 succeeded
Requested by
GitHub
Duration
00:01:49
Build pipeline
Bot
This will avoid the extra load of upgrading to new Bulma versions as well. Kindly up the priority to critical.
[python-discord/bot] New branch created: stats
Integrates the bot with Graphite (through statsd).
Provides the following stats:
mod_alerts.{rule_name}- Triggers of the mod alertsdefcon_leaves- Users denied access due to defconcommand_error_count- Total error count of commandsbot.filters.{filter_name}- Messages violating content filtershelp.total.in_use- Total in use help channelshelp.total.available- Total available help channelshelp.total.dormant- Total dormant help channels- `help.out...
Build 20200411.5 succeeded
Requested by
GitHub
Duration
00:02:05
Build pipeline
Bot
[python-discord/bot] New branch created: bug/frontend/870/help\-channel\-dm\-category
Build 20200411.6 succeeded
Requested by
GitHub
Duration
00:01:17
Build pipeline
Bot
This strikes me as terribly inefficient. This could be done with a single loop. Maybe 40k members is still chump change for python.
Oh it's only iterating changed users not all.
Wait, yes it is all. Lol
How does this communicate? Is it async? Should we care?
Not sorted alphabetically :(
Would rather this check the category rather than relying solely on the prefix.
That's something I've been looking into. It's not async but the method for sending stats is basically a UDP payload like statname:1|c to increment a counter. As far as I can tell there is little way for this to block.
Let's name this commands.error_count to be consistent with commands.{command_name}.
The bot is in some other guilds, like the emoji server. If not accounted for, the total could be overwritten. I think all events should explicitly check for the main guild.
Why is this name prefixed with bot?
I've avoided that intentionally. Since we may want something like "Total executed commands" and for that we can look at the metric commands.* (wildcard) and get all command invocations.
Did some digging:
https://github.com/jsocol/pystatsd/issues/93
https://pypi.org/project/aiomeasures/ is async but not being updated for 5 years is concerning.
I found the same thing and struggled to make it work as well as statsd. If this is a huge issue then statsd is such a simple protocol I could probably write a custom implementation.
OK, I am fine with trying it as is. But how could we measure if being synchronous is an issue?
That's fair. How about errors.commands, in case we add more error stats in the future?
That's hard to do, I don't foresee any issues because there is no waiting on a response from statsd and I can't think of any slowdowns over the local Docker network.
Build 20200411.7 failed
Requested by
GitHub
Duration
00:01:21
Build pipeline
Bot
Build 20200411.8 succeeded
Requested by
GitHub
Duration
00:01:30
Build pipeline
Bot
c53f5bc Add suppression of ANN000-level errors for dumm... - sco1
bd25aa8 Add tests for dummy arg linting error suppression - sco1
4f6f500 Add pre-commit hooks to CI - sco1
c840863 Reword inline comment on dummy arg skipping for... - sco1
1c3eefd Add the actual pre-commit caching step that was... - sco1
[python-discord/flake8-annotations] branch deleted: dev\-next
[python-discord/flake8-annotations] New tag created: v2\.1\.0
Okay, after speaking with aeros I've decided to write a custom asynchronous transport but keep the utility of a statsd library.
Build 20200411.9 succeeded
Requested by
GitHub
Duration
00:01:38
Build pipeline
Bot
Async stats client has been implemented in https://github.com/python-discord/bot/commit/bca47a1c2e59fb112b947876cea1836879ac7282 so this should not be a concern.
Did you intentional put it in an event that may be called on bot reconnect? If not, this should go in _recreate().
Right, but recreate is not an async function, would I have to use create_task again on the loop attribute of the bot class?
It isn't critical, I can have the create_socket method check if there is an existing transport and close that before creating another one, but I'm not sure how to do it from _recreate().
Hmm right. It could go in login. If not, at the least the previous socket should be closed before you overwrite it.
Not being able to have it in _recreate kind of makes the clear() function incomplete, but in practice we don't use clear().
Build 20200411.10 succeeded
Requested by
GitHub
Duration
00:01:18
Build pipeline
Bot
I think you messed up a merge somewhere because this position was never supposed to exist in the first place.
Build 20200411.11 succeeded
Requested by
GitHub
Duration
00:01:17
Build pipeline
Bot
Use is rather than == for enums. While you're at it, do an explicit comparison for the offline status in the rare case more statuses get added.
Will Unicode be an issue. In any case, stripping emojis from help channels would be a good idea.
Regarding help channels, the cog has a function you can borrow to strip emojis.
Build 20200411.12 succeeded
Requested by
GitHub
Duration
00:01:39
Build pipeline
Bot
List comprehension is not needed.
reformatted_name = "".join(char for char in reformatted_name if char in ALLOWED_CHARS)
This is a good stat too but I meant to track the duration it is enabled, not the threshold used.
Need to suppress key errors since on bot restart claim times will not persist.
That's what the if will do though right? If there is no entry in claim_times just move on.
Right, sorry. Didn't notice the get().
Though an in would make more sense.
Build 20200411.14 succeeded
Requested by
GitHub
Duration
00:01:28
Build pipeline
Bot
Build 20200411.13 succeeded
Requested by
GitHub
Duration
00:01:56
Build pipeline
Bot
I see, we don't have that information on demand after a restart though so this would involve changes to the defcon storage in the site KV store right?
Build 20200411.15 succeeded
Requested by
GitHub
Duration
00:01:28
Build pipeline
Bot
Yeah, I think so. It just stores JSON as the value IIRC. If you think it's worth it then let's go for it.
Build 20200411.16 succeeded
Requested by
GitHub
Duration
00:01:30
Build pipeline
Bot
Mostly LGTM, I just have a couple of minor comments.
Since you just need the count, you could avoid creating a list each time the stats are reported with: sum(1 for _ in self.get_category_channels(self.in_use_category)). It wouldn't make an overly substantial difference though unless this was being called frequently.
I mentioned this in dev-core, but this particular implementation (bare asyncio.create_task()) could result in the tasks not being completed since the task is just scheduled to be ran in the background but never awaited. It's okay though if it's not particularly critical, and some missing and/or delayed data is acceptable.
Addressed in 4adcb0b0ab2b8768e31043429bdfcbf4dab607e6
For now I think we'll leave it. Stats are not critical and UDP is already a protocol which is less prone to issues.
Build 20200411.17 succeeded
Requested by
GitHub
Duration
00:01:28
Build pipeline
Bot
In future though this rudimentary async stats reporter could be rewritten to have a better error handling structure, but right now my knowledge of asyncio, while gradually improving, is not quite there yet.
If anyone does fancy taking it on at a later date then that's fine by me.
[python-discord/bot] branch deleted: stats
Build 20200411.18 succeeded
Requested by
Joseph Banks
Duration
00:04:09
Build pipeline
Bot
Connected!
Build 20200412.1 succeeded
Requested by
Joseph Banks
Duration
00:03:21
Build pipeline
Bot



