71252e7 Add print statement to log when metricity is be... - ChrisLovering
#dev-log
1 messages · Page 83 of 1
GitHub Actions run 1210400708 succeeded.
[python-discord/site] branch deleted: init\-metricity\-at\-runtime
78d8279 Initialise metricity at runtime - ChrisLovering
a211f99 Use context manager for file open - ChrisLovering
661454f Move db url validation to cls method - ChrisLovering
6de87e4 Close db conns when finished - ChrisLovering
d245bbd Create and populate metricity in a single conne... - ChrisLovering
GitHub Actions run 1210407811 succeeded.
GitHub Actions run 1210430165 succeeded.
GitHub Actions run 1210414696 failed.
GitHub Actions run 1210414696 failed.
eaefb72 Remove explicit check for db port, as it's opti... - ChrisLovering
[python-discord/site] New branch created: remove\-port\-check\-as\-it's\-optional
We also do not specify it in prod, so this crash looped when trying to deploy.
[site] Branch remove\-port\-check\-as\-it's\-optional was force-pushed to `f12d4ac`
Changing a few more things, since after further inspection, the workflow won't work.
GitHub Actions run 1210562181 succeeded.
I guess we're not worried about port 0 being specified :D?
[python-discord/site] branch deleted: remove\-port\-check\-as\-it's\-optional
GitHub Actions run 1210584550 succeeded.
Sentry Issue: SIR-LANCEBOT-6C
ValueError: dictionary update sequence element #0 has length 3; 2 is required
(1 additional frame(s) were not displayed)
...
File "bot/exts/core/help.py", line 511, in new_help
await HelpSession.start(ctx, *commands)
File "bot/exts/core/help.py", line 452, in start
session = cls(ctx, *command, **options)
File "bot/exts/core/help.py", line 97, in __i...
async def quack(self, ctx: commands.Context, ducktype: Literal["duck", "manduck"] = "duck", *, seed: Optional[str] = None) -> None:
According to @Numerlor this should work as a converter. (don't forget to import Literal from typing)
We can just move this down to the set_image because we still have the file variable there.
Use the Quackstack API to generate a random duck.
Basically al needed to change is just doing: @in_month(Month.DECEMBER, Month.NOVEMBER) right?
6730607 Update embed description length to 4096 - mbaruh
[python-discord/site] New branch created: update\_length\_validation
Max embed description length was raised to 4096, but the API wasn't updated, causing logging to fail when trying to clean long embeds.
GitHub Actions run 1210877778 succeeded.
Basically al needed to change is just doing:
@in_month(Month.DECEMBER, Month.NOVEMBER)right?
Yeah that looks like it should work (although you could put November before December because it comes first :))
I would love to do the PR, tho I am not good with github so I am afraid I might be doing it wrong or it might take too much time.
GitHub Actions run 1211014325 succeeded.
I would love to do the PR, tho I am not good with github so I am afraid I might be doing it wrong or it might take too much time.
There's no rush at all for this to be done (still two months until November, and even then it wouldn't be urgent...), and there's no need to worry about doing something wrong- everything is fixable and you can ask on the server if you have any questions.
This is a pretty good issue for a first PR if you haven't done one before, so I'd say you should give it a g...
I did a PR once, but all I remember is forking the project, editing, and then somehow opening a PR. And after that Akarys did something with my fork and the repo.
GitHub Actions run 1211110362 succeeded.
@Xithrius That was my personal preference - I think string literal concatenation looks neater that way, and is easier and more organized to look at. If you insist, I could remove them.
Looking through the rest of the file, to keep it consistent you'd have to remove the unnecessary f-string prefix.
GitHub Actions run 1211123243 succeeded.
GitHub Actions run 1211165965 succeeded.
GitHub Actions run 1211196839 succeeded.
GitHub Actions run 1211217724 succeeded.
GitHub Actions run 1211221175 succeeded.
GitHub Actions run 1211276494 succeeded.
This can be removed as it's now validated by the literal converter
I've tested this, good stuff. Thanks Tizzy!
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
[python-discord/bot] branch deleted: infraction\-last\-support
GitHub Actions run 1212625055 succeeded.
Connected!
GitHub Actions run 1212638742 succeeded.
@jchristgit @jb3 Were you able to come to a solution?
No, I think we found an issue with The Kubernetes Cluster Manager killing site instances, and we ended up wanting to debug it, but ended up not figuring out which „requests per second“ metric is the correct one
Am 08.09.2021 um 11:02 schrieb Xithrius @.***>:
@jchristgit @jb3 Were you able to come to a solution?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with G...
GitHub Actions run 1213644845 succeeded.
As it stands if the cache is not ready it will say 0. I'd rather it gave a non-numerical value like - to show that, since 0 nominees is possible.
What is the difference between this and wait_until_guild_available?
The difference is that this is the wrong one :) on_guild_available is the event that sets the available flag. Nice catch :D
d84e2e1 URLs: add an allow everything robots.txt - Akarys42
[python-discord/site] New branch created: robots\.txt
This commit simply adds a robots.txt file from within the URL configuration.
GitHub Actions run 1213685098 failed.
4dfa1c2 URLs: typehints aren't going to import by thems... - Akarys42
I'd rather have the robots.txt content in a multi-line string than with \n, also we shouldn't allow everything, we should disallow /admin/.
Oop that probably makes sense
GitHub Actions run 1213694582 succeeded.
[bot] Branch declare\-talentpool\-cache\-on\-startup was force-pushed to `818b14c`
I've returned to school, so this may take longer than anticipated. I'll try and get it done soon!
GitHub Actions run 1213700468 was cancelled.
Before merging, let me know and I'll squash the fixup commit(s)
GitHub Actions run 1213703966 succeeded.
35d6e1b Regex: add a word boundary before .gg - Akarys42
[python-discord/bot] New branch created: filters/dotgg\-boundary
Before this commit, an-arbitrary-domain.gg/notaninvite would trigger the filter. This solve the issue by adding a word boundary before this branch of the pattern.
GitHub Actions run 1213754552 succeeded.
r"(?:\b(?:[\.,]|dot))gg" # or .gg/
We want this to be a non-capturing group, so that it doesn't affect us extracting the actual invite code.
Also, is this trying to enforce that there is whitespace before the .gg/? If so, don't we need to use \B?
This is a solution for the #862 issue, which says the Hanukka holiday can also be in November and not only in December.
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #862
Description
I added the Hanukka command in November month, by adding Month.NOVEMBER to the in_month decorator.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments i...
[python-discord/sir-lancebot] Checks Successful on PR: #864 Added Hanukka command in November month.
GitHub Actions run 1213837819 succeeded.
Hello all,
Just clarifying something for this command and the implementation of it. Is the goal to send all of the text from the Markdown or just a link to that section?
The way the command is now, it is only the link. In #dev-contrib I had a short [conversation](#dev-contrib message) with Jason Terror that the intention was to parse the README.md file and send the text of the section back to the user.
With the si...
If we are going FastAPI, there's also SQLModel to consider, just something to think about
@doublevcodes SQLModel is in v0.0.4 with unfinished docs, I'd say you should hold off on it until the docs are finished
If we are going FastAPI, there's also SQLModel to consider, just something to think about
I believe SQLAlchemy is the one that is specified in the pyproject file. But that issue meant to solve something different. As of now, the Database models are in Django. However, if we were to use SQLAlchemy (or SQLModel if you will) we'll need to migrate those models to SQLAlchemy. SQLAcodegen, grabs the current Database Schema and generates SQLAlchemy models accordingly.
You control this with a constant, the point of a constant is that if you want to change the value you only need to do so on one place.
By mentioning the value of the constant you're removing the benefits of a constant.
Can this be re-worded?
We're in the WTFPython cog so get_readme should be enough and a better name (honestly I'd prefer fetch_readme to follow Discord.py)
I think the flow would be better if this was flipped, because usually an else is for "If all else fails, do this" rather than a case we're expecting.
GitHub Actions run 1214104726 succeeded.
GitHub Actions run 1214109255 succeeded.
GitHub Actions run 1214114291 succeeded.
Still confused at this, I even looked at Quackstack's source. There's no case where file is None.
file = data["file"]
But even now we can just move this down to the set_image() call.
I know we talked about this before, and I may have been a bit confusing which I see now. But the status code handling should be good enough.
We don't do this anywhere else and it seems unnecessary.
GitHub Actions run 1214127069 succeeded.
It should be the header of the README.md that matches the user's query, followed by the link to that header.
This is the README that is being searched against:
https://github.com/satwikkansal/wtfpython/blob/master/README.md
An example header:
▶ Evaluation time discrepancy
And the generated link:
https://github.com/satwikkansal/wtfpython/blob/master/README.md#-evaluation-time-discrepancy
Yeah the README is pretty wild with these in the text: https://github.com/satwikkansal/wtfpython/blob/master/README.md#-examples
GitHub Actions run 1214164300 succeeded.
Right so it matches a markdown header and then what's <!-- tocstop -->?
To be honest, I am not sure. I inherited this PR btw.
But in the raw .md file, the table of contents has that string at the end of the table of contents:
# Table of Contents
<!-- Generated using "markdown-toc -i README.md --maxdepth 3"-->
<!-- toc -->
- [Structure of the Examples](#structure-of-the-examples)
+ [▶ Some fancy Title](#-some-fancy-title)
- [Usage](#usage)
- [👀 Examples](#-examples)
* [Section: Strain your brain!](#section-strain-your-brain)
+ [▶...
Additionally, after #802 the repository now fully uses dict over typing.Dict.
self.headers: dict[str, str] = dict()
Oh I get it now, <!-- XYZ --> is of course a comment (HTML-style). Then it stands for "Table Of Contents Stop".
What about a comment like this?
# Match the start of examples, until the end of the table of contents (toc)
r"\[👀 Examples\]\(#-examples\)\n([\w\W]*)<!-- tocstop -->", data
GitHub Actions run 1214215218 succeeded.
GitHub Actions run 1214223746 succeeded.
GitHub Actions run 1214228684 succeeded.
Added that above the re.findall line. I'll need to test before I change that to re.search
GitHub Actions run 1214466616 succeeded.
I think string literal concatenation looks neater that way, and is easier and more organized to look at.
I could be missing something but is there even a need for the string to be split over two lines rather than just having one string? IMO splitting in this instance doesn't add anything to readability etc.
No-return is used when the function will never return (e.g. an infinite loop), typehints should be for success cases, you do not generally typehint exceptions.
This should be raised either as an issue or in the #dev-contrib channel where a core developer can approve it. I'm not a huge fan of "shit code" as a PR title and an empty PR body, it's not in line with our contribution guidelines.
Alright, I'll remove this when I get home
GitHub Actions run 1214716859 succeeded.
Looks good. Do you think the scheduling approach should be used in the rest of the code-base as well? because we use this pattern quite a lot.
[bot] Branch declare\-talentpool\-cache\-on\-startup was force-pushed to `f699c56`
Yup, I like this interface, we should do it!
6bb0dba Declare and refresh TalentPool.cache on init of... - ChrisLovering
b412451 Wait until login before trying to use the bot a... - ChrisLovering
2a2b0cd Remove previous nominations output - ChrisLovering
f699c56 Use - rather than 0 for number of nominees when... - ChrisLovering
4529559 Merge branch 'main' into declare-talentpool-cac... - ChrisLovering
[python-discord/bot] branch deleted: declare\-talentpool\-cache\-on\-startup
GitHub Actions run 1214912643 succeeded.
Connected!
It's possible that you evaluated your code and it came out wrong, but you still want it in the chat, e.g to patch it and try to evaluate again, or to discuss it with someone. Ultimately this is your message so you can just delete it yourself via Discord UI, so all in all this doesn't seem like desired behavior to me.
GitHub Actions run 1214927105 succeeded.
Description
Consider switching to a discord.py fork, such as nextcord, which will be maintained for the foreseeable future.
Reasoning
We won't miss out on new features of discords API, and therell be more support in the long term.
Proposed Implementation
Switch to nextcord. It's more or less a drop in replacement. Switch up a few imports and we're good.
Would you like to implement this yourself?
- [x] I'd like to implement this feature myself
- [ ] Anyone can implement th...
GitHub Actions run 1214963111 succeeded.
GitHub Actions run 1215332996 succeeded.
GitHub Actions run 1215647950 succeeded.
Connected!
GitHub Actions run 1216584332 succeeded.
There's no reason to switch this early.
See #dev-contrib message for a statement from Zig.
Also that fork in particular is not the best, IMO.
Good summary here:


I don't think we should switch to a fork unless we absolutely need to. dpy 2.0 seems to be doing well atm.
I've only found a few bugs anyhow, neither of which should affect pydis
right now.
I feel like there's room for improvement over this.
This is a HUUUUGEE command, you have a whole cog to use! Can you split this into multiple methods and keep the command itself as small as possible?
f"as it is completely whitelisted by 'every'."
We want to make it clear that we're referring to the every keyword argument.
Why did you make these changes? The previous code wasn't longer than the line limit?
Because of how day_and_star has more code than the "else", can we flip this? So if not day_and_star and move the code outside the if-statement into it and vice versa.
f"The maximum number of results you can query is {AocConfig.max_day_and_star_results}."
# This is a dictionary that contains solvers in respect of day, and star.
# e.g. 1-1 will fetch the solvers of the first star of the first day and their completion time
We may be able to move this into the loop so that you don't need to duplicate it, though I am not sure on how.
Don't we want to make a "timed out" error embed?
Why do this now? Just have IMAGES be this dictionary.
2de1e72 Create db then switch conn, rather than use dblink - ChrisLovering
[python-discord/site] New branch created: fix\-database\-switch
The previous implementation would succesfully create the metricity db, but the tables and rows would be inserted into pysite.
This is because dblink doesn't switch contexts within the script, as psql doesn't support this.
If we were to stick with 1 sql file, we would need to wrap every single statement into a dblink_exec() call to force psql to exec on the other db.
[python-discord/site] branch deleted: update\_length\_validation
If this is considered, it will be done in the future. For now, there is no need to switch.
Thanks for bringing this up.
GitHub Actions run 1216942665 succeeded.
Yep, I'll split them into helper functions, though the functionality should still stay as one command so it makes sense
GitHub Actions run 1217013629 succeeded.
[python-discord/bot] New branch created: string\-formatting\-tag
Adds a tag to show the string formatting mini language.
To keep this tag on the shorter side, I'm aiming for a "look at how cool this is!" vs a "let me explain how this works."
So the examples aren't explained in depth, but hopefully it's enticing enough to click on the links and provide an entry point to a larger conversation.
This is how the tag looks:

GitHub Actions run 1217743440 failed.
GitHub Actions run 1217803369 succeeded.
Looks good to me, good tag for getting people into using f-strings!
Have you considered using a REPL style codeblock for displaying the results next to the expressions that print them? Or was this done to avoid the potential confusion around prompts
Looks great to me! Just as a suggestion, you could add "=" to the f-string as well, it will print out the variable name and the value. It is also part of the mini language in f-strings.
But adding it to everything could also make things more confusing to people that don't know about f-strings...so take it for what you want to lol.
print(f"{repr_str = !r}")
print(f"{my_str = :^20}")
print(f"{my_num = :,}")
Have you considered using a REPL style codeblock for displaying the results next to the expressions that print them? Or was this done to avoid the potential confusion around prompts
I have and decided that because this is primarily showcasing final print results I wanted to avoid any potential confusion with some of the REPL environment indicators.
Having to jump between the two code blocks is a bit confusing. Maybe the result can be shown as a comment near the line as in other tags?
Having to jump between the two code blocks is a bit confusing. Maybe the result can be shown as a comment near the line as in other tags?
So I did try it and it ended up looking cluttered and confusing to me. At least for me, I don't necessarily expect the answer to be provided as a comment, so I don't pay that much attention to it. Let me see if I can make the change and illustrate.
.
Showing the repr would be ideal but I think that could conflict with the repr below.
For the comments I think it's nicer to read than the two codeblocks, but the color used for them may be a bit too muted
Maybe something like this?

Also explains what each formatting is supposed to do
[python-discord/metricity] New branch created: metricity\-creates\-own\-database
This ensures that metricity creates it's own database before trying to run migrations.
It uses the given connection string, defaulting to a database name of metricity if there isn't one specified.
how much vertical space does that introduce? I'm mostly concerned about mobile users where it may take up the whole viewport
[metricity] Branch metricity\-creates\-own\-database was force-pushed to `f70ce37`
Can we also change some examples to be using .format() and that it works either way?
Can you mention that it seems to have come from the usefulness of old-style %s formatting?
That's at least my take-away from PyFormat
I feel like this is a bad example, it doesn't actually showcase that we're doing the same as rep(). Because it outputs exacltly the string you typed.
We should find something that has a different __repr__ than __str__, or at least point out that the quotes were included when we printed it.
Isn't it mini-language?
Why doesn't it showcase this? The \t is for tabs and the repr is showcasing that the tab isn't rendered in the repr version.
What useful information does that provide to people? I'm not sure how knowing it derives from %s is necessarily useful for this tag.
I feel like that can easily be mixed up because the string quite literally does \t.
@Bluenix2 I'm not sure what you're referencing with this statement:
I disagree with these, it means that we show no examples without it and now someone might think you have to do it.
Also, I almost exclusively prefer the use of f-strings vs .format() with the exception of handling newlines in str.join(). This tag isn't meant to be a "here's all the ways it could work" but covering the most common use cases/illustrative examples and having people explore for themselves.
There are still uses for %s, like with logging when you need lazily evaluated strings, and knowing that you have similar options with %s could prove helpful?
That said I am pretty neutral on the matter, but thought I'd bring it up for judgement haha
@Bluenix2 I'm not sure what you're referencing with this statement:
I disagree with these, it means that we show no examples without it and now someone might think you have to do it.
Also, I almost exclusively prefer the use of f-strings vs
.format()with the exception of handling newlines instr.join(). This tag isn't meant to be a "here's all the ways it could work" but covering the most common use cases/illustrative examples and having people explore for thems...
@Bluenix2 I'm not sure what you're referencing with this statement:
I disagree with these, it means that we show no examples without it and now someone might think you have to do it.
That was in response to @brad90four's comments where they suggested adding = to all examples.
Also, I almost exclusively prefer the use of f-strings vs
.format()with the exception of handling newlines instr.join(). This tag isn't meant to be a "here's all the ways it could work" but c...
3d6ba16 Change formatting of examples - janine9vn
LGTM
Not too shabby for a speed run right?
GitHub Actions run 1218121418 succeeded.
btw, I think you're importing a file here? ClientConnectorError is most likely revealed under the aiohttp namespace meaning aiohttp.ClientConnectorError should be enough.
That said this should be remove per our previous comments
# We just need to turn the string into an integer any way possible
May sound better like this? Feel free to keep the old comment though.
There should now only be used once, so we can move it down into where it's used.
6bb0dba Declare and refresh TalentPool.cache on init of... - ChrisLovering
b412451 Wait until login before trying to use the bot a... - ChrisLovering
2a2b0cd Remove previous nominations output - ChrisLovering
f699c56 Use - rather than 0 for number of nominees when... - ChrisLovering
4529559 Merge branch 'main' into declare-talentpool-cac... - ChrisLovering
[python-discord/bot] branch deleted: string\-formatting\-tag
GitHub Actions run 1218144347 succeeded.
Connected!
[metricity] Branch metricity\-creates\-own\-database was force-pushed to `b63516a`
Seems to work just fine. I'll pass on the if format really because it is you and you give me enough money for my approvals.
[metricity] Branch metricity\-creates\-own\-database was force-pushed to `3dd5957`
Seems to work just fine. I'll pass on the if format really because it is you and you give me enough money for my approvals.
Perfect bash style, thank you sir Owl
[python-discord/site] New branch created: revert\-metricity\-init\-changes
4088963 Add metricity to docker-compose - ChrisLovering
[python-discord/bot] New branch created: add\-metricity\-to\-compose
This moves the init back into a docker-compose volume.
The bot now migrates metricity by actually including metricity in the docker compose, so there is no need for the site to run migrations in the image anymore.
This PR also moves the postgres health check code from site runtime, into docker compose.
By adding metricity to the compose, we allow it to migrate itself, rather than needing the site to do it.
Defaulting 'skip_metricity' to true means that it will run migrations, but not actually start the bot. This means we don't add another service that needs to run all the time, which could impact some contribs on lower powered hardware.
This needs to be merged at the same time as https://github.com/python-discord/site/pull/588
GitHub Actions run 1218239448 succeeded.
[bot] Branch add\-metricity\-to\-compose was force-pushed to `1d8eb10`
GitHub Actions run 1218240528 was cancelled.
GitHub Actions run 1218245115 succeeded.
Is there some way of accepting this from .env and defaulting to true or will docker always use the val from here?
If it stays I think it'd be worth mentioning the override file here as changing the value here is not a permanent solution as it's tracked
9a5d4ce Use case-insentivite compare to true to determi... - ChrisLovering
I think this is possible now that I've pushed https://github.com/python-discord/metricity/pull/7/commits/9a5d4ce294c3d0a9d588bc4e1435606690e8c02f will test it tonight
[metricity] Branch metricity\-creates\-own\-database was force-pushed to `ff90e8b`
[metricity] Branch metricity\-creates\-own\-database was force-pushed to `a5a397d`
The bot can be seen escaping underscores in code [in this message](#mailing-lists message).
The regex (if possible) should be updated to not insert \ inside codelines or codeblocks such as (in this case) __eq__.
On the bright side, it did work for one ocasion I've screenshoted below!

I realized that the infractions viewset allows filtering by fields.
Adding:
filter_backends = (DjangoFilterBackend,)
filter_fields = ('name', 'discriminator')
To UserViewSet and then calling
await ctx.bot.api_client.get("bot/users", params=dict(name="Qwerty", discriminator=1))
Allowed fetching the user data by name and discriminator.
I think the implementation of this is simpler, but it returns a nested dictionary with a list of user dictionaries under "re...
1786859 Capitalise SKIP_METRICITY env var name - ChrisLovering
4d7496d Use SKIP_METRICITY value from .env if present, ... - ChrisLovering
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 1218343302 succeeded.
[python-discord/bot] branch deleted: Only\-check\-domain\-filters\-against\-URL\-like\-parts\-of\-a\-message
GitHub Actions run 1218348838 succeeded.
Connected!
GitHub Actions run 1218359425 succeeded.
It's probably possible to retrieve it as a simple list as the infractions endpoint does, but this is where my superficial django knowledge ends.
GitHub Actions run 1218870754 succeeded.
GitHub Actions run 1218875576 was cancelled.
I think it is fine, as we want the original message to be set initially outside the loop so we can edit it
How does this sound
"""
Cog for a challenge command.
The challenge command pulls a random kata from codewars.com. A kata is the name for a challenge, specific to `codewars.com`
The challenge command also has filters to customize the kata that is given. You can specify the language the kata should be from, the difficulty of the kata (1 is the hardest, 8 is the easiest, on a scale from 1-8), and lastly you can customize the topic you want the kata to be about
"""
GitHub Actions run 1218887468 succeeded.
31f2c3f Ensure compatibility with black (#11) - onerandomusername
ddb6624 Refactor workflows, add concurrency options, se... - onerandomusername
GitHub Actions run 1218959253 succeeded.
PR Author
Workflow Run
Source Branch
onerandomusername...
GitHub Actions run 1218957029 succeeded.
GitHub Actions run 1218960582 succeeded.
GitHub Actions run 1219128243 succeeded.
The regex (if possible) should be updated not to insert
\inside codelines or codeblocks
It should just be a matter of update the regex here.
>>> string = "Hello world `__repr__` how are _you_? I'm good _today_, but __tomorrow__ may be different, `_User`."
>>> reg = r'(?:`[^`\\]*(?:\\.[^`\\]*)*`)|([_|])' # will get underscores and pipes that aren't in backquotes
>>> to_escape = [m.span()[0] f...
So, is this not actually an issue?
So, is this not actually an issue?
Yea, this is an issue, but has been superseded by https://github.com/python-discord/site/pull/588 since this implementation didn't work for people who also run metricity too.
See #dev-contrib message for an overview of what our solution is
[python-discord/site] branch deleted: fix\-database\-switch
I've managed to confirm that the proposed change to the final if statement works, and @Bluenix2 has confirmed this is the wanted behaviour on [discord](#dev-contrib message) so will work on the PR.
1a03467 Fix escapes in python-news posts - TizzySaurus
[python-discord/bot] New branch created: fix\-pynews\-markdown
Closes #1821.
No longer escapes markdown inside of codeblocks for python news posts.
Haven't been able to test in the context of python-news but have done simulated tests locally which work:
>>> string = "Hello world `__repr__` how are \_you_? I'm ||good|| _today_, but __tomorrow__ may be different, `_User|123`."
>>> reg = r"(?:`[^`\\]*(?:\\.[^`\\]*)*`)|([_|])"
>>> to_escape = [m.span()[0] for m in re.finditer(reg, string) if m.group(1)]
>>> to_escape
[32, 36, 43, 44, 49, 50...
GitHub Actions run 1220554481 succeeded.
Can we have explanations for this regex? Potentially also move it to bot/utils/regex.py.
Seems like I forgot about it, please use a named capture group instead of relying on indices to make the regex more resilient
GitHub Actions run 1221087026 succeeded.
We could perhaps calculate this before-hand? singleplayer should not change between calls.
Would it really be so hard to just hard-code the numbers?
IMAGES = {
6: "https://cdn.discordapp.com/attachments/859123972884922418/883472355056295946/hangman0.png",
5: "https://cdn.discordapp.com/attachments/859123972884922418/883472756744814613/hangman1.png",
4: "https://cdn.discordapp.com/attachments/859123972884922418/883472808699629578/hangman2.png",
3: "https://cdn.discordapp.com/attachments/859123972884922418/883472862441267230/hangman3.png",
2: ...
I've redesigned this PR quite a bit.
The regex does now have comments explaining each part, and also a comment above where it gets used to explain why the regex works.
In terms of moving it, I decided to instead just make it a constant within the file.
Addressed as part of the redesign :+1:
GitHub Actions run 1221882437 succeeded.
GitHub Actions run 1221891305 succeeded.
singleplayer allows the user to change between only them being able to send a message and play versus anyone being able to send letters, so I don't see why it shouldn't change between calls
14468af Add a docker compose for local dev - ChrisLovering
9942e15 Add a script to create metricity db if it doesn... - ChrisLovering
803d19f Create database before migrating and running - ChrisLovering
a5a397d Use case-insentivite compare to true to determi... - ChrisLovering
1786859 Capitalise SKIP_METRICITY env var name - ChrisLovering
[python-discord/metricity] branch deleted: metricity\-creates\-own\-database
I can add comments to how the filenames work but I would likely have to go into my file system, rename the images, then send it to change the file names, does that sound good with just explaining the filenames?
GitHub Actions run 1222561087 succeeded.
This button does not seem to do anything if you click it when everything is already selected, is that intended?
Is this file going to be kept? It seems to be fully commented out.
This looks pretty good to me. I don't know much Django so I may have missed some important things, but what I know looks fine.
GitHub Actions run 1222651920 succeeded.
GitHub Actions run 1222667118 succeeded.
@Bluenix2 Alright, I made the command much smaller!
Let me know what you think when you're free!
Sentry Issue: BOT-1MX
ValueError: invalid literal for int() with base 10: ''
File "bot/exts/info/doc/_inventory_parser.py", line 107, in fetch_inventory
inventory = await _fetch_inventory(url)
File "bot/exts/info/doc/_inventory_parser.py", line 83, in _fetch_inventory
inventory_version = int(inventory_header[-1:])
An unexpected error has occurred during fetching of https://ipytho...
[python-discord/site] New branch created: jb3/repos\-update
In accordance with a poll in #dev-contrib, King Arthur becomes the 6th repository featured on the Python Discord homepage.
PS: Damm you for hooking me into Hans Zimmer film music again! Now I won't be able to listen to anything else but Inception and Interstellar for another 2 weeks
If called this function will.. Using bs4, and with a formatted link with the filters provided by the user?
We don't need these comments
Can you remove these comments that explain what the code does? Because we are currently reading this code and it is understandable.
If you do wish to keep this comment, you can reword it to be more helpful.
# We map the option label to the embed instance so that it can be easily looked up later in O(1)
So each iteration of the while loop you are re-declaring this lambda function. We can create it before the loop, additionally you can have an if-statement like
if singleplayer == "m":
...
else:
...
You haven't moved this file yet.
Additionally, how did you get this file?
Really couldn't find anything else, I just need to test this before approving.
if infr_type not in ("ban", "kick"): # If we haven't already tried to send the DM
Sending a reminder about [these messages from the Discord server](#dev-contrib message) so that it is also on record in the PR.
Any reason we can't just create the message with the view, and assign the attribute later on? API calls are expensive.
I suppose I could assign the attribute later
Haha, yeah I'll be fixing all of these when I get back to my device
We should handle invalid regex string here i.e. it is not in form of "`.+`".
Two bugs with the regex subcommand, the rest works well.
We should catch for re.error here in case the regex is invalid.
Example: !clean regex [
Traceback (most recent call last):
File "/home/shivansh/.cache/pypoetry/virtualenvs/bot-5X3Lakqr-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/shivansh/Programming/pydis_projects/bot/bot/exts/moderation/clean.py", line 521, in clean_regex
await self._clean_messages(ctx, traverse, reg...
GitHub Actions run 1223596525 was cancelled.
The Python discord bot implements bs4 not in another thread iirc, and it's been working fine, but this is a valid point
GitHub Actions run 1223597103 succeeded.
GitHub Actions run 1223603763 succeeded.
GitHub Actions run 1223614330 succeeded.
Is there any reason this doesn't direclty use the
discord.Colorclass?
Yes, the colors are actually the colors of the kyu levels on codewars itself
I will note that down!
GitHub Actions run 1223614972 succeeded.
GitHub Actions run 1223617856 was cancelled.
GitHub Actions run 1223621411 failed.
GitHub Actions run 1223624447 succeeded.
GitHub Actions run 1223628072 succeeded.
GitHub Actions run 1223629268 succeeded.
GitHub Actions run 1223631111 succeeded.
GitHub Actions run 1223631838 succeeded.
GitHub Actions run 1223645758 succeeded.
GitHub Actions run 1223668603 succeeded.
@Bluenix2 Added most of your comments, besides the ones I wanted elaboration on!
GitHub Actions run 1223670523 succeeded.
From the looks of it we do generally have the first word capitalised so will commit this :+1:
GitHub Actions run 1223960221 succeeded.
If it's not in that form, the match will fail and group(1) will raise an exception, causing the overall conversion to just fail.
Right, I was going to do that but forgot, thanks.
Scratch that, the exception seems to propagate when it's a required argument. Will fix it 👍
The way the program is currently written, the parse_readme function creates a dictionary of the Table of Content's headers, as well as the hyperlink to them. This gets called wtih fetch_readme, which is called in the __init__.
Once this dictionary is created, the fuzzy_match_header function uses the rapidfuzz.process.extractOne method with the user search term and this created dictionary.
If I change that to re.search, then I probably wouldn't be leveraging the fuzzy matching ...
To check that I'm following you here:
From this:
table_of_contents = re.findall(
r"\[👀 Examples\]\(#-examples\)\n([\w\W]*)<!-- tocstop -->", data
)[0].split("\n")
table_of_contents = list(map(str.strip, table_of_contents))
log.debug(f"{table_of_contents = }")
for header in table_of_contents:
to this:
table_of_contents = re.findall(
r"\[👀 Examples\]\(#-examples\)\n([\w\W]*)<!-- tocstop -->...
closes #1823
instead of letting the decoding errors go to the generic exception handler, the inventory header is now validated at multiple points and an InvalidHeaderError is raised if it is invalid.
The error is handled in the converter and converted to a clearer bad argument that's displayed to the user. In case of automatic inventory loading, the error is logged as a warning so the inventory can be fixed in case it was moved or some other reason for the convent to be invalid
GitHub Actions run 1224512186 succeeded.
I'll get this done if nobody else wants to grab it as it's annoying to work with the hidden errors
I made the code to escape the markdown previously so I fixed it but I only just noticed someone else was working on it. Here's my version of the fix, https://github.com/Ryu1845/bot/commit/051fc1559bcd2c7e2a1d3a67332a27a81431049a .
I added the escaping to the titles too.
Moved it!
I believe @CyberCitizen01 created it based on this: https://github.com/ryanzec/name-that-color/blob/master/lib/ntc.js#L116-L1681
GitHub Actions run 1224558030 succeeded.
GitHub Actions run 1224696995 succeeded.
closes #1807
replaces loop.create_task and asyncio.create_task usages with the scheduling util so exception logging is attached to created tasks
GitHub Actions run 1224771026 succeeded.
Any reason not to use the bot loop here?
Any reason not to use the bot loop here?
Any reason not to use the bot loop here?
If the loop is not passed in, the util itself uses asyncio.create_task which gets the running loop
GitHub Actions run 1224798620 succeeded.
Not an actual requested change (unless you want to make it), but having to set SKIP_METRICITY to false seems like a double negative 😅
Setting USE_METRICITY to true seems more intuitive.
I'd rather see these as hex values, it's a much more common way of sharing colors and makes it much easier for someone to reuse.
But we are inside of the miscellaneous_embed() method.
@Bluenix2 Added most of your comments, besides the ones I wanted elaboration on!
I don't understand, I can't any question or similar for me to answer.
219a530 Remove double negative from env var - ChrisLovering
[python-discord/metricity] New branch created: remove\-double\-negative\-from\-env\-var
It appears that the Hangman game from your other pull request has leaked over into this one. Are you not using two different branches?
Not an actual requested change (unless you want to make it), but having to set
SKIP_METRICITYto false seems like a double negative 😅
SettingUSE_METRICITYto true seems more intuitive.
Good point, I've raised https://github.com/python-discord/metricity/pull/8 will update this PR to match
7450a7e Remove use of double-negative env vars - ChrisLovering
It appears that the Hangman game from your other pull request has leaked over into this one. Are you not using two different branches?
I accidentally pulled the hangman branch instead of the challenges branch which is what this is on, and I thought the changes were gone, I'll remove the hangman from it
GitHub Actions run 1224823502 was cancelled.
GitHub Actions run 1224823983 succeeded.
GitHub Actions run 1224822818 succeeded.
GitHub Actions run 1224824676 succeeded.
For context, what was the original reasoning for doing the init outside of the compose? can you link the PR?
I don't think I understand, I simply suggested changing this re.findall to re.search because you only grab the first result from the "findall".
@Bluenix2 Added most of your comments, besides the ones I wanted elaboration on!
I don't understand, I can't any question or similar for me to answer.
Nevermind, I think I got confused earlier whether you were asking a question or not
In python-discord/bot#1820 the default for SKIP_METRICITY was true, meaning the default here should be false no?
For context, what was the original reasoning for doing the init outside of the compose? can you link the PR?
The original reason was because when we included site in the bot's compose file, we used the image directly, so it did not have metricity initialised. This wasn't much of an issue until recently, when we added django-prometheus which requires those relations exist at run time.
However, this wasn't a great solution, since users who actually want to run metricity needed to delete...
What happened to bs4 and lxml? It was removed from the lock file.
GitHub Actions run 1224835294 succeeded.
This is defaulted true, since we don't want to change current behavior when running metricity.
However, when running the bot via compose, we default it to false there since the majority of users running the compose don't need metricty running, only the migrations to be ran.
Ah I didn't see it was the metricity repo for some reason
This should only need to be opened once, take a look at how #843 does it.
What happened to
bs4andlxml? It was removed from the lock file.
I am not thinking today lol, I removed it because I didn't realize that it was part of this command
My bad, I'll add it back
GitHub Actions run 1224848061 succeeded.

Docker screams at me when I try to do anything
\b is a word boundary, \B is the opposite.
[python-discord/metricity] branch deleted: remove\-double\-negative\-from\-env\-var
Again, you can even just move this into the if-statements themselves.
So instead of doing level, query = f"-{query}", None you can just do params["q"] = f"-{query}.
Should probably comment that original_message will be set after being initialized.
I feel like aiohttp or httpx should handle this, did you get issues with doing params["beta"] = language in SUPPORTED_LANGUAGES["beta"]?
Does this not need to be followed by a newline as well?
Description
Editing an embed with an image causes the image to appear in the message as well. The original DDDG implementation used a workaround that immediately broke when we moved to discord.py 2.0. J9 then put in a temporary fix in the re-organization PR by editing the message text instead of the embed text. This fixes the image bug but places the text over the board, doesn't look as good, and is currently overwriting old text.
Proposed Solution
As far as I can tell, there is no...
71ce990 Adds Core Dev Voting To Changelog Blacklist - HassanAbouelela
[python-discord/bot] New branch created: ignore\-voting
Adds the channel used for voting on contributors to the message changelog blacklist.
GitHub Actions run 1225004072 succeeded.
Connected!
GitHub Actions run 1225011422 succeeded.
GitHub Actions run 1225012850 succeeded.
I made the code to escape the markdown previously so I fixed it but I only just noticed someone else was working on it. Here's my version of the fix, Ryu1845@5a6dc88 .
After discussion on Discord in dev-contrib and necessary changes etc. this has been committed, thanks :+1:
This PR is now awaiting reviews.
GitHub Actions run 1225025782 succeeded.
GitHub Actions run 1225085943 succeeded.

Docker screams at me when I try to do anything
Can this be reworded to make it clear that this is the user's guess?
Shouldn't this be an edit?
Shouldn't this be an edit?
I know! I believe @Shom770 was supposed to rename it to hangman_word_list.txt but never did.
Yeah, that probably makes sense. But don't we have the picture of the man for that?
It still may not be clear how many tries you have left.
I thought I renamed it, does git not pick up file name changes?
Well, after {tags} do we not need a new line so that it becomes (demonstrated with single-quotes)
'''nim
{tags}
'''
Instead of what this now becomes
'''nim
{tags}'''
But that may not matter?
Doc item doc_item.symbol_id='environment-variables' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
GitHub Actions run 1225553198 succeeded.
Nope, I guess not. I still see it as top_1000_used_words.txt.
GitHub Actions run 1225555690 was cancelled.
GitHub Actions run 1225556189 succeeded.
Unfortunately, it doesn't handle it.
Hm, I honestly think that the dictionary is more fitting since it is a mapping
Nope, I guess not. I still see it as
top_1000_used_words.txt.
It is named hangman_words.txt if you go to my fork and go under bot/resources/fun
GitHub Actions run 1225804286 succeeded.
GitHub Actions run 1225806097 succeeded.
GitHub Actions run 1225814034 succeeded.
GitHub Actions run 1226072206 succeeded.
@Xithrius This looks interesting to implement, do you mind assigning me this issue.
My approach so far
Create a list of all anagrams which can be made (JSON file maybe)
Select a word which has anagrams from JSON at random and scramble the word so its letters are jumbled
Users will suggest words which are anagrams, check in JSON if they are valid anagrams if yes award points (still figuring out how to do that)
[python-discord/site] branch deleted: jb3/repos\-update
GitHub Actions run 1226236841 succeeded.
Works well and looks great!
Yeah, I tested it out and it still worked. Fixed it!
I'm not an expert of async programming, but I believe this might be a blocking call. Normally, I would consider using something like aiofiles, however using something like io.StringIO might fit your needs better. You can use it with discord.File since it's a file-like object.
GitHub Actions run 1226591253 succeeded.
GitHub Actions run 1226631634 succeeded.
GitHub Actions run 1226663276 failed.
Huh, you're right, @Shom770. Your fork does say hangman_words.txt. Then why does the new name not show up here then?
This is outdated and has been fixed now.
The reason this isn't working is because . is not a word character, so it makes no sense to use \b here. It's possible to instead have a negative lookbehind for \w
GitHub Actions run 1227678630 failed.
Sending a reminder about [these messages from the Discord server](#dev-contrib message) so that it is also on record in the PR.
Cleaned it up a bit in https://github.com/python-discord/bot/pull/1663/files/e07febdbde4815466b161b535f4a5eaf3593f755..3edce6120b48cf83f8a87f34da1007221967232c after I realized the TagIdentifier.from_string handles part of the logic and can be used instead. I've also moved all the paginating into...
Do you think [[tag_group] <tag_name>]" would make more sense for the usage? to highlight that they're either both optional, or the name is required and the group is optional
GitHub Actions run 1227709268 succeeded.
GitHub Actions run 1227727698 failed.
GitHub Actions run 1227784481 succeeded.
Just keep this in mind for all log.trace() calls.
missing a trailing comma in aliases tuple
Is this PR going anywhere?
I'm making a guess that this is caused by a faulty disabling of .latex.
Currently, we only have a tag for the windows PATH variable. I suggest we expand this tag to explain what the path is, and maybe explain or give a guide on how to alter it.
Is this PR going anywhere?
Pretty sure it is.
Is this PR going anywhere?
Pretty sure it is.
Sorry, made this comment before I realized there were recent commits
@Kronifer If you look at the above review by Bluenix and my comment you'll see that these should in fact be one-line, so recommending usage of triple-quote string isn't correct yet.
This shouldn't have a trailing comma. You only use a trailing comma here when there's one alias (to make it a tuple).
Likewise shouldn't have a trailing comma here.
@Xithrius, is this approved and could I be assigned?
I'm putting this on pause until I have .quack done
I believe you should move the error_embed creation under the if condition, since it'll be only used if the response status is not 200.
In addition to the changes requested above, that is what I found so far. Great PR, regardless. 👍
Sounds good, I'll move once I get home
Got a bit confused by the wording at first
Deletes cache value (`message_link_embeds_cache`) of `msg_before` if it exists. It then removes the
Also I don't see any variable called msg_before. It will also be helpful if you mention what that variable represents in your own words, since people will be first reading the docstring and then the code.
This should be the first operation, and then count characters in the reduced string.
Nitpicking, but can be slightly improved with maxsplit=3
78d8279 Initialise metricity at runtime - ChrisLovering
a211f99 Use context manager for file open - ChrisLovering
661454f Move db url validation to cls method - ChrisLovering
6de87e4 Close db conns when finished - ChrisLovering
d245bbd Create and populate metricity in a single conne... - ChrisLovering
GitHub Actions run 1230574338 failed.
@OculusMode what's your status on this fix?
Hey @Xithrius sorry for late reply, been bit busy in studies, haven't worked on this.
When implementing this, I realised that this kind of day-and-star "formula" might not be the most convenient if someone wants to check multiple stars,days. So I went ahead an implemented a small panel, so that after invoking the command with something like: "1-1" you can step the day and star parameters and get new results accordingly. Also, I think it should be included in this PR that's what I proposed my idea here.
. -->
Description
Adds a .gitpod.yml file that automatically installs Python 3.9.6, poetry and installs poetry dependencies.
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 agr...
Hi, given the changes that this makes, I believe policy is to squash them into one commit.
View https://pythondiscord.notion.site/Squashing-a-Pull-Request-191e8efa2fbb4d72840fd17ca37cf7fa for how to do that.
GitHub Actions run 1231857916 succeeded.
Hi, given the changes that this makes, I believe policy is to squash them into one commit.
View https://pythondiscord.notion.site/Squashing-a-Pull-Request-191e8efa2fbb4d72840fd17ca37cf7fa for how to do that.
squashed
GitHub Actions run 1231866943 succeeded.
Log the error if the response failed? Useful for debugging later on.
You could also mention it in the embed so people can know the issue.
Did you test this first? It won't work because you're comparing role objects against IDs.
Also, do you think it would be scope creep to create a utility function for this role checking, since a similar pattern is being used elsewhere in the codebase?
Another feature could be to generate color palettes?
Here's what I could find at a quick glance, but other than that it looks good!
Can this not be moved to after line 124? You're reiterating over the raw_leaderboard_data.values() again over here
What exactly does the csharp bit do here? What importance does the coloring for csharp have?
Alternatively find the first occurence of a space so you don't have to keep counting if you do find one.
It doesn't seem like the string is stripped before this line as requested in https://github.com/python-discord/bot/pull/1446#issuecomment-830607365
It highlights the data in the codeblock, and I find it a perfect fit for this case. Take a look at the image sent below.
I believe it can be. Initially I wanted to modify StarResults but then decided to go with that and forgot that It could be solved there. Good catch! Thank you!
245281e Detect and copy config files passed by bot compose - ChrisLovering
[bot] Branch add\-metricity\-to\-compose was force-pushed to `d4c4cce`
GitHub Actions run 1233413003 succeeded.
@Vthechamp we decided against catching asyncio.ClientConnectorError
GitHub Actions run 1233815567 succeeded.
I believe all that remains is to redirect all existing resources pages to the one resource page, and to decide about the tests that aren't implemented. My filtering logic, which will probably be translated into JS (by someone who isn't me) when we make the page reactive, does not have a unit test.
I am looking at several tutorials and Gitpods reference itself, and this looks pretty good. Just have a few questions
This will become the name of the terminal itself, is it suitable for that though?
Is this for Gitpod itself?
I have a comment on the extensions installed, too. I think this should be
installing the python and pylance extension, at minimum.
Properly reverts the previous changes and works well with the bot PR 👍
This is so poetry can install deps, user-site packages aren't supported
@onerandomusername I'll work on that later
I'd suggest something more like just a bare:
- name: Python Environment
I'll do this, but to clarify this only sets this as the terminal name while the commands are running
GitHub Actions run 1234764708 succeeded.
GitHub Actions run 1235027892 succeeded.
GitHub Actions run 1235175918 succeeded.
GitHub Actions run 1235287050 succeeded.
Something clicked when I woke up today for some reason, this review is all about capitalization haha
Do we need these forms of politican words?
These appear to be heavily american
See my comment about "Republican".
I'll make it clear that I do not have Gitpod and cannot test this, but this all looks good according to all documentation I could find.
GitHub Actions run 1235507479 succeeded.
I don't think people read these carefully enough for it to matter and if they did then that would simply be confusing.
I am open for the discussion but what we have right now seems good enough.
Inside almost all of your scripts there is an import called from bot.bot import Bot and it throws an error because there is no module named bot.

Hi. Is there a way to prohibit certain modules in the standard library from being used? Specifically os, sys, and importlib?
@ChrisLovering I tried running .bm in an occupied help channel today but I got the message that I had to use #sir-lancebot-playground. Is that expected behavior because I wasn't the user that claimed the channel?
Hey!
There is no way to blacklist specific modules, you'll find that a lot of things use the modules you've cited as well which could cause a few problems.
Due to the isolation that snekbox provides there is little risk with any of the mentioned modules, for example you can only do limited spawning with os.system (the container doesn't have a lot of tools inside it).
I'd be interested to hear the use case for a blacklist of modules, but you can rest easy that using all of these with snekbo...
but the status code check remains right? So I was wondering if you could log the status code for future debugging?
GitHub Actions run 1236872259 succeeded.
GitHub Actions run 1237074177 succeeded.
Rather than implementing all of this, why not use @whitelist_override(roles=(Roles.everyone_role,))?
You'd just need to add the everyone role to constants, the ID of the everyone role in pydis is 267624335836053506
One is "fail," as in "I failed miserably," and the other one is "fall," as in "He fell down the stairs." Unless I misunderstood something, those aren't duplicates.
Wouldn't it be smarter to store these in the resources folder, since doing it this way makes it reliant on the channel and messages existing?
TextChannel.send has the delete_after option which does the same
I did that in the beginning, though the game became quite buggy and slow -- as it had to load from there every time due to a closing file operation from discord.py, I think the current way is likely the best for the game
It changes message.content to message.content.lower() on line 119
I'll change to that - but is there any difference between the two?
Thank you so much! So essentially, asyncio can run blocking code in a ThreadPoolExecutor (threading) and the main event loop can do other things?
I'd rather use a the process pool executer (the second here) since this uses the multiprocessing feature allowing us to bypass the GIL
What would be the use of bypassing the GIL here? The threads can still switch and I don't think we need to utilize more of the CPU.
From some tests I've done for the docs bs4 took quite some time for longer HTML so if it blocks for more than a ms or so I'd say it's definitely worth it, spawning threads is cheap
Using threading could still potentially block the event loop, which is why I suggested using Multiprocessing, but yeah it is a bit unnecessary.
No it won't potentially do so. Threading will not block the event loop.
The thing with threading is that it won't go faster, because it is not run in parallel and even when it is ran concurrently Python has the GIL which means that even concurrently only one thread can run at a time.. so half concurrently!
But that doesn't matter and we don't care, this is not a high priority calculation that we need to speed up with parallelism. The objective is to just not make it not block the event loop.
A lot of these are nitpicks and up to you whether you implement, but I do feel the following should be addressed:
- L101-L102
- trailing commas
- the split
__init__function - the inconsistency of "kata" vs "Kata"
- the inconsistency of "codewars.com" vs "`codewards.com`"
We generally put variables/attributes in backquotes for clarity (so "The `original_message` attribute..."). Example of this can be found here.
This perhaps isn't essential in this case as the next word is "attribute" but I personally would prefer this was added.
The first mention of codewars.com isn't in backquotes and the second is. Is there a reason for this? If not this should be made consistent (perhaps better without backquotes since backquotes are generally used to refer to variables/attributes and seemingly all other mentions are without backquotes).
There's a lot of trailing commas in this case that based on the rest of the codebase shouldn't be there for the sake of consistency (lines 26,31,44 etc.). I think these should be removed.
That would not change the title each time
Not at all, delete_after spawns an task that sleeps, then deletes the message. This accomplishes the same thing
So should I change it?
Please add a trailing new line
Yes this check should remain, and I do agree @Kronifer should add a log.error. This is what the rest of the bot does.
Tested and tried to cause some error cases with missing permission, handles everything correctly.
GitHub serves the file over http, which you can use (which was my original intention) like this: https://raw.githubusercontent.com/python-discord/sir-lancebot/main/bot/resources/fun/all_cards.png
IMO using delete after is cleaner but, feel free to leave it as it
Oh sorry didn't see that, though I don't think that overwriting the original message content is a good idea, as this make the code less readable...
Description & Reasoning
The .topic command provides conversation starters for our channels. It's very useful for getting things back on topic or to bring up a new thing to talk about. However, I've noticed that some people will just use this command as a rapid-fire answer mechanism, so they end up using .topic several times in as many minutes.
That's not really the intent of this command and is quite spammy, especially in already fast moving channels like python-general. I propose...
157b19b Don't call on_command_error when a check errors. - Qwerty-133
[python-discord/sir-lancebot] New branch created: sim\_matches
People have brought up the issue of if the users don't like the current topic, how can they get a new one?
The proposed solution there is to add a reaction to re-run the topic to pick a new one.
People have brought up the issue of if the users don't like the current topic, how can they get a new one?
The proposed solution there is to add a reaction to re-run the topic to pick a new one.
It could also be solved, by adding a countdown button, and when it reaches the desired amount of votes it picks new one.(Timeout should be configured accordingly)
(Just to make use of the new dpy. 2 features 👍 )
Description
About one year ago, I created a pull request (#590) that closed issue #277, a relatively simple game called the Spooky Name Rate game where people try to spookify a name announced everyday and compete for the spookiest name. Since October is arriving again, this cog is soon going to be in use, but now I realise that not only can this be improved using the new discord features such as threads and replies, but it might also break because of some recent changes, and some informat...
I think you need to do this first right? Because batch_manage() calls manage which ends up calling the load_extension and unload_extension methods, these two check if the extension is in the unloaded cache.
So what ends up happening is that the extensions don't get loaded because they're still in the unloaded cache.
Why is this necessary exactly?
Isn't it better if we add this as an on_ready (and guard it with a bool that we set the first time) or we can override start() to load the extensions.
Sounds solid. We'll have to review each model, but it's probably going to get us close to what we want. I think it typically struggles with things like Many-to-Many relationships, as I believe SQLAlchemy wants you to explicitly define your through model structure where Django will auto-create one if you don't specify one.
Description
The bot sometimes sends you error messages when you type invalid commands.
Steps to Reproduce
Type ...and or .cand or so on in a channel, and you'll be met with an embed by the bot saying "Command can only be used in October." This happens because the command handler tries suggesting the candy command but its checks raise a check failure, and the check failure is passed to the error handler again which is handled by it by posting that october embed.
Expect...
GitHub serves the file over http, which you can use (which was my original intention) like this: https://raw.githubusercontent.com/python-discord/sir-lancebot/main/bot/resources/fun/all_cards.png
Ah, I'll change it to that then
Oh sorry didn't see that, though I don't think that overwriting the original message content is a good idea, as this make the code less readable...
No worries, I can see your point though each if statement would be repetitive a bit
Just a few small comments.
Might be cool to add some Python themed words to the list too!
This code is duplicated at the end of the while loop.
You can remove this duplication if you move this whole block into the while loop and have it be the first thing that happens.
with open("bot/resources/fun/hangman_words.txt", encoding="utf-8") as f:
Wouldn't this be easier to read?
I'm not sure if there's a reason you're passing it through pathlib and then resolving it. Let me know if there is. Removing this means you can also remove the Path import.
GitHub Actions run 1239041496 failed.
GitHub Actions run 1239081639 succeeded.
GitHub Actions run 1239111843 succeeded.
GitHub Actions run 1239119337 succeeded.
GitHub Actions run 1239121413 succeeded.
GitHub Actions run 1239133911 succeeded.
GitHub Actions run 1239286373 succeeded.
Hey all,
I think I will just stick with sending the link to the relevant section in the WTF readme file. I don't see a way forward with the file preview of the .md or .txt file.
If that is ok, I will remove the readme_file command and the embed_file variable.
GitHub Actions run 1239432829 succeeded.
GitHub Actions run 1239786989 succeeded.
GitHub Actions run 1239792192 succeeded.
GitHub Actions run 1239798564 succeeded.
You could make a new variable for the normalised content
Connected!
GitHub Actions run 1242434833 succeeded.
GitHub Actions run 1242560883 failed.
GitHub Actions run 1242586851 failed.
GitHub Actions run 1242591532 failed.
GitHub Actions run 1242602748 succeeded.
Some comments from testing the game:
- The images seem to be badly cropped, especially in dark mode (see below) Could these be improved?
- The correct word isn't confirmed when the play wins, maybe the original embed should be updated with the full word at the end, and/or the You won! embed should also say what the final word was

GitHub Actions run 1242895116 succeeded.
GitHub Actions run 1242953527 succeeded.
hangman_embed.set_footer(text=f"Tries remaining: {tries}")
My last comment, I was confused while playing whether this meant the number of tries I've taken, or the number of tries I have left. I think this change will help the user understand what this number means.
GitHub Actions run 1242965269 succeeded.
Yea, I prefer using the delete_after kwarg for simplicity too, but it doesn't matter either way really.
Yea, it could be easier to read if you did lowered_content = message.content.lower() and then used lowered_content in each of the if statements, rather than editing an attr on the message itself.
GitHub Actions run 1242974806 succeeded.
GitHub Actions run 1242977562 succeeded.
GitHub Actions run 1242986776 succeeded.
GitHub Actions run 1243286056 succeeded.
GitHub Actions run 1245262941 succeeded.
PR Author
Workflow Run
Source Branch
use-pydis's-fork-...
GitHub Actions run 1245273998 succeeded.
[python-discord/bot] Issue opened: #1830 "Unresolved attribute reference 'trace' for class 'Logger'"
We inject a custom implemented trace method in our logger, but IDEs (such as PyCharm) don't detect this injection and so give a warning stating that the attribute doesn't exist.
This can be fixed by adding a CustomLogger class, with the trace method implemented within and updating logger definitions.
1adae82 Add CustomLogger to prevent IDE lint errors w... - TizzySaurus
[python-discord/bot] New branch created: custom\-logger\-class
Closes bot#1830.
Implements the proposed CustomLogger class to fix the lint warnings.
GitHub Actions run 1245357138 succeeded.
here is the CustomLogger class, so anyone reviewing this doesn't have to scroll to find it.
Looks good according to all documentation I could find.
2a83c5f Only check URL-like objects against domain filters - ChrisLovering
fddd341 Refactor & simplifiy domain filter check - ChrisLovering
9b094f6 Merge branch 'main' into Only-check-domain-filt... - ChrisLovering
14e910e Merge pull request #1788 from python-discord/On... - ChrisLovering
71ce990 Adds Core Dev Voting To Changelog Blacklist - HassanAbouelela
Here is the
CustomLoggerclass, so anyone reviewing this doesn't have to scroll to find it.
There's also the get_logger util function (entire file is new)
All other changes are removing the old monkeypatch trace or updating imports from
import logging
...
GitHub Actions run 1245472751 succeeded.
[bot] Branch add\-metricity\-to\-compose was force-pushed to `fe248cc`
GitHub Actions run 1245485217 succeeded.
[site] Branch revert\-metricity\-init\-changes was force-pushed to `c9aed17`
[python-discord/site] branch deleted: revert\-metricity\-init\-changes
[python-discord/bot] branch deleted: add\-metricity\-to\-compose
Connected!
GitHub Actions run 1245512601 succeeded.
GitHub Actions run 1245802152 succeeded.
I ran the model generation, surprisingly it did not end up generating Table definitions at all.
It still lacks of some Validation (However in some places it managed to generate those checks) however some of the checks defined on the Django side still need to be implemented. (Most of them are fairly easy though). Although, I believe opening a Draft Pull Request to discuss further things to do/implement is vital.
Originally, everything was in one file, so I took the liberty and split them in...
Just had an idea @CyberCitizen01
With your get_color_fields function, we can take any input mode and change that to rgb before passing it to the function. We could define individual <mode>_to rgb functions above the class and use them in the big if /elif loop when checking the mode.
From there we would call your overall function to create the individual color types and send that to the embed.
One thing I think we need to decide is whether to force the user to pass in tuples o...
Nice, I've personally wanted this for a while 👍🏻
Missing log migration: bot/exts/recruitment/talentpool/_cog.py
The logger should inherit .getLoggerClass() to play nice with other loggers.
It's better to use the non-internal .log() method to do the work for us, it essentially does what you're doing here but extra.
First of all, sorry that I haven't been able to produce any updates lately. School just started for me two weeks ago, and I have some things to sort out, so it's going to take me some time to get my developing and studying schedule back on track. And also, @ChrisLovering, I just realized: the everyone role didn't work for me before because I placed the decorators in the wrong order - and I assumed that it was the role's fault. Now, looking at the logic, you're correct. I will update this PR s...
But I do have a counter-argument: adding an every does seem more semantically precise - it's not immediately obvious what roles=(Roles.everyone,) should do, as I was confused as well when I started looking at the code.
So to clarify, this would become self.log(...)?
Changing this to class CustomLogger(logging.getLoggerClass()) results in PyCharm giving a warning stating Unresolved attribute reference 'isEnabledFor' for class 'CustomLogger' and Unresolved attribute reference '_log' for class 'CustomLogger' (same happens for log instead of _log).
Even casting doesn't fix this (cast(Logger, logging.getLoggerClass()))
All I could find from the diff, but I'll have to check what you didn't change as well to make sure we do not miss something.
Huh? Shouldn't MISSING be the keyword argument's default already?
This won't re-enable them if they were previously enabled, or are we gonna use channel overrides here instead enabling it globally?
def is_message_blacklisted(self, message: Message) -> bool:
"""Return true if the message is in a blacklisted thread or channel."""
return self.is_raw_message_blacklisted(message.guild.id, message.channel.id)
Why wasn't it done like this?
I disagree, it is rather clear that you allow anyone with the everyone role to use the command. Which also overrides any channel permissions..
If that still is a worry, add a comment!
Yep, and you pass *args instead of args
Unresolved attribute reference 'isEnabledFor' for class 'CustomLogger'
This seems to be a PyCharm bug, as both mypy and pyright correctly infers the correct type.
However, mypy (but not pyright) returns a different error relating to dynamic base classes. The workaround for that is
if typing.TYPE_CHECKING:
LoggerClass = Logger
else:
LoggerClass = logging.getLoggerClass()
class CustomLogger(LoggerClass):
A nice explanation of why casting and eve...
2a83c5f Only check URL-like objects against domain filters - ChrisLovering
dc01b87 Add concurrency rules to all GitHub workflows - ChrisLovering
da697ee Update in accordance with python-discord/kubern... - jb3
29b71ca Merge pull request #1808 from python-discord/jb... - jb3
dc26ff9 Merge branch 'main' into Add-concurrency-to-all... - ChrisLovering
GitHub Actions run 1248096958 failed.
NB: Linting & Test currently failing due to maintenance on the coveralls API. Will rerun checks later :+1:
With your
get_color_fieldsfunction, we can take any input mode and change that to rgb before passing it to the function. We could define individual<mode>_to rgbfunctions above the class and use them in the big if /elif loop when checking the mode.From there we would call your overall function to create the individual color types and send that to the embed.
Yes I totally agree.
One thing I think we need to decide is whether to force the user to pass in tuples or not...
@Vthechamp22 Could you please elaborate a little more and If you can, please provide with some (visual) reference to what you are suggesting.
Thank you.
Should we remove the Api prefix from models, and add uppercase letters where reasonable? Such as ApiOfftopicchannelname -> OffTopicChannelName?
I think multiple modules is fine, but we should have an __init__.py in there importing them so we can import the models from a single import.
Yes, sorry. The class names
were generated that way, there is a naming convention of some sort.
I'll remove the API prefix and add inits. Also, how does the overall picture looks like? It had some problem with the messages module, but I fixed it, I believe.
4772c5e Revert "Fixes Issue Matching Regex" - Vthechamp22
671be99 Revert "Fixes Issue Matching Regex" - Vthechamp22
b4ee10a Add stackoverflow cog with answers - Vthechamp22
5066446 Merge branch 'master' of https://github.com/pyt... - Vthechamp22
37ae939 Merge branch 'master' of https://github.com/Vth... - Vthechamp22
GitHub Actions run 1248680760 succeeded.
GitHub Actions run 1248745193 succeeded.
One thing I think we need to decide is whether to force the user to pass in tuples or not:
.color rgb (100, 100, 100)
or should we be flexible enough to accept these forms as well:
.color rgb 100, 100, 100
.color rgb 100 100 100
.color rgb 100,100,100
I think that all of the above user input examples can be handled with a regex match, so if possible I'd say go for flexibility. If you want a single format I'd suggest "100 100 100" over "(100, 100, 100)".
COLOR_LIST isn't actually a list of colors. It's a path to the color mapping JSON.
Likewise, COLOR_JSON isn't a JSON file or string, it's a mapping from color names to hex.
Can you try to give it more accurate names?
I don't think this and the logging below is really interesting at the info level. I'd place it in debug and maybe make it a single line instead of two.
"""User initiated commands to receive color information."""
You're doing the same work twice here. You can use the regex match (which I'd suggest doing with re.fullmatch rather than re.search here. Also eliminates the need for the ^ and $) with grouping, and then pull the values for the conversion from the group. This will allow you to easily make the # optional.
You should add the possible modes here. The docstring will be shown in the help embed for the command.
I believe this also closes #670 ,since with this merge every request seems to be authenticated.
This seems to be completed in #778.
Yeah I don't think we're planning on enabling it globally atm
But considering that, I'm not sure these commands should do anything with thread permissions at all?
If message.guildis None thenmessage.guild.id` will error, but otherwise yeah this should work.
The raw version also doesn't check the author.
GitHub Actions run 1248874807 succeeded.
Just a couple of suggestions before testing
This can be simplified.
singleplayer = singleplayer.lower() == 's'
IMAGES is a dictionary, not a list.
To be consistent with other files, you can use Path.read_text here. Something like this:
ALL_WORLDS = Path("bot/resources/fun/hangman_words.txt").read_text().splitlines()
Following what I previously said, the suggestion reduces flexibility, so I'll close this issue.
GitHub Actions run 1248993259 succeeded.
GitHub Actions run 1249010535 failed.
I don't think we should extend the windows path tag as it's already quite long. We could add a separate tag to explain how to modify the PATH, although that differs depending on OS so we could end up with quite a long tag, and i'm not sure how useful it would actually be.
One option would be to have:
- A guide on the site explaining how to add Python to path on windows, with the method here https://github.com/wookie184/python-guides/blob/main/windows/add-to-path.md, possibly as well as de...
Closing this as I don't think there's a good alternative to the current behaviour, and the current behaviour also seems fine. This feature was also moved to sir-lancebot.
A number of tags have typos / grammatical issues. This issue aims to resolve these.
For example, the !windows-path tag has a typo in the final codeblock, where it states:
... Python 3.6 stars ...
Here "stars" should be "starts".
I'll work on this myself over the upcoming days.
Closing this as it's very similar to #1324, and once smarter resources is complete I don't think this would be necessary, although the idea mentioned in the other issue of a subcommand to search for specific resource items sounds like a nice idea.
GitHub Actions run 1201457180 succeeded.
Please undo the changes you did to some of the logging in checks.py.
params["seed"] = seed
async with self.bot.http_session.get(quackstack_url, params=params) as response:
Can we move it to the footer?
embed = discord.Embed(
title=f"Quack! Here's a {ducktype} for you.",
color=Colours.grass_green,
)
embed.set_footer(text=f"A {ducktype} from [Quackstack]({API_URL}/docs).")
return
data = await response.json()
params["seed"] = seed
async with self.bot.http_session.get(quackstack_url, params=params) as response:
Ah, that is a good point, so we can change the non-raw one to do so:
def is_message_blacklisted(self, message: Message) -> bool:
"""Return true if the message is in a blacklisted thread or channel."""
# Ignore bots or Ms
if message.author.bot or not message.guild:
return True
return self.is_raw_message_blacklisted(message.guild.id, message.channel.id)
It should, you can open threads on messages even if you don't have send message permissions.
And if you have the "Send messages in threads" then you can send messages in that thread.
Is it always the start of the game each guess?
# Edit the message to the current state of the game
# The user should only guess one letter per message
mode: Literal["s", "m", "S", "M"] = "s",
) -> None:
"""
Play hangman against the bot, where you have to guess the word it has provided!
The arguments for this command mean:
- min_length: the minimum length you want the word to be (i.e. 2)
- max_length: the maximum length you want the word to be (i.e. 5)
- min_unique_letters: the minimum unique letters you want the word to have (i.e. 4)
- max_uniqu...
8: 0xdddbda, 7: 0xdddbda, 6: 0xecb613, 5: 0xecb613,
4: 0x3c7ebb, 3: 0x3c7ebb, 2: 0x866cc7, 1: 0x866cc7
first_kata_div = await asyncio.to_thread(soup.find_all("div", class_="item-title px-0"))
kata_description = "\n".join(kata_description[:1000].split("\n")[:-1]) + "..."
GitHub Actions run 1249413277 succeeded.
GitHub Actions run 1249474663 was cancelled.
GitHub Actions run 1249475391 was cancelled.
GitHub Actions run 1249475634 failed.
GitHub Actions run 1249478804 succeeded.
Works nicely and code looks good. Thank you very much for your contribution Shom!
Works nicely and code looks good. Thank you very much for your contribution Shom!
Awesome! Thank you so much :D
[python-discord/site] New branch created: cj\-wrapup
This updates the website now that the code jam is wrapped up.
It corrects wording and sidebars to show that the code jam is no longer currently on going. This happens primarily on the main page, the events page, and the code jam page.
Additionally this PR adds some information about the Code Jam winners with links to their projects.
This PR also goes a bit out scope and edits the contents on the main Events page, namely removing Hacktoberfest, updating the 2021 events calendar, and r...
GitHub Actions run 1249539038 failed.
The theme was actually "Think Inside the Box".
Why didn't these get cut off like the PyWeek ones?
It's not cut off, it just doesn't have an icon to show, so the text takes the full width.
But this did make me realize the Advent of Code icon wasn't showing up, so I'm now fixed that.
No I mean that PyWeek's lines you cut off at a certain length, while these ones go on for several hundreds of characters.
I'm not sure what you're referencing. The length of the line is entirely dependent on if the word can fit or if it needs to go on the next line. Do you have a screenshot?
Why doesn't these lines look like this?

Great job on this, @Shom770. I enjoyed working with you on this. I am sure many people will want to play this game!
Oh, you mean within the file itself, not how it displays.
That's just what it was from the start. I only edited the contents of that page and the general order, not how the lines were broken up. I also tend to have word wrap turned on in my editor so it doesn't really bother me.
fe992f6 Use the correct theme and update image link - janine9vn
GitHub Actions run 1249679959 failed.
Great job on this, @Shom770. I enjoyed working with you on this. I am sure many people will want to play this game!
Likewise! Thank you for all your help!
[python-discord/bot] New branch created: contributing\-tag
Closes python-discord/meta#109
This adds a contributing tag, providing a quick explanation of how to contribute to some of Python Discord's projects.
The tag currently looks like this:

I'm still not certain if this is something we want or what the exact wording should be. But I figured a quick explanation and links to where to get started is a good base.
GitHub Actions run 1249723650 failed.
This href should probably have target="_blank" and rel="noopener" the former for UX, the latter for security
Yes, "Send messages in threads" should be changed, but these two are off by default.
Connected!
GitHub Actions run 1250008374 succeeded.
Connected!
Description
When using Hangman multiplayer Sir Lancebot will respond to every message sent in the whole server.
Steps to Reproduce
Play a hangman game and send messages in other channels.
Expected Behaviour
It should actually just listen to messages in the current channel.
Actual Behaviour
Sir Lancelot intercepts every single message as one directed to the game and most commonly responds with an error message saying only 1 letter should be used.
Known Impacted Platforms
-...
Description
Following the removal in #871, hangman should be re-added again.
Reasoning
Quickly following its introduction it become apparent that hangman's multiplayer mode had some flaws. Most importantly, it meant that a whole channel was occupied.
Proposed Implementation
Multiplayer mode should be reintroduced using threads, this is also the reason that the issues are separated. As the Python bot doesn't quite yet receive messages in threads so threads have not yet been en...
I believe that's two perms we want to enable per channel, not globally
5024380 Modlog: reuse logic for the message blacklist - Akarys42
Huh?
That was also my reaction :D but apparently due to how the API changed you have to set it explicitly
GitHub Actions run 1250793425 was cancelled.
GitHub Actions run 1250795277 was cancelled.
1f59701 Remove multiplayer mode and correctly check cur... - Bluenix2
[python-discord/sir-lancebot] New branch created: no\-hangman\-multiplayer
GitHub Actions run 1250796247 failed.
Summary
Closes #871
With multiplayer and a missing check for the right channel the bot would respond to each message as one directed to the game. Multiplayer mode is planned to be reintroduced later on using threads (tracked in #872).
f"Thread {after.mention} (`{after.id}`) from {after.parent.mention} (`{after.parent.id}`) was {action}"
Is this because we want the bot to appear in the right side?

So this is sent when a thread is created, or we get access to a private thread by being mentioned in it.
We don't need this, when this event is received it should be from a thread being created no?
I went ahead and changed to re.fullmatch, but the second line is to convert the user input string hex color to a format that Discord can understand it. For some reason the embed expects a single integer value for the hex color or RGB color.
I really like this tag as, for one, I'm completely ignorant in how to get started with contributing. Pointers are always helpful.
Do we want to consider including a link to the meta issues board here? While not code contribution directly, it is a source of contribution.
Added 2 files
anagram.py - Has the code for anagram command
anagram.json - Contains all the words for anagram command
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #730 , creation of Anagram minigame
Description
Added 2 files for anagrams game command
anagram.py - It has code for anagram game command. Users can play the game by using ".anagram" command, it will show an embed with scrambled letters whic...
GitHub Actions run 1250890897 succeeded.
Yeah, so I don't think defcon should mess with these two globally.
Looks pretty good for a first OS contribution ;)
Just saw a few small things, I'm sure more reviews will comes with more time.
Don't know if it is worth a change, but would this work for you?
with open(Path("bot/resources/fun/anagram.json")) as f:
ANAGRAMS_ALL = json.loads(f.read_text("utf8"))
scrambled_letters, self.correct = random.choice(list(ANAGRAMS_ALL.items()))
Could avoid the re-assignment and just do it directly right?
9193466 Change external links to "_blank" and "noopener" - janine9vn
GitHub Actions run 1250990165 failed.
Looks great, love the new interface and look forward to this being merged 👌, just a couple of comments.
I managed to get this error
bot_1 | 2021-09-19 15:44:56 | bot.exts.backend.error_handler | DEBUG | API responded with 400 for command clean bots: {'deletedmessage_set': [{'author': ['Invalid pk "814417186864496711" - object does not exist.']}, {'author': ['Invalid pk "814417186864496711" - object does not exist.']}, {'author': ['Invalid pk "814417186864496711" - object does ...
Why is a time range not allowed when cleaning over multiple channels?
Probably meant to use DEFAULT_TRAVERSE here I guess
users should be typed as optional
Should probably update this comment, otherwise this looks good.
It's technically possible, but it doesn't really make sense I think. Can't imagine a legitimate use case for this
Looks great, love the new interface and look forward to this being merged 👌, just a couple of comments.
I managed to get this error
bot_1 | 2021-09-19 15:44:56 | bot.exts.backend.error_handler | DEBUG | API responded with 400 for command clean bots: {'deletedmessage_set': [{'author': ['Invalid pk "814417186864496711" - object does not exist.']}, {'author': ['Invalid pk "814417186864496711" - object does not exist.']}, {'author': ['Invalid pk "814417186864...
Does defaultdict accept the mapping types? honestly not a fan of this type hint
Looking into it i'm guessing this was caused by the switch from fuzzywuzzy to rapidfuzz, https://github.com/python-discord/sir-lancebot/pull/799/files, process.extract returns tuples with 3 elements, while creating a dictionary only accepts 2.
We can fix this the same way as Python bot does it, https://github.com/python-discord/bot/blob/ec8e3e3f69e9c9b938929efece487b229fc1dd9c/bot/exts/info/help.py#L130
...
I see two possible avenues to handle these errors:
- Hold a cache in the modlog to store deleted message ID's. Before relaying messages to the API it will filter out messages already cached. This has the issue of storing another cache which is meh, and also I'm not sure that the messages are deleted correctly when this error occurs.
- Change the API to ignore duplicate keys. This has the issue that we need to scope all of the places in our code where we use this API endpoint to understand w...
1a981e1 Remove false comment - Bluenix2
Note: This pull request should be squash-merged
GitHub Actions run 1251102503 succeeded.
Connected!
GitHub Actions run 1251127549 succeeded.
Should we remove the
Apiprefix from models, and add uppercase letters where reasonable? Such asApiOfftopicchannelname->OffTopicChannelName?I think multiple modules is fine, but we should have an
__init__.pyin there importing them so we can import the models from a single import.
I've added the changes mentioned, however I'm not sure I understand why the max line length is 88.
In our resources folder we have 3 yaml/toml files (https://github.com/search?q=repo%3Apython-discord%2Fsir-lancebot+extension%3Ayaml+extension%3Atoml+path%3Abot%2Fresources) and 43 json files (https://github.com/search?q=repo%3Apython-discord%2Fsir-lancebot+extension%3Ajson+path%3Abot%2Fresources), so a change to all JSON would be much easier.
I prefer JSON for this sort of use case, as it's more similar to Python's syntax so it's more clear how it will translate into a Python object once ...
Can you remind me why this is necessary? I think that we could strive to make this use threads, and it would be a bummer if you could only have on game across the whole bot.
Would you like some pointers on how to change it to make that work?
Can you do that now that it has worked correctly?
win_list = ", ".join(self.winners)
Any tips on how I can test this locally?
Was this intended? This will now return after the first iteration.
await ctx.send(codeblock + "```")
Absolutely not, the logic was moved around a bit and I did not test daily stats just the per_day_and_star stats, so I did not notice. Thank you! 👍
Any tips on how I can test this locally?
I'm not sure. SInce the AoC of 2021 hasn't started just yet, I was provided access to last year's data.
GitHub Actions run 1251309993 succeeded.
I was thinking in the case of something like !clean <user_id> 5M * (I think that's how the arguments would work...) if somebody was spamming over a bunch of channels you'd delete messages from them in the past couple of minutes.
Just choosing a number of messages to traverse would work fine for this scenario, so this isn't especially important, just wondering if there was a reason not to allow it.
We're using 3.9 so it should, yeah.
All looks good to me.
I see two possible avenues to handle these errors:
* Hold a cache in the modlog to store deleted message ID's. Before relaying messages to the API it will filter out messages already cached. This has the issue of storing another cache which is meh, and also I'm not sure that the messages are deleted correctly when this error occurs. * Change the site to ignore duplicate keys. This has the issue that we need to scope all of the places in our code where we use th...
Good work. I think the Code Jam Winners section could use a lot more whitespace, but that isn't a blocker for this PR.
<a href="https://github.com/A5rocks/code-jam-8" title="Lovable Lobsters GitHub Repository" target="_blank" rel="noopener"><i class="fa fa-github"></i> Github Repository</a>
Multiple instances of this throughout the page as far as I can tell~
<h4><i class="fa fa-medal"></i> Robust Reindeer: Rubik's Cube</h4>
<h3 id="qualifier"><a href="#qualifier">The Qualifier</a></h3>