#dev-contrib
1 messages · Page 129 of 1
What happens when you try? And which tool are you using (e.g. git CLI, GitHub Desktop, through your IDE, or something else)
im using cli
the linitng broke the commit system that i had
i recloned and it works now 👍
@vale ibex nice branch name lol
Lmao
Yes. A lack of bug fixes and support for breaking API changes may affect it
@vale ibex my existing pr is taking longer than i anticipated to be approved to rejected, can i wait for it to be resolved ?
so i can start on the issue you assigned me to
If you think you can manage it, you can work on multiple things at the same time, otherwise feel free to take as long as you need
Can you link it, I could take another look and review, might speed things along
Sure! Tysm!! here -> https://github.com/python-discord/sir-lancebot/pull/822
Ah I see, that is not very old. It usually takes a few days
@crude gyro where did you find the snakes introduced here? https://github.com/python-discord/bot/blob/9f5f0cef5000f741e22734d8537683d1c607995b/bot/utils/snakes/hatching.py (https://github.com/python-discord/bot/pull/78/files)
iirc it was part of the first code jam
And the top teams got their cogs added to the bot
that is correct
May I ask here what will be happening with the bot since discord.py will no longer be maintained and was archived? Do you plan on switching to another working fork once it's made or another language rewrite? Or is there something else you plan on doing?
Currently discord.py is working, it just won't receive updates anymore. As time progresses, the featureset and the API we use will become outdated, but currently it's not urgent for us to switch.
people are getting a bit carried away after that announcement. There's no reason to panic.
yeah, I do realize that, I'm just curious if you have any plans about it, since it will become necessary to do something eventually
by the time it actually affects us the market will look completely different. Putting together a plan right now would be a waste of time.
Well, there are lot of people who like both Python and discord bots, and will want to try their hand at writing a wrapper for the API, or at least maintain a fork of dpy. When the dust will settle we'll see.
we're not worried, you shouldn't be either.
Is there a way to have an optional string argument to a command, and have it not match in favor of an argument that comes afterwards?
For example if I have two arguments Optional[str] and Optional[TextChannel], if I input #algos-and-data-structs I want it to be in the second argument
Ugh, I guess I can force a specific pattern in the string
I don't think discord.py has that, though it has the inverse which is Greedy
I implemented something like this for the silence command
Basically, it’ll accept one of two data types as the first argument, both of which can function on their own. If someone wants to pass it both, there’s also a second argument which will the accept the other type
The command then tries to take in all the provided input, and create meaningful context from that
The issue is that a channel mention is a valid input for the string argument
What are you working on?
The clean command
What’s the desired interface?
I want to take both a regex pattern and a one of (a series of channels | an asterisk to denote all channels)
Since I want the asterisk, I can't use Greedy
So I used a positional only argument instead
So channels must be the last arg
And both the pattern and the channels are optional
So like
!clean [regex pattern] [channel or *]
?
yes
Hm
My recommendation is to drop the star, and instead make it its own command
!cleanall [regex]
I can’t think of a clean way to do this
I solved it by enforcing a pattern of r'<pattern>'
That already exists, but I created a command that combines all functionalities
None of this would be an issue if Greedy was a type instead of an object
Since then I would just do Union[Greedy[TextChannel], Literal["*"]]
But I'll open the PR and we can scratch our heads once you see everything in context
string = "A_B*[ <0-9 [#dev-contrib](/guild/267624335836053506/channel/635950537262759947/)"
regex = ""
converter = discord.ext.commands.TextChannelConverter()
for arg in string.split(" "):
try:
channel = converter.convert(arg)
except BadArgument:
regex += arg
else:
break
else:
# We exited the loop without breaking, meaning we didn't resolve a channel
raise BadArgument("Could not resolve a channel mention")
# We now have access to `channel` as well as `regex`:
# channel: "[#dev-contrib](/guild/267624335836053506/channel/635950537262759947/)"
# regex: "A_B*[ <0-9"
What about something like that?
@cold island ^
Hmm, right, we can't make a converter out of this because discord.py doesn't let you hook into the argument system like Greedy does
@brisk brook, is this good enough?
Hmmm, I am not sure. Do we want the text? Without it the logo won't make sense, but ehhh..
Can you post that in the PR?
@brisk brook
I managed to make a converter(It's a wild idea, and implementation) , combined with Greedy, (Yes, I know it sounds insane) and it seems to work. Apart from two things. If in the case of!clean [regex] is provided then it'll be a List of 1 (It's always, assured, because of Greedy, but that shouldn't be a huge problem.). Also, another thing. It assumes that you provide only one regex string, otherwise it won't work as expected, but could be solved with additional checks.
https://paste.pythondiscord.com/ofojiwuyuf.py
(Also.. I apologise in advance 😄 )
Is there only one channel after that argument?
where baby python gives the py logo
This has the same issue with Bluenix's suggestion
No, there can be any number of channels
i can crop the pic to only the logo if you'd want
So wait, a channel is valid input for the regex but there can also be multiple channels?
huhhhh, kinda doesnt make sense
how can there be multiple channels as an input tho-
Oh, well then the only option is "myregex[#the-pydis-mass-layoffs-lounge](/guild/267624335836053506/channel/464905259261755392/)" I see now
sup bluenix and zig btw
So you can search for channel mentions, that you tell to search in multiple channels
Yes, I went with this
ah-
!command <search that may contain a channel> <*channels>
!command fwefwefew #878694948810137621 #dev-log
Is that 2 channels, or channel in the regex?

Lol yes, the more we discuss it the more I see that there has to be something that separates the regex
2 channels i suppose,
let me try 🤔
Even if I could use Greedy on the channels it would have the same issue
Specifically this is two channels
Because a string argument breaks once a space is hit
You have to include quotes if you want spaces
Right, but in our imaginary convert situation
Undefined
Which issue? Assuming that only one regex is provided?
That the regex itself can be a channel mention
Exactly, that's the issue I was explaining to @desert vessel
So, in that case the channel mention would be the first and the second argument as well? 😄
I thought, when no regex is provided you want the channel mention to be the second argument.
Yes but how do you decide that no regex is provided when you give a channel mention, if the regex can be the channel mention
can someone help with with git auth ;-;
i got a new computer
and now git got screwed
how do i login from cli-
Well, in my implementation when you provide a channel mention the regex argument will return None, and the second argument will automatically be a TextChannel object, so you can just put a check if the regex argument is None, or not. !clean [channel]
Yes but that's not the desired behavior. The regex can be a channel mention.
Which is why I ended up enforcing a specific form the regex needs to be specified in
Alright, I might have misinterpreted your request. So in case of a command of !clean [channel_mention] what is the desired behaviour? That the first argument [regex] automatically qualifier as a textchannel, and returns an object accordingly, but I'm not sure what happens with the channel second argument.
The request is not possible. You can't have two optional arguments that can have the same value and skip the first argument
So you have to make the possible values for each argument different
@desert vessel are you trying to authenticate with github?
P
done :)
On line 56 of nominations.py (in @brisk belfry) why not just get a role object from constants.Roles.mod_team and use role.mention? Sure the current option works but it's usually not very good practice
Lol
true :( most people maybe confused with just the logo but- idk
what are your inputs ?
pysite/views/api/bot/infractions.py lines 137 to 145
CREATE_INFRACTION_SCHEMA = Schema({
"type": lambda tp: tp in INFRACTION_TYPES,
"reason": Or(str, None),
"user_id": str, # Discord user ID
"actor_id": str, # Discord user ID
Optional("duration"): str, # If not provided, may imply permanence depending on the infraction
Optional("hidden"): bool,
Optional("expand"): bool
})```
But the post request always expected a reason https://github.com/python-discord/site/blob/flask-archive/pysite/views/api/bot/infractions.py#L189-L195
pysite/views/api/bot/infractions.py lines 189 to 195
def post(self, data):
deactivate_infraction_query = None
infraction_type = data["type"]
user_id = data["user_id"]
actor_id = data["actor_id"]
reason = data["reason"]```
Maybe it was to support data from rowboat?
Are there actually any infractions with null reasons in the db now?
!remind 8h this
Your reminder will arrive on <t:1630326005:F>!
I don't see any error in the screenshot
And it should work perfectly fine on windows if i am not wrong
gunicorn.error
didn't show up
i mean its running
but status
Umm, it does show gunicorn.error but its running, does the api work?
Nope, no I mean does the using the snekbox work like with requesting it
umm , how can i test the api
this is the endpoint iirc
welp
imma try on my wsl anyway
it has some problems on windows ig
bot/exts/utils/snekbox.py lines 59 to 64
async def post_eval(self, code: str) -> dict:
"""Send a POST request to the Snekbox API to evaluate code and return the results."""
url = URLs.snekbox_eval_api
data = {"input": code}
async with self.bot.http_session.post(url, json=data, raise_for_status=True) as resp:
return await resp.json()```
I think scal runs it on windows
I run it on Windows as well, though I haven't played around with it
Gunicon.error is the default logging handler
Which is a terrible name that I don’t understand
It’s not an error though
@brisk belfry randomcommand
Sorry, an unexpected error occurred. Please let us know!
CommandNotFound: Command "randomcommand" is not found
We should fix that haha
@brisk belfry `@tawdry vapor
Sorry, an unexpected error occurred. Please let us know!
CommandNotFound: Command "`@tawdry vapor" is not found
Okay at least that is fine
@tawdry vapor is there a repo for this bot that is maintained or is it closed source? i could help fix it while i wait for my PR to get approved or decline :)
&src
thanks!
btw im still waiting for something to happen to the pr, im really sorry chris :( i'll start as soon as something happens to that pr
There's no rush with any of our issues 🙂 Things take time
ah alright :)
i can work on another branch but im known for screwing the entire repo trying to make a branch
so nope
@vale ibex it's dev time
I got my environment up and running on macos
you ready to review stuff?
Depends what you want reviewed lol I've got 30 minutes
macos? 
Did manjaro burn you?
Ahh cool


lol what
Do you know which dep?
I'm guessing they don't have mac wheels
Also, when did GitHub change their approve colour?
These are definetely more faded that I'm used to
@vale ibex they be changing stuff again
yeah
@timid sentinel thanks for review 
even discord i think, atleast i see colours being more darker today
i have an m1, i can help :D
call me anytime and i'll be there
heh
what for?
^
oof i cant send a screenshot here
I've re-figured out macos, I shall be fine. Thanks!
oh, ciik
cool*
i reinstalled macOs today
a py model broke macOs yesterday
lmao
Chris, i can start with the pr now
@vale ibex are you guys accepting pr's for sir-threadaveare too ??
yes.
oh alright, ill pr a better help message lol
not yet
ah
we haven't approved your issue
Hmmmm, I think the recent timestamps may change this too
after*
oh, lol @vocal wolf
?
I commented 10s after you
lmfao
cya
No Chris is just weird
xDD
It should be like 10 am there
BotSource:
source Display information and a GitHub link to the source code of a comman...
No Category:
help Shows this message
Type &help command for more info on a command.
You can also type &help category for more info on a category.
yikes, wrong channel
Damm Daniel, back with the default help command
thats why i made an issue-
k I'm closing this 2 year old PR
Finally-
Xith, things take time, stop rushing things
lmfao
you have no idea
I once updated a PR and 3k commits merged into it
that's when I found that the webhook caps at 1k commits
@patent pivot 
/Users/urmom/Library/Caches/pypoetry/virtualenvs/thread-bot-CQnFdfHJ-py3.9/bin/python: No module named thread_bot
help :)
im running poetry run task start in sir-threadevere
Which directory are you in?
inside the sir-threadevere dir?
Never mind, the task is just wrong
oof
Use this instead:
poetry run python -m bot
@vale ibex @timid sentinel thanks y'all for the reviews and stuff. I go bed now.
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Bod
good night :)
I think the issue was likely debug being false, could you pull from main and try now?
yeet, alright
yikes-
its something to do with env i believe
Did you update your config.yml to the right values for your server?
the last 3 role IDs are the same
wait does that matter
its just me in the server, so im using the same role
but i'll change it and try again
yea, we make a list rather than a set, so it can contain duplicates
those are the cogs loaded
What are you trying to do?
&ext load asdasd
:x: Could not find the extension asdasd.
fixed
even your discord colours become darker? I thought there is some problem with my discord again 😛
whats the zero width space code?
200B
Ok thanks, what I am doing wrong here?
question = question.replace(word, len(word) * "*\u200B")
to replace it would the same amount of *
so to escape the markdown, I added zero width spaces
Why zwsp instead of escaping it normally?
Regarding Sir-Lancebot#610, do I need to link a new branch to the PR?
Since the original PR has a different author I am thinking I need to set up a new remote based on their current branch, make a local branch / clone from that and then push my commits to my local branch. Then link my local branch to the PR. Does this sound sorta correct?
Here's your reminder: this
[Jump back to when you created the reminder](#dev-contrib message)
What you'll need to do is set up their fork as a remote yes, then create a local branch and pull their commits into it. Now you can fix what's necessary and open a new PR.
ye, whitelisting all the channels is in progress i believe
Yeah I guess I thought that was already merged lol
wth
hmmm
sir-lancebot#816
It was us making fun of k8s during yesterday's staff meeting
im too lazy to change mine back 
lol
btw
did u guys take a look at sir-threadevere ?
@vale ibex slight issue with this being merged, it wasnt done correctly
akarys said to remove the check entirely so it could be used everywhere, but that never happened
thats this
ah
its open
im just waiting for the other dude to accept it or tell no
i cant pr cuz chris asked him first
Yea, the PR met the requirements so I merged it
no point pausing that one just to wait for the new reqs to be done
yep
just removing the check won't work, since the bot has a global check, so there's a bit more to it than that
I'll never understand how discord managed to make such a terrible API. Why is the type """null""". I can't actually get the API to give me that field, so what I'm assuming is you only get that field if the object has premium, otherwise you don't get it.
You know what the sane thing would've been? Just using a fucking boolean
Now I've gotta figure out how to represent this with pydantic models
could be a not so great way of cutting down the size
Yeah I remember asking someone about, and that's it yeah
well they send last_pin_timestamp as a date string in channel objects
so size wouldnt be the consideration
@celest charm and myself have been using the api docs a lot over the last 2 days and i think our collective conclusion is "wtf"
is a date string larger than a timestamp when text encoded?
no clue
but it also includes the id of the pin
and IDs are just timestamps on steroids
ah then yeah that just seems like bad design if you can get it anyway
user objects also have 2 values, i cant remember their names, which is the colour of their profile as an int, and then then the colour of their profile but a #hex string
including the #
I can confirm that the Discord API is absolute nonsense and poop and bad and so on
okay maybe I exaggerated a bit
yeah turns out there are
How often does the api change? I could see those as bad decisions early on and then keeping backwards compatibility but that could be removed when the api changes
it was skipped from a documentation point of view
For example, this is the breakdown of the Channel object into subtypes. There's nothing wrong with the API per se, but the way it's documented (just a giant list of optional fields) is beyond horrible
https://paste.pythondiscord.com/raw/nujupuwoke
sometimes the api docs just completely neglect to include any sort of info about what an endpoint returns at all, so i guess we should be glad for what we do get
Wait that to the right is your notes?
yeah
Ah okay
lmao wait, we have null notes and warnings?
these are the contractions of these, minus group DMs
lmfao yeah apparently so
!note 212644551926611969
:ok_hand: applied note to @thorny obsidian.
!note @cold island
:ok_hand: applied note to @cold island.
can i be null noted 🥺
we don't joke infract helpers 
its a note not an infract
we don't joke infract non-mods/admins
the note could just mean "h" but expressed via null-ness
!h @fervent sage
oh yeah it could be joke infrs
wait we dont have an h command I must create an issue
here is another nice idiocy. Left is the name, right is the description. So I thought: cool, let's look at the hyperlink
all of these are in fact delivered
I find it weird that we can note outside of mod channels
class h(Cog):
@command(name="h")
async def h(self, ctx) -> None:
resp = await session.get("https://h.pydis.com")
await ctx.send(await resp.text())
Failed linting, banned
Always though 🤔
Yeah, let's add pydis-style docstrings
class h(Cog):
"""The h cog"""
@command(name="h")
async def h(self, ctx: Context) -> None:
"""Perform the h"""
resp = await session.get("https://h.pydis.com")
await ctx.send(await resp.text())
There is no way to see where a model is used, but for this endpoint, yup
Still failed linting
Class name should start with a capital
oh right
class h(Cog): # noqa
"""The h cog"""
@command(name="h")
async def h(self, ctx: Context) -> None:
"""Perform the h"""
resp = await session.get("https://h.pydis.com")
await ctx.send(await resp.text())
Also no period at the end of the docstring
I give up
lol
NameError: name 'session' is not defined
Pydis Roast™️ but it's just code
I don't want to interrupt the discussion since its awesome, but how would I go about getting the .rp search command enabled in more channels than just #bot-commands ?
Is it just me or have backticks for codeblocks started rendering really weirdly in github, e.g. typing ```hello``` looks like this
You can use the whitelist decorator, but have you gotten any other channels approved?
there should be a decorator to override the whitelist global check
shows fine in the preview though
link wookie?
No, this is the first time I'm bringing it up
it's only when i'm typing it, looks fine when I send it
Usually we don't want to enable these commands everwhere
For instance, SO command was deliberately disabled in help channels
Yeah that could get really spammy
Yeah, and because we don't want people just going into a help channel, copying the question into the command, and leaving
If someone wanted google, they could go to google
What channels did you have in mind?
I couldn't replicate, but for me it doesn't format at all, unless I look at the preview, or send it
Ot, help and general. But there is a lot of spam potential for 2/3 of those...so maybe its fine the way it is. Just wanted a soundboard to bounce the question off someone else
OT sounds fine, but I'd be against help channels and general
I'm going to advocate specifically for help channels, that's where RP could help the most
Also, I'd like to keep a "enable everywhere (except pygen) until proved noisy)" policy
I believe it'll have the same problems that we discussed when opting to not enable the stackoverflow command
I think that's different though?
StackOverflow caused this ^
real python is not a "just search your answer here", they are tailored articles to introduce subjects
It's a fundamentally different service
Decorators
A decorator is a function that modifies another function.
Consider the following example of a timer decorator:
>>> import time
>>> def timer(f):
... def inner(*args, **kwargs):
... start = time.time()
... result = f(*args, **kwargs)
... print('Time elapsed:', time.time() - start)
... return result
... return inner
...
>>> @timer
... def slow(delay=1):
... time.sleep(delay)
... return 'Finished!'
...
>>> print(slow())
Time elapsed: 1.0011568069458008
Finished!
>>> print(slow(3))
Time elapsed: 3.000307321548462
Finished!
More information:
• Corey Schafer's video on decorators
• Real python article
But why would you need to search it if you are giving someone something specific
If you have an article you think someone should read, you can link it
Like, if someone wanted to ask for async help like "should I use threads or async?" what would make it faster?"
then I would do .realpython concurrency and bring up the articles already
.realpython concurrency
Here are the top 5 results:
what's the interface of the command? If it's a search command that you have to interact with then I don't think it fits into a help session
So it's right there, and they can see what's available
I don't see how this won't be abused
As the person that asked the question
This has gotten me no where
You've just given me 5 random links
No idea if you've vetted them or not
"Hey, check out this real python article like the 1st and 3rd, they'll explain what you need"
No idea if they will answer my question
If you already know the articles
Why do you need a search
I do agree that someone may ask to get a personal explanation
Because it's easier than exiting out of discord, doing the search on google, then coming back and linking it
Doing that in a separate channel and then sending the appropriate link themselves seems like it'd make more sense to me
Because why have this only be available in bot-commands. Then it's the same as not having it at all and just using google to me.
I don't think that's true, especially considering that your topic may not be in the top 5, especially for a really broad term
Someone said that exact same thing for SO
That exact same argument
RealPython is a fundamentally different service than SO. I don't think the same arguments hold.
But we still pushed on through with it, because we had people that wanted to implement it, and we weren't harmed by having it
I don't see how that's true. Sure, the format of info is clearly different, but fundamentally it's just giving you a bunch of links to random text
I can make your exact same argument for SO
I mean RealPython itself, not the command.
Q: "How do I solve file not found?"
A: SO link to answer that explains it
RealPython are tailored articles, written with a specific purpose in mind. So if you're searching through it to link something, it's far more than just a "plug in your question into SO and nothing else"
Q: How does decorators work?
A: Tag that explains it
It's a "hey, this service has written this better than I could, take a read through this"
half of the links from the search above aren't even articles that you could easily make sure are correct for the given question
Not sure that having "tailored articles" helps if the person sharing them didn't read and vet them. The same is also true of SO in the exact same way.
An SO answer can technically answer something much better than a helper here
Just noticed yeah wow. Gonna open an issue for that, I think we only want articles
And linking to that answer can help someone understand something
The difference here is you can't take a random keyword and throw it into a search command
Which both SO and RP are
The .so search command abuse was because people would just assume it's a normal stack overflow search and plug in the question wholesale. I don't think people would do that with RealPython because it doesn't strive to answer broad questions.
You need to know what the tags are, and you need to know their content
I don't think the avenue for using the command against the spirit of the server is there enough to warrant pre-emptively denying it in help channels.
We could put it up to a vote, but I believe the same fundamental problems that exist with SO, will exist here
I figured it would reduce the friction for looking for more reading / info on a given topic. But if every search returns 5 links I don't know if it is appropriate for a lot of channels. But I do like the discussion here, you guys are awesome
Where was that spirit for the SO command :P
Regardless, I'm not willing to run a trial by fire on help channels for no reason
Because as I've said above, I think SO and RP fulfill different needs. SO opens itself up for abuse while imo RP doesn't because of the difference of the services themselves.
and fwiw
.RP should I use threads or async?
what's the actual command?
.realpython should I use threads or async?
Here are the top 5 results:
Just fed it that question
But who would think to do that with RP?
It's article-based, not question-answer-based
what does doing it in a help session offer over doing it in in bot commands and then posting a single link in the session offer?
There's no rush to get it to the person that's being helped, and is less confusing
Don't know why that distinction matters? RP has so many articles you can probably stick any question that you can in SO and get a result
Because why introduce that extra friction that would essentially mean it won't really see it being used because people don't know it exists. It's just burying this command.
But that doesn't even look like it will answer the question you gave it
Because of the expectations of the user. No one's going to think to do with Real Python because the service doesn't lend itself that way.
Right, which is the concern. People getting links thrown at them, which may or may answer their question, and which may or may not waste their time. The same concerns raised for SO
I don't think that's true
What's the context?
The main RP site has a search bar, people must be using it, right?
I started it: #dev-contrib message
Should the .rp command be used in more channels than #bot-commands
Enabling the realpython command in help channels. I believe it's problematic for the same reasons SO was.
Same here lol
I'll step out, but I just don't like us pre-emptively denying usage of useful commands without a strong reason. I don't think "people could abuse the .realpython search command by just plugging it in wholesale" is enough of one. When I search on RP, I search for general terms to find specific articles I have in mind.
If the disagreement is just over whether people will abuse the command and we do think there's a valid use case, could we not just try it out and see if that's the case. Would be easy enough to revert?
Hmm, that's a complex one since it is different from SO. I would say we can trial it
Yeah, you dont know how people will use it before they use it :P
even if it's not abused, imo the UX for the person that's being helped is not great
Because it can hurt the experience for people that do experience that abuse. I don't think it's utility is great enough to warrant doing that
But I'm afraid it will be the same problem
I think we all agree that there is a potential for abuse though, just different strategies for how to avoid that?
And like Numerlor mentioned here and earlier
^
There is a difference between "Hey, look at that article: $link" and dropping a search command in front of the user
Same problem as SO
Did we stop SO from being used in help channels because of bad UX or because we think people will just drop a "I dunno, search SO <search and leave>"
We could put it up for a vote, but I'm not in favor
Both
People can do both
Where is that documented?
But we don't know that's actually what will happen. Our policy is to trial more perms and reduce if it problematic.
The main good use case I would see is when you see a common topic, for which you know a realpython article exists, and just want to reference it, e.g. "for more on that you can check out this realpython article on lists, !realpython lists, take a look at the first link there".
^
Because I thought our policy was a "we'll enable everywhere then limit if it becomes problematic" and this feels like a significant departure from that policy. So it'd be nice if that reasoning and discussion was documented somewhere.
My response to that:
<#dev-contrib message>
The problem is that it will give a lot of hits, there isn't a single article talking about lists but many of them.
I'm willing to trial a lot of things, but in my mind I don't see all that many great use cases for this command, and I think it can be a significant harm.
That combination, along with one of our most core systems
Yeah... don't like it
Just spitballing, what if it returned a single link based on which channel it is in? Could lead to more problems though
.realpython lists
Here are the top 5 results:
Third one there works
Anyway, this conversation seems quite heated and we aren't very much listening to each other, how about we solve this with a poll? We can always go back and change it later
With the ever changing nature of articles (new articles come, old go), wouldn't it make more sense for you to vet them first and return the one you want
I'm good with keeping it where it is, just figured I'd ask how to go about having it elsewhere 😅 First contribution so I guess I would like to use it more places haha
From what i've seen of the command the results have been pretty relevant to the search query. Most of the problems being described here are ones that could be confirmed or (whatever the opposite of confirmed is) by trying it out. I think the harm of trying it out has been overstated here
for his approval?
he has approved it iirc, lemme find the link
https://github.com/python-discord/api/issues/7#issuecomment-894690425 counts as a approval?
Well, I don't think so. I never got assigned :/
I've set up the environment but never generated the models.
Ayy wookie, fast boy
Thanks
Wait I don't get it, why does it add a completely new file?
Probably because I suck at git
looks like an old base branch
I tried to make a new branch for the fix, since I read that was a good way to handle separate issues
You may have based on the old branch then
wookie, should I make the hidden * bold?
@short snow wdym by "replacing all punctuations would space could spoil words I guess", I think it would be OK if we just replace it in the title, maybe soemthing like
for word in re.split("\W+", title):
extract = re.sub(word, "\*"*len(word), extract, flags=re.IGNORECASE)
doing that sounds fine
like if any of the title has ' in the title, and then we remove it, like can't becomes cant but i think rapidfuzz can detect that
oh hmm in that case my solution just there would remove all cans and ts from the results though which isn't great lol. I guess we could just not split by some characters like ' or ", lemme try something out.
I mean, this is the rabbit hole we probably don't want to fell into haha
This is natural language processing, fuzzy matching will of course not provide any great result
true lol, would be hard to get something perfect 😄
That, or we lock recruit @trim cradle in a cave to make the algorithm perfect
wookie mail, co-authoring you
you can check a commit from them
Why is there wookie mail
When co-authoring I just go to a random commit from the user and copy paste their author line
I think we can just go for, split by characters that separate words, e.g. whitespace or -, then strip punctuation from the edges, and then sub
For real though, @trim cradle, would you know any tips and tricks we could use to make the quiz command detect correct answers better than blindly fuzzy matching the message?
I think I figured it out. Tried to do the first one from the command line only, but the new one is just from "editing" the file from the github web page
Is there like a better algorithm than fuzzy matching more adapted to this?
for word in re.split("[\s-]", title):
word = word.strip(string.punctuation)
extract = re.sub(word, "\*"*len(word), extract, flags=re.IGNORECASE)
Ok that's perfect nobody can convince me otherwise 😎
@green oriole I can look into it later
All we really want to do is split a sentence into words so we can substitute them out of a text
how is \W different from \s
hmm actually we should only sub out full words rather than parts of words

\W is the same as [^a-zA-Z0-9_], \s is only whitespace
so basically \W contains punctuation, \s doesn't
oh
W stands for word characters
Ok,
for word in re.split("[\s-]", title):
word = word.strip(string.punctuation)
extract = re.sub(rf'\b{word}\b', "\*"*len(word), extract, flags=re.IGNORECASE)
@timid sentinel done
Heyyy wookie 😀
8 is a literal, not a constant. But what feedback were you interested in for linking me to this?
I'm not too sure, https://github.com/python-discord/bot/pull/1786#issuecomment-908505064
Unless they think anything is inaccurate about my proposed changes, I think they should just substitute them in verbatim.
"By adding variables as attributes to your bot" isn't misleading per se, but the variable itself is something that can be deleted after the object it refers to is given another reference via bot, but the actual object will still be there.
I don't know their username on Discord unfortunately so we can't talk to them directly
unless
It's both haha
oh right
@severe tangle
@severe tangle discussion of the reviews on the previous version of your PR.
Hm?
I guess? is "Hello world!" a constant?
No ```py
a = "Hello world!"
b = "Hello world!"
a is b
False
x = 8
y = 8
x is y
True
8 is 8 might work coincidentally because of how certain integers are pre-allocated when the interpreter starts, but that's just an optimization. It's not part of the spec.
it is a constant in the same way 8 is, but constants is not really a term for objects in python beyond the few builtin constants
Yes, thank you for your contribution! Would you be open to substituting the changes I suggested verbatim?
sure
ah
!e print(10_000_000 is 10_000_000)
@trim cradle :white_check_mark: Your eval job has completed with return code 0.
001 | <string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
002 | True
huh
immutable literals compiled together are fetched from code constants
dank
so, what do u want me to change in the md file now?
I made two suggestions in the original PR--if you can just copy them in, I will approve it.
Though it might be later today that I take another look
ah, ok. I will just accept them. That is fine with you?
I only left them as comments in the original PR. I can't go back and add them as proper suggested changes because that PR is closed.
Ah, I will manually do it then
Sorry about that. I don't really do code reviews very often except for language-related stuff.
I think I can take a look this evening
Sure
@vale ibex lmfao that PR timed out
I tried trolling you and I got hit with karma
the god damn coverage report timed out
you didn't review for request 
@vale ibex have you tested this?
Yea, we've been testing it for weeks in lance too 😄
.github/workflows/build.yaml lines 11 to 13
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true```
👌
What are your opinions on the .gitmessage templates? I could see them being useful for newbies like me
is that a template for commit messages?
Yup! I am trying one out locally that is kinda nice, includes the 50 and 72 character limit lines, place to include an issue etc
Yes
interesting
And the format can be standardized based on what you save it as. Just have to make sure that the config is set that way
This is mine right now:
# 50 characters #
# Subject
# (If implemented this commit will ___)
# 72 characters #
# Problem
# Problem, Task, Reason for Commit
# Solution
# Solution or List of Changes
# Note
# Special instructions, testing steps, rake, etc
Issue #
git config --global commit.template ~/.gitmessage.txt
Hey! Could someone take a look at site#369 ? It seems to be a high priority issue. 🙂
Is the fix you talked about one you developed during the Django codejam?
I believe so, yes.
Alright, sure, that can work
I don't have access to github from here though, do you wanna get assigned?
Yes, I do! 😄
Cool cool, if there's a staffer around who can do it
Just grab the GitHub Mobile app©®™ :p
I need to log onto that device for at least three months by now
I just always forget about it
can I get approval to remove fuzzywuzzy from here and switch to rapidfuzz?
https://github.com/python-discord/snekbox/blob/main/deployment.yaml
Something to note is that the GPL licence is most likely of no concern since we're not distributing snekbox with it. It's only installed in the production env.
But if you just prefer rapidfuzz's features over fuzzywuzzy then sure
hm, I think fuzzywuzzy is the wider used one
I'm fine with it as is — as Mark mentions there isn't a licensing concern
so, would we switch it, or just add rapidfuzz?
You can just add both
I am personally not strict at all with adding new packages unless it's just for a meme or something, or would have no practical use given snekbox's restrictions (e.g. something for making network requests)
right
Also there is something to be said about the development activity on rapidfuzz vs fuzzywuzzy
yeah?
someone proposed adding scapy today which I'm for as well
I don't know what that does but if it doesn't go against what I wrote above then sure
building network packets
seeing that toml is in there, tomli too :))
I'm not sure what the code does, but apparently it works without connection: #community-meta message
yeah it's just packet building with a pythonic interface
you use / to encapsulate IP in an eth frame and whatnot, neat for teaching networking
what does tomli grant that toml doesn't have?
is compatiable with the 1.0 spec
toml only is compatiable with 0.5
you can get more info from pip and black devs, having had to move since 1.0 toml spec pyproject.tomls were breaking their tools on toml IIRC
yeah having a look, not opposed to adding that
So is there any point in keeping toml around too?
well, tomli needs a seperate module if you want to make toml
I kind of doubt anyone actually uses toml in their eval anyway, but whatever
yeah lol
I wonder if we can remove packages lol
I personally use atoml 🙃
dep caching might make that weird
Doesn't look like it would remove it.
What? But didn't we go through this? If the library is used (imported or linked) the project also has to be GPL?
snekbox code never imports it
It's just there available in the eval env. So it is the user code that imports it
^ you commented on using it for the tools in python which are never imported by the code
ex flake8 plugins
pydis code never imports it, yet you're still worried about their licenses
Ooh, makes sense.
@fallen patrol I comment on that? I do not remember that.
@plush narwhal yeah, but I think this is distinct from that, that has a much tighter tie to our stack, but snekbox evaluations don't, I'm not sure where the actual line is drawn though
wrong user ;-;
Yeah I didn't forget that but I didn't specifically mention tools like flake8
ah, whoops, one char off
I don't licences of tools generally matters, but I am no expert on this matter
Well, they do matter but things aren't typically in such manner that restricts use of the binary
Snekbox only exposes it through a server rather than distributing the software and I think AGPL was created to ensure that also counts
hmmmm yeah AGPL is just if you use a service you're entitled to source code right?
Maybe something like that. After yesterday's conversation I don't really wanna dig into licences anymore.
@patent pivot join us in vc
wait crap nvm I've forgotten what I've needed to tell you
lol, neither
am gaming
oh nice dev-voice got opened to all
yeah but you can't unmute yourself unless you're a contrib or staff person
right
sure
don't reimplement a lot – just needs to call the command
we will need to get that command in the container though
bind9-dnsutils
Hello I have been experimenting with an OOP infractions refactor. Any thoughts on this so far? https://paste.pythondiscord.com/mewogidoli.py
I have my own comments but I think it's better for them not to influence you yet.
Why is it necessary for the classes to have names?
It's a way to map them to their infraction types. The goal is, when having some infraction data from the API, to avoid a big if-else to instantiate the right class.
Though that reminds me that for create(), that should be changed so it's able to infer the type rather than requiring it to be passed explicitly
It's a bit odd to me to be able to search all user's infractions with Ban.search
Mind if I join VC to see what you're working on? 👀
for sure xith is doing some programming
Should the class methods just be module-level functions instead then? I felt like that would be a bit inconsistent with some of the other CRUD methods that are instance specific
Joe, have you tried Kakoune? 😄
The official website of Kakoune, a selection-first modal code editor
Erm, similar to vim.
One nice feature is it has a client-server model. So you can use your own window manager, instead of having to learn two sets of shortcuts.
I'm wondering if it should maybe stay as a cog command and keep the infraction classes to apply and pardon. Although I understand your goal was abstracting away the API calls
But otherwise yeah, the search function doesn't seem actually tied to the class
Yes, in practice working with dictionaries has not turned out to be nice. I suggested years ago that we should wrap the API but people weren't feeling it.
What about the other classemethods
get is the same I think
I'm a bit fuzzy on class method inheritance and not in front of a computer. Won't calling Ban.from_data set cls to Ban?
Why not? If you call Ban.create that'll call Ban.from_data
I wasn't using Infraction instead of cls because I was playing around with an abstract subclass for expanded versions of expansions, which may have needed their own set of concrete subclasses. I didn't really like how it was turning out but I never changed it back to Infraction.from_data
Hmm. cls seems fine here though, you don't need to look for the right class in from_data then
So I tried to take over another's PR that was assigned to me...I somehow added all of my previous commits to the PR. The changed file is there though, and is ready to start the review process again. Sir-Lancebot#832
@brisk brook I think I got it half way right, I was able to pull his remote branch into my local
Maybe. My concern is that it is using the _types defined on Infraction. I guess it should be since the subclasses don't override that
If the point you're trying to make is that the _types is redundant cause the cls gets set, I was trying to say that if you receive a response from the API you won't know which class to use so from_data takes care of creating the correct class.
Sorry I'm not sure I'm following. Reading the code, my impression is that the ban command will mainly become
infraction = Ban.create(...)
infraction.apply(...)
In that case I'm not sure why cls can't be used
Think about what needs to happen when you get a response from the API and need to create a class (e.g. get or search)
Yes, these are classmethods that are accessible on the concrete types, but that was never the intention.
you needed to change to main-- git switch main
The idea is that if you just have an infraction ID, no idea what the type is, you get a response and it has a "type" as a string, and now you need to find the class that corresponds to that "type" string.
Hmm I see
It can be optional in that case, but that doesn't really matter
But yeah, create and from_data seem fine as class methods
hellllo
oh
right
hmm
yeah
maybe add a another embed for the edited embed
to see the two differences?
or just add another field to the embed
ah yeah
no edits?
yeah
idts
def shorten_text(text: str) -> str:
"""Truncate the text if there are over 3 lines or 300 characters, or if it is a single word."""
original_length = len(text)
lines = text.count("\n")
# Limit to a maximum of three lines
if lines > 3:
text = "\n".join(line for line in text.split('\n')[:3])
# If it is a single word, then truncate it to 50 characters
if text.count(" ") < 1:
text = text[:50]
# Truncate text to a maximum of 300 characters
if len(text) > 300:
text = text[:300]
# Add placeholder if the text was shortened
if len(text) < original_length:
text += "..."
return text
haha yeah
okay mr. webscale
Alright, thanks. I agree with the feedback and will make those adjustments
any other functionality to be removed?
Maybe from_data is still confusing as a classmethod since it doesn't return the same type
Doesn't the response say what type of infraction that is?
You could get the right class in the search and get functions
Instead of inside from_data
What I mean is that if you do Ban.from_data it doesn't necessarily return a Ban. It could be any type. It makes sense when used as Infraction.from_data but it technically works on any subclass too.
Maybe not that confusing to use it, but if you're reading it, it might lead you to believe it's a ban that's returned
And there's no way to enforce that it's only called from Infraction
If you use cls and this, then it'll be guaranteed to return the same type
Yeah I guess it can be removed entirely or just be made private. I don't really see a reason for someone outside the class to be dealing with raw API data.
Ah yeah, if you do that then it's just an init wrapper
Tbh, that would be useful. I use fan-noise to tell if there's an infinite loop in my code 
@patent pivot
There's an xkcd for that
Well that's what it's intended to be currently.
Yeah I mean if you export the class fetching then it doesn't do anything but call the init
At which point you can just call the init
what, are these some new stuff
Right. I was speaking in terms of either doing your idea of fetching the glass in get and friends, or keeping it in from_data but making it private
@slim widget https://xkcd.com/1172/
Out of curiosity what did you notice yourself?
I was thinking the same thing
your volcy has a pr up mr.webscale
- Using an overload so I can easily get kwargs has the disadvantage that it defers validation completely to the API.
- Type annotations don't have the
Unspecifiedtype, but it's so ugly if it's added 😦 - The time parameters could accept anything that
arrow.getaccepts, which can be implemented once my time refactor PR is merged - Not sure how to add some of the other infraction metadata (e.g. the icon, the pardon text)
- Don't know how to implement support for expanded infractions
- The dataclass has to be separate from the abstract class because mypy complains (I don't remember if it otherwise works or if Python also crashes)
- Converting timestamps to arrow.Arrow in the dataclass is hacky since the dataclass is frozen. It also makes the
__init__a bit confusing since it's supposed to take strings but that isn't clear from type annotations
Alright cya, bye guys
Ah yeah, I wondered about the unspecified part, but thought that was maybe some practice I'm not familiar with 😅
It's an interesting problem though
I guess you want kwargs but be able to tell the user what the possible keywords are
Yes. Otherwise I'd have to check each parameter for being unspecified so I can avoid adding it to the payload
Plus I'd have to manually construct the dict to send to the request
Constructing the dict doesn't seem bad
I had to do it for create. It feels redundant especially when there are many params
Wait if you're doing the overload anyway why can't the args all be optionals?
For which function?
Search. Just not sure why you need default values for them. Oh wait I do
Yeah, on macos it's running an entire linux virtual machine @twilit juniper
To get the right behaviour in IDEs like PyCharm
How is that an improvement, besides being able to validate params a bit earlier?
Just seems a bit cryptic atm
The infraction icon is probably a class attribute for each subclass
lol, well doesn’t windows do the same thing?
With WSL
Using a WSL backend is optional, as I remember it
For docker no
You could potentially iterate over the locals
You can uncheck Use WSL to use Hyper-V instead
Then you have to remove unrelated locals
Yeah I was thinking that. The one caveat is that abstractness cannot be enforced, for what that's worth. There is a trick where the abc defines @abstractproperty but the subclasses just use regular class attributes. However, concrete classes are only validated when instantiated, yet class attributes don't require instantiate to be accessed. IIRC I played around with a way to "statically" validate that but yeah I don't think it's necessary.
That would be done at the beginning of the function
Fair
Interesting idea. I might try it to get a sense for how hacky it feels
Hmm yeah. Maybe you could raise an error with a metaclass but that seems overly complex, already having a separate dataclass and abstract class
@patent pivot arcade still broken
I believe it should be https://api.arcade.academy/en/latest/
and the pd and np packages which do nothing apart from adding duplicate symbols
!doc refreshdoc
- np, pd```
!d arcade.AnimatedTimeBasedSprite
class arcade.AnimatedTimeBasedSprite(filename: Optional[str] = None, scale: float = 1, image_x: float = 0, image_y: float = 0, image_width: float = 0, image_height: float = 0, ...)```
Sprite for platformer games that supports animations. These can be automatically created by the Tiled Map Editor.
@patent pivot can you change your name to something longer or shorter? Right now your name is causing me to think you're hemlock >_>
Mr. Webscale K8s Man perhaps
OH sorry sorry sorry
Mrs
fixedd fixed
big thanks! :D
lmfao
I ... apparently don't read names anymore and match on approximate shape, length, and color
@twilit juniper which video
I'm learning so much about github by failing so hard at it....Finally got everything set up to work on the actual file that needs changes
sir-lancebot#833
to lancebot
isnt it in the py bot ?
no
There are no templates for the python bot
ah alright
thanks for letting me know :D
Speaking of templates, just opened up sir-lancebot#834 for commit templates
@vocal wolf you mentioning on sir-lancebot#814 that it's preferred to only assign a PR when it's not the author working on it. Does this also apply to the bot repo?
imo it applies to any repo
but yes
👍
My logic was that it distinguished between "does this have anyone still working on it?" and "the person working on it is the author"
But good to know
I suppose it doesn't matter too much, but can anyone think of a branch name for bot#1780? All I can think of right now is ignore-errors-from-infr-attempts-on-mods which seems rather long lol
Then again, we do have longer ones like Only-check-domain-filters-against-URL-like-parts-of-a-message, so guess length just doesn't matter in a branch name
if hasattr(user, 'roles') and any(
moderation_role in user.roles
for moderation_role in MODERATION_ROLES
):
confirm_msg += " as target is a moderator or higher"
else:```is this the correct over-hang indentation for the `any` statement? pycharm indents an extra level but not sure if that's inline with pydis styling or not
ignore-infra-mods-errors
Doesn't need to be long enough, or explain what it does (because you will have a pull request attached to it), just needs to be unique.
👍
Hell, you can even use fix-1234 etc.
True lol
This passes linting so assuming it's fine
It's the any overhang I'm not sure about (lines 4 and 5)
I have a faint memory of such an error, something like "continuation line on the same level as next logical line"
I think that looks fine so as long as passes linting I'd say I am happy
Yeah, it passes linting so I'll leave it 👍
async def infraction_group(self, ctx: Context, infr_id: int = None) -> None:```should the typehint for `infr_id` be changed to `Optional[int]`? I was told in the dpy server that you shouldn't do this when the argument is the last of the command (or in this case, group), but not doing it does technically make the type annotation incorrect
It's not a big deal and I don't think we want to mess with discord.py too much
It's fine
Hey peopl!
will changelog that now
@clever wraith Is there an unreverse command for @dusky shore ? Cuz he just made my avatar so weird and I want my old one back. Or would I just have to manually change it?
Oh wait I thought it saves it to my actual profile
Nvm
Sorry for the ping
just reverse your reversed avatar to make it normal
Right
Yeah mb
I guess I haven't fully waken up yet
lol, i know the feeling
I literally woke up 10 min ago
Folks, it is happening
https://github.com/python-discord/sir-lancebot/pull/835
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 sol...
If we can have many people trying to break this version of the bot, that'd be perfect
tests :help_me:
for clean cog, zig's rewrite PR, why don't we use the metricity for getting messages from channels? I would be much faster IMO?
Metricity doesn't store message contents. I'm also not sure speed is a concern here
As in, it shouldn't be unbearably slow, but that's not the case we're in
no dw
it doesnt save
Yeah I realized that only after I sent that
lmao
Mb
Ah right, I thought metricity also stores the message contents
also really nicely documented 👌 PR and code
@patent pivot This is about the enhanced incidents message PR, do I show that the message was deleted in the embed if the message gets deleted after the incident gets filed
nope — no retroactive updating of message stuff, we can do that via existing logs
Spring cleanup?
hardly, it's just 4 nicely separated commits
why spring cleanup lol
there are like a few dozens actual changes, rest is lock file
Autumn cleanup 😤
@vale ibex mind taking a look at https://github.com/python-discord/sir-lancebot/issues/819 when you are free ?
Done
@vale ibex Could you also take a look at sir-lancebot#823 as well please? Thanks so much!
tysm <3
As wookie said, it looks very similar to the snake antidote game we already have
which is essentially mastermind but with a different theme
Ok, so my guess is I can't do it then?
Yea, I don't think it's worth having the same game in the bot twice
you could take a look at the snake antidote game source and see how it compares to your implementation
You could always see if you'd do it differently or if there are improvements to be made
or, you can wait a few days for the discord py 2.0 PR to be merged, and make a game with buttons
or re-write some of the games with buttons
Ok, sounds good, tysm!
Yes
we have a PR up to migrate sir lance to discord py 2.0
then we can try out the new features there, and do a dry run of 2.0
Buttons! Buttons everywhere for all the events!
if all goes well, we'll migrate bot to 2.0 too, and see what features can be migrated to interactions
we're not going to do one huge PR to re-write everything with interactions tho
Sorry for the silly question, but do we clone a local sir-lancebot from the PR to test it out on 2.0?
Or how would that work
Not a silly question! But essentially, you clone the sir-lancebot and then switch to the branch that Akarys is PRing
Ahh branches. I've been learning breaking a bunch of things with branches recently
@vale ibex Just to make sure, this is the snake antidote source, correct? https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/snakes/_snakes_cog.py
I've got a nice alias I use for git to check out a PR, since contribs can't make public branches
cpr = "!cd ${GIT_PREFIX:-.} && git fetch origin refs/pull/${1}/head && git checkout FETCH_HEAD #"
then you can do git cpr 1234 to checkout PR 1234
A Pull Request is essentially saying "hey, I'd like to merge this branch and its commits into the main branch". So to do the actual evaluation of the PR, you review the branch
you'd need to change origin to upstream though, to be able to checkout via your fork
... or just feel free to use GitHub desktop and do it with buttons
.src snake antidote
Right. And I keep running into the issue where a make a new branch, but it includes all of the commits from my main branch
Thanks
If you have a fork, you can pull down the changes to your fork, then switch to the branch
I'll bookmark Chris's command there for a reference

bot#1794
