#dev-log
1 messages ยท Page 87 of 1
Connected!
GitHub Actions run 1369570022 succeeded.
d3b1cef Bumps Pip Licenses - HassanAbouelela
[python-discord/sir-lancebot] New branch created: bump\-licenses
dde7535 Bump pip licenses - ChrisLovering
[python-discord/sir-lancebot] New branch created: bump\-pip\-licenses
Description
pip licenses used to use an internal method of pip, which got removed and caused errors in any runs. The newer version, which this commit bumps it too, now uses another method.
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] Ensure there is an issue open, or link relevant discord discussions?
- [ ] Read and agree to the [contributing guidelines](https://pythondiscord.com/page...
Seems like Chris has the fastest
[python-discord/sir-lancebot] branch deleted: bump\-licenses
[python-discord/sir-lancebot] branch deleted: bump\-pip\-licenses
GitHub Actions run 1369598998 succeeded.
Connected!
GitHub Actions run 1369607823 succeeded.
If the default is an empty list, then we would be passing no arguments to python, and python <code> doesn't work. I could however default it to ["-c"]
Every now and then, the help channel cog will desync (mostly due to unavoidable issues from the discord API). This desync takes many forms, most prominent being:
- Decrease in number of help channels available
- Desync of dynamic help message in
#how-to-get-help - Pins not being removed after a channel is closed
- Cooldown roles not being removed after a session ends
These happen often enough that I think we should spend some effort to get them to automatically figure themselves ou...
For the files that you have changed it looks good to me. But I haven't really checked any of the other files.
GitHub Actions run 1370470626 succeeded.
GitHub Actions run 1370495710 succeeded.
Connected!
GitHub Actions run 1370500243 succeeded.
GitHub Actions run 1370531054 succeeded.
GitHub Actions run 1370546510 succeeded.
GitHub Actions run 1370557965 succeeded.
GitHub Actions run 1370655284 succeeded.
I think reloading a cog is a non trivial action that shouldn't be running 48 times a day. It does make the cog unresponsive for 5s and do a bunch of API calls. I am also scared about race conditions where we would write a value to Redis, reload and read it too fast, but I don't know how possible that is.
My opinion would be to do implement the three checks mentioned above as a background task, that runs every once in a while. As for the channel placement itself, I wouldn't mind having the ...
I don't see anything out of place, it looks good to me, but I really don't know enough about datetime handling to feel comfortable leaving an approval
[python-discord/sir-lancebot] New branch created: tools/isort
This is a port of https://github.com/python-discord/bot/pull/1872 to this repository. Please check the original PR for more information.
GitHub Actions run 1371196722 succeeded.
It's a mere suggestion to do this rather than concatenating strings.
b912cc7 Modlog: explicitly write thread names - Akarys42
[python-discord/bot] New branch created: modlog/explicit\-thread\-name
It seems like there could be some caching issue with threads causing to appear as deleted channels. Beside, we also want to keep the name of deleted threads around.
GitHub Actions run 1372294706 succeeded.
I think it's fine as it is
Please update the failing test to reflect the changed role colour HSV.
Otherwise looks good ๐๐ป
GitHub Actions run 1373018948 succeeded.
Hello! Thanks for the PR!
I don't think copy pasting is a good way of handling this. We won't ever think about modifying the other version when modifying one of them. I can think of ~two~ one solution~s~, feel free to also suggest your own: ~1. Create a symlink? I don't know if this is something Git will like, or at least that will be cross-platform, but I think it is worth a try~ after giving it more thoughts we decided that this was a bit too hacky, we would rather wait for #1663 2...
Connected!
GitHub Actions run 1373386748 succeeded.
e082596 Add handling for when message.author is a di... - TizzySaurus [3793035](https://github.com/python-discord/bot/commit/379303520b1cbb0d777d05a2362a9df4006e636d) Migrate to on_socket_event_type event - ChrisLovering [aec75bd](https://github.com/python-discord/bot/commit/aec75bda82037bc5e3e9071d5e882bb343ff59ed) Merge pull request #1890 from python-discord/Mi... - Akarys42 [b2e8bfd](https://github.com/python-discord/bot/commit/b2e8bfdc47339714ec014a13e2018e03c0931fe4) Invert isinstance check as per review - TizzySaurus [5b7d8c4](https://github.com/python-discord/bot/commit/5b7d8c41c88d3d0333f16dabd45efa770da87c82) Update log message for when author isn't disco... - TizzySaurus
[python-discord/bot] branch deleted: tz\_awareness
GitHub Actions run 1373435125 succeeded.
Connected!
GitHub Actions run 1373450891 succeeded.
Sentry Issue: BOT-1P9
TypeError: can't compare offset-naive and offset-aware datetimes
(3 additional frame(s) were not displayed)
...
File "bot/exts/moderation/infraction/management.py", line 250, in search_user
await self.send_infraction_list(ctx, embed, infraction_list)
File "bot/exts/moderation/infraction/management.py", line 279, in send_infraction_list
lines = tuple(
File "...
bb00180 Use Arrow.fromtimestamp to get an aware datetime - ChrisLovering
[python-discord/bot] New branch created: fix\-tzinfo\-issue
Fixes #1905
Fixes BOT-1P9
datetime.fromtimestamp returned an naive datetime, so when comparing to the aware datetime from dateutil.parser.isoparse, it would raise an error.
[python-discord/bot] branch deleted: fix\-tzinfo\-issue
[python-discord/bot] Checks Successful on PR: #1906 Use Arrow.fromtimestamp to get an aware datetime
GitHub Actions run 1373772192 succeeded.
Connected!
GitHub Actions run 1373784110 succeeded.
Sentry Issue: BOT-1PA
TypeError: relativedelta only diffs datetime/date
(3 additional frame(s) were not displayed)
...
File "bot/exts/moderation/infraction/management.py", line 250, in search_user
await self.send_infraction_list(ctx, embed, infraction_list)
File "bot/exts/moderation/infraction/management.py", line 279, in send_infraction_list
lines = tuple(
File "bot/exts/modera...
22f155e Use datetime.fromtimestamp so we pass relatived... - ChrisLovering
[python-discord/bot] New branch created: fix\-tz\-issue
โฆ, not Arrow
Fixes #1907
Fixes BOT-1PA
GitHub Actions run 1373803168 succeeded.
Connected!
GitHub Actions run 1373849993 succeeded.
Cross-posting my message on discord for posterity.
The task isn't used anywhere as in if we assign a variable, it won't be used anywhere, I looked at other cogs to see how this is done and found even in
duck_pondit is ignored (the same use case).
99de765 Correct redis config instructions in bot guide - mbaruh
[python-discord/site] New branch created: mbaruh\-patch\-1
GitHub Actions run 1375483068 succeeded.
GitHub Actions run 1375499816 succeeded.
Looks and works well as far as I can see. Good job :)
I think our existing wolfram alpha command can return meanings of words as well

@anand2312
Oh Sorry I didn't saw that before
I think, I should close the issue now
@Brodevil no worries, maybe keep it open and try thinking of something more to add to this idea maybe?
@anand2312
Since for now, I should stop working and thinking about it
GitHub Actions run 1376119618 succeeded.
GitHub Actions run 1376162147 succeeded.
GitHub Actions run 1376348140 succeeded.
Connected!
GitHub Actions run 1376975720 succeeded.
Taking a break, here's what I have so far.
why do we need flake8-isort if it's running separately from flake8 in the precommit config? (Or, why do we need isort in the precommit config if it's running as part of flake8)
[modmail-plugins] Branch ignore\-all\-messages\-from\-the\-bot was force-pushed to `a0ddcbe`
why do we need flake8-isort if it's running separately from flake8 in the precommit config? (Or, why do we need isort in the precommit config if it's running as part of flake8)
flake8-isort is for IDE integration, isort itself is for the pre-commit
cfc85ae Send a message to the user on appeal - ChrisLovering
[python-discord/modmail-plugins] New branch created: send\-warning\-message\-on\-appeal
This is to ensure they are aware to keep DMs open and not to expect a response immediatly.
[modmail-plugins] Branch ignore\-all\-messages\-from\-the\-bot was force-pushed to `27a85c9`
[modmail-plugins] Branch send\-warning\-message\-on\-appeal was force-pushed to `80c14ed`
[modmail-plugins] Branch send\-warning\-message\-on\-appeal was force-pushed to `aecf702`
[python-discord/modmail-plugins] branch deleted: send\-warning\-message\-on\-appeal
flake8-isort is for IDE integration, isort itself is for the pre-commit
Ah I see, makes sense. This all seems good then
[python-discord/sir-lancebot] branch deleted: tools/isort
Connected!
GitHub Actions run 1378035739 succeeded.
GitHub Actions run 1378234901 failed.
I've done some more experimenting with the cog, and it seems the only thing that takes any time is the async_init task, which makes sense. During that time, the only thing affected is the close command, which gracefully errors out (albeit without explaining anything to the user). Claiming and all that fun non-sense is queued, so it's just a small delay for the user. The only concern would be with the race conditions. I've poked around a bit, and the chances of things going wrong is fairly low...
I'm also approving the other two fixes now.
c504c16 Unpin All Messages When Moving Help Channels - HassanAbouelela
[python-discord/bot] New branch created: pin\-consistency
Resolves partially #1903.
This implements a consistency guarantee for help channel pins, by making sure there are no pins stuck in the channel when moving it into the available category.
GitHub Actions run 1378330946 succeeded.
I was planning on installing a third party library for the bot but that library has requests and aiohttp as its dependencies. I want the library to function normally but I don't want other people to manually use the requests and aiohttp libs. Is this possible?
Again, not out of the box. We provide a fully functional Python interpreter, the actual limitations are at a system level (e.g. CPU time, memory usage, disk usage). We don't limit the capabilities of Python by design as it's easy to workaround, system level limitations are much harder to circumvent.
It is worth noting that aiohttp and requests will not work in Snekbox, nor will anything that depends on them. Snekbox has no network configurations and executed code snippets do not ge...
Ah ok that makes sense. Thanks for the quick response!
There are 1 failures, 0 warnings, and 0 notices.
I am vouching this as an incredibly important feature. We must have this.
GitHub Actions run 1378914535 succeeded.
Honestly, these looks great.
GitHub Actions run 1378931800 succeeded.
GitHub Actions run 1378937191 succeeded.
This is resolved, but it isn't addressed. If you implemented it locally and haven't pushed it yet then you should resolve the conservation after pushing the commit.
Description
Automatic issue linking currently uses a set to remove duplicates, which makes the list of found issues and PRs unordered.
I would like to use an alternative method to remove duplicates that retains ordering.
Reasoning
Keeping the list of found issues/PRs in the same order as the message that triggered the search isn't a hug...
Aaaand this turned out to be a duplicate of #743. (Thanks, @TizzySaurus)
This command can be more flexible by letting the default closing message be a suffix. For example ?cm 30m foo being equivalent to ?close 30m foo Feel free to open a new thread if you need anything else.
There should also be a command to send the closing message ?cm message/?cm msg as running ?help cm to obtain it doesn't feel intuitive.
8984894 consider parent channels when checking mod chan... - ChrisLovering
[python-discord/bot] New branch created: consider\-parent\-channels\-when\-checking\-mod\-channels
This allows commands that check if a channel is a mod channel to also work in threads of that channel
GitHub Actions run 1380991744 succeeded.
Seems about right, maybe we would want to just add a little comment saying we consider the parent if it is a thread?
Seems about right, maybe we would want to just add a little comment saying we consider the parent if it is a thread?
I put that in the docstring, just the line above, not sure if it needs a comment too. Maybe it does if you missed it when scanning, since others may too.
Sentry Issue: SIR-LANCEBOT-6X
KeyError: 'draft'
File "discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/utilities/issues.py", line 211, in issue
results = [await self.fetch_issues(number, repository, user) for number in numbers]
File "bot/exts/utilities/issues.py", line 211, in
results = [await self.fetch_issues(number, rep...
I think it's fine in the docstring for such a short function
I indeed totally missed it, let's merge this
GitHub Actions run 1381386971 succeeded.
It looks fine overall, there's only one single thing.
[python-discord/bot] New review comment on pull request #1889: feat: added url parsing to the filter
Since the regex won't match URLs without a scheme (either http or https) I believe .path could be dropped in case of message_url, and just use .netloc
(However, note that an url could be added to the blacklist without a scheme as well, so the blacklisted_url does not need to be changed.)
Revoking my approval due to subdomains not being filtered here.
See this message and the discussion preceding it for context
#dev-contrib message
857468c create a helper function to get the redis key o... - Numerlor
48b1a7b Prevent erroneous symbols from always raising s... - Numerlor
727ef75 Delete stale item counters when clearing doc cache - Numerlor
23a3e5e Raise for status to prevent parsing of invalid ... - Numerlor
3846da7 Direct users to the appeals server when banned - ChrisLovering
GitHub Actions run 1381808153 succeeded.
[python-discord/bot] New review comment on pull request #1889: feat: added url parsing to the filter
Dropping this would essentially do the same thing as it did before
[python-discord/bot] New review comment on pull request #1889: feat: added url parsing to the filter
Yes, but it would make the expression more clear.
Hey!
Vin here.
I just found this lol.
@mesub7 I have been trying to contact your for a while but I couldnt find your discord tag! Could you contact me at Vintheruler1#7617?
Thanks
-Vin
[python-discord/bot] New review comment on pull request #1889: feat: added url parsing to the filter
No, I mean that would get rid of the entire point of this pr
GitHub Actions run 1382182547 succeeded.
[python-discord/bot] Pull request review submitted: #1893 Filtering: add autoban on specific reasons
Trying to use this gives me
cmd = ctx.command.name AttributeError: 'NoneType' object has no attribute 'name'
Because ctx.command is not set.
Also, it's possible to invoke the command directly by calling it without using context.invoke.
We should make sure to use to use aware datetimes now. Since arrow is already imported in the file you can use arrow.utcnow().
f":warning: Heads-up! The new filter `{content}` (`{comment}`) will automatically ban users."
Trying to use this gives me
cmd = ctx.command.name AttributeError: 'NoneType' object has no attribute 'name'Because ctx.command is not set.
That's quite interesting, it is failing with tempban but not with mute, and I've been using the latter for my testing. Guess I'll have to do some actual yeeting now.
After some thinking I'd like to keep it here and in the other instance as-is. This isn't something we do in other converters, so I think it should be a separate discussion.
78b00dc Remove WatchChannel parent of TalentPool and mi... - ks129
dda3490 Use more accurate command names and docstring f... - ks129
f144bac Migrate nominations history command to non-watc... - ks129
807a27e Migrate Talent Pool Reviewer class to non-watch... - ks129
2d47640 Migrate unnominate command to non-watchchannel - ks129
GitHub Actions run 1382650209 succeeded.
GitHub Actions run 1382715590 succeeded.
GitHub Actions run 1382794101 succeeded.
[python-discord/bot] Pull request review submitted: #1893 Filtering: add autoban on specific reasons
Tested and works well. Some comment requests to ease future readability.
# If the filter reason contains `[autoban]`, we want to auto-ban the user
This describes what we're doing, but not why. IMO this would be better
# Create a new context, with the author as is the bot, and the channel as #mod-alerts.
# This sends the ban confirmation directly under watchlist trigger embed, to inform
# mods that the user was auto-banned for the message.
"this message to appeal your ban."
Don't think this is needed.
d55197b Filtering: remove dangling empty quote - Akarys42
GitHub Actions run 1382838223 was cancelled.
GitHub Actions run 1382839612 succeeded.
[python-discord/bot] Pull request review submitted: #1893 Filtering: add autoban on specific reasons
Fingers crossed the server doesn't explode
- me every time pressing merge
Relatable
Connected!
GitHub Actions run 1382874964 succeeded.
Great work on this!
You all did an amazing job!
Just a few small things in the review below, but overall amazing job!
I think usually the convention is using Pathlib.Path("your_path_here")
Quite a bit of distancing here, maybe separate it to one line only of distance instead of 2 at the top?
This shouldn't be present on the main command group, and rather be in the specific command docstring.
Also remember, the docstrings should be the perspective of a user running the command on discord, if you want to add some contrib information then you can put that in the function docstring and overwrite the command docstring using the help= param of the deco.
This docstring is incorrect, it is not a function in the perspective of the user running the command on discord, and rather the command, switch this with the help docstring you added in the main group.
If you want to keep this docstring, then overwrite the help docstring by passing it in help= in the @colour.command() deco.
Why isn' this a class variable?
NOTE
This issue is here because the work has already been done for my own project [here][commit], but enough changes have been made to the point where I think it may be useful for pydis to reap the benefits as well.
Description
Initially, I took the mocks for my own project, and added a few mocks that I needed, but while working through them, I noticed some shortcomings. Those shortcomings are addressed in the file change I made.
A short list of changes are as follows:
...
Original discussion [here]
[here]: #dev-contrib message
This would also apply to the COLOR_MAPPING variable and the color.py file name. These should all be made consistent.
A suggestion on the embed side: it could be cool to use whatever spelling the invoking message used. i.e.
async def send_colour_response(ctx: commands.Context, rgb: list[int]) -> None:
"""Function to create and send embed from color information."""
colour_spelling = ctx.message.content.split(' ')[0][constants.Client.prefix:].lower() # t...
[python-discord/modmail-plugins] New branch created: man\-close
This makes the ?close command require a time duration when closing with a custom close message. The close command in its current state abruptly closes the thread if you enter an incorrect time duration, for example.
Seems like you based your PR on the wrong branch, it includes changes to the ?cm command.
Maybe instead of straight up refusing to close we could instead ask for a confirmation? It would seem pretty weird to a newcomer to just have its close refused because of that.
What should that look like? Something like asking them to run ?close force message?
Sentry Issue: BOT-1PD
AttributeError: 'NoneType' object has no attribute 'ban'
(3 additional frame(s) were not displayed)
...
File "discord/ext/commands/context.py", line 187, in invoke
return await command(self, *args, **kwargs)
File "discord/ext/commands/core.py", line 468, in __call__
return await self.callback(self.cog, context, *args, **kwargs) # type: ignore
File "bot/ext...
d315bef Set ctx.guild to PyDis when auto-banning - ChrisLovering
[python-discord/bot] New branch created: fix\-no\-guild\-error
Fixes #1912
Fixes BOT-1PD
Previously this would error if filtering a DM, as there is no guild attr on the context.
[python-discord/bot] New branch created: mbaruh\-patch\-1
An autoban trigger being sent in DMs caused the ban to fail, but for it to still be registered in the database. That is becuase the ban command uses the ctx.guild.ban method, but in DMs ctx.guild is None. This commit solves it by overriding the context.guild field.
GitHub Actions run 1385190467 succeeded.
GitHub Actions run 1385193225 succeeded.
Connected!
GitHub Actions run 1385212506 succeeded.
This is what it currently looks like, are you saying the different input information should be moved to each "mode"?

Would not any run if the rgb values are equal to 0? Since they won't be None type.
There's some friction in needing to run two commands (removing and re-adding for updating the reason) in some cases and also having to type [autoban] Nitro scam needlessly as the reason will stay the same.
I propose adding something like !bl nitroscam the_domain_name which will do all the steps mentioned above.
This would be instead of having a constant at the top of the file? I kept it that way so it is easy to change if the thumbnail seems to be too large.
I'm getting hit with a flake8 error, I think it is because of PEP 601.
./color.py:193:13: B012 return/continue/break inside finally blocks cause exceptions to be silenced. Exceptions should be silenced in except blocks. Control statements can be moved outside the finally block.
No , instead of keeping the For the command... in the main docstring on the commands.group() it should be in their respective group.command() docstring i.e. instead of Function to create...
Oh right, my bad ๐๐ป
GitHub Actions run 1385310512 succeeded.
Sweet, I'll get that changed when I can ๐
any checks if any of the items in the iterable are truthy values, so if any 1 item is not 0 it would be True, but we need to check if all values are 0 so we would do not any.
Yeah, basically what you said.
Yeah, that's why we can keep it as a constant THUMBNAIL_SIZE = (80, 80). That's what I meant if I wasn't clear earlier.
List of strings yeah?
answers: list[str]
Could this be a source of confusion to some? It makes it seem like they answered correctly
Wouldn't it be easier to change this to a bool?
True represents a changed answer. Since you can only change once
Yeah, that's exactly what I meant, we can use ctx.invoked_command to find which alias of the command was used.
Yes โ I need to mutate it later on with the correct answer and make sure they didnโt answer twice.
GitHub Actions run 1385425363 failed.
GitHub Actions run 1385431066 failed.
No, fetch_user can even get users not in the guilds
I use it for the description of the scoreboard.
GitHub Actions run 1385441672 failed.
Yep. I should add some comments in the code
It removes the '\n' at the end
Hm, good point. When I get back home I can make these changes, thanks for the review!
Where would I define this as a class variable? I currently need to call it after a color mode is called so I have an RGB value to initiate the rest of the conversions with.
GitHub Actions run 1385568145 succeeded.
Whatโs the purpose/motivation for this. Would it just fetch a random GIF?
From a moderation perspective itโs raising a few red flags.
Yes it will fetch a random gif from group of some funny gifs. I can even select gifs @HassanAbouelela
Why not just use the built-in tenor command that Discord has?
4f42b24 Simplify bookmark target message error handling - ChrisLovering
7cbc715 consistently use error embed helper in bookmark... - ChrisLovering
54c8cde Remove needless bookmark helper func - ChrisLovering
b667cd4 Remove user's reactions after they bookmark - ChrisLovering
30f4cce Move bookmark error message to constant - ChrisLovering
[python-discord/sir-lancebot] New branch created: bookmarking\-enhancements
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #826
Closes #918
Description
The bot now tracks ids of messages that the user has bookmarked in Redis, so that a user can't unintentionally bookmark the same message more than once.
This also adds the ability for users to delete messages in DMs with the bot via the use of the bookmark delete command.
On top of this I have done some minor refactoring and fix...
GitHub Actions run 1387163753 succeeded.
GitHub Actions run 1387762612 was cancelled.
GitHub Actions run 1387763616 succeeded.
Here's a few coin prototypes. With the two designs on the left I was playing around with a "euro" style coin. The two on the right are later designs. We came to the conclusions in #dev-branding that the ducky is probably the best bet for the coin face, and that ducky designs seems to be the favorite anyway. Let me know if you have any suggestions.

GitHub Actions run 1369433800 was cancelled.
GitHub Actions run 1387850397 succeeded.
Connected!
GitHub Actions run 1387856314 succeeded.
Relevant Issues
Closes #627
Description
This implements the global leaderboard command, it is basically a leaderboard for all the games together, if you win the coinflip, you get some points, the points you get in the trivia quiz gets added here, etc.
This feature makes use of Redis Caches (two per game) to store the game leaderboards, one being the overall leaderboard (total) and the second being the per day leaderboard which gets cleared every day at midnight UTC through a ...
GitHub Actions run 1388173007 succeeded.
For a while now, I've been noticing that my longer reminders are usually removed from the database, without being sent, leading to many missing reminders. I've been digging into it for a while now, but there is nothing noteworthy as far as I could tell.
There is nothing in logs, and there is nothing in the bot behavior that should block reminders. The most recent example I have was scheduled for 1 minute after another reminder. The other reminder was delivered, mine wasn't. I won't be link...
GitHub Actions run 1389357955 succeeded.
GitHub Actions run 1389447066 succeeded.
GitHub Actions run 1389783523 succeeded.
Ya that will be good but I think that a command is better then built in command.
Like we can have programming gifs or something in embed. We can put GIFs in embeds and they can be related to programming or Python @Xithrius
d106056 Adds Deactivation Field To Reminders - HassanAbouelela
[python-discord/site] New branch created: save\-reminders
Connected!
Here is what it looks like now:

Connected!
dfbec15 Edit deployment interaction messages, rather th... - ChrisLovering
[python-discord/king-arthur] New branch created: edit\-interaction\-message\-on\-interaction
This makes it so that when you confirm/cancel a deployment, it edits the bots first message witht he feedback, rather than sending a new message.
This also remoives the buttons from the message too. This reduces noise when restarting a few services in a row.
GitHub Actions run 1389997960 succeeded.
GitHub Actions run 1389998689 succeeded.
I'm not sure how much use a command that just posts a random GIF would be. From a mod perspective, we don't want to encourage people to just post random off-topic content, especially noisy media like GIFs.
From a user's perspective, I'm not sure what the utility would be. If I want to use a GIF for something, I most likely have something specific in mind, and would use the tenor search to find it.
Closes #1765
First off, this is my first pull request so please give me general pull request feedback if you have any :-)
Some decisions have been made on discord. A search of bot#1765 should find you all the conversations.
Some changes to make to test:
- Create 3 new roles, with clear different colours so you can see colours on embeds!
- Put these in your config.yml
There are 2 new commands: !patrons and !patreon. These send the list of patrons and some patreon info...
GitHub Actions run 1390494853 succeeded.
I would also like a review from @ChrisLovering - cannot work out how to request a review from you though :-)
GitHub Actions run 1390528237 succeeded.
Can this be moved to the top of the class (but under the __init__())?
All other commands use it so it would be good to read it first.
As a last resort, can't we have this command pass any (potential) input to ImageColor.get() if they pass hsv(..., ...%, ...%) for example
GitHub Actions run 1390588236 succeeded.
On second thoughts, we'll soon not need to update existing domains but only add new ones.
Small thing, but in my opinion current_monthly_supporters seems a better name than current_supporters_monthly.
This f shouldn't be here as there's no f-strings. You probably did it to be consistent with line above but we've decided against this previously.
This should instead use bot.log.get_logger (added in #1831)
These 2 lines (29 and 30) shouldn't be necessary. I believe roles are always in cache (where cache has been loaded, such as here) and for channels we have bot.utils.channel.get_or_fetch_channel.
Removing these save API calls which we want to use sparingly.
Considering I'm not using the logger, should I completely remove this for now or add some logging? If logging could some logging suggestions be added!
I'm not too familiar with how we use logging in our codebase so not sure. Perhaps @ChrisLovering could shed some light on this.
[python-discord/bot] branch deleted: sql\-fstring
Should I change the other instance of this? Additionally, I believe Chris just directly copied this from the patreon page
[python-discord/bot] New branch created: sql\-fstring
This one is probably because I just copy and pasted Chris' message :-)
This adds a tag that talks about the perils of using f-strings in SQL statements and what to do instead.
It looks like this (with the typos fixed)

Credit to salt rock lamp who wrote the text for this.
GitHub Actions run 1390788761 succeeded.
Right. I would change both instances of this personally, but if it's on the patreon page then I guess to an extent it's whether @jb3 thinks its worth updating over such a small thing.
GitHub Actions run 1390812240 succeeded.
GitHub Actions run 1390847486 succeeded.
GitHub Actions run 1390877105 succeeded.
GitHub Actions run 1390944541 succeeded.
All looks good, thanks for your work. This is a big step for the API.
(For future reference, perhaps keep the linting till the end. It' really hard to figure out what changed when all files have diffs for quotes or trailing commas.)
Hmm, this goes above line length limits (by 2 chars)
(Solved on discord)
Since we use kubernetes in production, we should handle replication at the cluster level instead of using a process manager (like Gunicorn with workers) in each container.
See: https://fastapi.tiangolo.com/deployment/docker/#when-to-use
GitHub Actions run 1391027451 succeeded.
Most suggestions from @TizzySaurus fixed. Left 2 due to pending conversation / work to be done elsewhere.
GitHub Actions run 1391045925 succeeded.
I would quite like to work on this! @KittyBorgX if you still want to help we can work together!
Sounds good, you have both been assigned to that issue
f2ed333 Add Alembic Migration environment to the project. - D0rs4n
a267fe0 Increase code consistency in the alembic setup - D0rs4n
ce2aa1c Format codebase with black - D0rs4n
1b27b81 Modify project model, and linting configuration - D0rs4n
e48607d Remove alembic README, remove comments from ale... - D0rs4n
@Senjan21 managed to find in the logs that there are in fact errors being logged (and we accidentally took down the entire community's infra ๐
). user appears to be none in ensure_valid_reminder (my guess is because it's called during bot startup, which most likely means the cache is unpopulated. Can no longer confirm, as the logs have been deleted).
I have a new solution in mind, and will be PRing that instead.
I've only tested it quickly so this is mainly a code review (although it seems to work nicely, I like the embeds!)
Firstly, thanks for the PR! The structure of the code seems good and it's been written well.
My main comments here are about repetition, there are couple of places where I think using loops would neaten the code up a bit, making it a bit more concise and extensible. That said, these aren't required changes, i've only mentioned them as something to think about if you want to.
As these are discord.Members they have a guild attribute, so you shouldn't need to fetch the guild, you can access it through after.guild (or before.guild). This saves an api call.
It might also make the later logic easier and neater if these are in a list
patreon_roles = [
after.guild.get_role(constants.Roles.patreon_tier_1),
after.guild.get_role(...),
after.guild.get_role(...),
]
I do think it would be nice to reduce the repitition a bit here. If patreon_roles was a list as I suggested above you could use do something with a for loop. I came up with this (not tested) which is arguably slightly esoteric but also I think it's beautiful :P .
for tier, role in reversed(enumerate(patreon_roles, 1)): # Reversed to check highest tier first
if role in after.roles and role not in before.roles:
break
else:
return
# `tier` now contain...
An issue with this is that if the bot restarts on that day (and the bot does restart quite often) the message will send twice, which isn't ideal. I'd be interested to hear other people's thoughts on how we could solve this in this case.
Using redis cache to keep track of the time of the last send would be one way. I think the branding manager does something like that: https://github.com/python-discord/bot/blob/1ca6d5765d15c9f35e94a7069acd1acc85503e14/bot/exts/backend/branding/_cog.py
D...
GitHub Actions run 1391524117 succeeded.
I could try to bring back some of the string parsing logic from the original structure for this. I'm just worried it will get lengthy again.
Why would it? In my testing of this at random times today (when I was testing it, changed each time), it only sent once, at the specified time/
We could give an example of what it means by safely, e.g. what would happen inputting RHAT;DROP TABLE stocks using an f-string, although probably not necessary. I like it
I'm not sure the link there is the indended one. Guessing you meant to link to this instead https://docs.python.org/3/library/sqlite3.html :P
sql in sql injection could probably be capitalized
Hmm, I feel like this is much less clear for me to understand as a reader of the code. At a glance, a-b-c is clear to me, but yours seems a lot ahrder to understand. However, your idea with lists may make this seem different
I've only tested it quickly so this is mainly a code review (although it seems to work nicely, I like the embeds!)
Firstly, thanks for the PR! The structure of the code seems good and it's been written well.
My main comments here are about repetition, there are couple of places where I think using loops would neaten the code up a bit, making it a bit more concise and extensible. That said, these aren't required changes, i've only mentioned them as something to think about if y...
Regarding this, how does the help command use this? Does it take the summary line or the whole docstring?
I think that if you run just !help and find the entry for the command among all the other commands it only show the summary, although if you run !help patrons it will show the full docstring.
GitHub Actions run 1391674342 succeeded.
I don't understand what you're trying to do here. The code effectively becomes nothing.
You loop through all values, then override this with a blank string, then create a new string where "nothing" gets replaced by the word. But the thing is, blank.replace('', word) returns a new string but you don't do anything with this.
This part is meant to run when you complete the game yeah?
Use madlibs_embed = self.madlibs_embed(...) here, but replace ... with the correct arguments.
This is duplicating code
Doesn't discord.py have some Colour classmethod for this?
I don't understand what's with the lists
Actually, the function returns None and otherwise returns the embed and it has to check first to make sure it gets no errors
GitHub Actions run 1392317489 succeeded.
- Could we also add a command to get a set of distinct colours, like a set of visually distinct colours by maximizing the perceived colour difference between pairs of colours.
- Could we add a feature to simulate a colour under a certain colourblindness profile, like how it would look to a person with protanopia, deuteranopia, or tritanopia.
- Utility commands like
lighten,darken,compliment, etc.
Can be moved outside the try...except block as the error catching is not implemented for this.
This same thought can be used to decide whether it is Colour or Color by using ctx.command.name. So if a user does .color rgb it would take color, and if a user does .colour rgb it would colour.
Nitpick: CONSTANT_CASE isn't needed here.
Move this out of the try...except block as the error catching is not implemented for this.
So what I intended for this code to do was to iterate through all the "blanks" in random_template[value] (the story template chosen from the JSON file) and replace the "blanks" with the words entered by the user so that once the user has finished entering all the words, the bot prints out the entire story with the blanks filled in. Maybe there is a better implementation for this than what I have currently? @Bluenix2
I'm not sure how much use a command that just posts a random GIF would be. From a mod perspective, we don't want to encourage people to just post random off-topic content, especially noisy media like GIFs.
From a user's perspective, I'm not sure what the utility would be. If I want to use a GIF for something, I most likely have something specific in mind, and would use the tenor search to find it.
I think I should agree with you.
GitHub Actions run 1393455818 succeeded.
Didn't quite update it to exactly what joe has changed it to on patreon, to keep it making sense in the context!
GitHub Actions run 1393487399 succeeded.
Hi! I would like to work on this! For the solar/chinese system, I guess that it is just the opposite for the southern hemisphere like with the other seasons?
Ah never mind, I misread the time feature of tasks.loop as just tasks.loop(hours=17). Didn't realise 2.0 had this new feature. This seems good ๐
Yeah! When looking up how to have it repeat at a certain a while back, I found quite a complicated solution :-) - looked again a few days ago and did a bit more research and found this! It certainly makes doing this much easier :-)
This is why I use TypeError to handle when there is no match found:
sir-lancebot | Traceback (most recent call last):
sir-lancebot | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 167, in wrapped
sir-lancebot | ret = await coro(*args, **kwargs)
sir-lancebot | File "/bot/bot/exts/utilities/color.py", line 123, in name
sir-lancebot | _, hex_colour = self.match_colour_name(user_colour)
sir-lancebot | File "/bot/bot/ex...
Alright! I can help you with it :D
- Could we also add a command to get a set of distinct colours, like a set of visually distinct colours by maximizing the perceived colour difference between pairs of colours.
- Could we add a feature to simulate a colour under a certain colourblindness profile, like how it would look to a person with protanopia, deuteranopia, or tritanopia.
- Utility commands like
lighten,darken,compliment, etc.
Is this something that should be included with the original command? To be ...
It doesn't return colour or color in the context, it only returns the subcommand's name:



 itself, and was mentioned in a commit message (087d2f279e052871dcd4bb322953b01bf5b965cc), not sure where else to add credit ๐
, can you suggest some place else ?
Isn't return the same thing as break?
return will completely exit the function while break only breaks out of the current loop.
It does not, it only includes the sub-command's name.
As far as I can tell, this is the way to take a custom rgb color and convert it to a format that the discord embed's colour attribute can understand.
No, I wasn't talking about that. I am talking about the Colour in the embed. Currently, if you run .color or .colour, you get Colour. So, I wanted to ctx.command.name to decide whether to use color or colour.
And I know it doesn't return them, I said "This same thought can be used", so in a similar way we can implement this. Though I am not entirely correct here as above you use it to get the type. But yeah, this could be implemented to keep British English and American Engl...
Is this something that should be included with the original command? To be honest, I'm not sure how I would go about making those happen and what the command usage would look like.
Yeah, I would like to have it in the colour command, though this is completely optional and I would like to get inputs from other core devs part of this discussion. I feel like these commands are sometimes very helpful. I have implemented these on the quackstack repo (similar functionality), if approved I ca...
Like THUMBNAIL_SIZE? I also have two different values for the score cutoff depending on if it is matching a hex code or a color name, so that is why I kept it in place.
GitHub Actions run 1394748805 succeeded.
GitHub Actions run 1394837121 succeeded.
Thinking about this more, while this should work, this code might go the other way. If the bot is not running at 17:00 UTC on the 1st of the month, it will just miss it rather than trying again when the bot starts. Maybe I need to have a redis cache stating that it has been done, and then when the bot starts it can check this cache?
I think leaving it like this is fine. You could add a command, limited to admins, that sends the embeds on demand? That would cover the small chance that it fails.
(Personal note: completed api call saving on this one: leaving unresolved due to further discussion + fleshing out)
As I already have the !patrons command, I presume I don't need anything else (the !patrons command already returns exactly the same output!)?
Yup, that sounds fine to me then! (I haven't had a chance to look through the PR, just wanted to put my opinions about this comment)
GitHub Actions run 1395091595 succeeded.
Ohhh ok, then I'll fix that. Thx
@Shivansh-007 I would like to avoid scope creep. The issue has a well-defined scope that the contributors based their worked on. I'd like to get the PR to a mergeable state based on what was defined, and after merging additions can be discussed.
I'm 50/50 on this. A completely separately container here will be a lot heavier
to scale up and down than simply using multiple workers in a single container.
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?
Rust code looks decent, let's go
Makes sense to me.
Thanks!
[python-discord/bot] branch deleted: pin\-consistency
GitHub Actions run 1395870280 succeeded.
Connected!
GitHub Actions run 1395888253 succeeded.
The two routes specified in the PR description can be combined into the following route: *pythondiscord.com/robots.txt 
I agree here, the suggestions you brought up are quite different from the originally scoped issue.
Open another issue and we can discuss it there once this has been merged!
I'm getting some weirdness in testing. It seems like when I pass the extra it skips the subcommands. This is what I have right now that works for calling .color rgb(100, 100, 100) but fails for .color rgb 100 100 100 (yes I know a bare except is bad):
@commands.group(aliases=("color",))
async def colour(self, ctx: commands.Context, *, extra:str) -> None:
"""User initiated command to create an embed that displays colour information."""
try:
...
GitHub Actions run 1396756284 succeeded.
2dae405 Adds Get-Fetch User Utility - HassanAbouelela
[python-discord/bot] New branch created: reminders\-fetch
See python-discord/bot#1916 for more info.
Adds an integer field to reminders, to keep track of how many failed attempts at delivering the reminder were made.
Updates the documentation and serialization to include the new field.
GitHub Actions run 1396821315 succeeded.
Blocked by python-discord/site#618.
See #1916 for more info. This PR shouldn't close that issue.
I updated the reminders cog to try and get around the issue with missing users in the cache during startup. To try and resolve that issue, I switched to fetching as a fallback if the user wasn't found. To avoid accidentally hammering the discord API with fetch requests at startup, I removed the validity checks from the init function, instead opting to only run the check during the send functio...
GitHub Actions run 1396854858 succeeded.
Not needed as we raising a BadArgument error on the next line anyways.
We could ignore this suggestion then.
-
The docker error is not related to this, it is happening because you are missing the
trashcanemoji, which is required for pagination. -
You forgot to add a check to see if it is invoked with a subcommand.
if ctx.invoked_subcommand: return
Am I crazy or does this syntax not actually work? I would have done it something like this
if all(c in range(0, 256) for c in (red, green, blue)):
Max value for rgb is 255
message=f"RGB values can only be from 0 to 255. User input was: `{red, green, blue}`."
hue in hsv can be in the range of 0 to 360 degrees whereas saturation and value take a percentage (0 to 100). Same thing for hsl below, only hue can be 0 to 360, the other two are 0 to 100
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
[Approved by core dev to PR without issue](#dev-contrib message)
Description
Check whether a reaction is for a bot message when adding candies upon reactions. Previously you could use bot's reaction buttons which would trigger on_reaction_add and have a high chance of getting candies (or skulls). It can e...
GitHub Actions run 1397336497 succeeded.
#Bug risk
Magic methods that are not supposed to be asynchronous would not work as expected if they are made async. It is recommend to not make this magic method async.
GitHub Actions run 1397399238 failed.
Using the literal syntax can give minor performance bumps compared to using function calls to create dict, list and tuple.
GitHub Actions run 1397474682 failed.
Please run poetry run task precommit before pushing to help you with linting errors before pushing. More information can be found here.
Are you planning to make more changes to this PR? At this moment, it looks like #1920 is the exact same thing besides the formatting changes.
Closing this PR due to the contributing guidelines not being followed, as an issue was never created, and no discussion ever occurred with a core developer's approval.
Closing this PR due to the contributing guidelines not being followed, as an issue was never created, and no discussion ever occurred with a core developer's approval.
GitHub Actions run 1398581670 succeeded.
This gives me the same error, it doesn't recognize the subcommand is called.
@commands.group(aliases=("color",))
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:
return
else:
extra_color = ImageColor.getrgb(extra)
if extra_color:
await self.send_colour_response(ctx,...
GitHub Actions run 1398660465 succeeded.
I guess there is,
from discord import Color
...
Color.from_rgb(*rgb)
And I guess, this also negates the need of r, g, b variables in send_colour_response function.
GitHub Actions run 1399937484 failed.
The order here is wrong
h, s, v = colorsys.rgb_to_hsv(*rgb_list)
I think this is the same thing as with the ImageColor.getrgb where the functions expect the s and v values to be swapped. I'll test and make sure though.
https://pillow.readthedocs.io/en/stable/reference/ImageColor.html#module-PIL.ImageColor The docs specify hsv(hue, saturation%, value%)
hsv_tuple = ImageColor.getrgb(f"hsv({hue}, {saturation}%, {value}%)")
This was the behavior before I swapped the values (I took the HSV values from the embed when I called .color name Bone):

And the HSV values were not converted correctly.
I swapped the S and V and then got the correct embed returned:

You should be iterating through a tuple here
if any(c not in range(0, 101) for c in (cyan, magenta, yellow, key)):
GitHub Actions run 1400394931 succeeded.
I think you're getting this because you've also swapped the order in the embed which i've also made a comment on below. Here are the correct values from an online converter

โข [PEP-249](https://www.python.org/dev/peps/pep-0249) - a specification how database libraries in Python should work
โข [PEP-249](https://www.python.org/dev/peps/pep-0249) - A specification of how database libraries in Python should work
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, **safely**.
Yeah, got them both swapped back, should be ok now?
GitHub Actions run 1401167624 succeeded.
Very cool! We are getting very close, btw you still need to change the file name to colour.
This would never fail if the process.extractOne doesn't fail, so we can ignore TypeError and move this outside the try...except block. This won't fail as the match is being taken from the colour_mapping.keys() itself, so it has to exist in the dict.
Nitpick: You can just return early to ignore the indentation on ctx.invoked_subcommand is None.
Why not just make self._rgb_to_name return None?
Just to make the line shorter I pulled it out onto its own line.
Because it doesn't look good when it is on the top line of the embed vs the value for the Name field.
If it gets called without a subcommand I need to handle it (I would get an IndexError).
Very cool! We are getting very close, btw you still need to change the file name to
colour.
Why can't I keep it as color?
Very cool! We are getting very close, btw you still need to change the file name to
colour.Why can't I keep it as
color?
To keep it consistent throughout, in the source we have been using colour everywhere.
It's not needed, you can just make the string multiline if it extends the line limit. Variables are used if it acts as a constant or the value is being manipulated/used multiple times in the source.
I didn't understand, we are only using self._rgb_to_name once in the full source and when it returns No match found we make it None.
Connected!
GitHub Actions run 1401704708 succeeded.
Description
Right now, bookmarking messages as someone who is not the command invoker requires adding a reaction. I believe that the system can be made much more better using buttons as it greatly improves the UI and makes it a bit more simpler.
Reasoning
While using interactions, we now have an option to make any error only visible to the interaction author by making the error message ephemeral. This would mean that the error message will not be publicly visible and a confirmati...
Because it doesn't look good when it is on the top line of the embed vs the value for the Name field.
Rather than convert No match found to none, what about converting None to No match found?
This means that the code is consistent and the string 'No match found' only has to be in the code in one place, rather than several.
Comment at the top of the file, or if that doesn't work, as the value of key _
"Dumps list" doesn't sound right. Since the json could be loaded, I think just "json list" would be enough.
# {member id: json list of message ids}
This is should be updated since what this function does has changed. How about:
"""Builds an error embed for a given message."""
Probably a bit extra but still:
@bookmark.command(name="delete", aliases=("del", "rm",), root_aliases=("unbm", "unbookmark"))
also since aliases has it,
@bookmark.command(name="delete", aliases=("del",), root_aliases=("unbm", "unbookmark",))
Perhaps the error percentage of closeness could be listed as well?
I'm not even sure that rapidfuzz is needed here, or is the best tool for the job.
There's difflib, which is part of the stdlib.
In addition, there is a great deal of significance with the naming of these, and how they're matched.
As a quick review, because of how rgb and hex work, fff is very different from 000...
but run rapidfuzz.process.extractOne('f07070',['fefefe','010101']) and the result is 010101.
Th...
Rather than no match found, returning None and dealing with it elsewhere should be done.
This function reads like... The return result is a colour name, unless the name is 'No match found' then there's no colour. None is the python type for this.
IMO, just reference this as commands.BadArgument
There are way too many from imports here for my liking
Let's keep new changes for this out of here for now, we can revisit this later.
Sounds good. Is there an issue open for anti-spam already?
The extra , was present so that ("del") remains a tuple, otherwise, python would consider it as a single string. Trailing commas are only used for multiline tuples or single length tuples IIRC.
All seems good to me
[python-discord/bot] branch deleted: cleanrework
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 1402018671 succeeded.
Connected!
GitHub Actions run 1402024583 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 1402091161 succeeded.
This should be working now, based on my testing.
One way would be to have the colours as r b g integer tuples and find the one with the smallest euclidean distance using math.dist
colours = [(30, 30, 100), (25, 40, 25), (25, 25, 25)]
target_colour = (30, 30, 40)
closest = min(colours, key=lambda colour: math.dist(colour, target_colour))
# closest is (30, 30, 30)
Comparing colours is actually quite an interesting topic, and whilst this solution isn't perfect due to the way RGB works, I think it would be good enough fo...
The values needed to be swapped, fixed with 8808914.
The values needed to be swapped, fixed with 8808914.
In the current form this does not function the way I think it should. Two things that I see are:
- Default cowsay mode cannot be called - suggestion to fix that worked during testing is to start the
SUPPORTED_COWSlist with "default". - Message content cannot be passed without defining a cowtype. If the user tries to do
.cowsaythe first word of the message is interpreted as the cowtype, and raises the BadArgument error. I think this can be handled by changing the function definition...
This fixed the issue with the default cow not appearing. Since it is not appended to the list during the loop, it never appeared as a valid input.
SUPPORTED_COWS = ["default"]
Right now this isn't working if I don't include the cowtype after calling the command, since it is trying to pass the first word in the message as the cowtype. You might need to change the function definition to capture the rest of the message and modify the logic to handle the cowtype if none is passed.
GitHub Actions run 1402648854 succeeded.
GitHub Actions run 1403791761 succeeded.
Hello! It's me!
I had a quick chat with VCO on the DMD last night, and this issue was suggested!
Basically, we're using Metricity with Metabase at QuiltMC, but it doesn't have any support for threads. Since we use thread extensively, it'd be outstanding if Metricity was able to track threads in the following capacity:
- Whether a thread is archived or not
- Whether a thread is locked or not
- When the thread was created
- The name of the thread
- What channel a thread belo...
Joeโs been working on getting us there, but heโs been trying to work out the details for a while now. @jb3 how far along are we?
I think last time we spoke about it we were talking about a half hack, but thinking on it, full support isn't too hard really.
I may take a look at this later.
One of the problem mister banks mentioned is to find a way to not store one row per thread, but I personally think that's fine
I was thinking of having another table for threads, something like this ```
class Thread(db.Model):
"""Database model representing a Thread channel."""
__tablename__ = "threads"
id = db.Column(
db.String,
primary_key=True
)
channel_id = db.Column(
db.String,
db.ForeignKey("channel.id", ondelete="CASCADE"),
nullable=False
)
name = db.Column(db.String, nullable=False)
archived = db.Column(db.Boolean, nulla...
That seems about right, I would say having the archival time would be also good, and perhaps rename channel_idtoparent_channel_id`
Yea true. I've been trying to see if thread creation time is surfaced, but I can't seem to find it.
afaik if a thread is from a message, then the thread's ID will be the ID of that message, so you wouldn't be able to use that to work out when it was created.
afaik if a thread is from a message, then the thread's ID will be the ID of that message, so you wouldn't be able to use that to work out when it was created.
This is correct, but you could - if the bot's up - supply it based on the creation event?
Yeah, it should be fine to just create the thread in the db at the time the event was received by the client notifying it about the thread's creation. It's not going to be 100% accurate to its creation time like a snowflake would be, but I'm not sure a matter of a couple of seconds is that important at the scale of data something like Metricity uses.
Yeah, it does seem like there's some info lost here, I can't find a specific creation date either. For threads that already exist, it might be OK to assume that the ID is close enough, and then use creation date based on the event where possible.
It'd also be good to have the thread type in the table - so news, public or private
Can threads be news type? I was just gonna have a private boolean flag
My original implementation was going to be much less advanced, it was just going to be a new flag on messages which said if a message was in the parent channel or a thread of the parent.
I'm not opposed to storing more though, I think Chris' model looks good.
How are you planning to store thread messages @ChrisLovering, we could tie them to the parent channel and add a nullable FK to the thread and enum for thread message or channel message maybe?
I was going to have a nullable thread_id column on messages., so the channel_id would always be the parent channel in the case of thread messages.
Can threads be news type? I was just gonna have a private boolean flag
Yep, all threads created in an announcement channel are news type. There's no real difference other than that the user list contains all the users that could see the announcement channel, so I'm not sure why there's a difference, honestly.
I was going to have a nullable
thread_idcolumn on messages. So thechannel_idwould always be the parent channel in the case of thread messages.
This is my preferred ap...
Do we plan on having Metricity try synchronise thread statuses on startup? I'm not sure how we'd do that in a nice way without iterating all channels, but if we don't then the data stored are possibly out of sync with true Discord state (something we avoid very well for channels)
Yep, all threads created in an announcement channel are news type. There's no real difference other than that the user list contains all the users that could see the announcement channel, so I'm not sure why there's a difference, honestly.
I'll just have a type column then that stores the enum returned by discord.
Do we plan on having Metricity try synchronise thread statuses on startup?
Yea, we already iter channels on startup, I was planning on itering threads too
I was going to have a nullable thread_id column on messages. So the channel_id would always be the parent channel in the case of thread messages.
Sounds good - I think it makes sense that we include thread messages in the parent channels by default during aggregations.
Yea, we already iter channels on startup, I was planning on itering threads too
It's worth noting that the gateway will give you the active threads - but it won't give you archived or locked threads. Iterating all archived threads is likely to be very expensive.
hmmm, I wonder if just fine to not update archived threads
Do we need to sync archived threads? Some data would be lost, but I don't think it's too important
Yea, was my thought too.
Well, it'd be possible to just get the list of active threads and mark the threads that aren't in that list as archived - knowing whether they're locked or not probably isn't too important
Yeah, we're probably fine ignoring archived threads, as long as we try our best to capture active threads or archived threads that transition to active.
Yea, archived -> active is fine, as we can listen for the event and they'll be picked up in guild.threads.
active -> archived we'll have to listen to the event and iter through archived threads on ready to ensure we update statuses
active -> archived we'll have to listen to the event and iter through archived threads on ready to ensure we update statuses
No, I don't think so - you'd just have to iter the threads in the database and update their flags if they're not in the active list
No, I don't think so - you'd just have to iter the threads in the database and update their flags if they're not in the active list
We can't accurately capture locked here, not sure it particular matters.
Well, as I said:
knowing whether they're locked or not probably isn't too important
If you can avoid hitting the Discord API, you should - and there's no need to do so if you have a list of active threads, and a database state listing active and archived threads.
- Get list of active threads from Discord
- Get list of active threads from DB
- For active threads in DB not in list from Discord, mark archived
- Mark all threads from discord as not archived
Really doesn't have to...
There's no need to iterate every channel on startup to find threads anyway, since there's a [List Active Threads](List Active Threads) endpoint for guilds which I imagine is implemented. A single call to this endpoint on startup will get every active thread.
As the title suggests, this issue proposes adding support for getting the last x infractions, most likely via !infraction last .
This is mostly useful when you're dealing with a situation involving multiple issues and need to quickly get information on your infractions for each of them (e.g. to add context or edit duration after investigating).
Implementation wise, would most likely be best to revert the changes to !infraction made in #1804 and instead make last a subcommand, with...
Move text from footer to description.
closes #1873
GitHub Actions run 1404965756 succeeded.
This issue proposes allowing users to specify the end time of a reminder as the duration, instead of a relative time (e.g. !remind "01-11-2021 08:00" example instead of !remind 16h38M example).
This would mean the user doesn't have to do the maths of "how far away is the time I want", but would also mean we'd have to come up with some sort of parsing for the time, potentially with support for !remind 08:00 example (send reminder whenever the next occurrence of 8am is) and/or `!remind...
8fd91e4 Bump d.py to 2.0a0 - ChrisLovering
f2fdbb5 Expose psql port in docker-compose - ChrisLovering
019cbfb Support new guild specific avatars - ChrisLovering
233be3b db type that supports aware datetimes in user-land - ChrisLovering
d8cd02f Use tz-aware datetimes throughout project - ChrisLovering
[python-discord/metricity] New branch created: thread\-support
Closes #9
This adds support for discord threads. Threads now have their own table, threads. Each message sent in a thread will have a reference to the thread.
Due to the need to upgrade to d.py 2.0 to support threads, I have also done the following
- Store the hashes of both guild avatars and user avatars, when available
- Added a custom wrapper so that all datetimes being sent to and received from the DB are now tz-aware.
There are 1 failures, 6 warnings, and 0 notices.
There's no need to iterate every channel on startup to find threads anyway, since there's a
List Active Threadsendpoint for guilds which I imagine is implemented. A single call to this endpoint on startup will get every active thread.
We already iter all channels on startup since we also sync channels.
I've just hooking into this process and am also itering active threads.
Let's say you see an abbreviated command like
!i a l
that you're not familiar with and you want to figure out what it does. So, you go:
!help i a l
Currently, the response will be:

This is because despite the fact that the first two characters correspond to a valid subcommand, the final term of the command line, l, is an argument and not a subcommand. Maybe...
Connected!
GitHub Actions run 1405085726 succeeded.
31b3d60 Add support for !infractions by <m|me|uid> - TizzySaurus
[python-discord/bot] New branch created: infractions\-by\-command
Closes #1922.
Added support for !infractions by subcommand. See issue for more details on command usage & invocation.
GitHub Actions run 1405333556 succeeded.
I have a question.
I find the project mega interesting and have not yet worked with others except for the little bit (I'm still learning).
Now some things have not worked out for me as far as Hacktoberfest is concerned and I'm not sure if I can still make it. You are not by any chance participating at Hacktoberfest this year or could add it for me?
Regardless of this, I will of course continue to look around here and see how I can support and learn.
Yea that's a good spot. I'll change this, but I want to make it clear that this is serialised, so will change it slightly more than suggested.
[bot] Branch consider\-parent\-channels\-when\-checking\-mod\-channels was force-pushed to `a2ec6f9`
[python-discord/bot] branch deleted: consider\-parent\-channels\-when\-checking\-mod\-channels
GitHub Actions run 1405482703 succeeded.
Connected!
GitHub Actions run 1405489856 succeeded.
GitHub Actions run 1405679127 succeeded.
dropped the commit that added this and forcepushed
f8d09b2 fixup: another docstring improvement - ChrisLovering
GitHub Actions run 1405685000 succeeded.
GitHub Actions run 1405692555 succeeded.
Yea, that one would require use to store a lookup from message ID to dm message ID for each member, possibly over complicating it. I may be tempted to say we just keep the interface semi-restricted like this instead.
I have a question. I find the project mega interesting and have not yet worked with others except for the little bit (I'm still learning). Now some things have not worked out for me as far as Hacktoberfest is concerned and I'm not sure if I can still make it. You are not by any chance participating at Hacktoberfest this year or could add it for me?
Regardless of this, I will of course continue to look around here and see how I can support and learn.
added ๐
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 1405723011 succeeded.
Please update the failing test to reflect the changed role colour HSV.
Otherwise looks good ๐๐ป
Has been fixed :+1:
Longer but more descriptive, I like it! Might wanna resolve this?
@doublevcodes has said [on discord](#dev-contrib message) they let me take this one. Can I get assigned please? I've almost finished my implementation with a some improvements to the original and I'll open a PR after my exams are over.
I've added is_category to the context so that the button would only show up on articles (weird to say "edit on github" on categories). Not sure if there are already places in the existing con...
Description
There might be a bug/error when reacting to .wiki commands trashcan, I was able to remove the message by clicking trashcan even when I was not the one running the command.
Steps to Reproduce
If this is not how it should act there might be a error in check. Maybe adding a check to function to .wiki command (if this is not how it should act). It would be nice to be limited, so it would not be clicked to annoy others or be pressed mistakenly to remove the message....
Thanks for the report. The paginator takes a restrict_to_user argument:
https://github.com/python-discord/sir-lancebot/blob/ba4b0e498191195d773c031fcfdaef862bd472b8/bot/utils/pagination.py#L91-L95
which can be used for this exact purpose. I think we should use it here.
I see, that would be really nice to have on commands that have the trashcan reaction, especially the ones with more than a bit of content eg. .wiki command.
Have done this locally :+1:
Have done this locally :+1:
I guess the idea is that the footer would be more obvious the link is there and then the .url is what you can click to open it? I don't really know, but think for now I'll leave this.
I believe this was deliberately done as INFO so that it would show on our logs online (which doesn't show TRACE level).
Yeah, I'm inclined to agree with this. It means we don't have this specific error handling but we have generic handling for when there's a missing argument to a command.
Done locally, with a minor improvement to the if statements.
Done locally, with comments explaining each line :+1:
I prefer the latter, so have done that locally :+1:
Yep, have removed the __init__ locally :+1:
I'm not too sure but I'm going to leave this one as-is. Perhaps @hedyhli can look into this for one of their Hacktoberfest PRs.
Have done this locally :+1:
Have done this locally :+1:
Parsing the markdown seems too big of a thing for the scope of this PR. Perhaps @hedyhli would like to do this as one of their hacktoberfest PRs.
Have done this locally :+1:
I think I'll leave this now as I don't really have time to delve into this. Perhaps you can look into this for one of your hacktoberfest PRs.
Shouldn't the markdown already render like the GitHub webhook embeds?
Nice, thanks :D Yea, just wanted to wait for your feedback to make sure.
[sir-lancebot] Branch reorder\-hacktoberfest\-commands was force-pushed to `9518da2`
[sir-lancebot] Branch reorder\-hacktoberfest\-commands was force-pushed to `fca5a45`
GitHub Actions run 1407370469 succeeded.
@Shivansh-007 @hedyhli Have just pushed #fca5a45 which fixes all the reviews I said I'd do :+1:
0c814ce Set AI.user to @Sir Lancebot - TizzySaurus
462b83c Add missing Game.channel attribute - TizzySaurus
a7bb17c Fix bugs in .issue command & add aliases - TizzySaurus
b000a47 Merge pull request #914 from python-discord/iss... - ks129
860c137 Address review & make AI.get_move a staticmethod - TizzySaurus
GitHub Actions run 1407376243 succeeded.
I generally like to recommend aliases in the help or suggestion text
If the command is run with beginner (`.hacktober issue beginner`):
f"+type:pr" # Only get PR if it's:
f"+is:public" # public
f"+author:{quote_plus(github_username)}" # made by the user's github username
f"+-is:draft" # not a draft
f"+created:{CURRENT_YEAR}-09-30T10:00Z..{CURRENT_YEAR}-11-01T12:00Z" # made in October
f"&per_page=100" # Limit results per-page returned from API (100 is the maximum)
The ... looks a bit redundant, up to you though.
log.info(f"Getting stats for '{github_username}' as requested by {ctx.author.id}")
Yea I think it's a trade off between better multi-core support and better load balancing.
Do you know off the top of your head what the load difference would be? The reason I ask it afaik gunicorn has a management process on top of each of the worker processes, which wouldn't be needed with individual containers. So we do drop one of the resource sinks by doing this.
cc @python-discord/devops
Can we differentiate between not finding the webhook and missing permissions?
Wouldn't it be easier to use the author field here?
I think that discord.Colour.dark_theme() might fit better here?
The yellowish-gold is pretty obnoxious.
Yes exactly, you sleep instead of scheduling the removal.
Just parse() itself is kind of confusing, maybe use an as in the import to rename it?
Isn't it easier to just do like match = process.extractOne(...) and then have an if-statement?
I actually like the gold color ๐ I always found the transparent color pretty lackluster.
I don't think you can have mentions there, can you?
You mean catching discord.Forbidden as well? I don't think this is something we bother doing anywhere with webhooks. If the bot doesn't have perms for it we probably have bigger problems ๐
Ah right, maybe not. That could be an issue.
Since we load the cog earlier and then remove them from the cache (when using the .c load command, it would never be loaded as the cog would be present in the cache, so this option was added to force load the cog without checking the cache.
Since we don't want to force reload the cog when the bot initially loads the cogs, it is set to False.
Re: PR #1629 and [discussion on server](#dev-contrib message)
Currently when a user runs the .helpdm on command and subsequently closes their server DMs, when bot's DM fails to deliver the user is then set to not receive help DMs. The user has to remember to rerun the .helpdm on command again after re-opening their server DMs at a ...
GitHub Actions run 1408173092 succeeded.
But this means that when start() calls load_extension() it will always load all cogs?
Because you do if ignore_cache and not await self.unloads_cache.get(name):?
I am a bit confused
- Add reminder endpoint package to the project:
- Add reminder dependencies
- Add reminder schemas
- Add reminder endpoints
- Add reminder tests to the project.
- The tests use mocked DB session calls, to avoid using a test DB.
- Introduce changes in the flake8 config, and main to be comaptible with the test suites.
GitHub Actions run 1408515144 succeeded.
[python-discord/bot] New branch created: kill\-sir\-threadevere
These changes moves the management of nomination threads from Sir Threadevere to the bot. Once this PR is merged, Sir Threadevere can be shutdown.
These changes include creating a thread while posting the nomination, pinging staff inside the thread, and then archiving it once the nomination is concluded.
GitHub Actions run 1408944005 succeeded.
It would be nice if we could also add a listener on this cog automatically unarchiving threads if they get archived through a timeout and not manually
This regex will have to be updated, although I have no idea how it didn't already break
GitHub Actions run 1408951695 succeeded.
PR Author
Workflow Run
Source Branch
kill-sir-threadevere
The one I made for threadbot seem to do the job. Does this look better?
NOMINATION_MESSAGE_REGEX = re.compile(
r"<@!?\d+> \((.+)#\d{4}\) for Helper!\n\n\*\*Nominated by:\*\*",
re.MULTILINE
)
(ideally when we rewrite this for https://github.com/python-discord/bot/issues/1746 we will store these messages in redis
GitHub Actions run 1409255615 succeeded.
Connected!
GitHub Actions run 1409262190 succeeded.
This PR removes the allowed_strings converter because we can use typing.Literal as a converter to the same effect
Fixed in https://github.com/python-discord/bot/pull/1928/commits/57288b22e4e42493e2522b86db8a6f55c117d820 as for why it didn't break, this current regex supports both the current style of message, but also the old style before thread-bot. Since there aren't any old-style messages no, we can use the same regex as threadbot does.
GitHub Actions run 1409460560 succeeded.
The #noqa comments are no longer required when using Literal.
As the title says.
An example can be found on an internal staff thread [here](#902258820561137754 message). For those that can't view the message, it has the required amount of duck reactions but the bot didn't "duckify" it.
The issue may be these lines but can't be sure without further investigation.
channel = discord.utils.g...
GitHub Actions run 1409702134 succeeded.
I'd rather stick to the full command myself. It just feels more "complete".
The width does pass and I like it, so have done this :+1:
I'll also remove the ... since I think it adds more noise rather than helping with flow as intended.
Agree, have removed. Also aligned the comments in a way that looks neater.
[sir-lancebot] Branch reorder\-hacktoberfest\-commands was force-pushed to `ea8f556`
GitHub Actions run 1409750716 succeeded.
0c814ce Set AI.user to @Sir Lancebot - TizzySaurus
462b83c Add missing Game.channel attribute - TizzySaurus
a7bb17c Fix bugs in .issue command & add aliases - TizzySaurus
b000a47 Merge pull request #914 from python-discord/iss... - ks129
860c137 Address review & make AI.get_move a staticmethod - TizzySaurus
GitHub Actions run 1409782801 succeeded.
Please ignore the re-quest for reviews, I'm testing a bug I'm having with the interface.
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
Why the merge commit? Is this a bug that could be tested elsewhere?
GitHub Actions run 1409788298 succeeded.
Users are sometimes able to open a new help channel despite already having one open. It's hard to know how often this occurs since I don't know how often people try, nor how many we miss. The ones I've seen have had the proper role, but of course I don't know if they had it before opening the second channel.
It may be possible to debug this by having a look through logs. While the logs are significantly less helpful without the trace level, there may still be some errors to spot e.g. roles failing to be added the first time. What would make this much easier is if some user IDs or channel IDs were provided for instances of this error occuring.
Description
Remove the topic that asks people what skill level they are.
Reasoning
We spend a bunch of time getting people to not rate themselves and we just have this topic that asks them to do just that.
Proposed Implementation
Just remove it from the json or whatever it is.
- [ ] I'd like to implement this feature myself
- [x] Anyone can implement this feature
Relevant Issues
Closes #934
Description
I deleted the line from the yaml
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 guidelines?
GitHub Actions run 1410287684 succeeded.
Could you add type hints for this variable?
Not really helpful, could you add a bit more information on this logging statement. And we can bump such statements to info IMO.
Secondly, I don't think debug level logging statements are visible in the pydis production environment (Confirmed by joe).
Just some trivial things apart from your previous commit breaking hacktober stats (at least for me)
# If API request is unsuccessful it will be a dict with the error in 'message'
This doesn't work
hacktoberfest_timeframe = f"{CURRENT_YEAR}-09-30T10:00Z..{CURRENT_YEAR}-11-01T12:00Z"
logging.info(f"Hacktoberfest embed built for GitHub user '{github_username}'")
So it looks similar to line 111
It would require flattening out (transforming HTML to plaintext) but I don't really think it's that much of a problem. Users should go to the GitHub issue page anyway to see other information like assignees and linked PRs. If you'd still like that you should open a issue and we can discuss about whether it should be added.
The branch wasn't merged properly with main, and leaves out a few changes in the pyproject.toml file, for example, psycopg2-binary is left out.
Ah yeah, I had fixed that locally during my last testing... forgot to push it. Should be fixed now in 8193125.
GitHub Actions run 1410787183 succeeded.
Connected!
GitHub Actions run 1411297884 succeeded.
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
I know what you meant here, but this reads like the function is making a search by user, and not searching for something made by a user. I think search_by_actor is a better name here, and then change the argument name to actor accordingly.
c904d21 Rename search_by_user to search_by_actor - TizzySaurus
GitHub Actions run 1411478033 succeeded.
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
I know what you meant here, but this reads like the function is making a search by user, and not searching for something made by a user. I think search_by_actor is a better name here, and then change the argument name to actor accordingly.
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
This might seem a bit of a nitpick, but I think it's not necessary to create variables for the ID and the name+discrim.
You can have this condition at the beginning:
if actor in ("m", "me"):
actor = ctx.author
And then have 'actor__id': str(actor.id), instead of 'actor__id': str(actor_id),, as it doesn't seem like you save anything with that variable.
Then below you can have
title=f"Infractions by `{actor}` (`{actor.id}`)",
Since as you've shown at ...
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
That being said, in terms of formatting, this formatting strays from the usual infractions embed, where it's Infractions for {user#discrim} ({count} total). I think it'd be nicer if it was more consistent (e.g just replace the for with by).
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
I deleted this comment because I accidentally posted it as a single comment. Reply is in https://github.com/python-discord/bot/pull/1926#discussion_r740825265 and handled in c904d21
d26f014 Remove D0rs4n as they are now staff - ChrisLovering
[python-discord/.github] New branch created: remove\-dorsan
[python-discord/modmail-plugins] branch deleted: closemessage
@mbaruh I'm not able to reply to your reviews for some reason but they've all been addressed in d79b069 :+1:
GitHub Actions run 1411704526 succeeded.
Blocked by #25
Closes #11
I have based my branch on Dorsan's to get the test patches and routers set up.
My commit currently has a bug in the tests where it doesn't patch session.query.all properly and order_by fails to get the correct mocked object.
Relevant Issues
Close #933
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
I added restrict_to_user=ctx.author to wikipedia.py. Limits user reactions to prevent non-author from removing message by adding user restriction to paginator.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or lin...
[python-discord/sir-lancebot] Checks Successful on PR: #936 Limit user reactions on embed pagination
GitHub Actions run 1412155976 succeeded.
The first batch of review, just to get everything sorted. Good work, overall.
The second batch of review. :)
(I'll look into the problem with tests later on today, or tomorrow)
GitHub Actions run 1413233921 succeeded.
Description
Changes a users current profile picture into something more seasonal, similar to commands like .spookify
Reasoning
It would be fun and spread the holiday cheer
Proposed Implementation
Adding Christmas hats, snowflakes, etc etc
Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [x] Anyone can implement this feature
I would do it myself, but I'm rather busy and don't know how to use pillow, as I've never experimented with i...
GitHub Actions run 1414341342 succeeded.
GitHub Actions run 1415129444 succeeded.
@MarkKoz I reported this to modmail (I think that's how this issue came to be)
this is the second double-claim I found:
#help-apple message
#help-mushroom message
this is the second one
#help-chestnut message
#help-coconut message
Description & Reasoning
the .wtf command is quite nice for finding the explanation for a specific python quirk from the WTF Python?! repo. I would like an easy way to link to the entire repo directly. It would be nice to be able to provide that link to people so they can read through the repo on their own time.
Proposed Implementation
If .wtf is called with no query, then an embed and/or nicely formatted link of the repo is provided instead. Currently, calling just .wtf pr...
4e962af Correct link and wording - janine9vn
58ac3b5 Merge branch 'sql-fstring' of https://github.co... - janine9vn
fml, thanks for catching that.
@wookie184 @Bluenix2 incorporated your changes! Let me know if there's anything else you want changed
[python-discord/api] Pull request review submitted: #25 Migrate reminders endpoint from the site API
Using a mocked test database in the tests is a very huge stepback from the existing Django API and renders all of the added tests far less effective. Please re-add the test database and integrate it with our CI properly such that we can validate that the endpoints works with the database as wanted.
GitHub Actions run 1417322916 succeeded.
Isn't "presents" rather than "represents"?
My avatar represents me. On the other hand a broken door presents a security risk.
Don't use f-strings (`f""`) or other forms of "string interpolation" (`%`, `+`, `.format`) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it represents a major security risk via SQL injection.
Would "Additionally" sound better here?
Nitpick, trailing semicolons?
query = "SELECT * FROM stocks WHERE symbol = ?;"
Using a mocked test database in the tests is a very huge stepback from the existing Django API and renders all of the added tests far less effective. Please re-add the test database and integrate it with our CI properly such that we can validate that the endpoints works with the database as wanted.
Alright, I was gonna do this initially however @HassanAbouelela [mentioned](#dev-contrib message) that it would make the possib...
@jchristgit My reasoning for not adding the test database is that we don't really need it for our tests. I've looked over a few of the current site tests, and for the api ones, it's mostly just "Put data in DB, pull data from DB, call functions with that data." If you notice there, that whole putting into DB, and taking out is completely redundant. In both cases you're creating a predetermined instance of a model, and injecting it into a route. We don't need a DB to do that.
On the other han...
GitHub Actions run 1417788125 succeeded.
I just have two questions left as comments, but other than that it looks good and I am ready to approve when those are answered.
Shouldn't there be a closing quote here?
โข [Extended Example with SQLite](https://docs.python.org/3/library/sqlite3.html) (search for "Instead, use the DB_API's parameter substitution")
Should we be showing what the end result becomes in a comment?
I guess we could leverage the use of an Accept header in the post call to determine what to send back, so that it's backwards compatible, but also gives the option to accept an octet stream, or base64 encoded bytes.
This isn't possible with plain PostgreSQL, except if we were to use triggers, and I would currently stay away from that personally.
The original approach here was the correct way: foreign key constraints. But since this got removed due to performance issues (waiting on reply from a Django expert friend on this topic), this is a fine approach.
This looks good, thank you!
Could you rebase off master, please?
@jchristgit My reasoning for not adding the test database is that we don't really need it for our tests. I've looked over a few of the current site tests, and for the api ones, it's mostly just "Put data in DB, pull data from DB, call functions with that data." If you notice there, that whole putting into DB, and taking out is completely redundant. In both cases you're creating a predetermined instance of a model, and injecting it into a route. We don't need a DB to do that.
I can unders...
So I think that would make the tag a bit too lengthy, which is why I'm opting not to. In my ideal world I'd like to show how a the SQL statement would differ between the params and the f-strings, but at that point it's more appropriate for an article.
I'm hoping it's clear enough to get the point across with someone (in channel) explaining or to have enough of a starting point for them to investigate what's happening in more detail with better search terms.
GitHub Actions run 1418541396 succeeded.
So! I will likely not comment on specific pieces of code because the changes I'm going to request will span a lot and likely require a fundamental change to some of the logic.
Also thank you in advance for working on this! Please don't be overwhelmed by my requested changes.
New Features
After playing with this for a bit and thinking on the event overall, I am going to ask for some changes that deviate from the original issue.
- Adding a timer to questions. Each question will be on ...
This should not be a repr, since this is being displayed to the end user. It outputs something fairly unreadable.

GitHub Actions run 1418709758 succeeded.
Great change, thank you!
Once the review by Tizzy is dealt with, this looks good to merge.
This looks good. I would leave an approval, but I have a few comments which may be nice to address or not.
The -> None here is kind of ... wrong. But since it was wrong before, no need to fix it here.
This setting should maybe just be part of the config, or at least be computed in bot/constants.py to keep configuration logic out of here. What do you think?
Should we move this above the archive logic to make sure the nomination message(s) are deleted even if the thread is lost somewhere?
Readability nitpick aside, this looks good to merge (feel free to dismiss my review when it's addressed).
[python-discord/bot] New review comment on pull request #1926: Add support for \`\!infractions by \`
This is smart, but it's also very hard to read what's going on here. Could you move this above the get call, something like:
if oldest_first:
ordering = '-inserted_at' # Descending order
else:
ordering = 'inserted_at' # Ascending order
This is a very useful tag to have. Thank you!
I agree with the approach suggested by @mbaruh. Reusing DRF's builtin logic for this allows us to keep custom code (including tests, docs, etc.) to a minimum.
c6889de Improve ordering logic in API request - TizzySaurus
I'm still not able to reply to reviews for some reason but have fixed @jchristgit :+1:
GitHub Actions run 1419075305 succeeded.
-Added a default value to query, and if the value is None, send the
link to the repository in an embed.
-Modified the if / else statements to if / elif / else with the new
if statement to check if the value of query is None.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes#938
Description
-Added a default value to query, and if the value is None, send the
link to the repository in an embed.
-Modified...
GitHub Actions run 1419308313 succeeded.
I'm not sure I understand what you mean by that, where would the return statement go and what indentation would be changed?
Do you mean make it like this? I'm not sure what pulling it out from the try / except block really does to improve.
def match_colour_name(self, input_colour_name: str) -> str:
"""Convert a colour name to HEX code."""
try:
match, certainty, _ = process.extractOne(
query=input_colour_name,
choices=self.colour_mapping.keys(),
score_cutoff=80
)
except (ValueError, TypeError):
...
So for either of these solutions, I need the ryanzec.json list to have an rgb value: color name key-value pair?
GitHub Actions run 1419404273 succeeded.
It basically adds a redundant error catching try....except on self.colour_mapping[match] which is never gonna fail if the previous step worked perfectly fine.
if not ctx.invoked_subcommand:
return
try:
extra_colour = ImageColor.getrgb(extra)
await self.send_colour_response(ctx, extra_colour)
except ValueError:
await invoke_help_command(ctx)
- Add newlines so it's not a big unfriendly paragraph
- Fix gitpod workspace link
- Clarification on terminal commands
- Clarification on test server and bot
- Add links for that ^ and for environment variables
@hacktoberfest.group(invoke_without_command=True, root_aliases=('hackstats',))
How about some backwards compatibilily? :P
I think hackstats is unique enough unless we roll out some sort of hacking-related event/competition in the future
Just two additional things I forgot in my last review (so we can get this merged quicker to hopefully sort out the other hacktober-related things before the end of november ๐)
@in_month(Month.SEPTEMBER, Month.OCTOBER)
Perhaps people would like to start looking for issues beforehand if maintainers are already preparing for it
Description
The .rp command currently gives 5 results by default but what if you wanted to get only 1-4? There should be a option to get amount you want by still keeping the max 5 as default. If no amount provided default value, 5, will be returned.
Reasoning
Getting only specific amount of results if you don't want to see more, and could possibly be good to limit results if wanted.
Proposed Implementation
Currently I don't have any in code implementations, but some so...
This sounds good. I think an optional int argument before the query would work, since I doubt people will be starting their queries with numbers.
Tiny nitpick but this might be cleaner if there was a newline separating the if query is None block from the next, which can be an if rather than an elif since the first block returns
Yeah I had that originally and then got carried away a bit. Should be fixed now.
GitHub Actions run 1421481809 succeeded.
abfd10f Update my username in review-policies/core-dev... - hedyhli [e6c12b2`](https://github.com/python-discord/.github/commit/e6c12b219a2eac6918548c808b52346c643be10b) Merge pull request #8 from hedyhli/patch-1 - jb3
[python-discord/.github] branch deleted: remove\-dorsan
Description
One feature we'd like to have on the mod team right now is the ability to unfurl a shortened URL to apply further filters to it. There are multiple services we'd like to do this for, such as bit.ly.
We had discussed a similar idea in the past, but ultimately decided not to continue with it due to concerns with us making requests to untrusted destinations, or following a redirect too far causing an error. I believe I have a solution that'll help the mod team, while not introd...
Connected!
โข [Extended Example with SQLite](https://docs.python.org/3/library/sqlite3.html) (search for "Instead, use the DB-API's parameter substitution")
It is actually spelled like this on the page.
Looks good to me now, thanks
GitHub Actions run 1421844676 succeeded.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #940
Description
Now the .rp command has option to get specific amount of articles in between 1-5 (inclusive). I added new parameter to .rp which is amount. If no argument given when command is ran, the default value 5 will be used. If user tries to give negative, 0 or bigger than 5 , the bot will send a message saying "`amount must be between 1 and 5 (inclus...
GitHub Actions run 1421888346 failed.
GitHub Actions run 1421985072 succeeded.
Hmm, I guess we could have a DEFAULT_THREAD_ARCHIVE_TIME in constants.py yea.
Yea, agreed. we should probably wrap the edits and delete in suppress too
GitHub Actions run 1422046190 succeeded.
GitHub Actions run 1422070328 succeeded.
I'm not too fond of having annotated doc strings like this for commands, since this is the help that will be given to the user I think it should read as "proper" English. Maybe something more like this
"""
Send some articles from RealPython that match the search terms.
By default the top 5 matches are sent, this can be overwritten to
a number between 1 and 5 by specifying an amount before the search query.
"""
Could you add a new line after this line, to separate input validation from command logic :D
This works well, but doesn't need to be split up like this. I'm aware you didn't do this yourself, but lets make it better while we're here. The style we currently go with is this
await LinePaginator.paginate(contents, ctx, embed, restrict_to_user=ctx.author)
Connected!
GitHub Actions run 1422244847 succeeded.
The filters are re-run on messages that are edited and pinned. Because of the help channel system, This can cause a filter to trigger twice if the opening message contains a trigger.
We should check what causes the filters to trigger on pins and see if there's a way to disable that.
This happens because we re-run our filters whenever an on_message_edit event fires, which happens to fire when a message is pinned. Checking whether the pinned attribute's value changed should be enough.
6a1e220 Improve the UserFriendlyDuration converter - Qwerty-133
[python-discord/modmail-plugins] New branch created: closemessage
Thanks for the review again @jchristgit :D, I will work on them asap.
Looks like the otn endpoint is being migrated to https://github.com/python-discord/api, therefore I believe we should be moving this PR to api repo as well once https://github.com/python-discord/api/pull/26 is merged.
@jchristgit
?cm in msg and ?cm msg from now close the thread instantly because of how the time.UserFriendlyTime converter strips them away.
This PR also constructs a new argument and passes them to the super class' convert method instead of directly manipulating the arg attribute so that the raw attribute isn't left in a misleading state.
Looks like the otn endpoint is being migrated to https://github.com/python-discord/api, therefore I believe we should be moving this PR to api repo as well once https://github.com/python-discord/api/pull/26 is merged.
@jchristgit
GitHub Actions run 1422489122 succeeded.
GitHub Actions run 1423010665 succeeded.
GitHub Actions run 1423024483 succeeded.
GitHub Actions run 1423041616 succeeded.
GitHub Actions run 1423274139 succeeded.
Lots of people wonder what at typehint is, so this tag addresses that.
Draftish:
A typehint indicates to users of a function what type it expects to be passed, as well as indicating what type the return value of the function should be.
def add(a: int, b: int) -> int:
return a + b
Note that this has no actual effect on what is passed, for example, this is valid code
add("hey", ["yo", 2])
I turned off DMs earlier today and forgot to turn them back on before participating in a help channel. I did see the ping notification in #bot-commands but by the time I got there message was already gone. What is the current delay before message deletion?
Connected!
GitHub Actions run 1423932786 succeeded.
GitHub Actions run 1424391109 failed.
Right, I think its better to stick to the original definition, and we can perform a filter() instead of passing in params to queryset
They come from the function definition within the framework.
raise commands.UserInputError(":x: You can only delete bookmarks in your own DMs!")
or maybe
raise commands.UserInputError(":x: You must either use a message link to a bookmark in your own DMs or reply to one!")