#dev-log
1 messages ยท Page 81 of 1
3cd31e1 Make if statement elif - TizzySaurus
I don't think this is correct anymore
You should be able to structure the code better, I think it was good before.
That is what it was before? It will still work correctly.
Right but that's a bit convoluted and not that clear at a first view.
if isinstance(user_or_message, (User, Member)):
user = user_or_message
elif isinstance(user_or_message, Message):
user = user_or_message.author
else:
# No user passed, so it's None. Default to the command author
user = ctx.author
I did it like this to allow the elif below to stay an elif and not an if. Didn't see the point of making it always check the statement when we know as a fact it won't be true for user = ctx.author.
Hmm, to me this still looks like we're jumping through hoops when it could be more clear.
That said, it's not that bad after some more consideration so I'll change my review.
@MarkKoz Would this check also have to be implemented for the kick command? I assume this would have the same issue (although granted less often).
Also, do we want to do this check before the apply_x function is called (directly inside the command command) or within the apply_x function? I'm thinking of something along the lines of`
if user.top_role >= guild.get_role(constants.mod_role):
await ctx.send("You cannot use this command on mods+")
return
I'd be inte...
Hey @Kronifer, first thanks a lot for all the time you are putting into this PR.
It has come to our attention that the package you added, cowsay, is licensed under GPL, which isn't compatible with the MIT license. We need to remove that package and replace it with something else.
One solution could be to copy the animals from an R clone which is licensed under MIT. We will let you solve this the way you want!
I'm fine with how it is now, the point you make about burying the board is a fair one, so I think the changes you've made are good. Looking nice ๐
Just a couple of small points and then I'll approve. I really like the image in the help command, makes the rules much clearer๐
The return type here isn't correct
async def send_help_embed(ctx: commands.Context) -> None:
I don't think the change to Roles.moderator from MODERATION_ROLES was necessary, and it would be better to use MODERATION_ROLES (e.g. as an admin may not be a moderator but should still be able to stop a game). You'd have to unpack it in like @with_role(*MODERATION_ROLES).
Sorry, missed this one in my previous review
# Checking for the channel ID in the currently running games is not sufficient.
# The game could have been ended by a player, and a new game already started in the same channel.
Invalid arguments for side seem to be detected properly now, but you've introduced a new bug where running .coin with no arguments will result in the message being sent twice.
if not side:
await ctx.send(message)
return
It would probably make sense to change the next elif to an if if you're returning from this one actually
We're thinking of slimming down the stackoverflow command because it looks like a dumpster fire on mobile, so I'm going to mark this as stalled until we fix that up.
Is there an issue for that? I think it would make sense to move the hyperlink for each question to the title of each answer rather than the stats of the answer. Not sure if you meant that as I think that would make it render better on mobile, or if you meant actually reducing the size
I believe it could be added to the command error handlers. This way it would catch the 404 errors that were not handled locally, hence it's not that broad.
(If this issue is still active, I would be glad to grab it!)
Many newbies in discord.py are not familiar with Bot Variables and this tag will help them understand what are those!
GitHub Actions run 1170160894 succeeded.
Thanks for the contribution, although i'm not sure the purpose of this tag is quite clear to me yet.
Saying bot is a new type of global variable makes it sound like bot is a "magic" variable that behaves in a special way and is available in all of your files automatically, but I don't think that is quite right.
To make it accessible you need to pass it in when you create the instance of the cog
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = ...
I'm pretty certain this is intentional, the PR is in part to move away from subdomains in favour of paths instead.
Never mind I misread that line, it'll be False by default. Do we want to change the default to be true then? Like:
debug = environ.get("BOT_DEBUG", "true").lower() == "true"
Then the bot would have to be sure to set it to false in prod.
Yea, we should set it to true by default for consistency, and set it to false in prod (which I have just done)
I think this is confusing, instead of explaining attributes and how to use them on bot...
You're introducing this fake term and "special new behavior" when using discord.py because discord.py is magic.
A better tag would be one about attributes, and having a small foot note at the end that the bot is a class you can add attributes to.
Ah, ok, you can probably ignore my comment. Now I understand that the tag is focussing on defining variables on the bot instance rather than the bot instance itself, had misread it before.
[python-discord/sir-lancebot] New branch created: int\-eval\-owner\-check
Relevant Issues
Closes #817
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Limited int eval commands to the bot owner if in debug mode. Set debug mode to be the default
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read and agree to the [contribut...
GitHub Actions run 1170520300 succeeded.
Looks good to me ๐ Already added the required env var to prod too.
Thanks! Seems like sir Chris also added the env var to prod, let's do this!
[python-discord/sir-lancebot] branch deleted: int\-eval\-owner\-check
Connected!
GitHub Actions run 1170533196 succeeded.
Looks good! Thanks for updating this
This is also a massive tag, my discord is at 90% zoom and it barely fits (and I'm saying this as someone who writes big tags myself lol)

Perhaps it would be better as site content?
Connected!
GitHub Actions run 1170816551 succeeded.
Hey @D0rs4n, thank you for your interest in this project. Since this issue is about our old verification system before native gating, it isn't relevant anymore. This cog has been entirely removed.
Description
I propose that we change the error message given to users when they run the bookmark command and it fails to find the message they specified.
Reasoning
Users sometimes assume that just giving a message ID to the bookmark command is enough to bookmark a message, even if it's in another channel.
However, if the message they are trying to bookmark is in another channel the command will fail since it cannot find the message they are referring to.
See [here](https:...
78d8bde Use publically available URL when outputting me... - ChrisLovering
[python-discord/bot] New branch created: Output\-public\-url\-when\-sharing
In production we use the internal URL to call the metabase API, to avoid egress
but we still want to output the public url when giving the sharing link.
Making it a constant like this makes it easier to change/overwrite in future if needed.
GitHub Actions run 1171063969 succeeded.
Connected!
Ah, well my main motive is to tell users about Bot Variables... I think I will have to check my language in order to make it more understandable.. Any suggestions for that?
Hey @vcokltfre! Thanks for your suggestion. Never knew it would become a tag, that big in discord. I have reduced the size. Can you check again?
GitHub Actions run 1171102837 succeeded.
Uhh, I just rewrote the file again to make it smaller. Please edit this suggestion so as to avoid confusion...
I still stand by my previous review. I am in support of having the tag be called "botvar" or similar, but I think the content should be very clear that it is just setting attributes on your bot instance.
Instead of having normal commands and cogs, have one example that works for both.
@bot.command()
async def foo(ctx: commands.Context):
"""A command to demonstrate how to use a bot variable"""
await ctx.send(ctx.bot.test) # This will send the text, I am accessible everywhere!
@bot.command()
async def bar(ctx: commands.Context, *, new_text: str):
"""A command to demonstrate, how to change the value of a bot variable"""
bot.test = new_text
print(bot....
Bot variables are a new type of global variables
This is not a new magic thing
meant only for discord.py
I still think this tag should teach the user how it works, it's not magic
It is made as an attribute of your existing [commands.Bot]
Why were they not called this from the start?
GitHub Actions run 1171358382 succeeded.
Ah cool! Thanks for the review! I have commited every change that u suggested and thank you for suggesting those!
GitHub Actions run 1171359180 succeeded.
GitHub Actions run 1171359591 succeeded.
GitHub Actions run 1171359648 succeeded.
GitHub Actions run 1171360289 succeeded.
Here's some more improvements, that said I'll leave it up to you to change the confusing language to be more clear.
There is a big issue of people learning discord.py, not Python. They know discord.py constructs but struggle with Python outside of that. We don't want to further that by spreading "special discord.py syntax".
Thank you
print(bot.test) # This will print the text specified in new_text!
Can we change these to get and set, foo bar are common "fake" names but I think for our example they should have meaningful names.
async def get(ctx: commands.Context):
Since there is a lot of extra-code to make it actually work, we should outline the important part.
# Here we change the attribute to what was specified in new_text
bot.test = new_text
Feel free to improve this by the way ^
GitHub Actions run 1171409715 succeeded.
GitHub Actions run 1171409736 succeeded.
GitHub Actions run 1171410917 succeeded.
GitHub Actions run 1171410346 succeeded.
GitHub Actions run 1171410037 succeeded.
GitHub Actions run 1171411272 succeeded.
GitHub Actions run 1171410902 succeeded.
GitHub Actions run 1171412195 succeeded.
GitHub Actions run 1171411899 succeeded.
GitHub Actions run 1171411907 succeeded.
GitHub Actions run 1171411532 succeeded.
Uhh, I made some changes to the docstrings of those commands. Other than that, I am at the ends of my knowledge. I don't really think there is anything else which I can change (Though thanks to you for suggesting all those changes)...
GitHub Actions run 1171420299 succeeded.
I didn't notice before, but now I see with the syntax highlighting!
@bot.command(name='set')
async def set_test(ctx: commands.Context, *, new_text: str):
Uhh, would that really be important tho? Isn't that doing the same thing as setting the function name?
If someone pastes this code and tries to run it, and tries to create a set it will call the command. We shouldn't recommend someone to shadow types/variables/functions.
I don't really like complicating things by doing this though (someone might thinkthey need to set a name to do this), do you perhaps know a better name for the function that ignores this situation completely?
GitHub Actions run 1171536798 succeeded.
Ah, well in that case, we can change the name of the command to set_var or something? I don't want to use any kwargs in the decorator cz a newbie can get confused with those... I understand that u r talking about the Python's set() class and this command name can override that class.
These haven't been updated yet
Ah yea. Lemme fix it. But the starting is better now?
Hmmm, I know I said this originally but reading it out more and more there's always stuff to improve.
Python allows you to set custom attributes to class instances, like your bot! By adding variables as attributes to your bot you can access them anywhere you access you bot. In the discord.py library, these custom attributes are commonly known as `Bot Variables` and these can be a lifesaver if your bot is divided into many different files. An example on how to make a bot variab...
Yeah, I think we're getting there
There ya go. Fixed those...
GitHub Actions run 1171581854 succeeded.
GitHub Actions run 1171588112 succeeded.
GitHub Actions run 1171588129 succeeded.
article_embed = Embed(
title="Search results - Real Python",
url=SEARCH_URL.format(user_search=quote_plus(user_search)),
value=ARTICLE_URL.format(article_url=article["url"]),
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
I think this'll work the best?
Is the print necessary? You can already check with the get command
Remember, this isn't only about globals vs attributes.
When setting your own custom attributes you can access those variables anywhere you have your bot instance, this becomes extra useful when your bot is split over multiple files. This all applies to cogs as well!
Python allows you to set custom attributes to class instances, like your bot! By adding variables as attributes to your bot you can access them anywhere you access you bot. In the discord.py library, these custom attributes are commonly known as `Bot Variables` and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
Ah, ok. Well it can be removed then
GitHub Actions run 1171619555 succeeded.
GitHub Actions run 1171620852 succeeded.
GitHub Actions run 1171620192 succeeded.
GitHub Actions run 1171621479 succeeded.
GitHub Actions run 1171621485 succeeded.
GitHub Actions run 1171622103 succeeded.
GitHub Actions run 1171623102 succeeded.
We've already mentioned how useful it is at this point haha
This all applies to cogs as well! You can set attributes to `self` as you wish
Nit-pick haha, we don't use inline comments elsewhere. By reducint the line length we make it easier to read on mobile
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
Python allows you to set custom attributes to class instances, like your bot! By adding variables as attributes to your bot you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as `Bot Variables` and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
ah, ok. thanks for the information
GitHub Actions run 1171643860 succeeded.
GitHub Actions run 1171644724 succeeded.
GitHub Actions run 1171644725 succeeded.
GitHub Actions run 1171645049 succeeded.
Just one last thing I promise haha
these are probably meant to be used as code, can we use quotes instead maybe? I don't have a strong preference.
Python allows you to set custom attributes to class instances, like your bot! By adding variables as attributes to your bot you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom...
Yeah I am happy with this now, thank you for your helpfulness as we figured things out and contribution
GitHub Actions run 1171653846 succeeded.
Yay! Thanks to you too!
GitHub Actions run 1171653850 succeeded.
Ugh sorry I should've caught that
GitHub Actions run 1171741695 succeeded.
GitHub Actions run 1171792725 succeeded.
Did you mean to include this?
Did not mean to do a force push, my bad! Yeah I will need to squash those
No. respect_role_hierarchy is a check between the user invoking command and the user receiving the infraction. This issue is about the role hierarchy between the bot and the target user. For example, respect_role_hierarchy will allow an owner to ban a mod, but the bot cannot actually perform it because the bot's role is below the mod role.
Hello, thanks for this PR!
Please review our guide on how to make great commit messages, so future git histories are more organized.
@wookie184 There is no current issue for it, I was thinking we should reduce the size of the embed for the benefit of all platforms, including mobile.
52bed3d Add message link support to !user command - TizzySaurus
da3a75b Merge pull request #1783 from python-discord/us... - Akarys42
78d8bde Use publically available URL when outputting me... - ChrisLovering
fa2ed68 Merge pull request #1785 from python-discord/Ou... - Akarys42
e92d87d Merge branch 'main' into update-remind-help - Xithrius
[python-discord/bot] branch deleted: update\-remind\-help
506f1d2 Add time units and example to docstring of !re... - TizzySaurus [fe840ca](https://github.com/python-discord/bot/commit/fe840ca63647d6d6e92760cb4f0f49ac67926954) Add time units to the !remind editand!remi... - TizzySaurus
e92d87d Merge branch 'main' into update-remind-help - Xithrius
1c822e1 Merge pull request #1778 from python-discord/up... - Xithrius
Connected!
Marking this as draft until we get confirmation from RealPython that we can use this undocumented API.
I'm just nitpicking about terminology here, though I wonder if the approach this tag describes is a best practice as it could make the code less modular.
I would say "most objects" instead of "class instances". 8 is an instance of the int class but does not have this property.
I would say "By storing things as attributes of the bot object". "things" might be an imprecise word, but any object (not only those that have been assigned to a variable, and not the variable itself as some thing that exists separately) can have a reference via an attribute.
GitHub Actions run 1172179655 succeeded.
@Hunter2807 I just realized I merged this and since it was a tag, only one approved was needed. Could you create another PR to fix up the reviews that still exist here?
Looks good to me ๐
The README.md file had an outdated hyperlink which pointed to the docs directory which doesnt exist anymore
This PR fixes that
Commits : 1
GitHub Actions run 1173442892 succeeded.
@Xithrius sure! Also I need to make changes to the file name and rename it to botvar so that the command name becomes more meaningful. Is that ok with u?
But then, 8 is a constant whereas bot is a variable. Instead, I can change that to, like your bot variable!
@Xithrius sure! Also I need to make changes to the file name and rename it to
botvarso that the command name becomes more meaningful. Is that ok with u?
Do what you must (yes).
I can do this if nobody else is interested
Right, yes. Do we want to:
- update
respect_role_hierarchyto incorporate the bot's hierarchy too - create a new
respect_bot_role_hierarchywhich does the same asrespect_role_hierarchybut for the bot instead ofctx.author - handle this in some other fashion (not sure what this would be)
@wookie184 You can do it! I believe in you!
Good catch, thanks for fixing this
GitHub Actions run 1173803148 succeeded.
cc53644 Escape markdown properly in post body to fix re... - wookie184
[python-discord/sir-lancebot] New branch created: escape\-reddit\-posts
Relevant Issues
Closes #746
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Some of the results from the command aren't that beautiful, but I think any other changes aren't really within the scope of this PR and are difficult to do anyway because of how unreliable discord markdown rendering is.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in th...
GitHub Actions run 1174311846 succeeded.
Description
Since python, the language is named after a snake and anaconda, a very famous data science platform for python also goes by the name of a snake, my idea was to implement an anaconda snake to the .snake hatch command
Reasoning
The extra snake gives a more possible or a rarer chance to own the snake in the discord server and people hatch snakes all the time in #sir-lancebot-playground
Proposed Implementation
Using the same egg hatching format, i would want to a...
Maybe to avoid any possible confusion with the built-in any() ? But then again the only other time typing is called in this file is with typing.Optional in line 331. So then the import would be from typing import Any, Optional right?
if side in CoinSide.HEADS:
return "heads"
if side in CoinSide.TAILS:
return "tails"
raise commands.BadArgument(f"{side!r} is not a valid coin side.")
@gitautas can you present your implementation here so we can see it in action without having to study the source code or run it? Maybe with some GIFs? Maybe in the original post?
I'm a little on the fence here, mostly because I don't understand precisely how this will change the .uwu feature from how it works today. I don't think this PR description accurately explains what changes you want to make, and I don't have the time to sit down and play with your implementation.
@lemonsaurus So the current uwufication in Sir Lancebot is a very simple wepwacement, just replaces Rs and Ls to Ws.
This was okay for a quick joke, but the state of uwufication has progressed to have a lot more features, such as:
- Word replacement from an extensible lookup table:
I am a small bean.->i am a smol bean. - Nyaification:
The winner is China.-> "the winner is chinya~` - More advanced, context aware wepwacement based on Pydis community created regexes.
- RNG we...
There are still edits to be done, which were suggested by the other reviewer. For now, I just renamed the file to botvar. This PR is a continued version of #1784 . More information here -> https://github.com/python-discord/bot/pull/1784#issuecomment-906967074
GitHub Actions run 1174865085 succeeded.
Doc item doc_item.symbol_id='color' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
I decided I'd like to implement this, and after getting approval, I spoke to @mbaruh about this in #mod-tools.
It was decided that the implementation would be as follows:
- A
!infraction search id {id}command will be added to theinfraction searchgroup (the{id}being infraction id) - This will have a shortcut of
!infraction search {id}, again with{id}as infraction id. We can distinguish between whether it's a user id or infraction id by the length (if it's >=15digi...
Details : https://github.com/python-discord/sir-lancebot/issues/821
Relevant Issues
Closes #821
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
The snake was added in the _utils file and is implemented through a linking of a igmur image
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or ...
Can i help you with it ?
Hey, is this implemented yet or may i implement this?
9dde0b7 Add support for searching infractions by infrac... - TizzySaurus
[python-discord/bot] New branch created: support\-infraction\-id\-search
Closes #1066.
Can now search infractions by infraction id via !infraction {id}, !infraction search {id} and !infraction search id {id}.
Exact implementation may be tweaked in the future, but got approval from @mbaruh to stick to this for now.
GitHub Actions run 1175069485 failed.
Sure! I'll assign you. What's your username in Discord for reference?
Description
For those who don't know what Mastermind is, it is a 2 player game, where 1 of the players is the "codemaker" and the other is the "codebreaker". The codemaker thinks of a combination (code) that consists of 4 different colors. Then, the codebreaker tries to guess the codemaker's code.
Here is a complete list of rules: https://magisterrex.files.wordpress.com/2014/07/mastermindrules.pdf
The bot will be the codemaker.
Reasoning
I think it is a very fun game that many commu...
My idea is much simpler. Check if the target is a mod here and suppress the log
If you want you can also modify the confirm_msg to be more specific about the failure, even though the mod log will contain it.
Also the Sentry issue that sparked this discussion actually had nothing to do with infractions. It was actually the modpings cog failing to remove a role. See https://sentry.io/organizations/python-discord/issues/2352114214/
I think "default" should be removed.
GitHub Actions run 1175338165 succeeded.
Add the co-author commit and removed the comment on the first line
Marking this as draft until we get confirmation from RealPython that we can use this undocumented API.
Looks unlikely.
https://realpython.com/robots.txt
Marking this as draft until we get confirmation from RealPython that we can use this undocumented API.
Looks unlikely.
https://realpython.com/robots.txt
Hopefully Chris hears back from Dan at Real Python. I sent an email request to them originally asking if they had something I could use, but now is in clarification.
Marking this as draft until we get confirmation from RealPython that we can use this undocumented API.
Looks unlikely.
https://realpython.com/robots.txtHopefully Chris hears back from Dan at Real Python. I sent an email request to them originally asking if they had something I could use, but now is in clarification.
Oh, that's good to hear then.
I appreciate your response, which is very thorough and now I understand the changes.
The changes are, of course, like something out of a nightmarish fever dream and I hate them with every fiber of my being, but that doesn't mean I'm opposed to them. I'm sure some of our users would have a lot of fun with some of them.
You said the user can control the "intensity", please explain by which mechanism the user would control this?
[python-discord/site] branch deleted: jb3/collectstatic\-build
i dont think we need to abbreviate it to .mstrmd, we could just use .mastermind and have the other as an alias
GitHub Actions run 1175500033 succeeded.
Ok @Kronifer, that works. I'm ok with that.
I'll be getting this done soon, currently having IRL stuff.
GitHub Actions run 1175527640 succeeded.
Connected!
Cannot we add comma at the end to just add lines next time instead of editing it?
"Baby Anaconda": "https://i.imgur.com/4zT4aij.png",
GitHub Actions run 1175715348 succeeded.
Thanks, have updated this :+1:
Can you look over the second sentence again?
"""Search for an infraction by the infraction id."""
Why you don't use this variable?
Can you look over the second sentence again?
I'm not following? The change in the docstring was to demonstrate that !infraction {infr_id} is now possible.
This sounds like the same idea as the .snake antidote game we have already
Doesn't it make sense that the group is in this "region", why was this moved?
Why can this be removed with these changes? Just unused and you're batching it together?
Cannot we use self.TAILS? What is the convetion?
What if someone put uppercased string here? Do we allow that side can be H?
"""Infraction manipulation commands. If `infr_id` is passed then the command fetches that infraction."""
"""Infraction manipulation commands. If `infr_id` is passed then it fetches that infraction."""
Yep, I prefer to import things from typing by using from typing import ... because later it's shorter to write Optional, Any and so on instead of typing.Optional, typing.Any etc.
Will change this to side.lower() :+1:
Could you confirm this is needed? IIRC capitals were accepted already when I was testing, although I may be mistaken
Connected!
GitHub Actions run 1175769667 succeeded.
Could you confirm this is needed? IIRC capitals were accepted already when I was testing, although I may be mistaken
Yeah, it is. I believe at some point it may have accounted for it but the current state of the code doesn't.
raise commands.BadArgument(f"{side!r} is not a valid coin side.")
discord.ext.commands.errors.BadArgument: 'hEaDS' is not a valid coin side.
Yeah, someone else forgot to remove it previously.
Because resending an infraction doesn't edit it, and the new command is part of the same group that the edit commands are.
384d5b4 Upgrade pip-licenses to 5.3.2 - Akarys42
GitHub Actions run 1175790278 failed.
GitHub Actions run 1175798621 succeeded.
506f1d2 Add time units and example to docstring of !re... - TizzySaurus [fe840ca](https://github.com/python-discord/bot/commit/fe840ca63647d6d6e92760cb4f0f49ac67926954) Add time units to the !remind editand!remi... - TizzySaurus
52bed3d Add message link support to !user command - TizzySaurus
da3a75b Merge pull request #1783 from python-discord/us... - Akarys42
78d8bde Use publically available URL when outputting me... - ChrisLovering
This is now ready for review! Once merged, we should probably port that to our other major projects.
GitHub Actions run 1175808329 succeeded.
"""Generate an embed for the tag."""
self,
ctx: Context,
keywords: str,
matching_tags: list[tuple[TagIdentifier, Tag]],
Don't we usually indent hanging arguments like this? I know you don't for if-statements, but we have a ) -> None and a docstring that will distinguish them.
'.' + tag_identifier.group.replace('-', '_') if tag_identifier.group else ''
GitHub Actions run 1175826661 succeeded.
Looks okay for my amateur eye.
How was it determined which licenses are compatible with MIT?
Connected!
Connected!
Those are not equivalent. Your suggestion would make it impossible to have empty strings as reasons. As far as I know, that currently is not a restriction. Some may argue it should be, but that's out of scope for this PR.
Are empty reasons strings really allowed? ๐ค If yes then I can agree with you.
I'm not sure, it's mixed in the project. There were no 4 space indents in the file beforehand to be consistent with so I went with the recommended extra indentation recommended by pep 8 (within a normal def the recommended indentation makes the params align with the function name making it harder to distinguish)
Yes, I changed the assignment to use an or and added a comment above it
I'm not too invested in either of these, if others agree generate makes more sense then I can change it but I don't think it's worth making a commit for
GitHub Actions run 1175955249 succeeded.
GitHub Actions run 1176001379 succeeded.
Oh I thought I deleted this comment, but yes it would behave differently. https://github.com/python-discord/bot/pull/1663#discussion_r697746775 would be equivalent.
But I am not that picky on the subject, only the usage of f"tags.usages" being an f-string though I guess that leads to consistency.
Pretty sure that will never happen because of reason coming from discord.py and there an empty reason would become the default (None).
When is an empty string and None not functionally equivalent?
GitHub Actions run 1176017007 succeeded.
Description
Citing the rules of the game
Rules: You have 4 ingredients for each antidote, you only have 10 attempts
Once you synthesize the antidote, you will be presented with 4 markers
Tick: This means you have a CORRECT ingredient in the CORRECT position
Circle: This means you have a CORRECT ingredient in the WRONG position
Cross: This means you have a WRONG ingredient in the WRONG position
Info: The game automatically ends after 5 minutes inactivity.
You should only use...
My username : KIttyBorgX [ even in discord ]
It is possible by invoking it as follows: !command ""
In fact, the search group is under the same command group, so this group shouldn't have been in the edit region to begin with.
1dbe804 styles: filtering resources page - dawnofmidnight
9a5fd18 feat: Make default options ticked when page loads - doublevcodes
667a13e chore: Update django-simple-bulma from v2.1 to ... - doublevcodes
07ba4f0 fix: Pin psycopg2-binary to v2.8.* - doublevcodes
577dd08 feat: Center Search and Clear Search buttons - doublevcodes
Description
On running the bookmark command, the bot asks the user to react if they want the bookmark to be sent but the bot sends the bookmark to the user even if the user doesn't react
Steps to Reproduce
- Go to #sir-lancebot-playground
- Bookmark any message with the .bm command
- DO not react with the push pin
- Observe how the bot sends the message to you regardless
Expected Behaviour
The bot should send the message only when the user reacts with the push pin ...
This is intended. If you active the bookmark command, it will send you the link.
The reaction is for anyone else that wants to also bookmark that same message.
We've got confirmation from RealPython that's we're allowed to use this undocumented API. Marking this ready for review again.
How was it determined which licences are compatible with MIT?
I've looked at choose-a-license.org to see what their requirements are, and they all seemed to be okay with being used with MIT. All of those are very permissive.
Note that I'm not a lawyer and this is not a legal advice, you know the drill
Looks okay for me but it looks that some hooks failed.
I ran the linting tho and its a 1 line change afterall ๐ค
2a83c5f Only check URL-like objects against domain filters - ChrisLovering
[python-discord/bot] New branch created: Only\-check\-domain\-filters\-against\-URL\-like\-parts\-of\-a\-message
Previously a message such as 'https://google.com hello! flask.request.method' would be
filtered due to us filtering the url shortener t.me. This commit changes to logic so
that we only check parts of the messages that matched the URL regex against our
blacklist, to avoid these false-positives.
GitHub Actions run 1176982870 succeeded.
I think linters may complain about this?
SEARCH_URL = "https://realpython.com/search?q={user_search}"
ERROR_EMBED = Embed(
I just had one question, other than that I am happy. Thanks
discord.py has been discontinued, so a rewrite may be necessary in order to implement new features. Hikari is the best option for Python libs -- there is no stable release right now, but dev101 is the last majorly breaking release planned, and stable planned for release in November. It also has full support for slash command via the Tanjun comma...
We're in no rush to do a re-write. This new means a large number of people are now looking for an alternative, so we're planning to take it slowly and see what emerges in the coming weeks and months, we've got time to wait.
For the aforementioned reasons, we're going to see what happens in terms of emerging forks in the coming weeks.
@lemonsaurus currently the insertion of emojis and the stuttering are handled by a weighted RNG, which by default sets both values to 20%, meaning the every fifth word is stuttered and every fifth space has an emoji or word inserted, this can be tuned to the desires of either the staff, or the user by passing additional arguments.
def dependencies(self) -> dict[str, Any]:
def locals(self, locals_: dict[str, Any]) -> None:
def locals(self) -> dict[str, Any]:
GitHub Actions run 1177139560 succeeded.
I believe this is intended behaviour. The tick means you have a correct ingredient in it's correct position, but the position of the tick doesn't indicate anything, so you don't know which ingredient you have in the correct position. This makes the game more interesting, as the strategy for it is less simple.
You can see that the position of the result emojis (white circle, tick, cross) is sorted in the code (guess_result.sort()) in order to not give the position away, hence you get ...
GitHub Actions run 1177148359 succeeded.
Connected!
GitHub Actions run 1177158500 succeeded.
248698b Make title for all resources a link. - swfarnsworth
[python-discord/site] New branch created: swfarnsworth/smarter\_resources
I'm just combining all the work that has been done so far. Nothing to see here...
Superseded by #570, which includes all of these commits. Thanks again!
GitHub Actions run 1177177417 failed.
Description
This issue has 2 parts:
- Since users may try to react to the pin message after they have ran the bookmark command, making a feature to disable the
- When a user has already bookmarked a message, we check if the same message is already bookmarked and warn the user regarding the same
Reasoning
This feature can prevent confusion of the pin message in the first part and it would help detect duplicate bookmarks
Proposed Implementation
For the first part of...
I'm not quite following what it is you're trying to describe here.
If you're referring to someone book marking a message, then removing their reaction and reacting again, we already check for this, and it does not re-send the bookmark.
oh weird, the bot dm'ed me twice, must be a one time glitch. Thanks for letting me know chris, ill limit and edit the issue to only the second part
Looks like the problem is that the "baby cobra" line now has trailing whitespace, if you have the linting set up correctly it should detect that, have you run poetry run task precommit?
I looked at LGPL and even if it might be compatible with MIT, it does have some extra requirements. See section 4, which states that copies of licence must be included among other things.
@MarkKoz my understanding here is we are only a consumer of the original library and never modify it, meaning it isn't a derived work and aren't subject to those rules. Although I'm honestly not sure, should we ask anyone about this?
@MarkKoz my understanding here is we are only a consumer of the original library and never modify it, meaning it isn't a derived work and aren't subject to those rules. Although I'm honestly not sure, should we ask anyone about this?
It is a combined work. What I've heard is importing a library is considered to be linking to it. So, see the licence's definition of a combined work:
A โCombined Workโ is a work produced by combining or linking an Application with the Library. T...
As this project uses pre-commit, I feel like it would make sense to add this as a pre-commit hook, using the local configuration options, and setting it to only run on edits to pyproject.toml/poetry.lock. This would help ensure that regressions are discovered before they're ever commited.
GitHub Actions run 1177881400 succeeded.
[python-discord/bot] New branch created: restrictive\-infra\-commands
It is no more possible to pass arguments such as Qwerty to ban, mute, kick etc, as it's error-prone. Only mentions, IDs and usernames (name#descrim) are allowed.
This PR has the (positive) side-effect of making infraction search and reminder work with usernames instead of just mentions and IDs too.
GitHub Actions run 1177925261 succeeded.
if has_id_or_mention:
return has_id_or_mention
if argument[0] == '@':
argument = argument[1:]
# Check to see if the author passed a username (a discriminator exists)
if len(argument) > 5 and argument[-5] == '#':
return True
This is useful in cases where that lookup strategy would lead to too much ambiguity.
54fa5d2 Bump to latest d.py master branch - ChrisLovering
e57d49a Remove git from Docker image - ChrisLovering
550473c Use Guild.active_threads since channel.active_t... - ChrisLovering
8508950 Update nomination end test to raw text - ChrisLovering
082778e Consistent indents in config-default.yml - ChrisLovering
Update thread bot to use the latest discord.py version from git, since we don't need to worry about pinning this.
This allows us to remove git as a requirement in the Docker image.
Some minor breaking changes were made since our pinned version, so those have been fixed in here too.
GitHub Actions run 1177974320 succeeded.
I recently found this out, could this implementation detail optimize the method?
The created thread and the message it was started from will share the same id.
We don't use this, or is this a new discord.py requirement?
Was this accidentally added?
This PR is on top of https://github.com/python-discord/thread-bot/pull/3 for ease of merging, and is in draft until forms has a way to generate long-lasting app tokens.
This cog listens for embeds to be sent by the forms webhook for user's submitting ban appeals. When one is detected it fetches extra info from the forms API and starts a thread, ready for mods to deliberate.
When a decision is made, it allows for the generation of a response to the ban appeal, using canned responses and ...
GitHub Actions run 1177985274 succeeded.
Yea, my working tree was very noisy as I added added this on top of https://github.com/python-discord/thread-bot/pull/4 but tried to split this out and PR first, since the other PR is blocked.
No harm in adding this dep early though.
Hmmm, yea we could. I'd like to investigate that outside of this PR though, since #4 is based on top of this PR and I CBA to mess with git right now lol
303b441 use User.display_avatar, since User.avatar can ... - ChrisLovering
GitHub Actions run 1178005688 succeeded.
GitHub Actions run 1178007919 succeeded.
GitHub Actions run 1178017623 succeeded.
Simple enough, I used Sourcegraph to search the repository for things mentioned as breaking changes and found nothing. Thanks Chris
a5ad71d Add command to list all availible canned responses - ChrisLovering
GitHub Actions run 1178033666 succeeded.
GitHub Actions run 1178038561 succeeded.
I must be doing something wrong, as I tried this locally and added fuzzywuzzy as a dependency and this did not flag it at all.
It should just fail to convert in that case.
GitHub Actions run 1178106914 succeeded.
Linting process have been completed and i've fixed that from my end
That wouldn't work as-is (returns None sometimes) but I could instead use this to make the flow better
has_id_or_mention = ...
# Check to see if the author passed a username (a discriminator exists)
argument = argument.remove_prefix('@')
has_username = len(argument) > 5 and argument[-5] == '#'
return has_id_or_mention or has_username
Did you also adjust tests?
By adjusting tests I'm assuming you mean adding new tests for these converters since there aren't any? I didn't do so as UserMentionOrID didn't have any tests - on what basis do we decide to add new tests for something?
Did you also adjust tests?
By adjusting tests I'm assuming you mean adding new tests for these converters since there aren't any? I didn't do so as UserMentionOrID didn't have any tests - on what basis do we decide to add new tests for something?
Did you also adjust tests?
By adjusting tests I'm assuming you mean adding new tests for these converters since there aren't any? I didn't do so as UserMentionOrID didn't have any tests
Oh, in that case I am not sure
on what basis do we decide to add new tests for something?
That's a question better answered by a core-dev.
There currently arenโt any specific guidelines on adding tests. If you want to add them, go for it, otherwise donโt worry about it.
@MarkKoz alright, so we have two packages that uses LGPL. One of them is flake8-import-order which is quite easy to swap for Isort and would be quite an improvement.
The other is chardet, a dependency of aiohttp. It is a bit more problematic, but we could dodge it using the accelator lib instead cChardet, which is under the Mozilla license.
Maybe we could explore that if we want to get rid of them? Another solution would be to simply include a LICENSE-THIRD-PARTY file. I honestly su...
1dea763 Make the helper function more readable - Qwerty-133
The Baby Anaconda is very different from the other icons here, we should probably look into where the other pictures were found so that we get a uniform front.
GitHub Actions run 1179054090 succeeded.
2018cb6 Clarify the usage of ambiguity in the docstrings - Qwerty-133
Thanks for the suggestions, I've implemented them
GitHub Actions run 1179112560 succeeded.
Thanks! I'm not too concerned about testing them so will leave that off for now.
I was able to simplify this code a bit considering there's 3 cases:
- One has a group and the other doesn't (XOR)
- Identical groups (potentially both None)
- Different strings and should be fuzzy searched
if self.group is None != fuzzy_tag_identifier.group is None:
# Ignore tags without groups if the identifier has a group and vice versa
return .0
if self.group == fuzzy_tag_identifier.group:
# Completely identical...
Technically we can skip a level of indentation if we invert this
if len(tag_identifier.name) < 3 or len(tag_identifier.group) < 3:
return []
if tag_identifier.group is None:
return self._get_suggestions(tag_identifier)
else:
# Try fuzzy matching with only a name first
suggestions = self._get_suggestions(TagIdentifier(None, tag_identifier.group))
Why is MemberOrUser still used for bans?
https://github.com/python-discord/bot/blob/2018cb6e5386ead7609b6dcb065abaf30d32fb5a/bot/exts/moderation/infraction/infractions.py#L329-L342
https://github.com/python-discord/bot/blob/2018cb6e5386ead7609b6dcb065abaf30d32fb5a/bot/exts/moderation/infraction/infractions.py#L388-L390
Can we switch the explanation from name vs. username to something else, for many it has the same meaning. Maybe make a note that the discriminator has to be included or similar.
Agreed, it looks a bit out of place. I've had a look to try and find the origin of the others but can't find anything. One alternative would be to continue the joke with the baby python option showing the python logo, and show the anaconda logo instead. Thoughts?
That's not the ban command, it's a helper function, here it's used for type-hinting and they'd both do the exact same thing.
GitHub Actions run 1179242947 succeeded.
Thats a really great idea, showing the anaconda logo however the python logo kinda looks like a snake but the anaconda logo is like a circle. Photoshop the 2 maybe ?? or the anaconda logo works as well!, let me know after which i can commit the changes
GitHub Actions run 1179503472 succeeded.
Opening a new PR as this one has become pretty messy and the description is outdated.
GitHub Actions run 1179509007 succeeded.
The self.group is None != fuzzy_tag_identifier.group is None: comparison won't work. we'd need to do something like (not sure if there's any nicer way to check that either of them is None and they aren't equal)
if (self.group is None or fuzz_tag_identifier.group is None) and self.group != fuzz_tag_identifier.group:
# Ignore tags without groups if the identifier has a group and vice versa.
return .0
if self.group == fuzz_tag_identi...
GitHub Actions run 1179632261 succeeded.
No self.group is None != fuzzy_tag_identifier.group is None: will work, because they become bools. Bools only have 2 states, True or False. So we have 4 cases:
- both
self.groupandfuzzy_tag_identifier.groupare None (True != TrueFalse) self.groupis None andfuzzy_tag_identifer.groupis set (True != FalseTrue)self.groupis set andfuzzy_tag_identifier.groupis None (False != TrueTrue)- both
self.groupandfuzzy_tag_identifier.groupare set (`False ...
With how it's chained, it impossible for the condition to be True self.group is None != fuzzy_tag_identifier.group is None creates a != comparison between None and fuzzy_tag_identifier.group which is then compared to be equal to None. The long equivalent (and how python handles it) would be
self_group is None and None != fuzzy_tag_identifier_group and fuzzy_tag_identifier_group is None
In [149]: for self_group, fuzzy_tag_identifier_group in itertools.product((None, "ba...
e7b7d9b Allow dmrelay to only be used in mod channels. - Qwerty-133
[python-discord/bot] New branch created: dmrelay\-mod\-channel
Oh I see, so just add the parenthesis: (self.group is None) != (fuzzy_tag_identifier.group is None)
DMs between bot and users is private information which mods shouldn't be able to accidentally leak.
GitHub Actions run 1179692815 succeeded.
these do not act the same, the current implementation allows groups shorter than 3 chars to be used to invoke tags as long as the name is longer than 3 and matches
Ah, yes that should work, sorry I couldn't make sense of the comparison before
I think doing the containment is a bit more readable and less verbose; I'm not too worried about the two checks as they're negligible in runtime to pretty much anything else that's happening in the bot.
We could also go with -inf as the default for a get and compare with that but again imo doing a normal containment check is the most explicit to show what's going on there
GitHub Actions run 1179727797 succeeded.
The nesting is not too bad and there's nothing after it so I think it's fine as is
GitHub Actions run 1179732355 succeeded.
GitHub Actions run 1179732751 succeeded.
GitHub Actions run 1179735824 succeeded.
GitHub Actions run 1179743521 succeeded.
I think that actually sounds like a great idea
return self._cooldowns.get(channel, float('inf')) > time.time()
GitHub Actions run 1179776008 succeeded.
42da00d Remove the json argument from the raw command. - Qwerty-133
[python-discord/bot] New branch created: raw\-api\-improvements
async def raw(self, ctx: Context, *, message: Message, json: bool = False) -> None:
This is the current interface, which doesn't allow you to use !raw msg-link foo because of the existence of the json parameter which is used by raw json. The json parameter is also included in the help text by default which isn't ideal.
This PR abstracts raws logic away into a helper function to get the better interface.
GitHub Actions run 1179788956 succeeded.
GitHub Actions run 1179921260 succeeded.
GitHub Actions run 1179920516 succeeded.
GitHub Actions run 1179924304 succeeded.
GitHub Actions run 1179948388 succeeded.
Connected!
GitHub Actions run 1179949867 succeeded.
[sir-threadevere] Branch Bump\-d\.py\-to\-latest\-master\-branch\-changes was force-pushed to `0a1c75a`
Simple enough, I used Sourcegraph to search the repository for things mentioned as breaking changes and found nothing. Thanks Chris
GitHub Actions run 1179953191 succeeded.
b84919d Bump to latest d.py master branch - ChrisLovering
b4173f2 Remove git from Docker image - ChrisLovering
af5af29 Use Guild.active_threads since channel.active_t... - ChrisLovering
1bf18cd Update nomination end test to raw text - ChrisLovering
09cdaf1 Consistent indents in config-default.yml - ChrisLovering
GitHub Actions run 1180047351 succeeded.
Connected!
GitHub Actions run 1180049370 succeeded.
This pull request restructures the clean cog and adds additional features to it.
Changes
!clean messagerenamed to!clean until- Added
!clean betweenwhich accepts to limits to clean between. - The limits are now exclusive. Meaning, unlike now where
!clean messagedeletes the message specified,!clean untilwill delete the messages and stop at the message specified without deleting it. Same way withbetween. - The limits can now be specified not just via messages, but...
GitHub Actions run 1180069876 succeeded.
Hmm, I see now. What about this instead?
We're removing a level of nesting in the if-statements introducing several dimensions to keep track, by flattening them we get a clear case of when to do what
if len(tag_identifier.name) < 3:
return []
elif 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 cha...
GitHub Actions run 1180219879 succeeded.
I've added the anaconda logo and here's the preview :

GitHub Actions run 1180796716 succeeded.
GitHub Actions run 1181415501 succeeded.
Connected!
GitHub Actions run 1181416396 succeeded.
GitHub Actions run 1181429841 succeeded.
Connected!
GitHub Actions run 1181430992 succeeded.
[python-discord/bot] branch deleted: restrictive\-infra\-commands
570490f Replace UserMentionOrID with UnambiguousUser - Qwerty-133
70ac959 Add the UnambiguousMember converter - Qwerty-133
1ffe27a Fix mismatches in parameter names and docstrings - Qwerty-133
8b1108d Use unambiguous converters for infraction commands - Qwerty-133
1dea763 Make the helper function more readable - Qwerty-133
Connected!
GitHub Actions run 1181487408 succeeded.
570490f Replace UserMentionOrID with UnambiguousUser - Qwerty-133
70ac959 Add the UnambiguousMember converter - Qwerty-133
1ffe27a Fix mismatches in parameter names and docstrings - Qwerty-133
8b1108d Use unambiguous converters for infraction commands - Qwerty-133
1dea763 Make the helper function more readable - Qwerty-133
d560cdf Remove the json argument from the raw command. ... - Qwerty-133
[python-discord/bot] branch deleted: raw\-api\-improvements
GitHub Actions run 1181493462 succeeded.
Connected!
GitHub Actions run 1181506022 succeeded.
Connected!
GitHub Actions run 1181510784 succeeded.
GitHub Actions run 1181516874 succeeded.
@Hunter2807 Will you be able to do the changes requested by the reviews in the previous PR?
GitHub Actions run 1181520473 succeeded.
Connected!
Description
As discussed in https://github.com/python-discord/sir-lancebot/pull/816 we should allow the bookmark command to be allowed in every channel.
Reasoning
Bookmarking messages is very useful for people who want to remember things, and the command itself doesn't use up much screen real-estate, so it shouldn't cause an issue
Proposed Implementation
Possibly add the everyone role to the whitelist_override but I'll leave the details up to the developer.
Add...
GitHub Actions run 1181522693 succeeded.
@Objectivitix Since you did the first PR, I'll give you first dibs on this issue.
Do you want this? If not, I'll leave it open for others to pickup.
@PythonTryHard How's it going?
key=operator.itemgetter(1),
This is usually preferred over lambda's but it's not enough of an issue to make me request the change :D
Looks great, had some good fun playing it while testing!
@brad90four Hello! Sorry for the late reply. I'll assign this to you. In the meantime if you need help with conflicting files, I'd go into the #dev-contrib channel so people are able to get the most amount of information into your brain about how to deal with them. You can see conflicting files at near the end of this PR. In this case, it should show up as such:
<img width="266" alt="image" src="https://user-images.githubusercontent.com/15021300/131314850-36c39a37-0597-4999-9061-cc1f6d8917...
GitHub Actions run 1181549014 succeeded.
GitHub Actions run 1181552742 succeeded.
GitHub Actions run 1181552715 was cancelled.
Connected!
GitHub Actions run 1181556478 succeeded.
@TizzySaurus Thanks for the feature!
For future reference, it is prefered to assign a user to a PR only when they are not the author of the PR.
An example being the author is no longer able to finish up the PR, so another user takes over and we assign them.
Thanks once again!
[python-discord/sir-lancebot] branch deleted: coinflip\-command
Description
Change the help message and make it better
Reasoning
It will be more applealing to use the bot and look at the help command
Would you like to implement this yourself?
- [x] I'd like to implement this feature myself
- [ ] Anyone can implement this feature
Connected!
GitHub Actions run 1181580240 succeeded.
Can you be a little more specific on how you're going to implement this? Will it look the same as Sir-Lancebot's?
Could you describe further what is wrong with the current help command and what you propose to change about it?
With the new time formats and utilities, there may be some major rewriting needed for this PR.
If you do resume this, please feel free to re-open.
GitHub Actions run 1181623613 succeeded.
User doesn't seem to be active on GitHub anymore, and hasn't responded to ping. This PR is now up for grabs.
I intend to start working on this within the next 24 hours.
GitHub Actions run 1181768767 succeeded.
Connected!
GitHub Actions run 1181769739 succeeded.
GitHub Actions run 1181858828 succeeded.
Connected!
GitHub Actions run 1181859750 succeeded.
GitHub Actions run 1181873975 succeeded.
Connected!
GitHub Actions run 1181874593 succeeded.
Yeah it will look the same as Sir-Lancebot's
GitHub Actions run 1182092590 succeeded.
Doc item doc_item.symbol_id='environment-variables' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
!docs refreshdoc
Inventories refreshed
Before i commit, does this sound good ? - You must provide a message id from this channel or copy the link of a message in a different channel for bookmarking
Description
When using the Real Python command and inspecting the links, you'll find that some links are courses, lessons, or quizes.
Steps to Reproduce
Use the .rp command with concurrency as search words.
Expected Behaviour
The point of the Real Python command is to provide articles, it should only bring up articles per its purpose.
Actual Behaviour
Currently you may receive other medias that Real Python produces, which is unwanted.
Possible Solutions
The...
Description
Real Python search command returning courses, lessons and quizzes.
The intent of the search command is to return only articles based on the user's input.
Based on this discussion: [discord message link]( #dev-contrib message)
Steps to Reproduce
.realpython concurrency returned this list during a discussion:
Sir Lancebot
โ Today at 11:02 AM
Search results - Real Python
Here are the top 5 ...
They RealPython search API has a kind query parameter. It would be acase of setting this query param to article to just get articles.
Hey @D0rs4n,
What's the progress on this issue, #11 has been waiting for this to be completed?
Thanks,
Nice stuff, I think the gameplay with these changes is much more fun, better than i'd expected. Just a few things i've commented and things from other reviews (mainly fuzzywuzzy -> rapidfuzz, should just be just a drop in replacement) and i'll be ready to approve.
Also, on the line with self.question_limit = DEFAULT_QUESTION_LIMIT, this is not necessarily correct with the wikipedia cog as there may not be as many questions as DEFAULT_QUESTION_LIMIT. I think this line should be ch...
I'm not sure why this is needed, I think we'd want to include questions with spaces etc in them.
I'm not sure this works quite as expected, as you want it to replace case-insensitively but str.replace doesn't. I think using re.sub should work, something like this maybe:
for word in title.split():
extract = re.sub(word, '\*'*len(word), extract, flags=re.IGNORECASE)
Hey @D0rs4n,
What's the progress on this issue, #11 has been waiting for this to be completed?
Thanks,
Hey! I'm waiting for an official approval!
Umm, yeah I will change this to special characters like ~!@#$%^&*(){}[]<>?/:";' otherwise you get answers as Jurassic Park (Dominion), which would be marked incorrect when you answer it without them.
shouldn't the fuzzy matching of answers take care of that?
For some cases it does, for some, it doesn't.
might want to extract punctuation from word before the re.sub first like you did I guess. Although I guess if the title was ice-cream we'd want to sub out both word separately so maybe the split should take into account punctuation as well.
I could replace - with , like I do for _, but replacing all punctuations would space could spoil words I guess?
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #828
Description
Added "kind": "article" parameter to API request. Also added a check to handle cases where less than 5 articles are found.
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]...
I think tweaking the fuzzy match tolerance to make it a bit more forgiving may be a better solution than this, I reckon false matches would be fairly rare so we could probably be relatively forgiving. Thoughts?
Added the "kind": "article" parameter to the API request. This should
only return articles to the user instead of courses, lessons
or quizzes.
Also updated the "Here are the top x results" message to handle a
variable amount of articles.
[Ticket: python-discord#828]
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Description
Did you:
- [ ] Join the [Python Discord Community](https://discord.gg...
GitHub Actions run 1182884134 succeeded.
This could actually just be
description=f"Here are the top {len(articles)} results:",
as we're limiting the number returned elsewhere. This change would save us having to update the code in multiple places if we decide to change the number returned
Thanks for the PR, this is a good change :)
Just one minor comment
Doing the first change falls out of the scope of the PR, and requires a bit amount of refactoring so I am not sure if I should include that here.
Well I had written a comment on the old PR, but a reply hasn't come till now from the reviewer. I think we should just wait until he answers...
Well I had written a comment on the old PR, but a reply hasn't come till now from the reviewer. I think we should just wait until he answers...
I've pinged them. And now we wait.
Special case for len(articles) == 1?
description=f"Here are the top {len(articles)} results:" if len(articles) > 1 else 'Here is only one result:',
It is over the 120 character limit for the code style, and I'm not sure how to break / wrap that inline if / else statement. Also I would use " instead of '
Would having a dedicated if / else just for the article_embed be too bulky?
if len(articles) == 1:
article_embed = Embed(
title="Search result - Real Python",
url=SEARCH_URL.format(user_search=quote_plus(user_search)),
description=f"Here is the result:",
color=Colours.orange,
)
article_embed = Embed(
title="Search results - Real Python",
url=SEARCH_URL.format(user_search=quote_plus(user_search)),
de...
This was just a suggestion ๐
You can also do something similar to the following code.
if len(articles) == 1:
description="Here is the result:"
else:
description=f"Here are the top {len(articles)} results:"
article_embed = Embed(
title="Search results - Real Python",
url=SEARCH_URL.format(user_search=quote_plus(user_search)),
description=description,
color=Colours.o...
Yeah that actually looks way better and makes more sense. Are you able to make that in your suggested change? Then I can commit it directly from your comment.
Doc item doc_item.symbol_id='arcade-api' present in loaded documentation inventories not found on site, inventories may need to be refreshed.
if len(articles) == 1:
description = "Here is the result:"
else:
description = f"Here are the top {len(articles)} results:"
article_embed = Embed(
title="Search results - Real Python",
url=SEARCH_URL.format(user_search=quote_plus(user_search)),
description=description,
color=Colours.orange,
)
GitHub doesn't want to cooperate ๐

It is better if @brad90four simply makes the commit locally.
570490f Replace UserMentionOrID with UnambiguousUser - Qwerty-133
70ac959 Add the UnambiguousMember converter - Qwerty-133
1ffe27a Fix mismatches in parameter names and docstrings - Qwerty-133
8b1108d Use unambiguous converters for infraction commands - Qwerty-133
1dea763 Make the helper function more readable - Qwerty-133
There, I have made the requested changes
@Bluenix2 Yeah, this is what I was talking about GitHub and cooperation :eyes:
Hey @Hunter2807, be sure to read this guide to improve your commit messages!
[python-discord/bot] branch deleted: dmrelay\-mod\-channel
dc01b87 Add concurrency rules to all GitHub workflows - ChrisLovering
[python-discord/bot] New branch created: Add\-concurrency\-to\-all\-workflows
GitHub Actions run 1183302313 failed.
This concurrency rule means that workflow actions will be cancelled if a new set of actions are triggered on the same ref. A ref is either a PR or a branch itself.
Doing this means that if someone pushes to a PR multiple times in quick succession, workflows won't get queued up. Instead, only the workflows from the most recent changes will run, as this is all we really care about anyway.
I see the benefits of this as twofold.
- The author gets faster feedback about the most recent chan...
Some symbols always generate stale inventory warnings because some of the symbols they list are not present on the linked page, presumably because the formatting of the rst file or some other part of the doc build process is wrong. (for example the environment-variables symbol on https://www.pygame.org/docs/ref/pygame.html)
This PR adds a counter that's kept in redis and is incremented every time a warning is attempted to be raised for an item, its expire is also set to 3 weeks in the fu...
GitHub Actions run 1183351993 failed.
Tested on Sir-Lance for a while, works perfectly fine.
Thank you
No, thank you! Everyone who has submitted a requested change or reviewed has been awesome.
Connected!
GitHub Actions run 1183485910 succeeded.
GitHub Actions run 1183351993 succeeded.
GitHub Actions run 1183578263 succeeded.
GitHub Actions run 1183636316 succeeded.
[bot] Branch ks123/goodbye\-talentpool\-channel was force-pushed to `20aa8b2`
GitHub Actions run 1183658369 succeeded.
GitHub Actions run 1183683866 succeeded.
GitHub Actions run 1183719254 succeeded.
GitHub Actions run 1183870136 succeeded.
There have been instances of a doc inventory not working because of the base URL being misconfigured, this PR makes the URL optional to prevent issues like this from occurring.
For every inventory currently added on the bot, the method of extracting the base URL from the inventory URL by removing the last path segment holds true (the only package where it wasn't true from a recent dump had an invalid base URL to begin with).
At first I thought of making the inventory URL optional and d...
Allows blank values for the base_url field for https://github.com/python-discord/bot/pull/1796
The bot doesn't remove the reaction (even after bookmark was sent and we react again and again), is it okay too?
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Issues:
Closes #428
Closes #500
Closes #608
PR:
Closes #610
Description
Initial commit, looks like all of my previous commits are included in this PR by accident. ยฏ\_(ใ)_/ยฏ
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 r...
5c9cbfa typing.Iterable to collections.abc.Iterable - Xithrius
I think it should be fairly obvious to what this attribute is, it describes itself. The comment has been deemed unnecessary.
f49307c Removing for manual imports. - Xithrius
Can you elaborate here what was discussed?
GitHub Actions run 1184162295 succeeded.
942af62 fixed stuff - Xithrius
Can you elaborate here what was discussed?
@mbaruh We talked about whether the editing things were necessary given that we already have edit logs which not only show edited message but all iterations of edits.
The changes mean that the message will be relayed as-is at time of reporting (which in my mind at least makes more sense), it will still be cleaned up once the incident is actioned.
GitHub Actions run 1184175797 succeeded.
0cec14f Create The Code Style Guide under Code Jam pages - ks129
20ae1ec Add The Code Style Guide to useful information ... - ks129
fac0a2b Add The Code Style Guide to CJ 8 sidebar - ks129
25a5057 Remove trailing whitespace from The Code Style ... - ks129
23b1e46 Add missing slash at b tag ending - ks129
GitHub Actions run 1184223179 failed.
GitHub Actions run 1184224740 succeeded.
GitHub Actions run 1184223179 succeeded.
I will be squashing this PR.
We need to still route API traffic through NGINX, let's discuss this over in the #dev-ops chat on Discord to figure out a solution
We might need further modification to support internal routing through NGINX, will coordinate on Discord.
GitHub Actions run 1184292293 succeeded.
GitHub Actions run 1184313114 succeeded.
^ @ocean rock told me to
GitHub Actions run 1184446445 succeeded.
I've noticed we didn't raise for status when requesting the html of the page to parse which caused some invalid pages like 404s attempted to be parsed, I set it to true in 23a3e5e.
This should also prevent the cog from trying to parse invalid pages because of misconfigured inventories or completely wrong symbols. They won't hit the the stale warning handler now and will instead be logged as a normal network warning with a full traceback
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Issues
Closes #428
Closes #500
Closes #608
PR
Closes #610
Description
Initial commit, starting PR from original forked branch.
Did you:
- [X] Join the Python Discord Community?
- [X] Read all the comments in this template?
- [X] Ensure there is an issue open, or link relevant discord discussions?
- [X] Read and agree...
Description
Add a .gitmessage file to have the same message come up for running the command line git commit command. There are templates that exist and can be modified to match the communities needs. Users will have to configure their .gitconfig (or this can be pushed as well) to use the .gitmessage as the template for their commit messages. The command line command to configure this is:
git config --global commit.template ~/.gitmessage
Users may need to change the relative path...
Many a times when users ask for resources, the !resources command comes handy
However when a user asks for a specific resource like, where can i find a good python book , using the !resources command is out of context even though it has a section for books
My idea is to implement a specific resource command, like !books or !resources books which links to https://pythondiscord.com/resources/reading/
This feature is not just for books but for all categories which is part of the r...
Container should be imported from collections.abc since it's deprecated in typing.
bot/exts/__init__.pyshould importIteratorfromcollections.abcinstead.bot/utils/extensions.pyshould importIteratorfromcollections.abcinstead.
Mapping should be imported from collections.abc since it's deprecated in typing.
Container should be imported from collections.abc since it's deprecated in typing.
Just to be clear, what this actually means is that ignore is a tuple where each element is a list of integers. Is this your intention?
This is not my intention. It will be changed to the proper annotation of int.
Right, yes. I will make these two changes shortly.
929556f Improve docstrings - TizzySaurus
b0ea616 Added bot variables tag (#1784) - Hunter2807
570490f Replace UserMentionOrID with UnambiguousUser - Qwerty-133
70ac959 Add the UnambiguousMember converter - Qwerty-133
1ffe27a Fix mismatches in parameter names and docstrings - Qwerty-133
8b1108d Use unambiguous converters for infraction commands - Qwerty-133
GitHub Actions run 1185197630 succeeded.
33d62b7 Suppress logs caused by infraction target being... - TizzySaurus
[python-discord/bot] New branch created: ignore\-infra\-mods\-errors
Closes #1780.
log.warning is no longer called when an infraction/pardon fails due to the target being a Moderator+
I believe this is what @MarkKoz was after when they created their issue.
Not sure whether we want to still ping @Moderators if the pardon fails for this reason or not, but have left the ping there for now (can remove if requested).
Do we want to make this the correct typing of t.Optional[int]?
f028ec2 Make error messages consistent - TizzySaurus
GitHub Actions run 1185394587 succeeded.
My understanding is that you shouldn't use Optional in d.py when it's the last argument. That's what I've been told in the dpy server at least
GitHub Actions run 1185399458 succeeded.
Ah right, forgot that discord.py reads these typings. That's good then
User doesn't seem to be active on GitHub anymore, and hasn't responded to ping. This PR is now up for grabs.
I'd like to continue this :+1:
Is it just a case of resolving the reviews?
@magicandcode will you eventually be resolving the reviews in this PR?
Hi, I'm so sorry for not responding, had no idea I was being pinged on GitHub, still new to the whole collab part. The e-mail notification today is the first I've seen on this.
I should never have made this PR, I didn't want any reviews or comments (yet, as I said in the PR), just made a draft to see how things worked and to set it up. I've been working on this issue but it seems neither I nor my collaborator has a ...
@magicandcode you can still work on this if you'd like to!
@magicandcode you can still work on this if you'd like to!
Thank you, I appreciate it! Part of me wants to get it done but then I need help with the UI. I'm happy to keep working on this with @TizzySaurus if they're willing.
This still doesn't protect against the infinite loop, seemingly because of an off-by-one bug throughout this cog. A simple fix for this would probably be just to use min(DEFAULT_QUESTION_LIMIT, topic_length-1), or you could look into this further and try and fix this off-by-one in the rest of the cog (I think the root cause is line 389 if len(done_questions) > self.question_limit and hint_no == 0: which should instead be >=, as if the number of completed questions is greater than the li...
accidentally posted other comment individually rather than part of a review
You should avoid using noqas if you can, as usually they make a good point (as they do here). Here you can use raw strings, e.g. r"[\s-]" to make it clear \s isn't an escape sequence meant to be interpreted by python
I'm not sure this was resolved. If we think it's hard to guess because of the punctuation we could give the punctuation with the words redacted before the description, this would also help people know the order/length of words, could maybe do that the same as how we do it from the extract
cleaned_title = title
for word in re.split("[\s-]", title):
word = word.strip(string.punctuation)
secret_word = "\*"*len(word)
cleaned_title = re.sub(rf'\b{word}\b', f"**{secret_w...
GitHub Actions run 1186064289 succeeded.
ffda1f7 Migrate to Discord.py 2.0a0 - Akarys42
9c02adc Trigger the bot on mentions - Akarys42
57b0107 Make the bot automatically join threads - Akarys42
[python-discord/sir-lancebot] 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 commit also solves two small problems due to that fix, the avatar interface changing and Embed.name disappearing. Quite a painless migration.
I took the liberty of adding two QoL things:
- Adding mentions as a valid trigger for the bot
- Making the bot automatically join new threads
GitHub Actions run 1186303918 succeeded.
Just giving it a read through for the content. I haven't set it up or tested it out locally and I only saw two things to comment on. The first one is potentially the "testing" code as a place holder, and the other is related to the fix type annotations PR that is being worked on.
await bot.unloads_cache.set("bot.exts.evergreen.catify", "https://dummy-msg-link.com")
await bot.unloads_cache.set("bot.exts.evergreen.xkd", "https://dummy-msg-link.com")
Are these lines the "testing" code that you mentioned?
async def manage(self, action: Action, ext: str) -> tuple[str, t.Optional[str]]:
Just one comment for now, will give it a full look through & test later
Should we still replace this with PLAYER_ICON_IMAGE_SIZE?
Indeed, indeed, forgot about that one
f31d196 Snakes: make use of PLAYER_ICON_IMAGE_SIZE again - Akarys42
GitHub Actions run 1186350155 succeeded.
GitHub Actions run 1186416871 succeeded.
GitHub Actions run 1186482506 succeeded.
Add a signal to the api app that automatically unassigns
deleted roles from users that have them
GitHub Actions run 1186608596 failed.
Is there not a way to do this in batch? We should let SQL do this
Copying the docstring from Discord.py could be good too.
The lookup strategy for message ID is as follows (in order):
1. Lookup by "{channel ID}-{message ID}" (retrieved by shift-clicking on "Copy ID")
2. Lookup by message ID (the message **must** be in the context channel)
3. Lookup by message URL
``` I suggested opening a PR and getting feedback during review :)
Oh, I see your concern. That wasn't a wise choice indeed. Although, I think there's a way to solve this using Django ORM.
As wookie said, we already have this game in the bot, just under a different theme.
Please feel free to take a look at the snake antidote game source and see how it compares to your planned implementation. You could always see if you'd do it differently or if there are improvements to be made.
Alternatively, you can wait a few days for the discord.py 2.0 PR to be merged, and re-write snake antidote with buttons!
This PR is good to catch the licenses that are obviously against our MIT license.
I think we should create an issue to discuss what to do about the grey area licenses, rather than blocking this feature.
570490f Replace UserMentionOrID with UnambiguousUser - Qwerty-133
70ac959 Add the UnambiguousMember converter - Qwerty-133
1ffe27a Fix mismatches in parameter names and docstrings - Qwerty-133
8b1108d Use unambiguous converters for infraction commands - Qwerty-133
1dea763 Make the helper function more readable - Qwerty-133
[python-discord/bot] branch deleted: experiments/akarys/check\-licenses
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
6103527 Merge branch 'main' into experiments/akarys/che... - ChrisLovering
GitHub Actions run 1186774554 succeeded.
Connected!
GitHub Actions run 1186792354 succeeded.
It seems like, the Django ORM, F objects in particular does not support ArrayFields.
However, I've never really worked with arrayfields using raw SQL.
GitHub Actions run 1186836773 failed.
[python-discord/sir-lancebot] New comment on pull request #833: Teapot support \- Continues PR \#610
There appears to be an issue where it will display the status fine, and yet still shows an error:



You need to return after this point to prevent the error I commented about
GitHub Actions run 1186867261 succeeded.
Right now, the embed is only in 3 quotes and since the other 2 bots [ Sir-Lancebot and Python Bot ] have a nearly same help message format, it would be adequate to make Sir-Threadevere 's help embed the same too!
if thread.me:
# Already in this thread, return early
return
with suppress(Forbidden):
await thread.join()
on_thread_join is triggered on creation of a thread, and when ever someone joins a thread.
Since thread.join() makes an API request, I think we should check if the bot is already in the thread before trying to join it again.
Only thing I found while doing some tests. Didn't want to spend lots of time testing every area of the bot, since issues raised from this bot aren't critical.
32e94d5 Do not try to join threads the bot is already in
- Akarys42
GitHub Actions run 1186879806 failed.
I've just tested about 90% of the commands, as far as I can see they are working without issue
GitHub Actions run 1186918771 succeeded.
Proxy approval for my brother from another mother, ChrisJL.
[python-discord/sir-lancebot] branch deleted: discord\-2\.0
Connected!
GitHub Actions run 1186948584 succeeded.
GitHub Actions run 1187020792 failed.
After further consideration of the UX and future development, I think the command should stay at the top level without the infraction search and infraction search id part.
Sorry Tizzy :pray:
Can you elaborate on that? because Optional seems the correct annotation here just from a Python standpoint, and I haven't come across any issues with it.
After further consideration of the UX and future development, I think the command should stay at the top level without the infraction search and infraction search id part.
Sorry Tizzy :pray:
That doesn't explain why it can't be the last argument.
GitHub Actions run 1187156350 succeeded.
It simply isn't meant for the last argument, but I think it would work. That said though, what will now happen is that if the IntConverter fails instead of a converter error we will continue with infr_id set to None (as if it wasn't passed).
Is this acceptable?
GitHub Actions run 1187246786 succeeded.
"accepted status codes that are ok" seems a bit verbose, "The range of valid status codes is 100 to 599" might be a bit more concise. Same would apply to the other one, you could probably create a function that takes the url and runs the command to get rid of the repetition here, although having build_embed does remove most of the repetition so that's ok
Should be HTTP_DOG_URL here
Good stuff, just small things.
Btw, this is extremely picky so I wouldn't ask you to change it, but as python's range ends are exclusive, if for example you were looking for 2xx response codes you would check in range(200, 300) rather than range(200, 299). That said, 299 isn't a valid status code, so in practice this would make no difference at all!
I see. I suppose that's fine as is then.
Description
I created a Hangman game in Python and would like to add it to Sir Lancebot via a new cog.
Reasoning
I think Hangman is a game I am sure many people will want to play!
Proposed Implementation
I would like to add a new cog to Sir Lancebot with the command .hangman
Would you like to implement this yourself?
- [x] I'd like to implement this feature myself
- [ ] Anyone can implement this feature
GitHub Actions run 1187280912 succeeded.
I decided to create a standalone embed that would be sent in the case that the status code is outside of the range. I used your wording since it reads much easier.
[python-discord/sir-lancebot] New comment on pull request #833: Teapot support \- Continues PR \#610
Good stuff, just small things.
Btw, this is extremely picky so I wouldn't ask you to change it, but as python's range ends are exclusive, if for example you were looking for 2xx response codes you would check in
range(200, 300)rather thanrange(200, 299). That said, 299 isn't a valid status code, so in practice this would make no difference at all!
I went ahead and changed it, doesn't hurt to keep things proper (and I am already making changes, so what's one more smal...
cc3407e Update gunicorn options for deployment - jb3
[python-discord/site] New branch created: jb3/update\-gunicorn\-prefs
GitHub Actions run 1187298393 succeeded.
Remove threads & max requests configuration
GitHub Actions run 1187301530 succeeded.
I do not personally see any reason behind the dormant phase of a help channel. Once a question is answered, or the channel is closed, why should that help channel not then return to being available? Currently as of writing this there are only three available help channels with twenty-seven channels waiting an arbitrary amount of time to be re-opened.
Maybe I am missing the purpose behind the phase, but to me it just limits the available channels, requires more help channels as most are sit...
Moving all of the channels into the available category would push the channel list down for a lot of users
so realistically we want to move this configuration part into kubernetes. in my opinion, this has no place here. for instance, why are gunicorn workers checking migrations at every worker boot? this should be checked once at startup by an entrypoint script and then exec gunicorn and fast-booting workers excellent. this looks good regardless, thank you joe
Moving all of the channels into the available category would push the channel list down for a lot of users
So, have less help channels. Currently there are only so many to account for the large amount in the dormant category. Without the dormant category significantly less channels would actually be needed.
Currently there are only so many to account for the large amount in the dormant category.
We don't want to delete help channels because of the archival benefits, so at peak we have seen every channel you see today in use at once.
Without the dormant category significantly less channels would actually be needed.
This isn't so, no matter where the channels are at peak times all will be in use or all will be in available.
it just limits the available channels
This isn't how...
Just noticed a sort of weird thing with the statusdogs api, explained in comment. Otherwise this looks good!
This doesn't seem quite right at the moment, the .Embed shouldn't be that, and ERR_UNKNOWN.format(code=code) needs to be passed in as a keyword argument, so set_footer(text=ERR_UNKNOWN.format(code=code)).
What I noticed to get this result is that instead of returning 404 when the image isn't foundlike the cat url, httpstatusdogs.com seems to return a 302, meaning it isn't caught in the elif and gets to the else. We could probably change line 64 to check for 302 first, `elif respons...
GitHub Actions run 1187420176 succeeded.
GitHub Actions run 1187435376 succeeded.
This will be possible after the merging of https://github.com/python-discord/bot/pull/1663.
Connected!
3f9bf63 Remove !infraction search support for infract... - TizzySaurus
Per this comment, this PR will be deferred until the time utilities refactor is merged.
GitHub Actions run 1187493549 succeeded.
GitHub Actions run 1187561504 succeeded.
GitHub Actions run 1187566267 succeeded.
[sir-lancebot] Branch decorator\-factory/typehints\-fix was force-pushed to `745cd1d`
GitHub Actions run 1187589185 succeeded.
Could you please fill out the Proposed Implementation section with how you propose to implement this game?
@ChrisLovering Didn't I do that?
"I would like to add a new cog to Sir Lancebot with the command .hangman"
Yes, but could you explain how you propose it would work? Does the user get shown an image? does it use text, emojis, buttons, all of the above?
Actually describe what it is you plan to implement.
@ChrisLovering Done. Let me know if you need anything else
I've just found this issue https://github.com/python-discord/sir-lancebot/issues/599 that has quite a bit more defined about it, did you want to take over that issue instead? As it's currently up for grabs?
GitHub Actions run 1187818009 succeeded.
await ctx.send(f":x: No infraction with ID `{infr_id}` could be found.")
[bot] Branch support\-infraction\-id\-search was force-pushed to `9c40605`
GitHub Actions run 1187841230 succeeded.
A minor nitpick: this will enter the condition with infr_id == 0. It's not actually important, but more correct to check explicitly for None.
True. An infraction id will never be 0 since the count starts at 1, but will make this change nonetheless :+1:
[bot] Branch support\-infraction\-id\-search was force-pushed to `a86a6cc`
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
6103527 Merge branch 'main' into experiments/akarys/che... - ChrisLovering
75fa14d Add support for searching infractions by infrac... - TizzySaurus
[python-discord/bot] branch deleted: support\-infraction\-id\-search
Connected!
GitHub Actions run 1187896531 succeeded.
Per this comment, this PR will be deferred until the time utilities refactor is merged.
It wasn't a suggestion to defer the whole PR but rather to defer that specific request. However, if the moderation team is okay to wait for this command, then I have no problem just deferring the whole PR.
Yeah it will be nice to have, but it's not urgent.
@Xithrius I'd prefer for the squash to happen upon merging. Since you squashed before my final review, I don't have an easy way to see the diff between the last time I review and now. I'd have to find the right ref to compare.
@Xithrius I'd prefer for the squash to happen upon merging. Since you squashed before my final review, I don't have an easy way to see the diff between the last time I review and now. I'd have to find the right ref to compare.
Didn't think of that, sorry. Here's the ref: https://github.com/python-discord/sir-lancebot/commit/59301075adba95b2f93cb74b8c3885a58b7bd0b8.
This should probably also wait until the site's smarter resources project is complete, as that fully redesigns the resources page and allows you to pass in query strings for different filtering parameters. Here's what some of those categories are:

GitHub Actions run 1188524359 succeeded.
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?
Sentry Issue: BOT-Z0
This may be related to #905 and #1780. If it's a role hierarchy issue and an expected failure, then let's suppress the exception.
Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/moderation/modpings.py", line 98, in off_command
await mod....
The user that invoked the command is a moderator. Not sure why it failed. If the bot cannot remove roles from mods, then it seems like the whole modpings command would be broken.
I hope I tested everything. It's a fairly involved system and I don't understand it all since I don't regularly use it.
Oh, there's this comment from @mbaruh but I guess it is out of scope for the PR? I'm not sure what exactly the suggested change is anyway โ I'm not too familiar with the whole system anymore.
Will this put the main branch into its own concurrency group? Cause that may not be a good idea. The cancellation is premature โ it can't actually know if the newer workflow will even succeed. Imagine two different features are pushed to main at around the same time. If the newer workflow cancels the older one, and then the newer one fails, then neither change will get deployed. The older workflow could have succeeded and at least that change could have been deployed rather than nothing at al...
Currently when you search for an infraction which is permanent, it'll say "Expires: Expired" even though it hasn't expired (because it's permanent).
This should be corrected to say "Expires: Never".
I'll do this later today as it's a quick fix.
This is something that may get fixed by @MarkKoz's PR (#1680). Are you planning to do this Mark?
Please try and ensure you've tested your code before committing, this has a (different) bug with the same example I mentioned before, .status dog 478. It's fine if that means it will take you longer to respond to reviews because you need to be in a position to test, but it helps to make the review process easier in the end.
The .Embed before .set_footer on this line shouldn't be there, I don't think?
Whilst the cat api returns the 404 image if the result isn't found, meaning the URL can be used anyway, the dog api does not, meaning discord will try to use an invalid URL and fail to load the image. Explicitly using the relevant 404 image would be a way to fix this. Example to test this is .status dog 478
async def inner(self: Callable, ctx: Context, *args, **kwargs) -> Optional[Callable]:
def wrap(func: Callable) -> Optional[Callable]:
def locked() -> Optional[Callable]:
Do we really need -> None here?
990bc67 Add an extra alias to unnominate - ChrisLovering
GitHub Actions run 1189584103 succeeded.
Not suggesting it should be changed in this PR, but do we actually need a form of cache at all for this? All the cases it is used it seems to be refreshed before use (unless i'm missing something), which seems to sort of defeats the point of caching it.
There also seem to be quite a few validation requests before making the site request (often meaning extra api requests are required). As the site already does validation it would probably be much easier just to handle those failures (althou...
I think this was just from when the Python role was moved below the moderators role, which has been fixed now. We'd probably still want to know about permission errors such as this in the future, so this can probably be closed.
At the moment, posting a link to github causes the bot to respond with a manually performed codeblock snippet of the contents linked. However, if the user edits their message to change the link, the contents of the embed do not change, and the user has to re-send their message to get updated contents.
We've previously implemented similar behavior for the Eval cog, with a refresh icon. However, in this case, because the response is automatic and not derived directly from user interaction, I...
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
6103527 Merge branch 'main' into experiments/akarys/che... - ChrisLovering
GitHub Actions run 1189817762 succeeded.
GitHub Actions run 1189854399 succeeded.
f108d8e Use permissions_for over permissions_in - ChrisLovering
[python-discord/sir-lancebot] New branch created: Use\-permissions\_for\-over\-permissions\_in
Sentry Issue: SIR-LANCEBOT-65
AttributeError: 'Member' object has no attribute 'permissions_in'
File "discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/evergreen/bookmark.py", line 106, in bookmark
permissions = ctx.author.permissions_in(target_message.channel)
Unhandled command error: 'Member' object has no attribute 'permission...
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #837
Description
discord.Member.permissions_in() was removed in d.py 2.0 in favour of using discord.Channel.permissions_for everywhere.
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?
- [ ] Re...
GitHub Actions run 1189859925 succeeded.
After a long discussion on discord it was decided to simply just catch the error raised by using !starify on members above the bot in the role hierarchy.
A summary of reason is basically that in the other cases we want to know something went wrong, because there shouldn't be an error in any other infractions due to the user being staff (we can successfully ban/kick/mute/etc. staff, including Moderators+, it's only starify we can't as it changes nickname which is hierarchy dependant.)
GitHub Actions run 1189864969 succeeded.
GitHub Actions run 1189887836 failed.
[sir-lancebot] Branch Use\-permissions\_for\-over\-permissions\_in was force-pushed to `657ca6c`
Good point, i've updated both places to be the split way.
[sir-lancebot] Branch Use\-permissions\_for\-over\-permissions\_in was force-pushed to `6683af4`
Extension of #1787.
Will allow the usage of !infraction last to view details of the user's most recent infraction made.
Requires changing infr_id: int to infraction: Infraction and making the Infraction converter use the expanded endpoint (which I've already checked to ensure won't break anything).
GitHub Actions run 1189936689 succeeded.
Can confirm the described behaviour still happens, I can go through and fix these cases. Should be as simple as adding in some \ns where they are missing
Would this be the correct behavior if the status code is not found?
I hard-coded in the 404 pictures for the dog and cat urls if there is a 404 error.

GitHub Actions run 1189993628 succeeded.
[python-discord/sir-lancebot] New comment on pull request #833: Teapot support \- Continues PR \#610
Thanks for the patience guys, I think it should be working now!
a435173 Start and end codeblocks with newlines to avoid... - wookie184
[python-discord/sir-lancebot] New branch created: android\-codeblock\-fix
Relevant Issues
<!-- Link the issue by typing: "Closes #" (Closes #0 to close issue 0 for example). -->
Closes #615
Description
Added newlines before and after codeblocks that didn't have them already. From testing it seems they're only technically required before to fix the android rendering issue, but I added them afterwards as well for consistency.
Did you:
- [x] Join the Python Discord Community?
- [x] Read all the comments i...
GitHub Actions run 1190053102 succeeded.
Sentry Issue: SIR-LANCEBOT-66
AttributeError: 'Member' object has no attribute 'permissions_in'
File "discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "bot/exts/evergreen/fun.py", line 82, in uwu_command
text, embed = await Fun._get_text_and_embed(ctx, text)
File "bot/exts/evergreen/fun.py", line 200, in _get_text_and_embed
if isinst...
This seems to work as expected now, thanks!
f509054 Add support for !infraction last - TizzySaurus
[python-discord/bot] New branch created: infraction\-last\-support
Closes #1803.
Adds !infraction last, which will view details of the last infraction the user made. Also changes the Infraction converter to use the expanded endpoint
GitHub Actions run 1190263675 succeeded.
[python-discord/sir-lancebot] branch deleted: Use\-permissions\_for\-over\-permissions\_in
Connected!
GitHub Actions run 1190291304 succeeded.
Looked through the code and tested it out- just two small comments, other than that all looks fine.
Would Unnomination reason: rather than Unnominate reason: be slightly better english? I'm not actually sure
We'd probably want to pop the user from the cache here, I guess, although in practice it probably wouldn't affect much.
Yes, that would be correct. Will update later
The following are missing this change:
- https://github.com/python-discord/sir-lancebot/blob/android-codeblock-fix/bot/exts/evergreen/snakes/_utils.py (the egg stages)
- https://github.com/python-discord/sir-lancebot/blob/a4351738cc074f42b60521c122e8712888c50498/bot/exts/evergreen/cheatsheet.py#L73
- https://github.com/python-discord/sir-lancebot/blob/a4351738cc074f42b60521c122e8712888c50498/bot/exts/evergreen/cheatsheet.py#L67
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
async def infraction_group(self, ctx: Context, infraction: t.Optional[Infraction] = None) -> None:
ca15abb Improved consistency for codeblocks to end with... - wookie184
GitHub Actions run 1190639649 succeeded.
For the eggs I don't think there should have been any leading whitespace so I removed that too.
Description
Sir-Lancebot, way back in the day, was created around seasons. We'd have things associated with Christmas, Easter, Valentine's Day, and then year-round things that we put under the "Evergreen" folder. With the growth of our community, Sir Lancebot has since outgrown this structure.
I'd like to re-organize Lancebot to be more general and less revolving around seasons.
Reasoning
I think restructuring it to not be focused around seasons will make Lance's structure eas...
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
We actually don't want this because then the error raised by the Infraction converter would get supressed (which means the cog_command_error handling wouldn't work).
Thank you, I appreciate it! Part of me wants to get it (the issue) done but then I need help with the UI. I'm happy to keep working on this with @TizzySaurus if they're willing.
Yeah, sure. I'll hopefully be able to make a commit fixing the current reviews by EOD tomorrow and we can go from there :+1:
@magicandcode you'll need to add me to your fork so that I have write access to the repo.
[python-discord/bot] New review comment on pull request #1804: Add support for \`\!infraction last\`
This assumes that BadArgument will only ever be raised from the infraction converter.
Perhaps this should be a custom error such as InfractionConversionError which will inherit from dpy's ConversionError
Cool cool, seems to be working well!
It's already fixed by 28f24313c45c237dfd8562be4ca7cae6873fd3c8 in #1721
Just a few minor things.
It doesn't seem like None is ever returned here.
Doesn't ... indicate a tuple with a variable length? I think it should be this:
HEADS: tuple[str, str, str] = ("h", "head", "heads")
TAILS: tuple[str, str, str] = ("t", "tail", "tails")
In fact, I don't see a need for this type annotation at all.