This restricts the discoverability of this feature because if users do .help bm del in a public channel it shows an error saying "You are not authorized to use this command". It would be more user-friendly if it could mention the delete command can only be used in DMs. I'm not sure if this is a dpy thing or a custom thing.
#dev-log
1 messages ยท Page 88 of 1
Tested locally, works well ๐ Just several clarifications on its behavior and some trivial fixes.
This is what happens when I double bookmark a message (using message link to DMs, see comment on line 112 :))

This is because it proceeds to sending the pin reaction embed after calling action_bookmark on line 164. I mean it's not a bad thing, of course, since others may be able to bookmark that message regardless whether the original user has already bookmarked it before. Is th...
technically this could be hacked through.
As far as I can tell, the embed title has been "Bookmark" for all bookmarks sent in dms.
imo it would not be bad if it allows other messages to be deleted as well. Also there wouldn't be need for storing bookmarks anywhere in that case. The original idea was for bookmarks but this does not sound bad idea if it allows to delete other messages.
GitHub Actions run 1424490422 succeeded.
Yeah it isn't a bad idea, but IMO it's a bit of a hack and weird to make sir-lancebot delete any of its messages using a command called .unbm
Ye, the .unbm doesn't fit there in that case. If it would be allowed to delete any messages the .unbm would be something like .del/.delete that should be existing.
A short-term solution seems like it would require making channel-specific overrides for the antispam config, which sounds kind of complicated for something that'll get removed soon anyway. If the new filter system will subsume the antispam functionality and can adequately cover this use case, we should mark this issue as stalled waiting for it to be implemented.
I've identified the cause of the first case - users can claim as many help channels as they want if they leave the server and then rejoin.
The second remains a mystery as the logs don't have any meaningful and it seems their Help Cooldown role was randomly removed after 3 minutes of them claiming their original help channel.
5da7bdf Unpin all messages when help channel goes dormant - dementati
[python-discord/bot] New branch created: feature/1903/fix\-pin\-inconsistency
GitHub Actions run 1424853385 succeeded.
Pretty trivial but let's update the type hint here
async def wtf_python(self, ctx: commands.Context, *, query: Optional[str] = None) -> None:
Apart from that, LGTM ๐
[python-discord/sir-lancebot] Checks Successful on PR: #936 Limit user reactions on embed pagination
GitHub Actions run 1425348824 succeeded.
[python-discord/sir-lancebot] Checks Successful on PR: #936 Limit user reactions on embed pagination
GitHub Actions run 1425363780 succeeded.
Connected!
GitHub Actions run 1425366950 succeeded.
8ae1576 Only re-run filters in on_message_update if c... - TizzySaurus
[python-discord/bot] New branch created: filter\-improvement
GitHub Actions run 1425518834 succeeded.
GitHub Actions run 1425523588 succeeded.
Connected!
GitHub Actions run 1425690756 succeeded.
This would not alert us when an embed has been added to a message, which is why we should only really be skipping the filters if the message was pinned or unpinned.
This would not alert us when an embed has been added to a message, which is why we should only really be skipping the filters if the message was pinned or unpinned.
We don't want to be alerted of that, since it means we'll get double-pinned for domain filters
We might miss self-bots though.
This is only for message edits, can you actually edit an embed in?
We might miss self-bots though.
I believe we have other filters for that
A short-term solution seems like it would require making channel-specific overrides for the antispam config, which sounds kind of complicated for something that'll get removed soon anyway. If the new filter system will subsume the antispam functionality and can adequately cover this use case, we should mark this issue as stalled waiting for it to be implemented.
I spoke to @mbaruh about this yesterday and he confirmed this will be possible with the rewrite. Will add the "stalled" label :+1:
The reason we got two pings for that mod-alert is because of an oversight in the embed filter. So we should be running our filters on embed additions, I can PR a fix for the embed filter.
https://google.com produces an embed with a url https://google.com/ which don't compare equal. We should ignore trailing backslashes in urls to reduce false positives.
[python-discord/bot] New branch created: dynamic\-views
Adds views for commands to navigate groups.
For subcommands, a button is added to show the parent's help embed.
For groups, buttons are added for each subcommand to show their help embeds.
The views are not generated when help is invoked in the context of an error.
The code has gone through several iterations of design, and this is what I arrived at.
Because conversion of callbacks to buttons is done in subclass_init of the view baseclass, I had to create Button subclasses.
Beca...
GitHub Actions run 1425957035 failed.
GitHub Actions run 1425981512 succeeded.
GitHub Actions run 1426043429 succeeded.
I think the output looks just a tad nicer when the "go to repository" link is on a line by it's own:

If they're unpinned when the channel becomes available, then why even bother unpinning when it goes dormant?
This allows us to get rid of the message cache with no known disadvantages.
Getting pinned messages requires an API call to Discord. With the cache, this is avoided. That is basically the only advantage. That being said, this sort of optimisation is not necessary; it was nice to have but it's not worth keeping if it's causing consistency issues.
I don't think Literal does a conversion to lowercase, but I don't think anyone was relying on that feature previously.
I think the output looks just a tad nicer when the "go to repository" link is on a line by it's own:
I agree! Added a single new line character, but haven't tested locally.
GitHub Actions run 1426927049 succeeded.
GitHub Actions run 1427846886 succeeded.
GitHub Actions run 1428086592 succeeded.
GitHub Actions run 1428092655 succeeded.
GitHub Actions run 1428095142 succeeded.
Currently it looks like this:

description="A repository filled with suprising snippets that can make you say WTF?!\n\n"
I think double newline looks a bit better. Perhaps we could switch to the discord link button (like .challenge) when we start using it more often in other places, but this is good for now.
GitHub Actions run 1428203493 failed.
Description & Reasoning
In a few commands like hacktoberissues, we've hardcoded . as the prefix which won't make sense if a user is using a different prefix for the bot.
Expected Behaviour
The correct prefix should be displayed, by fetching the correct prefix through the constants module.
Would you like to implement a fix?
- [x] I'd like to implement the bug fix
- [ ] Anyone can implement the bug fix
GitHub Actions run 1428772707 succeeded.
We should be running our filters on embed additions. I can PR a fix for the embed filter.
#1938 relevant issue.
@Qwerty-133 This has been addressed :+1:
GitHub Actions run 1428928144 succeeded.
Everything looks good to me, thanks!
1302632 Only re-run filters in on_message_update if c... - TizzySaurus
[python-discord/bot] branch deleted: filter\-improvement
Connected!
GitHub Actions run 1428939052 succeeded.
GitHub Actions run 1429058090 succeeded.
Also tested locally, the only odd behavior I found was when doing .challenge R it would send an error embed:

But would work fine with .challenge r

Other than that, the Beta languages seem to be supported as addressed in the Sentry Issue.
So, I see valid points on both sides.
What's the consensus?
I can push a draft solution how the testing using a test DB would look like. (Or, how it would not )
Everything's wrapped up, thanks for implementing this!
I don't really care all that much, so I'll just mark this as resolved. It's fine
I tried it just now, you cannot. This style of embed looks good enough.
Can we also display attachments if there are some? You don't need to download them. Just use discord.Embed.set_image with the attachment link.
This doesn't account for threads
GitHub Actions run 1429878121 succeeded.
@RohanJnr what's the status on this?
This isn't the only place language is used. It would be better IMO to reassign lowercased language at the beginning (before line 278) so we can avoid calling .lower() multiple times. Further, since SUPPORTED_LANGUAGES["beta"] are all lowercase, line 301 wouldn't work for an uppercase language argument :)
GitHub Actions run 1430556305 failed.
The site pr is almost ready, current being reviewed
65cfed4 Handle .wtf command without query (#939) - brad90four
GitHub Actions run 1430565587 succeeded.
Connected!
GitHub Actions run 1430567720 succeeded.
[python-discord/sir-lancebot] branch deleted: test
If they're unpinned when the channel becomes available, then why even bother unpinning when it goes dormant?
Apparently, it's the API itself that bugs out occasionally, and making two passes will decrease the likelihood that there are pins remaining by the time the channel becomes available.
Getting pinned messages requires an API call to Discord. With the cache, this is avoided. That is basically the only advantage.
That is true.
it was nice to have but it's not worth keepi...
The pins issue is solved by #1909 and #1936.
GitHub Actions run 1430889318 succeeded.
[python-discord/bot] New branch created: feature/1903/sync\-cooldown\-roles
2e4cbf4 Sync Help Cooldown role with help channel claim... - dementati
Every hour, retrieve all channel claimants from Redis cache,
get all members who currently have the Help Cooldown role,
then remove the role from any such member who is not a
channel claimant as per the cache.
GitHub Actions run 1431085453 succeeded.
[bot] Branch feature/1903/sync\-cooldown\-roles was force-pushed to `a8bb2e3`
GitHub Actions run 1431483975 succeeded.
GitHub Actions run 1431623918 succeeded.
[python-discord/site] branch deleted: save\-reminders
[python-discord/sir-lancebot] branch deleted: Add\-border\-around\-bat
GitHub Actions run 1431733772 succeeded.
Connected!
GitHub Actions run 1431856426 succeeded.
Do we want to add punctuation at the end?
Since the previous if-statement should be removed, this can now raise a ValueError.
In the same channel right?
We're loosing all the git blame history here.. can you try using git mv?
That may save something?
Actually I will Request changes so that this can't be merged until we have looked into this more.
67fbe89 Check number of available help channels hourly - dementati
[python-discord/bot] New branch created: feature/1903/fix\-channel\-inconsistencies
If number of available help channels is incorrect,
reload the HelpChannels cog.
GitHub Actions run 1432276520 succeeded.
Would this help with the issue? I imagine if the count drops the admins will be notified sooner than the one hour period in most cases
the maximum amount of available channels is configurable in the config, this should use the config value
a3b55c5 Use max available help channels from config ins... - dementati
GitHub Actions run 1432301752 succeeded.
Would this help with the issue? I imagine if the count drops the admins will be notified sooner than the one hour period in most cases
I used the one-hour interval mentioned in the original issue, but perhaps that was referring to actually reloading the cog and not just checking the available channel count. Since getting the category channels in this manner doesn't seem to require an API call, I guess we could do it much more frequently at no cost.
No issue, approved here:
#dev-contrib message

In addition to !pypi, a user can now also use !pip in order to get package information, since pip is the package index.
GitHub Actions run 1432310867 succeeded.
GitHub Actions run 1432328004 was cancelled.
GitHub Actions run 1432343365 was cancelled.
[python-discord/patsy] Checks Successful on PR: #3 minor: add missing word to commiting instructions
GitHub Actions run 1432369940 succeeded.
GitHub Actions run 1432349263 failed.
GitHub Actions run 1432383594 was cancelled.
GitHub Actions run 1432349263 was cancelled.
GitHub Actions run 1432392412 succeeded.
[python-discord/patsy] Checks Successful on PR: #4 minor: add missing word to commiting instructions
GitHub Actions run 1432420039 succeeded.
[python-discord/patsy] Checks Successful on PR: #4 minor: add missing word to commiting instructions
GitHub Actions run 1432428536 succeeded.
GitHub Actions run 1432431286 succeeded.
GitHub Actions run 1432440988 succeeded.
For list.remove? The if statement can be kept for add_or_remove == "remove" (even though it may be guarded by this if .unbm is only for actual bookmarks).
mm, @Bluenix2, you make a fair point, but we shouldn't block this merge over this small amount of git blame. It's fine to lose a little git blame in a refactor like this, and cleaning this up now after the fact is going to be quite annoying. I don't want this PR getting closed or abandoned over a technicality that might never have any real practical use for us, especially after all these wonderful people spent time reviewing it.
Actually I will Request changes so that this can't be merged until we have looked into this more.
Currently when messages are deleted by the anti-spam filter or by the clean command, a message log is created with info of of the user who sent it, at what time, and the contents of each message.
With recent developments, these two features now work across multiple channels, but the logs don't include that information making them sometimes hard to follow.
Including the channel ID for each message seems to make sense, but at the same time we navigate channels using their names. Perhaps ...
LGTM, thanks for handling the lower case!
After countless code-reviews, I have played around with this - very good job here!
Frontmatter, groups and cooldowns all working well! Thanks Numerlor. There are some conflicts to resolve before this can be merged though
When trying to send a link to a deleted message I got the following exception:
python-discord-bot-bot-1 | 2021-11-08 20:36:51 | bot | ERROR | Unhandled exception in on_message.
python-discord-bot-bot-1 | Traceback (most recent call last):
python-discord-bot-bot-1 | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/converter.py", line 397, in convert
python-discord-bot-bot-1 | return await channel.fetch_message(message_id)
pytho...
50f3937 Migrate to asyncpg - ChrisLovering
a230ebd Add helper task for generating migrations - ChrisLovering
67e88b2 Migrate models to use BigInt for Discord ids - ChrisLovering
6f3ea1d Move SessionMiddleware to top with other middle... - ChrisLovering
6af9d15 Add basic CRUD operations for users - ChrisLovering
log.info(f"Skipping cog {name}, found in unloaded cache.")
log.info(f"Skipping ext '{name}', found in unloaded cache.")
This if-statement is still wrong, but now for the wrong reason. await self.unloads_cache.get(name) becomes None and then you invert this using not.
What ends up happening is the opposite of what we want.
GitHub Actions run 1436665680 succeeded.
PR Author
Workflow Run
Source Branch
drop-external-ing...
GitHub Actions run 1436652847 succeeded.
GitHub Actions run 1436704301 succeeded.
# Tuple of tuples, where each inner tuple is a role id and a month number.
# The month number signifies what month the role should be assignable,
# use None for the month number if it should always be active.
ASSIGNABLE_ROLES: tuple[tuple[int, Optional[int]], ...] = (
note: also requires from typing import Optional
Maybe add an annotation like the comments beautifully describes it?
Maybe we should add a trace or debug call when this happens?
This does not have the same order as the constants file and default config ๐
It's fine to leave it but I have a strong urge to point it out
When the member isn't in cache before is after will be True afaik. Do we want to run the check if there's a possiblity that the name or nickname was changed? This isn't very expensive right?
cleaned_normalised_name = "".join([c for c in normalised_name if not unicodedata.combining(c)])
List comprehension for that Sonic the hedgehog speed?
I agree with Wookie here, with a small comment that basically clarifies what that last line does this is more maintainable.
Something like "Remove members who's already in the 'tier_members' list and have a higher role".. maybe?
Will this work correctly (both semantically doing what you want to - and not breaking) considering the enumerate() is inside the reversed()?
I think it's still good to keep, since print() doesn't work at all if you want to debug something.
There's no check on this, anybody can send this anywhere.
"stickers, microcontrollers that support CircuitPython, or maybe even a mechanical keyboard.\n\n"
"You can" read more about how Patreon supports us, or even support us yourself, on our Patreon page "
I like to refect empty lines in the code.
"""Send information about how Python Discord uses Patreon."""
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
Shouldn't there be an empty line here?
# region: Search for infractions by given actor
@infraction_group.command(name="by", aliases=("b",))
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
I am not sure if I think this should be done, it feels more like actual buttons that when you press will "append" something rather than selecting a command.
Could just be a matter of getting used to it?
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
Won't this be done by discord.py if you just use the correct method being add_item()?
Says what it does on the tin. Best used as a black box, without looking too deep into the cursed inner workings.
Takes a URL that's presumably behind some redirection, and unfurls it until it reaches the actual redirect hidden at the end of the rainbow (or dies trying). See bot#1933 for the intended usage of this worker.
4b716c2 Add missing newline after region comment - TizzySaurus
Still can't reply to reviews (GitHub seems to hate me) but you're perfectly right. Have just fixed @Bluenix2 :+1:
Is the status of this still WIP?
GitHub Actions run 1437077836 succeeded.
Shouldn't there be another loop that sets all of them to TRACE?
Lol it looks like I had a few old comments I never submitted.
This claims to be "via DM" but you added the guild_only() check?
MODERATION_ROLES = {Roles.moderation_team, Roles.admins, Roles.owners}
We do a few in checks so we might as well make it a set.
This would be handled by the Literal.
if element[0] not in {"turtle", "stegosaurus", "ghostbusters", "turkey", "mutilated", "kiss"}:
What character is that?
@TizzySaurus
Closes python-discord/meta#154
Let the bikeshedding begin!
GitHub Actions run 1437165419 succeeded.
@SavagePastaMan
A few first-glance alterations:
I don't like that we're calling the variable sum, thus overriding the built-in sum() function. The type hint here also doesn't particularly make sense. Inline assignment type hints like this should only be done when the type isn't obvious from the variables / other type hints.
There's also some small rewording I've done here.
Current proposal:
 and also mention static type checkers like mypy which can be used to "enforce" type hints.
Yes, I agree.
@TizzySaurus
The root logger is set to TRACE so loggers we don't set to DEBUG explicitly inherit that
๐ดโโ๏ธ๐ดโโ๏ธ๐ดโโ๏ธ๐จ๐จ
Should probably mention that the sum variable can be inferred (or guessed could be a easier word to understand) by whatever static type checker the user is using.
A typehint indicates what type something is expected to be. For example,
Would this be an improvement in wording?
"Type hint(s)" should be two separate words
GitHub Actions run 1437375156 succeeded.
if "#" not in hex_code:
hex_code = f"#{hex_code}"
if len(hex_code) not in (4, 5, 7, 9) or any(_ not in string.hexdigits+"#" for _ in hex_code):
raise commands.BadArgument(
message=f"HEX values must take the form **#RRGGBB(AA)** or **#RGB(A)**. User input was: `{hex_code}`.")
hex_tuple = ImageColor.getrgb(hex_code)
if len(hex_tuple) == 4:
hex_tuple = hex_tuple[:-1] # color must be RGB. ...
def _rgb_to_cmyk(rgb: tuple[int, int, int, int]) -> tuple[int, int, int]:
One too many here
No, since it's making sure that query_splitted isn't over the length of 2 (python, 8 would be valid but python, 8, let's break the bot wouldn't be valid.)
I believe we need 307 here too
19df10c Filter the same messages in both listeners. - Qwerty-133
[python-discord/bot] New branch created: ignore\-bot
The on_raw_message_delete listener doesn't filter messages from bots or DMs unlike on_message_delete, which leads to unwanted logs.
GitHub Actions run 1438913934 succeeded.
Connected!
GitHub Actions run 1438942258 succeeded.
Sentry Issue: BOT-1Q3
AttributeError: 'int' object has no attribute 'author'
File "discord/client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "bot/exts/moderation/modlog.py", line 616, in on_raw_message_delete
if self.is_message_blacklisted(event.channel_id):
File "bot/exts/moderation/modlog.py", line 525, in is_message_blacklisted
if message.author.bot or ...
[python-discord/bot] New branch created: refactor\-modlog
Closes #1945
Closes BOT-1Q3
This PR also removes the need to cache message deletions by only listening to on_raw_message_delete.
GitHub Actions run 1439351283 succeeded.
Looks good! nice one!
Is the status of this still WIP?
Sorta stalled on what to do with the color names. Currently it uses rapidfuzz to match the name if it is close, or the actual hex code. Since even one character off for the hex code can throw a non-match, currently the color can look the same but not have a name. Current ideas are to use difflib instead, or to create an RGB: color name mapping and try to use an RGB point distance calculation to determine the closest RGB color, then use that for ...
Wait, its the other way around. Should be 3 ints incoming, to 4 ints outgoing.
GitHub Actions run 1439563790 succeeded.
I'm not sure the current code is set up to handle RGBa hex codes. Is this something that should be added in addition? I feel like the most common is #0099FF type of hex. If there is an error message to raise, maybe we can raise it with the limits of the alphanumerics used? Like "Hex values must be 6 characters long, with characters being in the range of 0-9 and A-F."
Connected!
GitHub Actions run 1439989783 succeeded.
You're right, we can't handle alpha. I convert it to RGBA and remove the alpha if there is one. I don't think it's helpful to not convert the color just because there's an alpha included. Instead, we should convert the rest of the color and ignore the alpha, showing a message that transparency will not be shown. We could even put an indicator for transparency as a percentage, separate to the color preview
91d5e45 Return More Data On Broken Location Headers - HassanAbouelela
Current ideas are to use difflib instead, or to create an RGB: color name mapping and try to use an RGB point distance calculation to determine the closest RGB color, then use that for a name.
The latter seems better but out of all things it's probably more code and logic for you (in the grand scheme of things it probably requires the least amount of code - but that is abstracted away).
As long as rapidfuzz doesn't give annoyingly wrong results I see this as a non-critical feature th...
Does the code break if an RGBA color is sent?
Is there anything I need to do to test this? I have both rebuilt the container with docker-compose build and removed it using docker-compose rm.
I added this logging to make sure changes were applied:
def setup() -> None:
... # Setup of all the loggers
coloredlogs.install(level=logging.TRACE, logger=root_logger, stream=sys.stdout)
root_logger.info('Installed coloredlogs')
Yet still there's no colours like the other bot has, you can see that Docker ...
Is there anything I need to do to test this? I have both rebuilt the container with
docker-compose buildand removed it usingdocker-compose rm.I added this logging to make sure changes were applied:
def setup() -> None: ... # Setup of all the loggers coloredlogs.install(level=logging.TRACE, logger=root_logger, stream=sys.stdout) root_logger.info('Installed coloredlogs')Yet still there's no colours like the other bot h...
Looks 99% good, just two small comments.
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
The infractions from header doesn't have the user in a codeblock. Could you make it match?
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
I'm leaving this up to you, but since you're calling len everywhere to call this function, it might look neater to send the infraction list itself and call len inside the function.
Does the code break if an RGBA color is sent?
yes. Specifically discord.Color.from_rgb(*rgb), since it only takes 3 args
Is there anything I need to do to test this? I have both rebuilt the container with
docker-compose buildand removed it usingdocker-compose rm.
I added this logging to make sure changes were applied:def setup() -> None: ... # Setup of all the loggers coloredlogs.install(level=logging.TRACE, logger=root_logger, stream=sys.stdout) root_logger.info('Installed coloredlogs')...
I think we should just follow what bot does
Should work now
GitHub Actions run 1441567321 succeeded.
GitHub Actions run 1441649666 succeeded.
GitHub Actions run 1441948852 succeeded.
Connected!
GitHub Actions run 1441956413 succeeded.
Here is possibly another instance:
Since it wasn't mentioned in the original issue, I am not going to implement alpha support for the base PR. The hex codes having that as an input will pass silently, but will fault out if too long.
It is a different type of space, using the normal space ( ) didn't keep the items aligned in the embed and they were stripped out.
GitHub Actions run 1442099227 succeeded.
It is the user ID, discord.py won't format it.
Debug logs aren't shown in the production setup, hence I kept it as info.
When this is invoked, it believes ensure_leaderboard has already been run on the game ext... See the coinflip example.
So basically, a member can only get a maximum of MAX_PER_GAME_PER_DAY_POINTS points in a day, say I have 95 points now and I win a coinflip game, so I should get 105points but since the max points are 100, I can only earn 5 more points. Therefore I only get 5 more points, so in the total leaderboard, I get 5 more points which is basically MAX_PER_GAME_PER_DAY_POINTS - current_points_today as the docstring says.
Now, say I have 80 points, then I would get a total of 90 point...
Probably, not the same but can be used to achieve the same functionality by if not ctx.invoke_without_command as invoke_without_command gives True if there is no subcommand. But invoked_subcommand is much simple and explicit IMO.
GitHub Actions run 1442200754 succeeded.
Tested it out as written above, it did not work. Keeping the code as below:
@commands.group(aliases=("color",), invoke_without_command=True)
async def colour(self, ctx: commands.Context, *, extra: str) -> None:
"""User initiated command to create an embed that displays colour information."""
if ctx.invoked_subcommand is None:
try:
extra_colour = ImageColor.getrgb(extra)
await self.send_colour_response(ctx, extra...
Tested it out as written above, it did not work. Keeping the code as below:
@commands.group(aliases=("color",), invoke_without_command=True)
async def colour(self, ctx: commands.Context, *, extra: str) -> None:
"""User initiated command to create an embed that displays colour information."""
if ctx.invoked_subcommand is None:
try:
extra_colour = ImageColor.getrgb(extra)
await self.send_colour_response(ctx, extra...
Tested and functioning, closed with 1de5e9b
GitHub Actions run 1442228022 succeeded.
Not implementing in the base PR as mentioned here: #dev-contrib message
Otherwise looks good, great work
This has been repeated in a number of places.
if any(c not in range(256) for c in (red, green, blue)):
hex_ = "".join(hex(val)[2:].zfill(2) for val in rgb)
GitHub Actions run 1442240042 succeeded.
GitHub Actions run 1442341972 succeeded.
Somehow a [non breaking space](#dev-contrib message) creeped up in here that makes github not render it as a proper heading. Toggle rich diff, else it looks like nothing has changed ๐
GitHub Actions run 1442415730 succeeded.
I really like this feature! The code looks good, I just have a few things to mention in terms of the UX. Apart from the comments below...
- I think it's a bit redundant for all the subcommand help texts to start with "Command to create an embed for" (or at least "Command to" since we all know the list is about its sub commands).
- For the help for the top level
.colourcommand, how about something like "Display an embed with information about a given colo[u]r"? I'm not sure if "User i...
This doesn't match all possibilities for invalid hex values. Perhaps we could try-except a ValueError on line 142 so the bot can show some output (like an error embed) for invalid value?

Currently there is no output as an ValueError is encountered.
This doesn't quite look right

Hex information for
('ee439f',)
Perhaps we could special case HEX mode here and only show the first item of the tuple?
This shows up in the command signature. I think that extra doesn't convey much as to what type of input it can accept. How about this to make it more user friendly?
async def colour(self, ctx: commands.Context, *, name: str) -> None:
Remember to change line 82 too :)
GitHub Actions run 1442915531 succeeded.
@brad90four what's the status of this PR as of today?
Connected!
GitHub Actions run 1442927880 succeeded.
We can even enhance the hexdigits check a bit as only the first digit of a hex can be #.
if hex_code[0] != "#":
hex_code = f"#{hex_code}"
if len(hex_code) not in (4, 5, 7, 9) or any(_ not in string.hexdigits for _ in hex_code[1:]):
Isn't the help embed sent now also? Looks like that is done on bot but not here. Maybe we could add that functionality for sir-lancebot also (after this PR).
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
There we a bit of bikeshidding this util function in #dev-contrib and in the end we decided to make it take the actual format count, so I'll leave it as-is.
2aad138 Unify infraction embed title - TizzySaurus
GitHub Actions run 1443364698 succeeded.
b2367b2 rework clean to fully use delete_messages ins... - Senjan21
7bcc74f rename command messages to until - Senjan21
3797474 Introduce cache to cleaning as well as fix cancel - Senjan21
0a7c728 Implement range clean command - Senjan21
bb26ed3 set self.cleaning to False once done cleaning - Senjan21
[python-discord/bot] branch deleted: infractions\-by\-command
GitHub Actions run 1443552521 succeeded.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
I'm not sure what you mean here
Connected!
GitHub Actions run 1443572993 succeeded.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
Like the comment says, that you don't show buttons for only some of the subcommand. If you can't add the menu properly then don't add it.
I can add logging
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
This is never called, it's closed immediately after creation. This is an artifact left behind from when the function had a slightly different structure.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
When you call the help command directly, the context for the help cog gets updated, but here that doesn't happen anywhere and the context is empty.
I'm not at a computer at the moment, but you'll be able to see the bug that happens if you remove that line and then try to do !clean &$#
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
Hmm yeah I'll try that, thanks
GitHub Actions run 1444001327 succeeded.
@brad90four what's the status of this PR as of today?
Should be on the final stretch now, just fixing up some UX / UI that hedy found in their testing. Hopefully I can address the last of their concerns by the end of the week.
Just a thought, would a general "Hex error" embed be enough to cover both situations you have pointed out?
I can have it default to the random mode, that's fine by me.
I'm away from my testing setup till the end of the day, but this should work:
@commands.group(aliases=("color",), invoke_without_command=True)
async def colour(self, ctx: commands.Context, *, color_input: Optional[str] = None) -> None:
"""User initiated command to create an embed that displays colour information."""
if color_input is None:
await self.random()
Might wanna return there
Since the BadArgument is raised in the function match_colour_name, would this now need to be an async function so that it can return an embed directly?
def match_colour_name(self, input_colour_name: str) -> str:
"""Convert a colour name to HEX code."""
try:
match, certainty, _ = rapidfuzz.process.extractOne(
query=input_colour_name,
choices=self.colour_mapping.keys(),
score_cutoff=80
)...
That could work. If you don't want it to be async, other possible solutions include:
- raise a custom error for no color name matched, or
- return None for no color name matched
Both of which would need to be handled specifically when calling the function of course.
GitHub Actions run 1444397297 succeeded.
Haven't tested either, but this looks like it would continue on line 87 so we might need to return early
await self.random()
return
GitHub Actions run 1444409816 succeeded.
hex_error_embed = discord.Embed(
title="The input hex code is not valid.",
description=f"Cannot convert `{hex_code}` to a recognizable Hex format. "
"Hex values must be hexadecimal and take the form *#RRGGBB* or *#RGB*.",
colour=discord.Colour.dark_red()
)
await ctx.send(embed=hex_error_embed)
change on line 151 should also be made on 250. Will the other color modes h...
It should be raised by the BadArguments, with the details of the accepted ranges for the other commands.
This is what I have locally for the match_colour_name:
async def match_colour_name(self, ctx: commands.Context, input_colour_name: str) -> Union[str, None]:
"""Convert a colour name to HEX code."""
try:
match, certainty, _ = rapidfuzz.process.extractOne(
query=input_colour_name,
choices=self.colour_mapping.k...
That's an interesting idea, I'm not a fan of the structure of the proposed template, but if we have a good one to use, sure, why not. I do like the mention of length limits and what should each paragraph be though.
GitHub Actions run 1445911633 succeeded.
705fe00 Fix !infractions by me - TizzySaurus
[python-discord/bot] New branch created: infractions\-by\-command
Extension to #1926.
The literal converter is now before the Member converter so that "me"/"m" isn't attempted to be converted to a Member.
Also swaps from discord.Member to UnambiguousMember.
GitHub Actions run 1446031833 succeeded.
b2367b2 rework clean to fully use delete_messages ins... - Senjan21
7bcc74f rename command messages to until - Senjan21
3797474 Introduce cache to cleaning as well as fix cancel - Senjan21
0a7c728 Implement range clean command - Senjan21
bb26ed3 set self.cleaning to False once done cleaning - Senjan21
GitHub Actions run 1446092595 succeeded.
I just realized, the actor doesn't necessarily have to be a member.
For some reason I thought it did despite thinking this over at least a dozen times during development. Thanks.
2e0e0a1 Change from UnambiguousMember to `Unambiguous... - TizzySaurus
GitHub Actions run 1446174277 failed.
GitHub Actions run 1446229139 succeeded.
9c0d91b Merge PR #1947: Fix !infractions by me - TizzySaurus
[python-discord/bot] branch deleted: infractions\-by\-command
Connected!
GitHub Actions run 1446248605 succeeded.
Looks good to me. From my understanding, this is only enabled if a tty is detected, so no weird formatting errors should crop up.
2b3c796 Add dm_sent field to infractions model - TizzySaurus
[python-discord/site] New branch created: add\-dm\_sent\-field
85ab440 Add dm_sent field to infractions model - TizzySaurus
[python-discord/api] New branch created: add\-dm\_sent\-field
Closes #20.
Exactly as the title says.
GitHub Actions run 1446464409 succeeded.
Thanks for the PR! We do not need to merge it with the API as they don't rely on each other. What we do need though is to either add bot side code to handle it at the same time, or have a sensible default value. Based on what you have so far, we should just set the default to null (do we even need to?).
Thanks for the PR! We do not need to merge it with the API as they don't rely on each other.
Will update that :+1:
What we do need though is to either add bot side code to handle it at the same time, or have a sensible default value. Based on what you have so far, we should just set the default to
null(do we even need to?).
Yep, the default value will benull. I looked through the docs and after a while of figuring out the structure etc. I found out that the default value for `B...
Added the return and had it call random by default, this is how it looks:

Here is the behavior now:

Made it async, here is what it looks like:

Added the fixes for description and embed=, seems like it is working now.
@Xithrius , @Bluenix2 , @Shivansh-007 , @Sn4u, @hedyhli I think this is finished.
GitHub Actions run 1446698991 succeeded.
"""Show a random colour."""
"""Show colour closest to provided name."""
"""Show colour provided in HSV format."""
"""Show colour provided in cymk format."""
Darned commit making all of my changes outdated before I even published it.
GitHub Actions run 1446729254 succeeded.
Thanks for all your work, we're almost there! I really like that there's a .colo[u]r color_input shortcut as well as .colo[u]r providing information about random colors if no subcommand or argument is given -- super useful if someone would like to design something that doesn't take into account color palettes (ooh that sounds like a nice feature request in the future).
Just some miscellaneous things here, most likely my last non-approving review :)
Bit of a nitpick too since this is probably unlikely to happen and not that easy to notice, but #RRGGBB and #RRGGBBAA can produce different colors:


It seems t...
A tiny bit repetitive imho
If no subcommand is called, a randomly selected colour will be shown.
UnboundLocalError: local variable 'match' referenced before assignment on the next line if the color name matched isn't found.
If we return here though, there would be an error about None not having len() on line 163. I feel like the neatest solution here is to simply return None and send the error embed in self.name there, if the return value of this is None.
Or if you still like to keep this async and have it send the error embed, you could return on line 162 if the return v...
Currently, when you try to add an invite link to the invites whitelist, it is rejected if the given link begins with https://, http://, etc.
For example:
!whitelist add guild_invite https://discord.gg/aMZJ7NAr R Programming language
Fixing this should just be a matter of adding the prefix to the regex pattern.
Relevant parts of the code:
- the regex
- [the validator](https://github.com/python-disco...
The problem comes from #1817, that changed the matching inside the converter to a full match to access named capture group. I think the best solution is to continue to do a partial match.
Could we take this as an opportunity to clean up the regex a bit, and possibly add a couple of regression tests?
I find the re.VERBOSE flag can make the structure of a regex clearer (and permits comments in the pattern). I haven't tested this, but to illustrate:
INVITE_RE = re.compile(
"""
(
(https?://)?
(discordapp|discord|dis)
(.|dot)
(com|gg|me|li|io)
(/|slash)
(invite)?
)
...
Sorry, the code I wrote above is littered with errors. This is closer to the original regex:
INVITE_RE_NEW = re.compile(
"""
(https?://)?
(
(discordapp|discord) (.|dot) com (/|slash) invite
| (discord) (.|dot) (me|li|io|gg)
)
(/|slash)
(?P<invite> [a-zA-Z0-9-]+)
""",
flags = re.IGNORECASE | re.VERBOSE,
)
I tested it out on a freshly created database, it works perfectly fine.
Thank you!
For any future viewers of this issue, we had another trigger today due to the member being banned so that seemed to be the cause (as opposed to a faulty cache).
4c42f84 Change log level from WARNING to DEBUG. - TizzySaurus
[python-discord/bot] New branch created: TizzySaurus\-patch\-1
Sentry Issue: BOT-1Q8
User#disc (ID) isn't a member. Not giving cooldown role or sending DM.
Closes #1949.
As was stated in #1845 the WARNING was only to trigger a sentry issue to see if we could find a cause for the issue (message.author being a discord.User).
We have now discovered today from the warning triggering that it's caused by the member being banned. Since we now know the cause this can be downgraded to a log.debug.
Course of action here is just to lower from a WARNING to a DEBUG as the warning functionality has served its purpose (further debugging of #1839).
GitHub Actions run 1450218554 succeeded.
eb15819 Replace psycopg with asyncpg - ChrisLovering
683b1aa Add taskipy and a revision helper task - ChrisLovering
d94d767 Create docker volume for alembic migrations - ChrisLovering
b8d084a Switch to asyncpg for migrations - ChrisLovering
7e657fc Remove database validations in Pydantic models - ChrisLovering
[python-discord/api] New branch created: async\-sqlalch
This PR moves our migrations to asyncpg, adds a docker volume for migrations and adds a helper task for generating those migrations.
Simply by running poetry run task revision "Migration message here." while the docker containers are running, a migration will be generated.
Something to keep in mind is that, now that we are using asyncpg, no database validation can be run within Pydantic models. This now needs to be deferred to the routes that need that validation instead.
[python-discord/site] New branch created: easy\-docker\-migrations
This PR adds two things
- An easy way to generate migrations running under a pure docker setup
- Simply run
poetry run task dockermigrationsand all the migrations will be created - Under the hood this calls docker exec and then through the magic of volumes it appears in the local system
- Simply run
- Add a persistent volume for postgres data
- This means
docker-compose downwon't lose your db data anymore. - If needed you can still do
docker-compose down --volumes
- This means
GitHub Actions run 1450545468 succeeded.
Looks fine, the bogus DATABASE_URL in the CI has to be changed. It was added because of the Pydantic configuration, I'll resolve all of those problems in my next PR, but it has to be updated in order for the tests to pass.
Thank you!
GitHub Actions run 1450558403 succeeded.
The home app's migrations should also be mounted. This seems to be the only other app that has models.
The home app's migrations should also be mounted. This seems to be the only other app that has models.
Not sure why I forgot you mentioning other apps having migrations yesterday. I've force pushed a new mount ๐
GitHub Actions run 1450568294 succeeded.
GitHub Actions run 1450677423 succeeded.
I am following you. I think it makes sense to remove the async call and just handle it within the name command, I added an if statement that sends the error embed and returns if there is no match found. Should be fixed with: b905415
๐ I'm going to leave the alpha values for someone else.....but I did strip them off of the embed. Should be fixed with: 1914905
Because of recent discussions and changes, I decided to close this pull request, and rewrite the changes from (almost) scratch.
Hi! I'd love to have a go at this
a345a91 Change log level from WARNING to DEBUG. (#1... - TizzySaurus
[python-discord/bot] branch deleted: TizzySaurus\-patch\-1
Greetings.
Please see this page on making commits with great messages, to increase users' knowledge of the update history.
Thanks!
I'll be closing this for now, due to inactivity. If/when this is re-opened, please refer to this comment for file structure changes.
Besides that, we've moved away from pipenv, and poetry is now in use.
Thanks!
@TizzySaurus I know I pinged you before in Discord and you responded, but message search has been broken for a while on my system so I'm not able to refer to what you said.
What do you think should be done with this PR? Will you be resuming progress, or should we close this/make it up for grabs?
@ToxicKidz Please resolve these here conflicts.
Thanks!
Connected!
GitHub Actions run 1451135943 succeeded.
Sorry if this was gone over already, but why don't we have Optional[str] in place of Union[str, None]?
def match_colour_name(self, ctx: commands.Context, input_colour_name: str) -> Optional[str]:
@TizzySaurus What's the status of this PR?
Thanks!
@TizzySaurus Please fix the file conflicts here and appease the review of blue.
Thanks!
GitHub Actions run 1451165833 succeeded.
@DMFriends @Bluenix2 What's the progress of this PR so far?
@Kronifer Greetings. Will you be able to finish off this PR with the file conflicts and reviews?
GitHub Actions run 1451175323 succeeded.
@Xithrius I will not be continuing this, cowpy has an incompatible license
@DMFriends @Bluenix2 What's the progress of this PR so far?
I think I'm almost done. I'll probably need another day or 2 to get this done.
@Kronifer should we close this PR then?
@DMFriends very well. Thanks for the reply!
Very well. I hope we're able to implement this in the future.
Connected!
[python-discord/site] New branch created: edit\-on\-github
Continuation of broken PR #506, closes #459.
Continued in #623 due to borked branch.
[python-discord/sir-lancebot] New branch created: file\-log\-debug
Description
The most recent changes to the logging setup were crashing the bot on startup in prod, as /logs was read-only. This PR prevents any file logs from being written in prod, since we don't use them anyways.
This PR also moves the sentry setup into the init, so we can catch any errors that happen before we get to main (such as the one behind this bug). It's not best practice for the __init__ to have side-effects, but it really doesn't matter in this case.
Did you:
...
GitHub Actions run 1451408263 succeeded.
This is okay, but it would be nice if it started the service itself if it isn't already running.
Connected!
GitHub Actions run 1451999501 succeeded.
4bf2087 Content: update help channel claiming system - Akarys42
[python-discord/site] New branch created: content/update\-help\-channel\-timing
This PR changes the following inside the help channel guide:
- Only one help channel can be claimed at the same time
- You can use the search to find your channel
- The channel will close after 10 minutes if someone else sends a message
GitHub Actions run 1452270555 succeeded.
we only allow someone to claim a single help channel at the same time
Perhaps reword this bold part to "we only allow a user to have a single help channel at any time."
You can search in the top right corner of your Discord client
from:yourusername#xxxxto find back your channel.
Perhaps also mention the "new" !helpdm feature, which serves a similar purpose.
There's a few other areas that also need updated, and the odd grammatical point.
...will be moved down to the Python Help: Occupied category.
We've renamed the category to "Occupied Help Channels". We've also changed Python Help: Available on L39 etc. to Available Help Channels (as per the image) (Python Help: Dormant wasn't changed so that's still good).
Another minor thing is the fact we've now added emojis to the topics, so we may want to update the images?
The message has since been updated, so this image should be updated to reflect the new message.
f335d26 Bump & Lock Protobuf to 3.19 - HassanAbouelela
[python-discord/snekbox] New branch created: fix\-tests\-protobuf
Temporary PR to test the actions.
@doublevcodes Whats the status of this PR?
GitHub Actions run 1453126720 failed.
Along with the serializer, don't forget to also add the new field to the documentation there
7d85198 Update documentation to include dm_sent field - TizzySaurus
Along with the serializer, don't forget to also add the new field to the documentation there
Have done both :+1:
GitHub Actions run 1453465627 failed.
GitHub Actions run 1453587793 succeeded.
No particular reason, I guess I was more focused on having either possibility covered explicitly with Union, but that is probably unnecessary.
GitHub Actions run 1453599418 was cancelled.
GitHub Actions run 1453600854 failed.
GitHub Actions run 1453606962 succeeded.
Along with the serializer, don't forget to also add the new field to the documentation there
c0990d0 Display whether DM was sent to user when listin... - TizzySaurus
[python-discord/bot] New branch created: add\-dm\_sent\-field
Closes #1864.
The !infraction embed now show whether or not a DM was sent when an infraction was made.
Possible values:
Yes: the DM was sentNo: the DM wasn't sent (triggers for "hidden" infractions too)N/A: the infraction was made before database change so we don't know if DM was sent or not
NOTE: I've not been able to test that the N/A actually works since I didn't have any prior infractions in the database, but it should be fine.
**To be merged with [site#...
GitHub Actions run 1454014935 failed.
The nsjail version being used is 2.9, not 3.0, unless you plan on upgrading that too.
1780e38 DowngradeTo 2.9 - HassanAbouelela
[python-discord/site] New comment on pull request #624: Content: update help channel claiming system
I think besides updating the screenshots and specific details, much of this text I think warrants a re-write. Can I get a few days to read and review this page more closely?
input_colour isn't defined here - but because the random command selects a colour from the color_mapping that means that name will always be defined when this is the case and as such name or input_colour will always become name (never tries to get the value of input_colour and causes an UnboundLocalError), right?
Could there be a corner case?
This is what invoke_without_command=True does, the group command is only called if there is no subcommand so this check is extraneous.
Indicates if the group callback should begin parsing and invocation only if no subcommand was found. Useful for making it an error handling function to tell the user that no subcommand was found or to have different functionality in case no subcommand was found. If this is
False, then the group callback will always be invoked first. This means that th...
This looks very good, very happy with the restructuring and everything that's been going on in here.
I do have 2 comments but they aren't in the way of my approval. Thank you for this Brad and CyberCitizen01.
This looks amazing! This should be just the last few things left from me.
def _rgb_to_name(self, rgb: tuple[int, int, int]) -> Optional[str]:
Let's update the type hint here
I don't think this description reflects what information is actually provided in the embed.
Name information for Black
Hex information for Red
In all cases above where the command succeeds, all six values for the color is shown (RGB, HEX, name, HSL, etc). Whereas the description implies only the name or hex values (in the examples above) is in the embed.
How about:
Colo(u)r information for HEX
#71653e
Colo(u)r information for RGB(1, 2, 3)
Colo(u)r information for...
From the user's perspective they aren't (and don't need to be) aware of a reference file's existence, imo.
"""Create an embed from a randomly chosen colour."""
As per rule 5:
Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
The current tag says you should not assist with questions related to ytdl. People might ask a simple question about general Python coding within a project breaking YouTube's Terms of Service, and other members provide support for the user, which breaks the rule 5.
GitHub Actions run 1456464500 succeeded.
GitHub Actions run 1456769195 succeeded.
This behavior was changed due to the suggestions by hedy, I don't believe there is a corner case anymore. Relevant changes are in: e87e037
GitHub Actions run 1456783250 succeeded.
Fixed in: e87e037 and e9cda06
Now the embeds look like your examples above:


" part. Even if you add a space that is not correct grammar.
Would it not just be better to have it in here? Seems like such a thing one may forget.
If that is a no please update the docstring to make this clear to anyone implementing the leaderboard into their game.
Can you switch this to the name of the character? See this page and scroll down to:
>>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name
'\u0394'
>>> "\u0394" # Using a 16-bit hex value
'\u0394'
>>> "\U00000394" # Using a 32-bit hex value
'\u0394'
I am talking about the kwarg you pass to @commands.group(). This if-statement should be unecessary
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
When I used the help command and the name of one subcommand was "Append" it seemed more to me that when I press that button something will append rather than me viewing the help of the subcommand called "append".
Does that make more sense? I think the .title() part is what messes this up for me.
Yes, I thought I removed it from my commit, was testing... so needed that.
Hmm, this would also work and is a bit cleaner (instead of concatenating, you add a space before the __ in the f string) but this is a nitpick and is also just a consideration, not anything necessary.
submitted_words.append(f" __{word}__")
This will not exceed the line limit, so I don't think it's necessary to split this into different lines.
madlibs_embed = discord.Embed(title="Madlibs", color=Colours.python_blue)
This is more of a consideration, up to you, but usually, it would be a random one of the negative messages to be in uniform with the other 'error' embeds
title=choice(NEGATIVE_REPLIES),
This should also fit in one line, so the separating isn't necessary.
async def madlibs(self, ctx: commands.Context) -> None:
GitHub Actions run 1457936591 succeeded.
GitHub Actions run 1457938104 succeeded.
GitHub Actions run 1457943122 succeeded.
GitHub Actions run 1457947082 succeeded.
b1f73f4 Add #bot-commands to guild features in !server - jb3
[python-discord/bot] New branch created: jb3/guild\-features\-channels
This prevents spam in dev-contrib and dev-core from people trying to
find which Discord feature flags are enabled for Python Discord. It's
not ideal that we have to increase output size in #bot-commands but it
prevents spam in #dev-contrib.
GitHub Actions run 1458019171 succeeded.
This was added in #1166 by kosayoda through suggestion from Numerlor to remove the clutter and possibly unnecessary information, but I do agree we shouldn't encourage users to spam in #dev-contrib just to see this information.
What do you think should be done with this PR? Will you be resuming progress, or should we close this/make it up for grabs?
I personally won't be continuing this PR. I think the best course of action would be to close until @magicandcode is able to complete this.
@TizzySaurus What's the status of this PR?
Thanks!
I ended up going down a massive rabbit hole in this PR. I tried to get some help from @Bluenix2 but in the end I just kept going deeper and deeper and couldn't get it working, and in the end kinda just gave up.
I may start again and have another go but keeping it simpler for the time being. Hopefully I'll either have this done by next weekend or will mark as up-for-grabs.
See the function docstring.
"""DM the user the information for joining the Python Discord leaderboard."""
The "via DM" is in reference to the fact that it does ctx.author.send(the_information) rather than the fact the command gets invoked in DMs.
I made this guild_only since it uses Member-only attributes, such as the .roles check.
7769d3e Update tuple-constants to be a set for faster... - TizzySaurus
Have done so, along with STAFF_ROLES and WHITELISTED_CHANNELS.
For the record I'm planning to fix this tests at some point this upcoming week :+1:
GitHub Actions run 1459214361 succeeded.
This PR looks absolutely excellent. Thank you very very very much for going through so many review rounds and continuing to push for this feature. Let's get it merged babyyy!
GitHub Actions run 1459226444 succeeded.
0d51688 Start from upstream main branch - brad90four
15d545e Create draft body of file - brad90four
969ab35 Add colorsys import, verbage for using JSON - brad90four
b66e613 Added ryanzec_colours.json constructed from rya... - CyberCitizen01
663b528 Added ryanzec_colours.json constructed from rya... - CyberCitizen01
Connected!
GitHub Actions run 1459281745 succeeded.
GitHub Actions run 1459303333 succeeded.
GitHub Actions run 1459463213 succeeded.
Which issue is this relating to?
This would make it inconsistent with the other lines.
Nope, that's not how it works in 2.0 now.
I was going to say this wouldn't be easily possible since asyncredis cache doesn't really support these types, that's why I'm serialising. but then I realised if I'm already serialising, then I can just serialise dicts instead. I will rethink the approach for this.
Yea, this is an d.py thing. I could remove the check here and do it inside the command instead, that way we can have customer handling.
Yea, I will making this interface better with the custom check. Will resolve this convo and keep the discussion in the other one.
I chose not to limit this to only message IDs in redis as then users wouldn't be able to delete messages bookmarked before this PR was merged.
I think root-aliasing this as .delete could be good, especially with the customer dm check I will add which will explain the interface if ran in-server.
Not really any, the current tag simply doesn't really say the same as the rules.
f70c8ad Don't log threads in admin channels - ChrisLovering
[python-discord/bot] New branch created: Don't\-log\-threads\-in\-admin\-channels
This change disables the mod-log for any changes to threads in channels that mods don't have read perms to.
[bot] Branch Don't\-log\-threads\-in\-admin\-channels was force-pushed to `31f422f`
c5948e9 Update off-topic.md - ChrisLovering
[python-discord/bot] New branch created: ChrisLovering\-patch\-1
THIS WAS A TERRIBLE SOLUTION. TRY HARDER NEXT TIME.
[python-discord/bot] branch deleted: ChrisLovering\-patch\-1
GitHub Actions run 1459764412 succeeded.
[python-discord/bot] New branch created: reorder\-ot\-embed
ce6fedb Update order of off-topic channels - minalike
Reverse order of off-topic channels from ot0, ot1, ot2 to ot2, ot1, ot0
Reference python-discord/meta#157
[python-discord/bot] branch deleted: reorder\-ot\-embed
GitHub Actions run 1459820460 succeeded.
Connected!
GitHub Actions run 1459826683 succeeded.
Considering what this PR tries to achieve I'm not sure it makes sense to have the channel mention in the log
Considering what this PR tries to achieve I'm not sure it makes sense to have the channel mention in the log
It's a trace log, purely for dev testing, since I wanted a way to ensure it was being ignored.
GitHub Actions run 1459953784 succeeded.
Could you add the details here too?
https://github.com/python-discord/sir-lancebot/blob/main/bot/__main__.py#L10
โThis decorator completely overrides defaults rather than adding to them.
So normally for PR's you need to make an issue so we can discuss and bounce back ideas and agree on what ends up in the repo. I believe we have some contributing guidelines in the readme of this repo.
And personally I don't see what the issue is with this but if we were to change it I would do something like "questions/projects" but that's just my opinion.
The current YTDL tag says that, as per rule 5, we should not provide with questions related to YTDL. However, the rule 5 says we should not help with projects that breach Terms of Services (in that case, YouTube).
An example where you are against the rule 5 but not against the YTDL tag:
Someone asking a general question not related to YTDL in a project that contains YTDL and therefore breaches YouTube's terms of service.
In that example people will help as the question is not relat...
GitHub Actions run 1461319532 succeeded.
GitHub Actions run 1461326672 succeeded.
Well, this is interesting. It seems changing the generated config file from its default name now breaks sneakbox. I'm struggling to investigate this much, especially because I can't reproduce locally. I've tested it here in actions (if you couldn't already tell from the 10 force pushes), and it seems that no combination of nsjail config name and final config name works besides the default config_pb2.
I haven't had a chance to investigate yet, but it seems everything is working with the ren...
Description
#677 Was recently merged, while we focused on the main functionality on that as described in the issue, this issue proposes a few util commands which help when you are working with colours!
- lighten/darken subcommand
.colour lighten #3f6d2a 40would lighten the colour3f6d2aby40percent i.e. mixing 40% white colour.colour darken rgb(1, 92, 23) 50would darken the colourrgb(1, 92, 23)by50percent i.e. mixing 50% black colour- Basic implementatio...
Description
Get the remind content from the replied message

Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [X] Anyone can implement this feature
Description
Get the remind content from the replied message

Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [X] Anyone can implement this feature
I was actually planning to do this myself soon:tm: so if this is something that gets approved I'll work on it :+1:
Sure, I don't see any harm. Go for it @TizzySaurus!
Description
Currently, there is no way to view your (the member who invoked the command) score, I suggest adding another line to the resulting embed which tells the user their own candy score.
Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [X] Anyone can implement this feature
I'm not sure how it ever worked to begin with, but even as far back as 2016 there was a report of this same error when the prefix was removed (so it's not something introduced by a new protoc version). See https://github.com/tgalal/python-axolotl/issues/14 Even the generated file in the main branch has the original module name hard-coded at the end of the file.
There isn't a way to tell protoc to use a different file name: https://github.com/protocolbuffers/protobuf/issues/2283; https://gi...
b597cdc Update review policy to use org default - ChrisLovering
Approved by the Python Discord DevOps:tm: Team:tm:
97394a5 Replace psycopg with asyncpg - ChrisLovering
1f95993 Add taskipy and a revision helper task - ChrisLovering
b7e6b62 Create docker volume for alembic migrations - ChrisLovering
260353a Switch to asyncpg for migrations - ChrisLovering
1796ed9 Remove database validations in Pydantic models - ChrisLovering
Changing the name of the config.proto file used to generate our config changes the __module__ constant. I've tested various combinations of __module__ and file names, and it seemed nothing besides config_pb2 works for this.
These are all the combinations I've tried besides the current one, and they all failed with the same exception:
Snekbox config & nsjail config:
- [
proto_configandproto_config](https://github.com/python-discord/snekbox/compare/5e618f3...cbfdf4842f63...
GitHub Actions run 1464116414 succeeded.
GitHub Actions run 1464247566 succeeded.
By __module__ I mean the key in the dictionary here (there are several instances) https://github.com/python-discord/snekbox/blob/fbc9476cf911ee3e3fc1c2d30cf3702a46f2b3ef/snekbox/config_pb2.py#L995
I am suggesting that changing this value to config after the file is generated may fix it. But if it doesn't work then I can live with config_pb2.
7311496 Rename To Config - HassanAbouelela
I think that's what we had before I started messing around with the file, but I tried it again in c00c4cf. Still seeing the same error.
Ah okay I guess it's just doomed to fail if it's renamed
Would you like to add a workflow to check black formatting? Basically, check if there is a black diff (black . --check --diff).
Other than that and the changes required by Chris, everything looks good ๐๐ป
GitHub Actions run 1466094528 failed.
GitHub Actions run 1466215311 succeeded.
Not sure if we want a newline before this or not. I think it's better without it.
Missing a space here after the comma
Picky but should probably be MyPy not mypy. Same for after the period.
@DMFriends this was marked resolved but I don't see the changes applied in the "Changed Files" tab.
Have you pushed your changes?
6cebf89 Add ability to reply to message for !remind - TizzySaurus
[python-discord/bot] New branch created: allow\-reply\-in\-remind
Closes #1958.
As title says. You can now reply to a message instead of giving a content (or do both).
GitHub Actions run 1466342266 succeeded.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
I can remove the title, it doesn't look great for commands made of several words anyway
[python-discord/bot] branch deleted: Don't\-log\-threads\-in\-admin\-channels
9cdfe35 Don't log threads in admin channels (#1954) - ChrisLovering
GitHub Actions run 1467195128 succeeded.
Connected!
GitHub Actions run 1467214349 succeeded.
If the issue is up for grabs, I would like to give it a try.
Solid work. Thank you!
One minor suggestion for the future: Instead of using the autogenerated names by Django for migrations (like auto_20210519_0545), it's nice to have a short name describing the migration.
This is a very very very cool use of buttons. When the open discussions are addressed, this looks good to merge from me ๐
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
Personally I think we can leave it, since the bot logs plenty of things by default already, and this is a static thing that won't ever change.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
I'd agree with removing .title(), I had the same thought as @Bluenix2 watching the video posted.
A very nice QOL change. Thank you!
[python-discord/.github] New branch created: tagger\-workflow
This workflow will automatically apply any labels, as defined in the auto_tagger_config.yaml config file. This runs on PR open, reopen and synchronize, which is triggered when a commit is pushed to the PR branch.
If the label doesn't exist in the repo, it will be created automatically.
This allows us to enforce the removal of a "needs testing" tag before any PRs are merged, as reminder for us that PRs should be tested by at least one person before merging.
Connected!
GitHub Actions run 1468820116 succeeded.
GitHub Actions run 1469121802 succeeded.
GitHub Actions run 1469567287 succeeded.
Just pushed @Bluenix2
This issue consists of two parts:
-
I believe we can improve
helpdm's embeds by making changes such as:- Adding a mention to the claimant
- Setting their profile picture as the thumbnail
- Adding the condensed text that the claimant themselves receive
- Updating the embed when the help channel has been closed
-
While
helpdmsometimes comes in handy when juggling between multiple help channels, what I would like more is to have the option to be notified for message...
77b66ea Adds Redirect Filter List - HassanAbouelela
[python-discord/site] New branch created: filter\-redirects
Adds a new filter list for URLs which should be treated as redirects and unfurled.
See python-discord/bot#1933 for more details.
GitHub Actions run 1471120103 succeeded.
[python-discord/bot] New branch created: unfurl\-redirects
8a958db Clean URLs Before Adding To Filters - HassanAbouelela
Closes #1933.
Blocked by python-discord/workers#20.
Blocked by python-discord/site#625.
Description
This PR implements the URL unfurling filter feature described in #1933. It adds a service to do so (which will further be wrapped by a command in a future PR, to avoid delaying this one), and the filtering logic. To prevent the filtering logic from being slow, and to handle the fact that this filter calls another filter, I've had to make modifications to the core filtering logic to allo...
GitHub Actions run 1471246768 succeeded.
Connected!
01c121a Run black on entire repo - ChrisLovering
[python-discord/bot] New branch created: see\-what\-black\-would\-change
This is just to see what the diff would look like and whether we would want some of these changes.
GitHub Actions run 1472224137 succeeded.
[bot] Branch see\-what\-black\-would\-change was force-pushed to `47c9f12`
GitHub Actions run 1472237215 succeeded.
Possibly another instance
#help-mango message
#help-pancakes message
2 minutes apart
[bot] Branch see\-what\-black\-would\-change was force-pushed to `2e95e31`
ad98a49 Black with 90 line length - ChrisLovering
[bot] Branch see\-what\-black\-would\-change was force-pushed to `14719a2`
GitHub Actions run 1472813632 succeeded.
Let's get this merged! โจ Thanks for this @Shivansh-007
[bot] Branch see\-what\-black\-would\-change was force-pushed to `08fd293`
GitHub Actions run 1473020582 succeeded.
[bot] Branch see\-what\-black\-would\-change was force-pushed to `44c0ea2`
GitHub Actions run 1473037738 succeeded.
[python-discord/bot] New review comment on pull request #1939: Dynamic views for command help embeds
But since there's no logging so it won't even show up in development.
This is what the invoke_without_command kwarg does.
if value.get("points"):
self.view.points[key.user_id] += self.view.points.get(key.user_id, value["points"])
If you accept this repeat the same for speed.
Isn't this equivalent?
serialized_json[idx] = {"description": self.unicodeify(question["description"]), **question}
I see now, by doing this the description is overriden.
I must say I am not a huge fan of all mutations that happens with the questions so easily, my gut-feeling tells me that there's a lot of room for subtle bugs. Besides, it also limits us because you have a few places where you need to un-unicodeify the descriptons (code duplication...
This will block the rest of the bot, besides, why sleep?
I am not sure if this reflects what happened correctly.
The bot didn't time out, the user took too long to respond!
@Bluenix2 Well, what I meant this to mean is "the bot timed out because the user took too long to respond." Does that make sense?
Why will this block the bot?
I thought sleep would make it more realistic that it's "loading the game", in a sense.
Thanks for this Shivansh-007, nice work!
Yeah technically that's true but I don't think that's clear to the user.
This sounds like something broke in the bot, such as some form of connection somewhere.
I thought
sleepwould make it more realistic that it's "loading the game", in a sense.
No we don't want it to be realistic, the faster the better. It is i just for getting a message to start with.
Alright, I will remove it then.
Ah I see, I can fix the message to make it more clear, no problem.
GitHub Actions run 1473654756 succeeded.
[python-discord/bot] branch deleted: jb3/guild\-features\-channels
Until the issue gets an approval, this PR shall not be merged.
GitHub Actions run 1473869282 succeeded.
@hedyhli Sorry, didn't see your comment here. As we discussed in Discord as well a while back, you're welcome to take this PR.
Thanks!
It takes 0.5 seconds usually from the interaction handling on Discord's end.
Ah, I didn't know that so I used both. Thanks!
Wouldn't this error out if key.user_id isn't a key inside self.view.points?
Connected!
GitHub Actions run 1473885956 succeeded.
So if someone presses a button the instant Discord receives it they will still have taken 0.5 seconds according to us?
Isn't that just ping? I don't think we should be on relying on this - we aren't measuring exactly how fast people are to answer so that we can see who's the fastest, we just need to be able to give someone who clicked after 5 seconds more points than someone who clicked after 20.
That's what the .get() is, the second argument is the default when that key isn't already present.
Oh nvm - I just realized - that does += vs. = for when it is missing.
Yeah you're right here.
Good point, I'll remove the overhead subtracting
I see your thumbs up, one thing I like to do in my code is to have the reaet logic be shared with the initializing code.
This way, you dont forget to reset anything ๐. So my recommendation would be to have like a setup() or initialize() method that is called by both the reset command and __init__().
GitHub Actions run 1473983045 succeeded.
Gotcha! I'll add this after updating the command checks
GitHub Actions run 1474004305 succeeded.
GitHub Actions run 1474003372 succeeded.
GitHub Actions run 1474020394 succeeded.
GitHub Actions run 1474031062 succeeded.
I'd also still like to see tests for the new feature.
Thanks for including my suggestions!
Maybe we should come up with a standardized and user-friendly way to represent color values. I can think of three ways this can be done if we're implementing a mini parser to let users specify more than one color (especially for color schemes feature, or even the ability to show information on multiple colors at the same time):
Single argument
If it was a single argument (so no space allowed unless we use or implement a .split() that respects ...
Description
Migrating the .quiz command to threads for when it is called and deleting the thread once the quiz is over.
In addition, adding more questions to some of the most played categories, such as the python category.
Reasoning
The .quiz python currently will take over the entire channel when you run it, and with the new Discord threads also supported in DPY 2.0,, the quiz command could be migrated to threads. When it is called, a new thread could be created und...
The _delete_found doesn't properly handle the NotFound exception, a contextlib.suppress block should be added to prevent the exception from propagating.
Sentry Issue: BOT-1QH
NotFound: 404 Not Found (error code: 10008): Unknown Message
File "discord/http.py", line 331, in request
raise NotFound(response, da...
Something worth mentioning if it's useful is that Mesageable.delete_messages() special cases when you send it an iterable with just 1 element. In this case, it uses the normal delete_message() function. Whereas if you pass it more than 1, it uses bulk_delete, which does not raise any errors.
7199736 Hastebin filter: change project description - Akarys42
I like this.
Should we perhaps add a way to bypass this, in case the user is 100% absolutely perfectly sure that no token is in there?
IMO if we want to explicitly pass the exception, then this is the cleaner way to do it.
Otherwise, we end up duplicating information in the traceback already printed by log.exception and the separate exception printed here.
except discord.DiscordException as e:
log.exception(f"Failed to make message link embed for '{message_link}'", exc_info=e)
[modmail-plugins] Branch ignore\-all\-messages\-from\-the\-bot was force-pushed to `05e1bcb`
[python-discord/modmail-plugins] branch deleted: ignore\-all\-messages\-from\-the\-bot
Relevant Issues
Closes #325
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
- The AoC day and star browser has been separated from the leaderboard command, from now on it's a separate command
- The leaderboard command has a new
self_placement_nameoption, that shows the personal stats for the specified profile name.
Did you:
- [x] Join the Python Discord Community?
- [x] Read...
[python-discord/sir-lancebot] Checks Successful on PR: #949 Introduce command changes in the AoC Cog
GitHub Actions run 1478304268 succeeded.
Small typo. Apart from that, very clean code, as always from you!
Maybe a minor suggestion: possibly we could make the code in _format_leaderboard a tiny bit cleaner by moving out the line formatting into a separate function. Specifically this bit:
AOC_TABLE_TEMPLATE.format(
rank=rank,
name=f"(You) {data['name']}",
score=str(data["score"]),
stars=f"({data['star_1']}, {data[...
Small typo:
Additionally you can specify a `self_placement_name`
Thank you for the quick review!
Sorry, I should've made the _format_leaderboard more consistent.
Will push a patch ASAP.
Also, I noticed a minor problem, in the code.
I have to modify the cache a little bit.
Should be fine!
Update: Yes, there is a problem with caching, I've found a solution and will push a change along with the others.
GitHub Actions run 1478833068 succeeded.
GitHub Actions run 1478839782 succeeded.
GitHub Actions run 1478847165 succeeded.
Please don't review this yet :grin:
PR body
Supersedes #623 and #506
Closes #459
This PR adds an 'Edit on GitHub' button on the top right of content articles which links to the corresponding page source URL on the site repository on GitHub. This only shows up on articles (and those with sub-articles) and not categories. Apart from that this differs to the original implementation (in #506) in that it uses the relative path URL, and replaces the prefix (/pages/ part) with t...
GitHub Actions run 1479533303 failed.
[python-discord/site] Checks Successful on PR: #626 feat: Edit on GitHub button for content articles
GitHub Actions run 1479551047 succeeded.
e9c2bcc Send webhook embed containing information about... - Shivansh-007
a2958fb Add incidents webhook to default config template - Shivansh-007
c32aee3 Send multiple webhook messages in case of more ... - Shivansh-007
7c4fdba Use MessageConverter to find messages - Shivansh-007
d521273 Use str() when checking for message.content - Shivansh-007
Connected!
GitHub Actions run 1480853664 succeeded.
In #1446 we made the bot unfurl and message links found in reported incidents. This sends a webhook with details on the message referenced.
This is incredibly useful, especially for people on Android, where Discord links are completely broken.
I would like to request that this feature is extended to at least all staff channels, with the option to whitelist additional channels/categories if needed.
As a brief spec, the bot should look for Discord links in all messages in staff cha...
I'm in full support of this suggestion. This would alleviate much of my frustration when Discording on my phone. In fact, I'm raising the priority on this. This is really crucial for user experience right now.
Connected!
Connected!
The issue has been patched, everything should work as expected! ๐
[python-discord/sir-lancebot] Checks Successful on PR: #949 Introduce command changes in the AoC Cog
GitHub Actions run 1481982141 succeeded.
b55a2b9 Remove unneeded new lines - ChrisLovering
[python-discord/bot] New branch created: ChrisLovering\-patch\-1
These new lines made the output embed look far to spaced out.
GitHub Actions run 1482535566 succeeded.
Connected!
GitHub Actions run 1482614459 succeeded.
I'm Steele and I approve this PR.
Connected!
GitHub Actions run 1483777543 succeeded.
nit: if adding a comma at the end of this line, should they be added for the other lines? (eg L16)
Not entirely sure, but I believe this still needs the line length configuration, as it defaults to 88 for black.
https://pycqa.github.io/isort/docs/configuration/profiles.html
The second config argument here is redundant.
Is this ready for review or is this that issue we've been debugging @TizzySaurus?
What is the issue that's being debugged still, it doesn't seem to have been explained above?
Please see the PR description.
Seems like this will error if the user cannot be dmed, and won't handle it safely.
I like this function, however it seems to be two seperate messages. Discord can now support up to 10 embeds per message, so if this does occur they should be in the same message IMO.
Ah, it catches the error below. Perhaps update the docstring, since it clarifies one of the issues it will raise but not all.
Connected!
GitHub Actions run 1484841684 succeeded.
GitHub Actions run 1484872757 failed.
GitHub Actions run 1484880829 succeeded.
Success
Too many redirects
Long URL
Unhandled Error (on the worker end, logs a warning)
:
pythondiscord-bot-1 | File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 351, in _run_event
pythondiscord-bot-1 | await coro(*args, **kwargs)
pythondiscord-bot-1 | File "/bot/bot/exts/recruitment/talentpool/_cog.py", line 5...
GitHub Actions run 1484954577 was cancelled.
GitHub Actions run 1484956694 succeeded.
e9c2bcc Send webhook embed containing information about... - Shivansh-007
a2958fb Add incidents webhook to default config template - Shivansh-007
c32aee3 Send multiple webhook messages in case of more ... - Shivansh-007
7c4fdba Use MessageConverter to find messages - Shivansh-007
d521273 Use str() when checking for message.content - Shivansh-007
The annotation seems correct here
GitHub Actions run 1484961408 succeeded.
GitHub Actions run 1484977156 succeeded.
PR Author
Workflow Run
Source Branch
Add-an-initial-de...
Description
pick 3cd4c92b1e24c8cfdae8c5c68c19607c62cc01ed from python-discord/bot
remove additional unnecessary edit
Relevant Issues
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read and agree to the [contributing guidelin...
GitHub Actions run 1485036560 succeeded.
What I would like to see, is a ๐ reaction that shows up after .color random, that allows you to quickly randomize colors. The existing embed would be edited rather than creating a new one each time
[python-discord/modmail-plugins] New branch created: notify
ModMail by default only notifies rejoins and leaves in the main server, but we would like to have this in appeal threads as well.
[python-discord/modmail-plugins] branch deleted: notify
aee95da Disable File Logging By Default - HassanAbouelela
[python-discord/bot] New branch created: disable\-file\-logs
b794b02 Disable File Logging By Default - HassanAbouelela
[python-discord/sir-lancebot] New branch created: file\_logging
Connected!
After a vote on discord, it appears almost no one uses file logging, except in exceptional circumstances. I changed the settings so file logging would be disabled by default, and remove the volume from the docker-compose to avoid any problems, and reduce the maintenance burden. I added an environment variable to enable it.
If someone really wants to use file logging, they still can, but it will no longer be the default, nor particularly convenient.
[python-discord/king-arthur] branch deleted: edit\-interaction\-message\-on\-interaction
13da183 Edit deployment interaction messages, rather th... - ChrisLovering
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Approved by me.
Description
Decoupled file logging from the environment variable, and moved it behind it's own variable.
See python-discord/bot#1966 for details behind this change.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link ...
GitHub Actions run 1485256440 succeeded.
Connected!
Is there any use in typehinting a constant?
LGTM
One question, but not important to approval.
Should this remain here even if its optional?
03b7956 fixup actually use self.guild in pleases - ChrisLovering
This wasn't actually needed, since I've noticed we don't actually use self.guild anywhere.
So I've updated other parts of the cog to actually use it. See https://github.com/python-discord/bot/pull/1868/commits/03b79560afec92998c14ee8c9914e106319af6c7
You've commented on the diff that removes it.
This has fixup commits, so please do not update this branch, as it will stop me from being able to rebase and actually fix them up.


