You can add return None at the end of this method.
#dev-log
1 messages ยท Page 82 of 1
We temporarily tried to lower the bot down the hierarchy and that broke things, it's now back up. Can be ignored.
None isn't even right iirc, since it returns its self?
Correct me if I'm wrong.
The only case where we have to DM the user first is when we apply a ban. Otherwise, if applying the infraction fails for any reason, it will unnecessarily DM the user about it first.
@onerandomusername __init__ doesn't return anything afaik (since you don't have any return inside).
@Den4200 yeah but is it necessary? I am not adding typehints for methods like __str__ or __bytes__ because return values are obvious ๐
Sorry I wasn't being clear; I was responding to @onerandomusername. I agree with you, it's not necessary here in this case.
This method returns None as annotated. NoReturn is for functions that never return.
@kwzrd where it returns None? ๐
Functions that have code execution "drop off" the end of the function return None by default.
GitHub Actions run 1191772861 succeeded.
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
Yeah, I've made an InvalidInfraction error and decided to also slightly improve the error messages (invalid id and 404). Will push these changes shortly.

[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
Also going to change "...infraction for {number}" to "...infraction with id {number}`
GitHub Actions run 1191883833 succeeded.
GitHub Actions run 1192000830 succeeded.
After many hours dabbling with the tests I figured out how to fix them. Hopefully this should all now be ready to merge, just needs the reviews :+1:
Strictly speaking we also need to DM first on kicks. Although we kick much less often, we should still account for it.
Then it shall be removed.
I noticed there is an up for grabs tag on this, if no one else wants to, I would love to implement this issue.
I've already started making the basics, once I'm free I can send a video of how the base looks
I noticed there is an
up for grabstag on this, if no one else wants to, I would love to implement this issue.I've already started making the basics, once I'm free I can send a video of how the base looks
Experimented with this hangman idea. I would love to work on this issue though if anyone else wants to take it, that's fine with me
@Shom770 I liked your video! You can certainly go ahead and implement this feature. I was actually going to take it but I had a feeling that I might not have much time to do it, so I didn't assign it to myself. If you get stuck along the way, feel free to DM me on Discord (DM-Friends is my username) or ping me here and I can try to maybe find some time to help you.
@DMFriends Sounds great!
I havenโt contributed much so I donโt really know if multiple people are allowed to help on one PR (I would presume so) but if you ever have time I would be more than glad to have you help out if you wanted to!
@Shom770 I am pretty sure that you are allowed to work with multiple people on one PR.
Cool, thanks so much!
Since there are about 2x the amount of __init__ methods without the None annotation than ones without, the annotation will be removed from the remaining ones.
There is no need for this. It's either that the return new_name is hit within the for loop, or the function returns the default value of None.
GitHub Actions run 1192498465 succeeded.
@ChrisLovering I'll be on it, thanks! Will role=(everyone role) be enough? I'll look through the code tomorrow, currently about to sleep lol
Wow, super cool :D Lancy getting a restructure!
This was purely a code review, I'll test out this feature soon.
What does this mean? I don't think I get the meaning of the comment correctly.
I think this is what you wanted to have here.
if (isinstance(first_limit, Message) or isinstance(second_limit, Message)) and channels:
async def convert(self, _: Context, argument: str) -> str:
ctx doesn't seem to be used anywhere in the function, so I think we can use _ here.
I don't get the convention because sometimes None is returned, sometimes not ๐ค
This is deprecated, re.Match support __class_getitem__ now.
What's the hurt in keeping this?
Just inconsistency I suppose. We use a linter for annotations and the rule for init is explicitly disabled among other things.
Which convention? The Optional annotation?
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
Doesn't TYPE_CHECKING come first?
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
Raised by the Infraction converter when trying to fetch an invalid infraction id.
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
I don't really understand what you're saying here.
The Pydis style guide states that for imports:
Each group must be ordered alphabetically, with uppercase modules coming before lowercase.
and that's what I'm doing here? H < T < U soHashable, TYPE_CHECKING, Union, as I did.
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
Will adjust this, thanks :+1:
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
I understand what you mean now. TYPE_CHECKING is all caps so should come first. I'll double check if this is right.
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
It seems that it just means A goes before a. In this case we only need to care about the first letter of each import, but if we had say TYPE_CHECKING and Task, then although the second letter of Task (a) is before Y in the alphabet, because it's lowercase it'd go after the TYPE_CHECKING import.
This is the result of linting after changing to TYPE_CHECKING, Hashable, Union:
Flake8...................................................................Failed
- hook id: f...
GitHub Actions run 1193611663 succeeded.
Hi! I would like to implement this! This will be my first contribution, so I will probably have a lot of questions!
For the role added, I would guess the best method would be to listen for on_member_update?
Then for the monthly one, using Role.members?
I guess the #community-meta channel is in config.yml at guilds-channels-meta (meta being in the # Discussion comment)?
Should the monthly one get pinned?
Great! I'll assign you to the issue. For reference what is your name on Discord? Also, feel free to ask questions in #dev-contrib if you need any further help!
For the role added, I would guess the best method would be to listen for on_member_update?
Yes, that would be the way to do it. Keep in mind that we'd only want to send a message for when a new patron subscribes, rather when someone stops being a patron. The modlog cog currently watches for role changes, so if you're looking for ...
Great! I'll assign you to the issue. For reference what is your name on Discord? Also, feel free to ask questions in #dev-contrib if you need any further help!
I am mathstrains19#2057 on discord!
Ok!
For the role added, I would guess the best method would be to listen for on_member_update?
Yes, that would be the way to do it. Keep in mind that we'd only want to send a message for when a new patron subscribes, rather when someone stops being a patron. The modlog cog curre...
3228ded Apply infractions before DMing - TizzySaurus
[python-discord/bot] New branch created: infract\-then\-dm
Closes #1805
Bot now attempts to infract before DMing, with the exception of kicks/bans, in order to prevent the user getting sent a message stating they were infracted when the infraction failed (and so they aren't).
GitHub Actions run 1193838759 succeeded.
That looks really nice. However, (that's just a suggestion.) since Sir Lancebot is now on discord.py 2.0 I believe it would be really great if somehow you could integrate the concept of views into the structure. That's still in the future, but as a concept I could imagine something like generic_views that are used all around the code, and are useful in many contexts, and "local" views that are specific to a Cog or topic.
(However no views have been created, and they won't be created in a...
I imagine generic views would go into the utils folder, similar to other helpers functions/classes, and cog-specific views would be near the cog itself.
Description
Add more information on how to run or reload a bot during testing to the contributing guides.
Reason
For people who are new to using Docker / discord.py / contributing to python-discord/bot or python-discord/sir-lancebot, this will be a helpful resource on how to test small changes during the development stage (or review).
Proposed Implementation
Based on a short discussion in #dev-contrib, this is a short and possibly incomplete overview of how to start / reload ...
I'd like to take this issue, if it's up for grabs.
(As a matter of fact, this issue has been already patched in case of the reminders)
Great, I'll assign you to the issue! I'm not too familiar with the check, but that might do it. Feel free to ask in #dev-contrib if you're having issues.
As always there's no rush, so take your time :)
Yea it does add main as it's own group. I think a deployment failing on push to main isn't too much of a concern, since the checks need to pass in the PR first anyway, so it would be very rare. It's also easily solvable by re-running the failed suite.
I think the change is a net positive as it means there are less suites in the queue, and leads to less re-deployments as you say.
I actually can't, because this gets formatted into italics in the help embed. This is why I said asterisk and not just *.
I can add dashes I suppose.
I think it's reasonable to simplify the predicate if possible. The two lines don't actually cost anything.
Yeah that seems like a good idea.
ctx is used in other converters in the code-base that don't use the context.
I'd like to keep it clear that it's intended to be used with messages.
It's the clean group though. It just takes optional arguments.
What is the difference? we don't check for containment anywhere as far as I can see.
Yeah that seems right.
Hmm I'm not sure that's clearer.
Seems like old code that never got addressed. Will fix ๐
If anything the order of operations here seems incorrect, as we first delete the older than 14d messages, and only then the messages we found beforehand and added to to_delete.
Maybe.. I'm not sure. It's also checked in the logging, and overall seems easier for me to read.
I considered it but I ultimately think both approaches are fine.
I am not sure, but we could have a small section on the site home page towards the bottom giving a shoutout to the active patreon supporters?
Had an idea - when someone changes their patreon tier to a higher level, the bot will also message.
However, this would only work if the new role was added first, and then the old role was removed.
How reliable would this be?
If it's a case of a computer changing the roles automatically, then we can make sure the requests are done in the right order.
If it's a case of a human manually doing the change, then I could provide a command that does the change, making sure it does in the...
I've actually been briefly looking over some mypy and there's a lot of false positives. Perhaps some of these could be brought down further by using the correct command line arguments but it's certainly annoying as-is.
As an example, we get error: Item "None" of "Optional[Role]" has no attribute "name" for the code
for role_id in role_ids:
if (role := guild.get_role(role_id)) is not None:
members += len(role.members)
else:
...
Also, a few potential commands that could come with this:
patreon - provides a link to the patreon page, and a short description
supporters - basically the same as the monthly update, just for when the command is run
[python-discord/.github] New branch created: update\-policy\-bot\-contribs\-list
Remove staff members from the list, and add new contribs.
a GREAT PR :neckbeard:
[python-discord/.github] branch deleted: update\-policy\-bot\-contribs\-list
Oh right, missed that ๐๐พ
I am not sure if it simplifies the predicate IMO, but I am not against it.
The @group deco makes it clear that it's a group, so group isn't needed and it acts as a master command, and explains its functionality in a better way, so I would have that changed.
๐คท๐พ I had leave that you, I am fine with anything.
I am not sure if I get you here. Since order won't matter as it is getting "broken" out of the loop on the next line.
GitHub Actions run 1194894508 succeeded.
Connected!
GitHub Actions run 1194908654 succeeded.
Thanks for making those changes, this seems good to me now!
GitHub Actions run 1195104368 succeeded.
Thanks! I'd probably need a PyDis server clone, and since I haven't contributed for a while after the 3.9 and poetry upgrade, I'd need to update my Lance file as well to work with it. IIRC the instructions are in dev-announcements, so that's convenient :P
You could simplify the code a bit like this:
domain_blacklist = self._get_filterlist_items("domain_name", allowed=False)
for match in URL_RE.finditer(text):
for url in domain_blacklist:
if url.lower() in match.lower():
return True, self._get_filterlist_value("domain_name", url, allowed=False)["comment"]
Then you don't need the if check and a new local variable.
Btw, why return a flag and an Optional[str] when you can just return Optional[str]? That would also play better with type checkers.
Everything looks great to me. Nothing seems out of place or missed.
Everything looks solid. I didn't see anything missed.
GitHub Actions run 1195334446 succeeded.
9ce33f3 More explicit importing for Bot - Xithrius
I, for one, am glad that we can remain on the cutting-edge in this vitally important area. All too often, the most advanced uwugorithms are locked up in the ivory towers of academia, where they are unable to fulfil the enormous potential they have to enrich the lives of ordinary people. Thank you, @gitautas, humbly.
GitHub Actions run 1195379583 succeeded.
I don't have a problem with this idea, I'll leave it to you guys to find the right "intensity" for our use.
Is this type supposed to be a string? It seems like an odd change from int to string if the expected type will be an int.
since the checks need to pass in the PR first anyway
okay good point
looks pretty good to me I think
GitHub Actions run 1195507235 succeeded.
Connected!
I didn't squash, sorry about that.
GitHub Actions run 1195529713 succeeded.
It does, it's one less function call per message.
What I mean is, handling old messages should not be done in the loop at all. Once it reaches an old message it should:
- break immediately
- handle any leftover messages that can deleted in bulk (which were encountered before the too-old message)
- handle old messages
When manually unbanning someone with a perma ban, this raises the below error. I assume this is due to expires_at being None
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
bot_1 | ret = await coro(*args, **kwargs)
bot_1 | File "/bot/bot/exts/moderation/infraction/infractions.py", line 270, in unban
bot_1 | await self.pardon_infraction(ctx, "...
Got a few errors while testing this out in the test server they all seem to be caused by the same thing though
Similar as the above, this fails with the below error when trying to edit an infraction without an expiry.
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
bot_1 | ret = await coro(*args, **kwargs)
bot_1 | File "/bot/bot/exts/moderation/infraction/management.py", line 134, in infraction_edit
bot_1 | expiry = time.format_with_duration(duration)
...
This errors with the below log
bot_1 | 2021-09-02 20:18:35 | bot.exts.backend.error_handler | ERROR | Error executing command invoked by Chrisjl#2655: &stream 126811506632294400
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
bot_1 | ret = await coro(*args, **kwargs)
bot_1 | File "/bot/bot/exts/moderation/stream.py", line 140, in stream
bot_1 ...
Sorry, this is comment is on the wrong line. This error is actually for line 123 in here.
[python-discord/site] New branch created: jb3/django\-prometheus
Adds Django Prometheus and installs the necessary middleware and URL paths for reporting.
GitHub Actions run 1195796764 succeeded.
GitHub Actions run 1195819532 succeeded.
django-prometheus = "~=2.1"
This should be changed to follow the format of the other pinned dependencies.
1190c68 Follow standard for dependency versioning for d... - jb3
[python-discord/quackstack] branch deleted: vcokltfre/feat/package\-ready\-rewrite
[python-discord/quackstack] New branch created: feat/vcokltfre/seeded\-ducks
/duck and /manduck both now support a seed query param to use a seed to generate a duck. The seed is an integer, for example GET /duck?seed=1234
This also fixes the fact that quackstack wont start because the dockerfile was using an outdated location for the main file.
typing.Optional also applied here
Let me know if I've totally misunderstood what's happening here.
Can't you just leave this as Random(seed)? The docs say the seed can be NoneType.
GitHub Actions run 1196080459 succeeded.
032bf78 fix: apply requested changes - vcokltfre
[python-discord/quackstack] branch deleted: feat/vcokltfre/seeded\-ducks
GitHub Actions run 1196121164 succeeded.
950b5aa fix: use seed on the correct duck generators - vcokltfre
[python-discord/quackstack] New branch created: feat/vcokltfre/seeded\-ducks
[python-discord/quackstack] branch deleted: feat/vcokltfre/seeded\-ducks
This method is not used anywhere, could and should be removed. Furthermore, it doesn't make any requests with headers.
Possibly remove the git alias here since git is not github?
What about just showing the first issues, up to MAXIMUM_ISSUES, and adding a small message if there were more issues than sent in the list?
Missed a few things, mostly with the bot not using the api token to make requests.
Ignore the first part of the above, this is used in the below, which means either the below should be rewritten to not use it, or the above should be rewritten to use it, as its duped requests now.
This should use the REQUEST_HEADERS as well
745cd1d Fix type annotations - decorator-factory
6683af4 Use permissions_for over permissions_in - ChrisLovering
69c1852 Merge pull request #838 from python-discord/Use... - ChrisLovering
f4e5e38 Union item with None to Optional with item. - Xithrius
aecc1e6 Removed None return annotation for any init - Xithrius
[python-discord/sir-lancebot] branch deleted: android\-codeblock\-fix
GitHub Actions run 1197147016 succeeded.
Connected!
GitHub Actions run 1197150329 succeeded.
GitHub Actions run 1197198169 succeeded.
Yes but then you need to say that the other commands are subcommands of something called clean_master, which doesn't seem intuitive.
GitHub Actions run 1197342100 succeeded.
52b5ab2 Timeout when fetching GitHub repository metadata - ChrisLovering
[python-discord/site] New branch created: Add\-timeout\-to\-GitHub\-repo\-metadata\-fetch
Sentry Issue: SITE-1G
SystemExit: 1
(36 additional frame(s) were not displayed)
...
File "urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "urllib3/util/connection.py", line 86, in c...
Closes #576
Not having this timeout could cause a worker to hang indefinitely.
GitHub Actions run 1197515771 failed.
[site] Branch Add\-timeout\-to\-GitHub\-repo\-metadata\-fetch was force-pushed to `708775e`
GitHub Actions run 1197522633 failed.
[site] Branch Add\-timeout\-to\-GitHub\-repo\-metadata\-fetch was force-pushed to `6834519`
GitHub Actions run 1197700721 failed.
[site] Branch Add\-timeout\-to\-GitHub\-repo\-metadata\-fetch was force-pushed to `fa68a10`
[python-discord/site] Checks Successful on PR: #577 Timeout when fetching GitHub repository metadata
GitHub Actions run 1197868861 succeeded.
So I see that this was approved in Feb of last year, but was there an agreed implementation method?
There would be a command named "season" with options for astronomical, meteorological, and solar seasons. If no options are passed, what should the default response be? Should there also be a North / South hemisphere check or just default to sending both?
Just trying to wrap my head around what could be done and what the result will be.
User Input
.season <optional season: astro, ...
I think I can take this one, looks like rapidfuzz also has an extractOne method and the change from fuzzy_wuzzy to rapidfuzz is just the import statement.
This seems like it is pretty well defined regarding the scope and the features required. I can try to give this a shot.
I don't really understand this. The characters inside rhyme_scheme don't actually end up in word, so they wouldn't be going into the GET request.
Also, using urllib.parse.quote would turn one character into many. For instance, let's say someone types in .poem iรฑiรฑ (which is the same as .poem abab except with special characters), the sanitization would turn it into .poem i%C3%B1i%C3%B1. So the รฑ is now a group of 6 letters, and makes a whole new poem entirely.
I apologize ...
I don't mind adding support for gitpod, I just ask we maintain a high standard for what we add.
Gitpod is a large service, with many users, so it's okay to add. Smaller services are a dime a dozen, and don't make as much sense to support.
Hey @Xithrius I think we should close this for now.
We tried to poll for it in the dev-core channel, but we don't have enough people that can implement and review this feature, due to limited accessibility.
We can reopen it in the future if we do find people.
If I were to use typing.TypeVar, how would I use it to show that the function returns the return value or None?
Hello @PythonTryHard
Can I just clarify, is the intended behaviour that you should get:
- the
0message for a score in the range0-4inclusive, - the
5message for5-19, - ...
- the
95message for95-99, and - the
100message for just100?
If that is the case, then you would want to use bisect.bisect_left rather than bisect.bisect_right (which is what bisect.bisect is an alias of). It's actually only due to a quirk of tuple-comparison (shorter tuples are less...
Hello @PythonTryHard
Can I just clarify, is the intended behaviour that you should get:
- the
0message for a score in the range0-4inclusive, - the
5message for5-19, - ...
- the
95message for95-99, and - the
100message for just100?
I believe there might be a cleaner way to implement this. Let me know if you want me to elaborate.
But markov_poem isn't supposed to return anything. I am not sure if I understand.
I'd like to grab this issue!
This seems like it is pretty well defined regarding the scope and the features required. I can try to give this a shot.
I would also like to work on this.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #677
Description
This is a work in progress and is an effort to contribute collaboratively with CyberCitizen01.
Implementation
To be updated as work moves on.
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 d...
GitHub Actions run 1198523818 succeeded.
4ecba07 Removed HTTPStatus Dependency, enable broader S... - sam-heller
c9ff73c Removed HTTPStatus Dependency, enable broader S... - sam-heller
87cc0de Merge remote-tracking branch 'origin/teapot-sup... - sam-heller
c91ae2d Return 404 Floof embed on invalid status code - sam-heller
87dc10b Numerous syntax and bug fixes - sam-heller
Connected!
GitHub Actions run 1198542225 succeeded.
@anand2312 I compared the two functions, and I think the current one is faster.
Looks like all the errors are with humanize_delta not understanding None as the second timestamp. If only one timestamp is passed, then it's relative to now, but it does not treat a None second timestamp as equivalent to not having passed it at all. I suppose the best fix is to allow it to be None; having to check for None outside seems too annoying.
@HassanAbouelela Very well.
@brad90four I shall assign you. rapidfuzz is currently what we're going with for the default replacement of fuzzy_wuzzy. Be sure to re-lock poetry.lock.
Yes, but also no.
This is nice. This needs a change though, because we are using multiple workers, because Python can't gobble around on more than one core in the same address space.
gunicorn needs to be started with a configuration file as its argument, with the following contents:
from prometheus_client import multiprocess
def child_exit(server, worker):
multiprocess.mark_process_dead(worker.pid)
This is step three from the Prometheus Python client's multipro...
And as a small bonus, it would be nice if you could add a small comment in the Dockerfile explaining why we need BUILDING_DOCKER=yes.
Chris, this is great. It's essential for a request like this to have timeouts. Thank you for patching it in.
[python-discord/site] branch deleted: Add\-timeout\-to\-GitHub\-repo\-metadata\-fetch
GitHub Actions run 1198852002 succeeded.
[python-discord/site] Issue opened: #578 Add an endpoint to fetch user information from a username\.
We'd need this endpoint to be able to implement features requested in this bot issue.
@action(
detail=False,
methods=["GET"],
url_path=r"username/(?P[^#]{,32})#(?P[0-9]{4})"
)
def get_by_username(self, request, name, discriminator):
user = get_object_or_404(User, name=name, discriminator=discriminator)
return Response(UserSerializer(user).data, status=status.HTTP_200_OK)
...
GitHub Actions run 1199069286 failed.
b3b9d3f CI: check for dependency licenses - Akarys42
384d5b4 Upgrade pip-licenses to 5.3.2 - Akarys42
3f2b233 CI: add ISC License (ISCL) to allowed licenses - Akarys42
44f7a4f Merge branch 'main' into experiments/akarys/che... - Akarys42
1b04bdf Make the base_url argument in doc set optional - Numerlor
[python-discord/bot] branch deleted: ks123/goodbye\-talentpool\-channel
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
Connected!
GitHub Actions run 1199478377 succeeded.
700cc67 Add gunicorn.conf.py with Prometheus specific s... - jb3
GitHub Actions run 1199481322 failed.
GitHub Actions run 1199493122 succeeded.
Since 0b726398d2135ab414374412fa85f791569e3640 we accept a loop kwarg to scheduling.create_task which can be used to create a task with a not yet running loop where asyncio.create_task doesn't work directly.
Because the created tasks currently don't have any error handling they can hide errors in development until the task object is destroyed (if that occurs at all) which logs the exception. The scheduling alternative attaches a callback which logs exceptions to prevent this.
For ev...
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #599
Description
This creates a hangman game, and adds a new hangman.py file, with a Hangman cog, and a new folder in bot/resources/evergreen/hangman with images of the hangman.
From the original issue, I considered that the executioner may have been a bit too broad of a scope to go along with the game, and should be a separate issue for the sake of organiz...
GitHub Actions run 1199684757 failed.
GitHub Actions run 1199703128 failed.
GitHub Actions run 1199711004 succeeded.
This won't let us match only with a name if a tag is matched with a long group but a short name, I'm on the edge of that being worth it for the increased code complexity.
On one hand it's relatively unlikely to happen as !<name> <2chars> would have to be invoked (maybe an emoji would be an actual case where that can happen) but then the code is also not that much less complex without the first if taking care of that case and then the name length check at the end
GitHub Actions run 1199931005 succeeded.
GitHub Actions run 1200510749 succeeded.
GitHub Actions run 1200521064 succeeded.
GitHub Actions run 1200529936 succeeded.
GitHub Actions run 1200542616 succeeded.
Connected!
GitHub Actions run 1200543064 succeeded.
7719d69 Update in accordance with python-discord/kubern... - jb3
[python-discord/quackstack] New branch created: jb3/update\-k8s\-path
Update in accordance with python-discord/kubernetes#95
da697ee Update in accordance with python-discord/kubern... - jb3
[python-discord/bot] New branch created: jb3/update\-manifest\-path
GitHub Actions run 1200571138 succeeded.
[python-discord/site] New branch created: jb3/update\-k8s\-path
[python-discord/site] branch deleted: jb3/update\-k8s\-path
8bd260d Update in accordance with python-discord/kubern... - jb3
[python-discord/site] New branch created: jb3/update\-k8s\-path
Update in accordance with python-discord/kubernetes#95
71feea7 Update in accordance with python-discord/kubern... - jb3
[python-discord/sir-lancebot] New branch created: jb3/update\-k8s\-path
Update in accordance with python-discord/kubernetes#95
Connected!
GitHub Actions run 1200587632 succeeded.
[python-discord/site] branch deleted: jb3/update\-k8s\-path
[python-discord/sir-lancebot] branch deleted: jb3/update\-k8s\-path
[python-discord/quackstack] branch deleted: jb3/update\-k8s\-path
GitHub Actions run 1200594125 succeeded.
Connected!
GitHub Actions run 1200594682 succeeded.
fa68a10 Timeout when fetching GitHub repository metadata - ChrisLovering
f6d886e Merge pull request #577 from python-discord/Add... - jchristgit
8bd260d Update in accordance with python-discord/kubern... - jb3
f027f96 Merge pull request #579 from python-discord/jb3... - jb3
f5efff5 Merge branch 'main' into jb3/django-prometheus - jb3
GitHub Actions run 1200597306 succeeded.
GitHub Actions run 1200610198 succeeded.
Sentry Issue: BOT-1MQ
AttributeError: 'TalentPool' object has no attribute 'watched_users'
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/info/information.py", line 219, in server_info
embed.add_field(name="Moderation:", value=self.get_extended_server_info(ctx))
File "bot/exts/info/information.py", line 75, in get_extend...
a0bf7df Server command now uses correct TalentPool attr - ChrisLovering
[python-discord/bot] New branch created: fix/server\-command\-nominations
Closes #1809
This was attr changed when we removed the concept of a user being 'watched' while removing the talentpool.
GitHub Actions run 1200648601 succeeded.
[python-discord/site] New branch created: jb3/ips\-allowed\-hosts
This is necessary to allow Prometheus to scrape the sites metrics endpoint.
GitHub Actions run 1200653135 failed.
GitHub Actions run 1200657117 succeeded.
GitHub Actions run 1200666688 succeeded.
GitHub Actions run 1200889332 failed.
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 1201026969 succeeded.
66f1ca3 Pin platform in Dockerfile - ChrisLovering
[python-discord/bot] New branch created: pin\-platform\-in\-Dockerfile
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
GitHub Actions run 1201047929 succeeded.
d185a88 Pin platform in Dockerfile - ChrisLovering
[python-discord/forms-backend] New branch created: Pin\-platform\-in\-Dockerfile
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
4e08954 Pin platform in Dockerfile - ChrisLovering
[python-discord/king-arthur] New branch created: Pin\-platform\-in\-Dockerfile
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
GitHub Actions run 1201050866 succeeded.
29363a3 Pin platform in Dockerfile - ChrisLovering
[python-discord/sir-lancebot] New branch created: Pin\-platform\-in\-Dockerfile
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Did you:
- [ ] Join the Python Discord Community?
- [ ] Read all the comments in this template?
- [ ] Ensure there is an issue open, or link re...
a48612d Pin platform in Dockerfile - ChrisLovering
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
GitHub Actions run 1201052303 succeeded.
3bbb7c0 Pin platform in Dockerfile - ChrisLovering
[python-discord/site] New branch created: Pin\-platform\-in\-Dockerfile
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
GitHub Actions run 1201053045 succeeded.
7ea170f Pin platform in Dockerfile - ChrisLovering
Some of our deps don't have wheels for atm processors.
With Mac's M1 chips becomming more common, we should make it easier for those users to build our environments.
Connected!
This PR will conflict with our current code base since we merged in the Type Annotations PR.
You should pull down the recent changes and resolve those conflicts.
Otherwise from my testing the game plays just fine.
This and some of the other typing annotations are going to conflict with the current codebase. You should pull down the recent lancebot and resolve merge conflicts.
This will conflict with the current codebase and we should use list since we're on 3.9.
This is minor, but I'm not sure why the rules index is kept in a code block format. It's very odd visually.

Sentry Issue: SIR-LANCEBOT-67
AttributeError: 'Member' object has no attribute 'avatar_url'
File "discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/evergreen/avatar_modification/avatar_modify.py", line 272, in prideavatar
await self.send_pride_image(ctx, image_bytes, pixels, flag, option)
File "bot/exts/evergreen/avatar_modifica...
Description
I would like to create a mad libs game command for Sir Lancebot. When the command is run, the bot will ask the user to give them a random part of speech (e.g. noun, adjective, verb, plural noun, etc.). There will be a text file with 20 different stories that the bot will choose from each "round" to make the game a little more varied and interesting.
Reasoning
I personally think it's a fun game and I'm sure many people will want to play it!
Proposed Implementat...
Could you explain how you will get words from the user?
Yup. Makes sense to me. Thank you!
[python-discord/bot] branch deleted: Add\-concurrency\-to\-all\-workflows
[python-discord/sir-lancebot] branch deleted: Pin\-platform\-in\-Dockerfile
Rock solid.

+1 on removing the pin for .5. Patch versions, no problem, no problem.
Connected!
@Kronifer By simply asking the user to send a message with the word they want to use
GitHub Actions run 1201435616 succeeded.
Connected!
GitHub Actions run 1201438394 succeeded.
[python-discord/site] branch deleted: Pin\-platform\-in\-Dockerfile
[python-discord/bot] branch deleted: pin\-platform\-in\-Dockerfile
Connected!
GitHub Actions run 1201452477 succeeded.
Rock solid.
Adding my green check mark since policy-bot wants a DevOps approval.
[python-discord/forms-backend] branch deleted: Pin\-platform\-in\-Dockerfile
This won't let us match with only a name if a tag is matched with a long group but a short name
I see now, so we just remove that if-statement and leave it to the code below this. That way we will at least match for groups yeah.
if tag_identifier.group is None:
return self._get_suggestions(tag_identifier)
if len(tag_identifier.group) < 3:
# No point in fuzzy matching if the group is less than 3 characters
suggestio...
GitHub Actions run 1201457180 failed.
if infr_type not in {"ban", "kick"}: # We have already notified the user for these types
Tested it simply, and works. Can we just get a comment that the Infraction converter special-cases last as getting the last converter from the author?
I thought last was a subcommand at first and was confused.
Have committed the comment but leaving as a tuple since that's what's used elsewhere in the codebase.
GitHub Actions run 1201746789 succeeded.
Description
The .challenge command would pull a random kata (challenge) from codewars.com, and the user can filter with either the query or the kyu (difficulty), 1 being the hardest, 8 being the easiest, along with the programming language the kata is in.
Reasoning
codewars.com is a popular website for coding challenges, which many people use. A lot of people including myself want to be challenged sometimes but aren't sure what to do, and sometimes people also hit 'code blo...
Are you planning on using the codewars API?
I've looked at it previously and I'm curious how you're going to search for katas or select random ones because as far as I know it only returns challenges that you specifically query for.
Tested it simply, and works. Can we just get a comment that the Infraction converter special-cases
lastas getting the last infraction from the author?I thought
lastwas a subcommand at first and was confused.
Done :+1:
GitHub Actions run 1201789096 succeeded.
dc01b87 Add concurrency rules to all GitHub workflows - ChrisLovering
dc26ff9 Merge branch 'main' into Add-concurrency-to-all... - ChrisLovering
66f1ca3 Pin platform in Dockerfile - ChrisLovering
0a83cd7 Merge pull request #1794 from python-discord/Ad... - ChrisLovering
969dbfe Merge branch 'main' into pin-platform-in-Docker... - jchristgit
b4c7d61 Server command now uses correct TalentPool attr... - ChrisLovering
[python-discord/bot] branch deleted: fix/server\-command\-nominations
GitHub Actions run 1201796096 succeeded.
Connected!
GitHub Actions run 1201802617 succeeded.
Are you planning on using the codewars API?
I've looked at it previously and I'm curious how you're going to search for katas or select random ones because as far as I know it only returns challenges that you specifically query for.
I'm using bs4 to get the kata ID, coupled with the codewars API to get information about the kata itself
Tested earlier today, works nicely. Thanks Tizzy
I've noticed that the bottom beak is layered incorrectly. Has this been noticed? I've attached an example below.

Really just the title. The seed will always produce the same accessories, but different ducky colors.

Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #652
Description
Implemented a .quack command that can take a seed and optional ducky type if you want to generate a duck or manduck. If the seed given is a word, that word is converted into a seed using ord().


Hi @Kronifer,
Thanks for the report, a bug in my code ๐. Well the bug is here: https://github.com/python-discord/quackstack/blob/c7ace24fb0ef852d65bf912a011f8520a64b1342/quackstack/ducky.py#L43-L47
Where beak should be placed above body (the list is in the order it would get built), as beak is supposed to be under body. A quick PR would be appreciated.
Alec was real quick ๐จ
Sentry Issue: BOT-1MS
AttributeError: 'TalentPool' object has no attribute 'cache'
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/info/information.py", line 219, in server_info
embed.add_field(name="Moderation:", value=self.get_extended_server_info(ctx))
File "bot/exts/info/information.py", line 75, in get_extended_serve...
3368834 Declare TalentPool.cache on init of cog - ChrisLovering
[python-discord/bot] New branch created: declare\-talentpool\-cache\-on\-startup
Closes #1812
This avoids issues in the server cog trying to access it before assignment.
GitHub Actions run 1202714514 succeeded.
d89c65a Rename utils.py to resource_search.py. - swfarnsworth
990eeba Drop -Option from {topic,type,etc}Option. - swfarnsworth
94fa4c6 Make an asterisk in the URL a wildcard. - swfarnsworth
affbac0 Delete resources_resources_redirect. - swfarnsworth
54c9acf Add tutorial and video tags for RealPython. - swfarnsworth
GitHub Actions run 1202988731 failed.
I still need to figure out the situation with the tests, but I'm otherwise ready to put in the PR to main.
12c09e0 Merge with main, resolve conflicts. - swfarnsworth
[python-discord/site] New branch created: swfarnsworth/smarter\-resources/merge\-with\-main
This PR contains the first iteration of the new resources page. I expect that a few of the tests will not pass but am otherwise ready for criticism to prepare it for production.
GitHub Actions run 1203010545 failed.
There will be other missing pages now that we've consolidated the resources into one page, though I'm not sure how to create redirects for these.
[python-discord/site] branch deleted: swfarnsworth/smarter\-resources/filtering\-system
[python-discord/site] branch deleted: swfarnsworth/smarter\-resources/new\-resources
[python-discord/site] branch deleted: swfarnsworth/smarter\_resources
GitHub Actions run 1203074857 succeeded.
They are now used to log an error when the FM API key isn't present
Have removed a number of type annotations in this commit :+1:
GitHub Actions run 1203083703 succeeded.
e isn't of type string, it's of type api.InvalidArgument. Strictly speaking you can just pass e and it'll call the __repr__/__str__ if __repr__ isn't present, but I prefer explicitly casting.
Have converted to use LinePaginator :+1:
I believe it was there to indicate the text is continued from previous line, but was decided on Discord to remove so have done so :+1:
As commented on Shivansh' review, this is now used
@magicandcode did mention that this PR wasn't completely finished (hence the "Draft" status) so have left this for now in case they intend to use it for something later.
Have just addressed most of the reviews, the remaining two depend on what @magicandcode intended to use them for.
All works well, just some minor comments on a few things. Thanks for the PR!
Would be good to make it clear what this does to somebody who doesn't know what the quackstack API is, something like
"""
Uses the Quackstack API to generate a random duck image,
If a seed is provided, a duck is generated based on the given seed.
If a duck type is provided, either a duck or manduck will be generated.
"""
Should try and avoid the repetition of ducktype.lower() if ducktype else 'duck' here. If we make ducktype duck instead of None we could just use the value directly
We should define the API URL once, as a constant (all caps), at the start of the file.
That would skip the name length check altogether, allowing fuzzying of invocations like !de which may just be a typo
Logs from the library below warnings aren't relevant when working on the bot
GitHub Actions run 1203267816 succeeded.
No it wouldn't, check the code below this comment.
The code below won't run when the group is None
Ah right, so we can special-case it and just add a second and len(tag.name) >= 3:
Wouldn't setting it to None to signal that the cache isn't available be clearer interface? Or would the 0 in the server embed be seen as that
With that None groups would go beyond the check for short names
GitHub Actions run 1203299727 succeeded.
GitHub Actions run 1203301285 succeeded.
GitHub Actions run 1203306721 succeeded.
I think I'm gonna leave it like this for now
[python-discord/sir-lancebot] New branch created: lance\-restructure
Whats the status of this?
Just noticed, as it adds on a bit to the front here it's a little repetitive, could probably remove the "The given duck type is invalid" bit

Relevant Issues
Closes #841, closes #846
Description
This substantially changes the exts/ structure for Lancebot. This moves us way from the seasons approach to something more generic and (hopefully) easier to understand for first-time contributors. The resources/ folder also mimics the exts/ folder.
The exts/ folder now has the following subfolders:
avatar_modification/
core/
events/
fun/
holidays/
utilities/
Avatar_Modification was kept as a high-le...
GitHub Actions run 1203444899 succeeded.
Looks good, only thing I can notice is this, which will need updating.
https://github.com/python-discord/sir-lancebot/blob/main/bot/utils/extensions.py#L39
GitHub Actions run 1203539094 succeeded.
GitHub Actions run 1203545679 succeeded.
GitHub Actions run 1203549474 succeeded.
I went through all of the commands, and I couldn't find anything besides the ones mentioned(and patched) before.
I'd be interested in doing this, however would this be done in this repository or another?
I can spin up an example using typer in a personal repo.
f5ca5a6 fix capitialisation of a contrib in policy bot - ChrisLovering
[python-discord/.github] New branch created: fix\-capitialisation\-of\-a\-contrib
[python-discord/sir-lancebot] branch deleted: lance\-restructure
Hm, yea that might be better to do it that way. Will just need to add logic to the server command so it doesn't try to do len(None)
Connected!
GitHub Actions run 1203669079 succeeded.
[bot] Branch declare\-talentpool\-cache\-on\-startup was force-pushed to `6746d04`
None of this is solid stuff that needs to necessarily happen, just a few pointers.
Even though this doesn't adversely affect the function in this case, this is a case of mutating default arguments (I think?), check out !mutable-default-args in PyDis
seed = int(''.join([str(ord(e) for e in seed]))
This is also a more optional thing, but it's just a more concise way to write this
What happens if the request fails?
This doesn't handle down-time, even though it should be little and we should know when that is. Unneccessary to blow up the console about it.
I don't understand this, why the intermediate str(ord()) stuff?
This could be a converter that returns an enum.
No, strings are immutable. Besides, even if they were this would not hurt anything.
@melodicht We no longer use pipenv, so this branch will have to update to poetry, which is used on the main branch.
Since we've recently redone this repository's file structure, the main file here needs to move from bot/exts/valentines/markov_poem_generator.py to bot/exts/fun/markov_poem_generator.py
Literal should work as a converter with the new d.py
I will be closing this PR due to inactivity, I know you'd like to finish this feature yourself but no progress has been made.
Due to this project being restructured, the target file needs to be moved from bot/exts/evergreen/youtube.py to bot/exts/utilities/youtube.py.
Description
The cogs that are in the events folder are not loaded in.
Steps to Reproduce
Try to use .aoc
Expected Behaviour
It should send an embed containing the specifics of the AoC commands
Actual Behaviour
The cog(s) are not loaded in, so nothing happend
Known Impacted Platforms
- [x] Web
- [x] Desktop
- [x] Android App
- [x] iOS App
Possible Solutions
Add an __init__.py file to the events directory.
Additional Details
Would...
Just in case the user submits a string as a seed
GitHub Actions run 1203769170 failed.
GitHub Actions run 1203772144 succeeded.
Typer is just a wrapper for click, and uvicorn already uses click, so it may be more efficient to use click to make a simple wrapper. Typer does not seem necessary to me.
[python-discord/sir-lancebot] New branch created: post\-restructure\-fix
Description
This caused some cogs not to load.
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?
Thank you for changing the file paths so soon after the restructuring. I plan to review this PR soon.
GitHub Actions run 1203777108 succeeded.
Connected!
GitHub Actions run 1203781254 succeeded.
Thank you for changing the file paths so soon after the restructuring. I plan to review this PR soon.
No problem!
Given that the restructure of this bot occurred, the main file of bot/exts/evergreen/wtf_python.py will need to be moved to bot/exts/utilities/wtf_python.py.
The file restructure of this repository has occurred recently, so changes will have to be made to this PR.
This should probably go into the bot/exts/utilities folder.
File restructure has occurred, it may have been the cause of these conflicts.
The file structure restructure has happened. This file no longer exists in bot/exts/evergreen/githubinfo.py, but in bot/exts/utilities/githubinfo.py.
The file that is changed within this PR has been moved to bot/exts/holidays/valentines/lovecalculator.py due to the file restructuring that has occurred.
Please resolve the file conflict to reflect these changes.
GitHub Actions run 1203843708 failed.
The folder of evergreen no longer exists due to the recent file restructure.
Please move the main file to bot/exts/utilities/color.py and the resource file to bot/resources/utilities/ryanzec_colours.json.
I seem to have updated this branch due to being in the wrong browser tab. Sorry about that.
de5866f Initialise metricity at runtime - ChrisLovering
[python-discord/site] New branch created: init\-metricity\-at\-runtime
We want this done at run time as other projects, like Python bot, rely on the site initialising it's own db within the image, rather than relying on an init.sql volume.
GitHub Actions run 1203930828 failed.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `cc4ad07`
GitHub Actions run 1203932723 failed.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `a9d5f15`
GitHub Actions run 1203939500 failed.
Right, and how does work and why did you do this rather than something else like skipping the str() step.
Or is this just the first-best way to get a number from a string with characters?
[site] Branch init\-metricity\-at\-runtime was force-pushed to `f380f39`
[site] Branch init\-metricity\-at\-runtime was force-pushed to `bfc9e80`
Do we want to refresh the cache before checking the length in the server cog? If autoreview is off the cache will not be populated until the cog is interacted with in some way. We could also just populate the cache on loading the cog even if autoreview is off.
I am starting to see why the if-statements look exactly like they do- because I tried to write a suggestion for the code to be exactly the same. That said I came up with something like this:
if tag_identifier.group is None and len (tag_identifier.name) >= 3:
return self._get_suggestions(tag_identifier)
if tag_identifier.group is None or len(tag_identifier.group) < 3:
# No point in fuzzy matching if the group is less than 3 characters or None
...
suggestions = []
if tag_identifier.group is not None and len(tag_identifier.group) < 3:
# Try fuzzy matching with only a name first
suggestions += self._get_suggestions(TagIdentifier(None, tag_identifier.group))
if len(tag_identifier.name) >= 3:
suggestions += self._get_suggestions(tag_identifier)
return suggestions
I can't use the GitHub suggestions for this, because that would duplicate code. But what...
Yeah so the implementation doesn't matter, can you add a comment for that for future uses?
That should work according to my tests after fixing the inequality in the first if, pushed it in ba2a74ac18f9e40fad917d51ffa2238a340416c0
I'm getting quite confused over the whitelist logic - it's scattered over multiple files and I tried implementing an every parameter in in_whitelist_check but didn't get any results. I'll try some more stuff tomorrow, but if all else fails, I'm thinking of just making an Everywhere class whose instances can be put into the channels param. The class will roughly look like this: ```py
class Everywhere:
"""Docstring"""
def __contains__(self, item):
return True
For now though, I still got some things I can try :P
Perhaps using double quotes " are better, for consistency
I decided to remove the converter for tag names in f5db0b8 as after the removal of adding tags through the bot, it just restricted the input which can safely be ignored by the cog and with the new handling it could refuse tags when parsing a message even if the unparseable part of the message wasn't a part of the tag identifier.
An error caused by that was fixed in f3634f9dbcb6c7cc6952f7d9e40879518c4e6eb1 but I believe that should be everything that could have problems with input that woul...
GitHub Actions run 1204290106 succeeded.
GitHub Actions run 1204512714 failed.
Still doesn't handle non-200 responses, which was mostly what I thought we should handle. We don't catch ClientConnectorError elsewhere afaik.
It's a bit cramped here after you added the try/except.
This uses dict.get() implying file may be missing, yet you don't handle the case of it being None.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `13f9f2b`
GitHub Actions run 1205229591 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `5c70836`
GitHub Actions run 1205345322 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `c002dff`
GitHub Actions run 1205449373 succeeded.
@PythonTryHard How's it going?
Barely opened GitHub. Turns out the semester hits me harder than expected. I'll need to set up a temp VM for dev work now install of constant rebooting to my Linux dual-boot.
[...] Let me know if you want me to elaborate.
@lxnn Yes please
[bot] Branch declare\-talentpool\-cache\-on\-startup was force-pushed to `6bb0dba`
GitHub Actions run 1205883647 succeeded.
GitHub Actions run 1205918293 succeeded.
GitHub Actions run 1205927469 succeeded.
Yea, Patreon automatically assigns the role and removes the old one, so that should just work without change, since it just looks like a new tier 2 supporter. I don't think we should add extra logic to catch people who upgrade, just treat them as a new tier 2 or 3 supporter.
The commands seem like a good idea.
Connected!
GitHub Actions run 1205931262 succeeded.
I wouldn't want you to spend time on this, since in 1-2 weeks we will be upgrading Python to d.py 2.0 and moving all of this logic into that bot and deleting this bot.
Refactored that an pushed it, thanks :D
It seems all of the filters are expected to return a tuple like this. So changing that would require a larger change. As far as I know, #1530 plans to change how to do filtering quite a lot.
d7553a9 Refactor & simplifiy domain filter check - ChrisLovering
GitHub Actions run 1206013037 succeeded.
[bot] Branch Only\-check\-domain\-filters\-against\-URL\-like\-parts\-of\-a\-message was force-pushed to `fddd341`
GitHub Actions run 1206029377 succeeded.
It might be best asking in #dev-contrib, I haven't looked into the whitelist check myself, others might have.
cace28f Add .gg/ to invite filter regex - ChrisLovering
[python-discord/bot] New branch created: Expand\-fitlers\-to\-\.gg\-
GitHub Actions run 1206137144 succeeded.
Connected!
GitHub Actions run 1206152996 succeeded.
2fbe252 Migrate to Discord.py 2.0a0 - Akarys42
ab9132a Make the bot auto-join threads - Akarys42
6b20bfb Silence: forbid threads from being silenced - Akarys42
[python-discord/bot] New branch created: discord\-2\.0
Since the Discord.py repository has been archived, we can switch to the latest commit of 2.0a0, knowing no breaking change will occur (still pinned to the commit just in case).
This PR fixes any problem related to the migration:
- New avatar interface
- TZ aware datetimes
- Various internal API changes
The bot will also automatically join new threads and silence cannot be used in threads due to their lack of permissions.
This was a significantly harder migration than Sir Lance, but ...
GitHub Actions run 1206251427 succeeded.
We have been using coloredlogs on bot for a while now which makes the logs more readable. There initially were some issues on windows but those seem to have been taken care of now.
The same configuration as the bot uses can be used for consistency.
I can take care of this along with #706 if @ToxicKidz is not working on that issue
I believe we need to specify colorama as a win32 only dependency to make sure it is supported on any terminal. That sounds good to me though!
19b865a CI: check license compatibilitySince our projec... - Akarys42
[python-discord/sir-lancebot] New branch created: license\-checking
Port of https://github.com/python-discord/bot/pull/1779
Since our project is licensed under the MIT License, we can't be using any incompatible license-wise dependencies in our project, such as GPL.
This commit adds a step to the CI lint phase that will use pip-licenses to verify that all the installed packages are part of an ALLOWED_LICENSE variable. This variable is currently set to be every license we currently use.
We opted to use an allowlist instead of a denylist to make...
GitHub Actions run 1206463482 failed.
GitHub Actions run 1206476348 succeeded.
python-dotenv = "~=0.15"
taskipy = "~=1.6"
Shouldn't these be pinned like other deps for consistency, and I realise this is not related to your PR :P
Perhaps, but that's is indeed out of scope :P
Me about to fall asleep:
My brain: hey, did you check the decorator type hints today? You might've simply reversed the order...
Me: no no shut up
Me brain: the solution to your bug was probably very simple
Me: ...
def inner(func: Callable) -> Callable:
So yeah, I swapped it around xD I used the decorator on a command object
BRUH IT EXPLICITLY STATES TO USE ON THE FUNCTION ITSELF
ALLOWED_LICENSES: Apache Software License;
๐
run: pip-licenses --allow-only="$ALLOWED_LICENSES"
3fbbd54 CI: ALOWED_LICENSE -> ALLOWED_LICENSES - Akarys42
GitHub Actions run 1206545742 succeeded.
๐ Consider this approval whether you change the dependency format like mentioned or not
GitHub Actions run 1206566538 succeeded.
Update: lmao my late night brain was right, linting and making PR now
[python-discord/sir-lancebot] Pull request opened: #856 Allow \`\.bm\` command to be used everywhere
Relevant Issues
Closes #827
Description
I added a every parameter in in_whitelist_check, which when set to True means a command is in the whitelist. Consequently, this means setting this parameter to True in whitelist_override essentially represents that a command can be used everywhere by everyone. I did that to the .bm command.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x...
Relevant Issues
Closes #321
Description
From now on the AoC leaderboard command accepts a total of 2 optional arguments a day and star string (eg.: 1-2, for the second star of the first day) and a number of results they would like to see, with a total maximum of 15. (Default is 10)
(The reason I used csharp syntax highlighting is because it surprisingly fits the results quite well)

See comment above on style consistency
Path("bot/resources/fun/top_1000_used_words.txt") could perhaps be stored in a global constant such as TOP_WORDS_FILE_PATH, to facilitate reading.
Once again, this would be way more understandable with a list comprehension and an if clause in it, instead of list/filter/lambda combo.
Oh, I forgot this: it should also be a global constant.
PEP 8 suggests to use the trailing comma (for a bunch of reasons, such as minimizing diffs, easy maneuvering, and symmetry), so a comma is missing here after the string.
Absolutely amazing! The code looks super clean now, great job! I still got a few more subtle things, and then it'd be perfect.
filtered_words = [
word for word in self.all_words
if int(min_length) < len(word) < int(max_length)
and int(min_unique_letters) < len(set(word)) < int(max_unique_letters)
]
Missing trailing comma
We don't follow that style, I think it is fine with or without it.
Really? I believe Kat had a discussion with us about that.
Two small requests, but it looks good!
Maybe upload the images not on discords CDN, because deletion would cause problems.
Maybe use the bot.constants colors instead
Please see what PEP8 has to say about trailing commas: https://www.python.org/dev/peps/pep-0008/#when-to-use-trailing-commas. Our style guidelines falls back to PEP8 and regardless trailing commas are good since we use version control and they ensure the git blame is accurate.
The styling of this is not consistent with the way you defined the new embed fields and hangman_embed, maybe switch.
It's a bit too spaced out to me, so I may just keep it as is
Does this allow other users to guess letters? That could be problematic
I uploaded the images myself on my test server so I doubt they would ever get deleted, but would there be an alternative to discord's CDN?
Yes, since I thought other players should be able to play along, since this would only ever be in the playground and it ignores messages with a length greater than 1
I agree. Perhaps you can add a singleplayer/multiplayer selection if you'd like to keep this feature?
GitHub Actions run 1206831753 succeeded.
Image-to-link sharing services like imgur, perhaps. The best way would probably be to store it locally, in a folder in the resources folder or something like that.
I know this is probably getting annoying now, but we like consistent styling lol (yes, another missing trailing comma)
Still no trailing comma here lol
[python-discord/sir-lancebot] branch deleted: license\-checking
GitHub Actions run 1206841073 succeeded.
Connected!
GitHub Actions run 1206845570 succeeded.
I agree. Perhaps you can add a singleplayer/multiplayer selection if you'd like to keep this feature?
Added!
GitHub Actions run 1206939489 succeeded.
Looks good! Maybe make the docstring more concise, but otherwise it looks good!
Due to the concern of how long a animated avatar could be, this can cause large amounts of resources to be used up.
Maybe another feature can be created with rickrolling? If so, please make another issue.
Why JSON instead of YAML?
I'd argue we would be better off switching everything to Yaml or Toml as it is much more readable :P but I'm not even sure that is worth doing
I don't want to fill up the user's pinned messages, since it may collide with something in the future.
If anything, we should go with manual additions instead of automatic bookmarking so users aren't randomly DM'd.
@ NeilShah2026 This bot currently doesn't have a database, such as postres.
To note, at this point, the bot basically has a database with redis.
Well, yes, but I'm not sure if it's suited for long-term storage. We'd have to put some time limit on the bookmark or something so we don't use up storage for no reason.
BTW @Shom770, make sure to resolve conversations when you've made the changes or when you've decided that the changes are unnecessary, so that reviewers won't see them popping up every now and then when they review the code!
So, I would kind of argue for:
- removing the print if it already exists, to reduce noise
openinto awithblock
but since this fixes the broken local dev at the moment, we should get it in ASAP.
Looks good! Maybe make the docstring more concise, but otherwise it looks good!
Thank you!
Yes, I did take a look at the word database because I have nothing else to do at the moment lmao xD
This might be problematic, contraction suffixes probably shouldn't be allowed...
Should these be hangman-allowed "words"?
Acronyms might not be good, since people won't really guess them
BTW @Shom770, make sure to resolve conversations when you've made the changes or when you've decided that the changes are unnecessary, so that reviewers won't see them popping up every now and then when they review the code!
I'll resolve it in a bit, since I have to go somewhere for a bit
b361ad8 Use context manager for file open - ChrisLovering
[site] Branch init\-metricity\-at\-runtime was force-pushed to `1fcc51d`
GitHub Actions run 1207115356 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `cc2b959`
GitHub Actions run 1207118396 succeeded.
You know, I probably should have taken a look at the database before I used it haha, thank you for looking at it, I'll change some words in it
GitHub Actions run 1207120964 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `a211f99`
#dev-contrib message
Explicit approval for removal :D
GitHub Actions run 1207126629 succeeded.
GitHub Actions run 1207131958 succeeded.
GitHub Actions run 1207136758 succeeded.
GitHub Actions run 1207153576 succeeded.
Could you make this end with either a full stop or an ellipses, rather than two full stops?
"With the filters you provided, "
You'll need a space here, since the two strings are concatenated directly when you do multiline like this.
only the bot.wait_for call will raise this error, could you change this so you only surround that with a try/except, rather than the whole block?
Yep, I uploaded these images and they are in my sir-lancebot testing server which I will always have, and if I ever do delete it I will migrate it to imgur
I'll change it to a full stop!
Yep, I'll change that
GitHub Actions run 1207176482 succeeded.
yup no worries, just wanted to make you aware ๐
GitHub Actions run 1207197991 succeeded.
this hasn't been resolved
On second thoughts the sentence doesn't really make sense. Would like be better just as No words could be that fit all the filters specified.
Everything looks good to me!
r is a bit of a generic alias. How about something like response?
async with self.bot.http_session.get(quackstack_url, params=params) as response:
if response.status != 200:
await ctx.send(embed=error_embed)
return
data = await response.json()
...
I love this command! It's pretty neat and it would be nice to have the Quackstack command exist in Python Discord itself! I have a few nitpicks here and there, but otherwise, style-wise, this looks good!
This part could use a trailing comma but it doesn't really matter, see the reply below near line 65
Trailing comma -
Objectivix pointed this out earlier on my PR but Kat earlier said that to comply with PEP8, and make the git blame more accurate, etc., that it is recommended but not required that we use a trailing comma.
Alright, I'll start working on it
I would personally prefer py seed = int( "".join( str(ord(letter) for letter in seed) ) ) (double string and generator expression for better readability). I am aware that using a genexpr is several tens of microseconds slower than using a list comprehension in this case, but that's negligable IMO and it's easier to understand without the [].
int.from_bytes on the bytes from the encoded string should have the same behaviour with unique seeds for strings, something along the lines of int.from_bytes(seed.encode(), "big"), I think that's a bit less convoluted way to get it
Yeah, that sounds like a better way
GitHub Actions run 1207330688 failed.
Relevant Issues
closes #854, closes #706
Description
Adds coloredlogs to the bot and standardizes the logging format with bot. I've also moved the log files to a logs directory in the project root and renamed the file name from hackbot to sir-lancebot.log.
Also adds selective trace loggers from python-discord/bot#1529
GitHub Actions run 1207428012 succeeded.
i dont tend to use trailing commas, I'm gonna leave this
i tend to use lists, im gonna keep this the same
sounds better, ill do that
GitHub Actions run 1207543568 succeeded.
Does the previous connection not need to be cleaned up in any way?
Can something be done in SQL to avoid having to switch connections?
This is true, but also fragile since nothing is enforcing that wait_for_postgres() is called before this function.
[python-discord/king-arthur] branch deleted: Pin\-platform\-in\-Dockerfile
GitHub Actions run 1207729005 succeeded.
the black profile already sets this variable, and it sets it to a different setting from what was set
see the docs here: https://pycqa.github.io/isort/docs/configuration/profiles.html
the black profile sets the below settings
multi_line_output: 3
include_trailing_comma: True
force_grid_wrap: 0
use_parentheses: True
ensure_newline_before_comments: True
line_length: 88
Please add a PR description.
I came across that myself too, and the latter part of that answer became quite complicated. While I don't mind using it, this seems much easier to understand what's going on.
ah yes, you're right. I had assumed leaving the context manager dealt with this, but it does not.
GitHub Actions run 1208706139 failed.
GitHub Actions run 1208711791 succeeded.
Hmm, I might spend a little more time on this, might have a working solution.
8f4271f Create and populate metricity in a single conne... - ChrisLovering
This should do it, actually much nicer to read the code now, just the sql file is a little more complicated to follow, not much of an issue though.
https://github.com/python-discord/site/pull/583/commits/8f4271f8a8113d175cb8680735ec352305cd47a0
GitHub Actions run 1208770336 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `d245bbd`
GitHub Actions run 1208782454 succeeded.
For the "eval" command, once you press the trashcan reaction for your evaluation, it would delete your message that invoked it.
Right now, it just deletes the response when the trashcan is pressed
The f-string prefix is not needed for lines that are just plain strings without any variables.
Lines 76, 83, 91, etc. of the bot/utils/checks.py file are examples of this.
Additionally, you can provide a day-star (e.g. 2-1, as second day first star) to filter your query more.
Should we have variables that contain dayandstar be separated into day_and_star?
# e.g. 1-1 will fetch the solvers of the first star of the first day and their completion time
Is this comment talking about how str.encode() converts strings into integers? Either way, this isn't using the ord() function, but the string's encode() method.
# Converts any word(s) with numbers into an integer
Apparently .org and .com for this specific domain both go to .com, so we can just replace this URL with the API constant.
description=f"A {ducktype} from [Quackstack]({API_URL}/docs).",
We no longer have this annotation across this repo for the dunder of __init__.
def __init__(self, bot: Bot):
Since TOP_WORDS_FILE_PATH is only used here, I believe you can just do this at the top of the file instead.
with Path("bot/resources/fun/top_1000_used_words.txt").open("r", encoding="utf-8") as f:
ALL_WORDS = [line.strip('\n') for line in f.readlines()]
GitHub Actions run 1208999709 failed.
Initialise metricity relations and populate with some testing data.
Initialise metricity when running in debug mode.
rely on the site initialising its own db, rather than relying on
GitHub Actions run 1209010371 succeeded.
GitHub Actions run 1209023354 succeeded.
I'll be squashing large portions to all of this PR when it's done.
GitHub Actions run 1209038398 succeeded.
GitHub Actions run 1209087091 succeeded.
Should I get perms to Shivansh's repo in order to push changes to the feature branch or should I make a new PR with a branch from my own repo?
@melodicht if you don't already know, you will have to port over the function reaction_check from here in the bot repository to get this working properly.
Make a new PR you will.
This PR will conflict with our current code base since we merged in the Type Annotations PR.
You should pull down the recent changes and resolve those conflicts.
Otherwise from my testing the game plays just fine.
GitHub Actions run 1209172950 succeeded.
Connected!
GitHub Actions run 1209181110 succeeded.
GitHub Actions run 1209239169 succeeded.
GitHub Actions run 1209266222 succeeded.
GitHub Actions run 1209285973 succeeded.
Most of this looks like black magic to me, but I don't see anything obviously bad. The one thing I did see is "missing" a trailing comma.
GitHub Actions run 1209436580 succeeded.
Looks solid to me, just one minor thing I thought I should point out.
maximum_scorers: Optional[int] = 10,
) -> None:
Not sure if I am mis-remembering the code style, but should the closing of the function be on its own line?
async def quack(
self,
ctx: commands.Context,
ducktype: str = "duck",
*,
seed: Optional[str] = None,
) -> None:
Just a suggestion on whether or not to wrap the long function definition
Relevant Issues
Closes PR #605
Closes Issue #602
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Gets the fuzzy match of a search query, returns None if the ratio is below 90 else returns the fuzzy match. If the return is None, then we send our custom Error Message else it sends the link to the subsection of the WTF Python README.md.
Reasoning
Approved by Staff
Screenshots from original PR
,
description=ERROR_MESSAGE,
colour=constants.Colours.soft_red,
)
See comment above regarding trailing comma
Grammatical nitpick - """Load the WTFPython Cog"""
Could you give a brief explanation of what the ratio means in this context?
Possibly adding it to the docstring so if anyone ever needs to edit this in the future they know what it means?
GitHub Actions run 1209861610 succeeded.
There is a typo - this should be self.get_wtf_python_readme.start()
This won't work as the filestructure got updated, so this should be
ext = "bot.exts.utilities.wtf_python"
This will return a ValueError, as rapidfuzz.process got updated for extractOne where it returns three values, the match itself, the certainty, and the index the string was found.
It doesn't seem like you are using the index so you could just replace it with a wildcard.
This should be updated to:
match, certainty, _ = process.extractOne(query, self.headers.keys())

@brad90four Would you know as to why this is happening?
@brad90four Would you know as to why this is happening?
Nope, I went ahead and marked as draft if it is not working. I will need to dive deeper into debugging, I am currently away from my testing setup.
@brad90four Would you know as to why this is happening?Nope, I went ahead and marked as draft if it is not working. I will need to dive deeper into debugging, I am currently away from my testing setup.
I found the issue -- the minimum certainty is too high.
Right now it's at 75, and when you do .wtf del, it finds the string, but the certainty is only 60%
Sounds good to me, approved.
Codewars robots.txt has a blanket allow, and no where in the terms does it disallow automation.
GitHub Actions run 1209919340 succeeded.
resolved through a fixup on 6d7f46fabe530e4cafdffa25d7fced730965e481
GitHub Actions run 1209922132 succeeded.
GitHub Actions run 1210017947 succeeded.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #848
Description
This pull request adds a .challenge command, which uses bs4 to filter through the queries given for the challenge command, get the kata ID, then uses the codewars API to get information about the kata.
Here is an example of it running:
Say I used .challenge python binary tree, it essentially will search for the query 'binary tree' for kata...
Description
Currently we have a .timeleft command under the hacktoberfest cog. However, it's a top-level command.
I'd like to move it as a subcommand so you would have to do .hacktoberfest timeleft.
Reasoning
Hacktoberfest is no longer going to be a major event we participate in and we have other events that I think would be better suited to this type of countdown. Advent of Code already has a countdown subcommand and that is a much bigger event for our server.
Pro...
[python-discord/sir-lancebot] Issue opened: #862 \`\.hanukkah\` should not be timelocked to December
Description
Currently, the .hanukkah command is locked to only be usable in December. This is uh... not correct as Hanukkah can drift into November as well.
Possible Solutions
The @in_month() decorator can be expanded to include November as well as December.
Would you like to implement a fix?
- [ ] I'd like to implement the bug fix
- [X] Anyone can implement the bug fix
Don't think so, it fits the line limit
Wow I am a jew and I didn't know it can be drifted to November as well. Anyways, yeah. Any chance you can point me to the commands source directory?
This error message is inaccurate and the type of exception is inappropriate. It should be a ValueError that states the URL is invalid. A KeyError will already be raised by os.environ["DATABASE_URL"] if the variable doesn't exist.
If you got the code from SO, then you should attribute it to the author(s).
Wow I am a jew and I didn't know it can be drifted to November as well. Anyways, yeah. Any chance you can point me to the hanukkah command source directory?
The current check is here:
https://github.com/python-discord/sir-lancebot/blob/edb80b90186b7ebfcce8b3dae55fedb62a77b912/bot/exts/holidays/hanukkah/hanukkah_embed.py#L40
Would you like to PR this change, @NIRDERIi?
Hmm yea that a little contradicting.
Maybe just the below at the top of the sql file will do it?
-- The following function is from Stack Overflow
-- https://stackoverflow.com/questions/18389124/simulate-create-database-if-not-exists-for-postgresql/36218838#36218838
-- User frnakhommers (https://stackoverflow.com/users/971229/frankhommers)
Yes, probably. I wouldn't worry about it too much as long as we at least tried to attribute :)
Oh it does state its invalid, I missed that. Well, just change OSError then I guess.
I think it's a bit confusing since it says "not found" at the end.
Yea agreed, I copy-pasted it from the previous validation without reading it. Updated it in https://github.com/python-discord/site/pull/583/commits/4a0207fc198feab280065772142dbaffe25ffb4f
GitHub Actions run 1210370487 succeeded.
[site] Branch init\-metricity\-at\-runtime was force-pushed to `59f4a3d`
[site] Branch init\-metricity\-at\-runtime was force-pushed to `04ab6e6`
GitHub Actions run 1210375975 succeeded.
GitHub Actions run 1210379904 succeeded.