#dev-contrib
1 messages Β· Page 150 of 1
Your reminder will arrive on <t:1635878673:F>!
Here's your reminder: .
[Jump back to when you created the reminder](#dev-contrib message)
just closed now i guess
Think you could delete the issue too?
or delete their words
they got some words which would be ban worthy in it
even if it just lyrics
Going off what we've discussed so far, I believe the only thing that you still need to set up is TRASHCAN. That's just a custom emoji on the server where you are running the bot. You can type \<emoji_name> into discord to get the value for that variable. Mods and Admins are optional role IDs for certain features, you can get them by right clicking on the role, like you did for channels
I can't delete it, don't have the perms. I've already escalated it, and I'm just gonna leave it up for a little bit while someone who has the perms gets to it.
ah
Have not gotten past this error but I did set up a TRASHCAN variable
ClientOSError: [Errno None] Can not write request body for http://localhost:8061/eval
Also, I used localhost:8060 and 8061 but now those give me ERRO[0000] error waiting for container: context canceled , if I use port 8062 it works
After a few tries I suspect 8062 won't work
Dude maybe I should use docker for evalbot instead of what I'm doing right now?
It should just be what you used in the docker command
actually
I know why lol
sudo docker run --ipc=none --privileged -p 8061:8061 ghcr.io/python-discord/snekbox
The ports here are in the format host_port:internal_port
You shouldn't change the internal one, even if you change the external one
So try sudo docker run --ipc=none --privileged -p 8061:8060 ghcr.io/python-discord/snekbox
And the URL in the bot would still be this
I shouldn't, although I didn't close it nicely. Just CTRL+C
hm
Try taking them down
docker container stop <ID>
If you want them to be removed when you stop them
add --rm to the docker run command
sudo docker run --rm --ipc=none --privileged -p 8061:8060 ghcr.io/python-discord/snekbox
I just done this by myself for once I feel accomplishment today
noooice
Woo hoo we are on a roll
When I attempt !eval print("") I get ClientResponseError: 500, message='Internal Server Error', url=URL('http://localhost:8061/eval')
Are you able to make repos under pydis?
We'll need the logs from snekbox lol
No, the power of opsec π€
docker logs <container>
I'll get this now, there's exception occurred while trying to process the request and then traceback to some code
Docker still runs after this though
Could you post the traceback
yes I can
just a moment
File "/home/stivens/.cache/pypoetry/virtualenvs/evalbot-dJNuoo1j-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/stivens/Desktop/EvalBot2/evalbot/bot/exts/snekbox.py", line 298, in eval_command
response = await self.send_eval(ctx, code)
File "/home/stivens/Desktop/EvalBot2/evalbot/bot/exts/snekbox.py", line 186, in send_eval
results = await self.post_eval(code)
File "/home/stivens/Desktop/EvalBot2/evalbot/bot/exts/snekbox.py", line 54, in post_eval
async with self.bot.eval_session.post(url, json=data, raise_for_status=True) as resp:
File "/home/stivens/.cache/pypoetry/virtualenvs/evalbot-dJNuoo1j-py3.9/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in __aenter__
self._resp = await self._coro
File "/home/stivens/.cache/pypoetry/virtualenvs/evalbot-dJNuoo1j-py3.9/lib/python3.9/site-packages/aiohttp/client.py", line 625, in _request
resp.raise_for_status()
File "/home/stivens/.cache/pypoetry/virtualenvs/evalbot-dJNuoo1j-py3.9/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1000, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('http://localhost:8061/eval')
This happened when I ran !eval print("")
That part should be fine, the 500 indicates it's an error on the snekbox side
Debugging that would mean checking the output of snekbox
If you're referring to the output of docker logs, the output is twice as large as that traceback
Maybe a bit more
That's unfortunate, post it anyway lol
Should be able to use the pastebin for that
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Hastebin*** lol
Could you run sudo cat /etc/mtab | grep cgroup
yes I can just a second
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0
Ok, unfortunately, this does get into more complicated territory. Snekbox only supports cgroups 1, not 2 right now. It's still possible to get cgroups 1 though. Are you running this on your personal machine?
Yes
Laptop running Ubuntu 21.10
Do you need my specs as well or have I passed the inspection π
Haha yeah that's enough info
I'm running non-LTS because I installed 21.04 at first and didnt realise
Just going to wait until the next LTS version, no use downgrading to... 20.04 I believe it is
So, to get it working, you'd need to downgrade cgroups. That means adding the necessary flags to your kernel, and reinstalling docker. Would you be comfortable with doing something like that, or would you like to look into other solutions
That depends, would downgrading cgroups have a chance of fucking up my system? If not then I'm fine with a bit of dirty work in the terminal
I believe you shouldn't see any functional differences
Then I'm fully on board 
Alright, while I figure this out
Go ahead and uninstall docker for now
Do you have a /etc/default/grub file?
I do
I removed docker using apt-get remove and apt purge but if I run sudo apt list | grep docker there are still directories and files present
I thhhhink we should be fine
Uninstalling is a precaution anyway
Alright, I'll need you to edit it
specifically
it's show time
the GRUB_CMDLINE_LINUX variable
I wish I had an ubuntu machine on hand
wait I do brb lol
Modifying the grub config for testing 
Currently GRUB_CMDLINE_LINUX=""
add this inside the quotes systemd.unified_cgroup_hierarchy=0. I think that should be all the config we need
It's not testing, it's local prodβ’οΈ
Alright, if you are testing in prod 
** (gedit:40168): WARNING **: 19:40:37.785: Set document metadata failed: Setting attribute metadata::gedit-position not supported
``` But it has been set to the given value now
If you're done with this, sudo update-grub, reboot, and then we'll check groups again
uh um
cp /boot/grub/grub.cfg /boot/grub/grub.backup.cfg please first @worn swallow
Might need to sudo
Yup yup
The power of virtualization \o/
done
It is free, duh
reboot, yeah?
yes please
No, pray first
that too
Excellent
it should be a fairly mundane change, but caution is never a bad idea
Here we go
If I'm not back in like 5 mins assume It fucked up or I died or wifi is down
You'll be remembered
I'd be more scared that the configuration isn't what they would expect to be, due to grub-mkconfig needing to be run with a special param or a package having fucked up a hook
You're suddenly making me very nervous about copying a well defined option 
The change in itself isn't bad, at worst you have more alerts in your system logs than atoms in your computer
lol
It is just regenerating the config that is a non trivial operation
Are you back from your adventure
my adventure? The grub reboot?
dude this was the announcement
oh lmfao
π
Did it fully boot?
Im not sure what you mean. Is my operating system in two pieces? I dont think so so I say yes
Its working as normal
Yeah, do you see your desktop like normal
If that's what youre asking
Cool
yep
In that case, redownload docker, run the docker run again, and hopefully it should work this time
alalalalal let's do this
just to remember
docker runs
if thats a surprise to anyone lol, just thought I should say
The only surprise here is how fast you are blasting through these steps
Genuinely shocked
Haha, yes
I thought you were still going to reboot after you had already installed and rebooted everything...
Yeah, it is usually 30 minutes to ask people to give us the content of a file
So not so bad haha
π
:O
Yaaayy
this is the most hyped I've been about no output
lol
a little french-flare every now and then doesn't hurt
Am I getting missing permissions for not having mod or admin roles? I have included an environment variable for the emote
And it works
The worst is it does that every time for add reactions because it doesn't make sense to has an s here in English
The bot is missing permissions on the server
The bot itself will need the perm
You probably only need to give it that one
Better be safe with bot perms
Um.. if it has admin role it should work lol
thats what im saying
These gifs are all on point haha
traceback?
one moment por favor
docker logs doesnt seem to have any errors, but the terminal in which I ran poetry run python -m bot has the following:
fucking idiot I closed the terminal
let's try this again
Been there way too many times lol
Hahaha
interesting, so, I'll send the error in a min
I ran !eval print("Hello"), it worked
I ran !eval print(""), also worked
but then after waiting for a while I got that same error I posted earlier, I'll send the traceback now
I would probably blame it on discord heh
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
!paste
yay thank you
Hehe
Oh that's silly
It neeeeeeeeedds
Manage reactions?
If that isn't a thing then manage messages
so needy
It has admin role, am I to change this in the server or in the bot's settings in discord dev portal?
just the server's, but I'm confused why admin isn't working
Can we just reboot discord?
Try clicking the π emoji
ah, okay
but i must remain vigilant
must watch it... forever
Please hold for a short customer satisfaction survey
no less than 11/10
Please rate your experience with @gritty wind from a range of
to 
lol
Now I want to get this bot hosted, nothing bad should happen
How do you rate your assistant helper, @clever wraith ?
Our system sees that you rates Scale as a
, please let us know what went wrong and how we can improve our performance
Do I rate them, or does the customer
Yay!
yo what the fuck
Imagine if that was an actual thing.... #community-meta
I'm just messing, Scale and Ali are great!
You're great too bud, this was the most productive help session I've participated in on this server in terms of results:time
Oh 100%, I would have expected having to change boot params to take at least 2-3h
Lol
I'll come back here if I have any problems related to the bot when I try to host it
I found this site, https://something.host/en/
So, idk what your hosting situation is, but the bot has a docker container published π
If you're trying to host the bot, it's probably not a great idea to use a Minecraft host. Something like Linode or DigitalOcean would probably be better.
I was thinking about hosting it so that I dont need to have my laptop and two terminals on at all times
Sounds good, I'll look those up. I just found that one on a list of top 7 discord bot hosting platforms. Was number 2
Ignore what I just said, they have "DISCORD BOT HOSTING" on their home page.
I blind
Hehe, good luck with your next adventure!
Sorry you can delete that if you wish I just found that really funny
might as well leave a parting gift
gl with your projects π
Yeah, about that.
Could someone take a quick look at api#25? π
I guess, so. π
Is there a webhook for linking issues to here?
What do you mean?
sir-lancebot#938
Turns out, yes
!remind 7h add this to wtf
Your reminder will arrive on <t:1635974163:F>!
want to be assigned?
Sure, if no one else takes it up! Could be an easy one for a new contributor
Just depends on if you want it now, or leave it up for grabs
you should be able to self assign things now too, if you wanted to claim things π

True, you're PyDis staff, after all, Brad
Imposter syndrome I guess
Still need an approval one more approval on sir-lancebot#937
Lol
It's approved though
Then why is there a 1 out of 2?
Because you selected one option out of two boxes
At the bottom of the issue description
Yeah, ignore that. GitHub uses the checkboxes as "tasks" for tracking how far you've gotten through an issue/PR but in our case we use it for checking if you want to implement yourself or whether anyone can
If you check any other issue (on lancebot) it'll be the same & say 1 out of 2
Ahh ok, got it.
I think we should use something here btw, since that's a thing
There's this one feature I've been wanting from the python bot. Being able to use matplotlib and embed the created plot after calling plt.show()
A custom backend would probably be needed, similar to what ipython does.
So I think that's going to be a significant deviation away from how our snekbox and !e command works
So our eval works currently by essentially passing whatever is in the message/code block to a sandboxed container that has a python interpreter with python -c and it returns the output. It doesn't do anything REPL/ipython/graphical-like
@white light @thorny obsidian https://github.com/python-discord/snekbox/issues/103
We discussed this earlier in the year, it's something we're interested in and can support in snekbox, just haven't done any work to it
but as the issue notes
Supporting byte output would allow a much more diverse range of things that could be returned e.g. images and sound.
oooh neat, I missed that
From the dpy docs it seems there can be 5 rows of interactions. My questions are:
- What's the number of buttons a row can contain?
- Does a select take up the whole row?
Also, I only see these two types in the dpy docs. Wasn't there a thing where you could input text?
I don't think text field exists. There is dropdown
- 5 so 5x5
- Yes, inside an ActionRow you can only fit one select menu
No; only planned or whatever
Nooo
OK that kiils one thing I wanted to do
The other is more important anyway
You essentially have 3 things you can create..
- Link buttons
- Buttons
- Select menus*
- *select one thing
- *select multiple
Does the bot have more_itertools?
if it doesn't feel free to add it
Eh, feels excessive for what can be solved with a list comprehension
Ah, we do
Excellent
but if everyone thinks like that nobody ever adds it and you end up with a dozen less readable snippets because individually they don't seem like that much :P
That is true
I doubt most of more_itertools cannot be factored to a small list comp or something like that too
The snippets may be a little harder to read, but you can still write very clean, very readable code without itertools
I'm of the opinion we try to keep dependencies as few as possible
The more dependencies, the more moving parts, the greater the risk of something breaking, becoming unmaintained, becoming a source of attack, delaying upgrades (we already feel this significantly), and the more headache in general
I think adding C deps is more problematic than pure Python, strict pinning of versions pretty much solve all of those problems, there is a very tiny chance a pure py dep from one major python release to the other, and only bumping when necessary limit attack vectors
that's my two cents on it
Here's your reminder: add this to wtf
[Jump back to when you created the reminder](#dev-contrib message)
We don't update dependencies, and it's possible for attack vectors to be introduced even if you don't upgrade versions. Hell, it might even be more likely. Look at any of our repos that have dependabot and scanning.
Pure python deps can also break over time, but that's highly dependent on the context. itertools is less likely to break because it's calling normal python function, in mostly normal ways. Other dependencies which interact with other systems, or use features which are not available in all versions do still present problems. The reason I would (and did) argue against more-itertools is because it's utility is very low imo. The code you write with more-itertools isn't all that much shorter or clearer than the non m-itertools version
Hey @patent pivot, how does the view here add these buttons as children? I don't see it being set anywhere? π€
https://github.com/python-discord/king-arthur/blob/main/arthur/exts/kubernetes/deployments.py#L68
arthur/exts/kubernetes/deployments.py line 68
@ui.button(label="Cancel", style=ButtonStyle.grey, row=0)```
Ah ok, dpy does dynamic funky stuff
Yea, the button deco adds it to the view when you subclass the view
if you want to subclass buttons directly, ather than define N behaviours
you can do this https://github.com/python-discord/bot/pull/1868/files
see subscribe.py
What are you trying to do?
Hopefully I'll be able to show it soon
Hmmm that's weird
ctx.send leads to this line https://github.com/Rapptz/discord.py/blob/master/discord/ui/view.py#L195
discord/ui/view.py line 195
return item._rendered_row or 0```
I indeed added them to the view
But I don't see this attribute being defined anywhere except in Item
Which I'm not using
I'm not even sure where it's being used
buttons subclass items
what issue are you having that's led you down the rabbit hole of d.py internals?
That the buttons don't seem to have this attribute
Yea IG I'm asking why do you care
Because ctx.send with a view leads to the line above
ctx.send takes a view, which is made up of items
items are implemented by buttons and selects
I created the buttons with the decorator
But the decorator doesn't set this attribute anywhere
the deco attached a Button to the view it's called within
and Buttons subclass Item
and _rendered_row is an attr on the Item
hmm
The Button class is attached to the callback function, but the callback itself is not a Button
And doesn't have the attr
also, I'm pretty sure it's an internal attr that's only used by selects anyway
since it stores which row is currently the active row
Apparently not, since my code throws an exception on that line
Because it doesn't have that attr
could you paste the error and your code?
AttributeError: 'function' object has no attribute '_rendered_row'
Because the callback is a function, and not a Button
What's your code look like?
Like a devilish hack
But I'm basically doing this:
@ui.button(...)
async def callback(view: ui.View, button: ui.Button, interaction: Interaction) -> None:
...
self.children.append(callback)
you're missing the self attr
the button decorated function needs to be within a view class
hmmmm I'm not sure
It looks like you're doing that in that PR in the edit part
Hmmm.. I guess I can subclass as well
But all the init_subclass is doing is appending the callbacks to self.children
The deco is just ```py
def button(...):
def decorator(func: ItemCallbackType) -> ItemCallbackType:
if not inspect.iscoroutinefunction(func):
raise TypeError('button function must be a coroutine function')
func.__discord_ui_model_type__ = Button
func.__discord_ui_model_kwargs__ = {
'style': style,
'custom_id': custom_id,
'url': None,
'disabled': disabled,
'label': label,
'emoji': emoji,
'row': row,
}
return func
return decorator
yeah, and then you have:
def __init_subclass__(cls) -> None:
children: List[ItemCallbackType] = []
for base in reversed(cls.__mro__):
for member in base.__dict__.values():
if hasattr(member, '__discord_ui_model_type__'):
children.append(member)
if len(children) > 25:
raise TypeError('View cannot have more than 25 children')
cls.__view_children_items__ = children
So doesn't init anything then and there, I'm not sure how and when the __discord_ui_model_type__ gets inited
So it just finds the callbacks and appends
No point
That's the weird part
Oh wait
found it
def __init__(self, *, timeout: Optional[float] = 180.0):
self.timeout = timeout
self.children: List[Item] = []
for func in self.__view_children_items__:
item: Item = func.__discord_ui_model_type__(**func.__discord_ui_model_kwargs__)
item.callback = partial(func, self, item)
item._view = self
setattr(self, func.__name__, item)
self.children.append(item)
First line in the loop
View init
So I'm guessing the issue is that you're adding the button decorated func to the view after it's inited
Ooooh
Riight
I need to move the super call to the end
Or to just subclass Button
Yea, may be slightly less esoteric
Considering how esoteric my code is atm that would be a good thing lol
bot/exts/utils/utils.py line 169
name=f"Snowflake{'s'[:len(snowflakes)^1]}", # Deals with pluralisation```
π
adding context :D
@thorny obsidian
Got some things done, essentially:
[x] Added stats onto the embed that shows the correct answer showing how many % of answers got which answer (I can remove this depending on what you think)
[x] Added the 'algorithm' that just adds zero width spaces in nearly every space besides the areas where you have ``` or py, as that might mess up the syntax highlighting
[x] Added a button at the scoreboard that shows the user their individual rank if they didn't score high enough to be shown on the scoreboard
Let me know what you think of it and any other possible things to add!
Would it be possible to maybe have .pr have argument to choice in between 1-5 and if not specified it would be 5 by default.
.pr
You must have at least one issue/PR!
**```
.issue <numbers> [repository=sir-lancebot] [user=python-discord]
**Can also use:** `issues`, `pr`, `prs`
*Command to retrieve issue(s) from a GitHub repository.*
That command is used to link issues from repos though
I don't think it makes sense if we have a default argument
Wrong command Then
Sorry I mean .rp π
.help rp
**```
.realpython <user_search>
**Can also use:** `rp`
*Send 5 articles that match the user's search terms.*
Sure
.rp Python
Here are the top 5 results:
yea 5 as a default seems fine
IG an optional int arg before the query seems good
Since I doubt people will be starting their queries with numbers
Did you want to raise an issue/work on it @cursive relic?
erm I was more likely curious if it would fit to command and if yes I could open a issue.
Yea no worries, was more just asking rather than expecting you to do it π
Yea, it sounds like something that would be good, feel free to write up a brief issue and I'll approve it
I will try to find a some sort of message for it
And feel free to ask me about the program!
about the code?
Yeah, I wrote it originally
that's nice, I took a look at code and it does not seem too hard
does this seem good? And can I change the checkbox if I want?
Looks good to me
great, I'll post it π
So in the code, I would guess that this is the limiter? ```py
params = {"q": user_search, "limit": 5, "kind": "article"}
yup
so if there was argument amount = Optional[int] or something the number 5 would be replaced by amount
It would be amount: int = 5
oh right
so that it has a default value, but can be overwritten
Yea, that may be may bad for using the generic term optional for the arg, when it has a specific meaning in type hints
I'm trying to monkeypatch an attribute to a Command object. It works fine, but when the command is invoked it no longer has that attribute π€
are you doing it with a decorator?
or are you trying to do it to more than just one command?
well I will get on working with some sort of solutions, but how will I know if the solution is about correct?
I don't have sir lancebot in my server π
run teh bot, see if it works, if so you can then PR it and then we can give feedback π
Oh, did you want to get it up and running?
I think I have to
A guide to setting up and configuring Sir Lancebot.
Ah thx π
and feel free to ask any questions here π
I will π
Here's your reminder: Check, implement, test reviews for color command
[Jump back to when you created the reminder](#dev-contrib message)
12 hours ahead of you reminder π
Last big topic for color command is what to do with matching a color name based on the hex code with fuzzy matching (rapidfuzz/difflib) or RGB space distance with a new RGB list with color names
I have forked @dusky shore repo, do I need to pull the changes from there to update my repo as well?
Add the original repo as upstream and your fork as origin
huh?
Your forked repo is a separate entity front he original repo. You can git clone your fork locally to your computer, but at some point you will want to update it with pull from the python-discord repo. You can do that by adding it as a remote repo with a different name
Usually, your fork will be called origin, and the python discord repo will be upstream
Then you can update your forked repo from the original with git pull upstream main
ah I see, seems to be up to date
seems like it's working, the improvement to .rp command
hmm nvm, if I don't give the argument it throws a error
You need to give the default value
Like this? ```py
async def realpython(self, ctx: commands.Context, amount: int = 5, *, user_search: str) -> None:
I think you need Optional[int] = 5 because of how dpy works
Assuming this didn't work
aha, that worked!
Can I ask, maybe somebody remembers before, what was docker being used for when I was figuring out how to run evalbot?
I had to run sudo docker run --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox and then poetry run python -m bot
What should the bot do if bigger number than 5 is given?
Default to 5 as a maximum
But now just the poetry run python -m bot works, without using docker
Put the value to 5 ig
And if it's <= zero set to 5
if not 1 <= amount <= 5:
amount = 5```
might wanna send an error message if it's <= 0 though?
I personally would just do what I said above π€·
I mean I suppose technically < 1 is an error whereas > 5 isn't but π€·
if not 1 <= amount <= 5:
await ctx.send("Amount must be between 1-5")
return```maybe this
I think I prefer that actually
You would use this?
Yeah
Then I'll put it there
I guess technically "\amount` ..."`
Eh discord doesn't render that well
But amount should be in backticks to show it's an argument
"amount must be between 1 and 5 (inclusive)."
I'd go with that @cursive relic
Like this @cursive relic
Literally in backticks
`amount`
Oh you mean the error message π
With a decorator yeah
It's above, so like after in chronology
hmm odd
The current dockstring is this, what should the new be? ```py
"""Send 5 articles that match the user's search terms."""
"""Send a variable number of articles that match the user's search terms."""
thx π
Might be worth making it multi-line with an explanation below like:
"""
Send a variable number of articles that match the user's search terms.
The default amount is 5, but can accept a range from 1 to 5. If the user does not specify
an amount, it will default to 5. If the user passes a number less than 1, it will return
1 article. If the user passes a number greater than 5, it will return 5 articles.
"""
But this is sorta long
I can wait for others opinion about which one should be used
This describes it perfectly
Hmmm, I am not sure for this change, why does one want to select a number of articles?
They aren't getting any harm for getting more than what is needed
well if you want.
sometimes the fifth article might help
Just a feature I noticed when someone happened to ask about the amount of articles and I decided to come here
I am fine with more number of articles, but choosing less than 5 is π€·ββοΈ
this can be useless feature, but you still get 5 by default
Gimme one reason why one would want 3 (say) articles rather than the default 5... If it is a redundant/useless feature there is no need of adding it in imo
I don't have a specific reason for it myself.
If I know the top article for searching vim is the first link, and don't want to send the entire embed
.rp vim
Here are the top 5 results:
Vs.
well if ran in general the whole embed can "flood" the chat a bit
so can most tags, and far more than the realpython embed
I will anyways be making a pr even if it would be denied after
Well because you already know that, and the embed is really short to cover up the whole chat... secondly the command is only allowed in the bot channels imo so its fine
make an issue first
alrd did
you should wait till this gets approved properly
was it approved?
and it's approved
It is
where?
could always just read the issue lol
I think its a good quality of life thing to add
seems like my page ain't updated π
Yea, it's such a trivial change that doens't change the interface for anyone who doensn't care about it
it's fine to add.
anyways now comes the hard part, the commit message
I will give it the last tests and see if it works fine
I am still against it but fine... if we add it realpython we should do it for others too then
what do you all think, this one or the one above?
If the default is still 5 and it doesn't impact current usage... why be against it?
I don't think forcing consistency for the sake of consistency on lancebot makes sense
Yeah, this seems fine.
If the default is still 5 and it doesn't impact current usage... why be against it?
It's just not needed IMO
so I will add multi-line dockstring π
I mean most things on lancebot aren't needed, that doesn't make it a good reason to block someone from adding a feature they want
isn't lancebot like community bot and made for kind of random things
Yup, and is meant to be like an "intro" to contributing
Yup!
so far I have made 1 change to the bot, and it was only 1 single argument. And it took me ~90 minutes to make a pr for it π
Hah your first PR on any repo is usually a little longer
since you need to get setup and learn your way around the code base
"""Send `amount` (between 1-5 inclusive) articles that match the search terms (`user_search`)."""```Imo something like this is all you really need @cursive relic
Since it shows up in the .help I think we should keep it short
Yeah I like that more ^^
If you wanted multi-line then I guess```py
"""
Send amount articles that match the search terms (user_search).
amount must be between 1 and 5 (inclusive). If it's not, an error message is sent.
"""```
Which one do you prefer?
I guess the latter
I will probably make the pr in 2 hours
I'll play around with it now
Sounds good!
- https://github.com/python-discord/bot/pull/1634
- https://github.com/python-discord/bot/pull/1446
Need one more approval each :D
Feel free to @ me when you do and I'll review
oooh that's nice! @trail pilot
Thanks!
Thx, I will π
The only worry I have so far is rate limits. The counter and the confirmation embed are both done when a user answers
did I need to create a new branch for the commit?
If someone has idea for branch name and could help me to create a commit message, it would be needed (again)
git checkout -b rp-940 I usually have the cog / command and the issue as my branch
But if you are just PR-ing from your main, that is probably ok for now
I might use that as well
Just wanting to be sure, does this look good commit message?
the inclusive may not fit in there
Is your commit title there the Pr enchantment?
ye, I think so
So your commit title is arguably more important than the body of the message. Your commit title should be in the form of:
Action to complete thing
Examples:
Remove channel limitation with time range
Improve documentation for X
Add tz aware datetime
You'll notice they all start with a verb that's explaining what the commit as a whole is doing.
You want your commit title to do some similar, so people can look at just the title and understand the gist of what that commit is doing
oh I see
"When applied, your commit will:" Is how I think of commit messages. But then I converted to atomic commits
Now I came up with this, but the title still does not seem to be quite good
"Handle user-specified article amounts"
I should use that?
I think that's fine, you can try playing around with it but don't stress. Writing good commit titles + messages is a skill that times time and practice to get good at
It can probably change it slightly to Add option to get specific amount of articles, but again I think what you have is fine
(but capitalized A)
you saw nothing
I might use this one, it sounds better
Iβm gonna keep these features for now but remove them if when itβs tested, the bot gets ratelimited
I think the first iteration is done though, what should I accomplish for the second iteration?
did you see my review on your PR?
Ah, not yet
π¬ sorry in advance
For some reason I donβt get notifications for PR reviews on my phone
Also if I could request a squash + button push on this: https://github.com/python-discord/bot/pull/1918
I am looking over it again and I'll approve it afterwards
It's met the tag speedrun criteria, just requires a core dev to push the button
Don't hate me.. but yes I have one more comment
looks good?
bluenix zig commented on your review on enhanced incidents PR, could you look into it?
make the pr title, the commit title
So I think I know the reason behind all the bugs, but the scoreboard and whatβs my rank worked for me when participating, my best guess is that it didnβt register because it needs .trivianight stop, but that should be fixed with the new changes Iβll be making soon
I was about to do that
Now is time to click button of doom (create pr)
erm, there seems to be a problem
this seems to be as well in the pr
Did you make a branch off of the upstream main?
I think so
I only added the other file (realpython.py) to commit
and the status only had that file there
I'm guessing you had that changed file in your fork before you made the new branch, and github is detecting it as a change from your fork to pull into the upstream
how should I fix this?
Remove the file changes from your PR-linked branch
good catch!
In your PR-linked branch, change the code of the wikipedia file back to how it was before, add it and commit. It should then be removed from the PR but will leave a little bit of a messy history
contents, ctx, embed
so after I commit the changes, what do I do next?
ah ye, it's gone!
now time to click the button of doom
@static canyon, the pr has been made π
Thx again for helping π, until next time π
Also, would anyone mind approving sir-lancebot#909? It's a small fix for an error for the .challenges command it's just 4-6 lines of code
!remind 6h test and review open PRs locally
Your reminder will arrive on <t:1636060441:F>!
Thanks for the reminder Front π
linting failed == ?
no..?
poetry install pre-commit
then it will run the checks on each commit
!remind 3h Review
Your reminder will arrive on <t:1636049832:F>!
Will review when I get back home
that did not work ```
poetry install pre-commit
Too many arguments.
I'll try to get it fixed before that, thx!
poetry run task precommit
Yeah core devs have just hit their heads against the walls more times than you have so far
Don't mind the concussions
Creating virtualenv sir-lancebot-6DCunF8E-py3.9 in C:\Users\nipa\AppData\Local\pypoetry\Cache\virtualenvs
FileNotFoundError
[WinError 2] The system cannot find the file specified
at c:\users\nipa\appdata\local\programs\python\python39\lib\subprocess.py:1420 in _execute_child
1416β sys.audit("subprocess.Popen", executable, args, cwd, env)
1417β
1418β # Start the process
1419β try:
β 1420β hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
1421β # no special security
1422β None, None,
1423β int(not close_fds),
1424β creationflags,
nope, I have not done anything like that
poetry install first
Also, if this is sir-lance, it's actually a different command same command exists on lance too
poetry run pre-commit install
but after poetry install
both failed
I had an error in the first one, just updated it
so do I run this after install?
poetry run task precommit
pre-commit installed at .git\hooks\pre-commit
Should work when you next try to commit
If you'd like to run them now, use poetry run pre-commit -a
-a is short hand for --all
poetry run pre-commit -all
usage: pre-commit [-h] [-V]
{autoupdate,clean,hook-impl,gc,init-templatedir,install,install-hooks,migrate-config,run,sample-config,try-repo,uninstall,help}
...
pre-commit: error: unrecognized arguments: -all
``` I'm bad at poetry π
(both failed -a and -all)
it would be --all (two dashes). Why did -a fail?
oh actually I know why
it's because I'm an idiot
poetry run pre-commit run -a
was missing a run in there
run poetry run!
now it's doing smth
first time install is my guess
@thorny obsidian One more question!
Currently, I have a counter showing how many people answered.
Should I just replace that with the amount of seconds left? Or should I keep it and instead send like how .quiz does, doing 5s left, etc
isort (python)...........................................................Failed
- hook id: isort
- files were modified by this hook
Fixing C:\Users\nipa\projects\sbot\bot\exts\utilities\realpython.py
Flake8...................................................................Passed
``` isort failed, what does that mean?
I say do the countdown in 5 second intervals
Your imports in that file were not according to our style rules
Sounds good
So the check failed, but then isort fixed them
isort changes your files though so you should just be able to run it again and it'll work
Gotta add it again, commit it again
oh I see
And if the checks pass, then push it
"fix: typing import issue from isort"
so I would not need any body for it?
probably squash that when merging it anyway
so now I can use -m in git commit?
yeah
yeah
what does this mean?
It means I've left comments on your PR and asked for some changes π
They left a review and requested changes - Chris beat me to it
Quite often when you raise a pull request, other members of the community will comment on your code and ask for explanations, or suggest some changes
which one looks better,
where exactly the new line should come up?
imo, the first would be better if you didn't put 4th in code blocks and made them line up
Directly after the validation and before the params
to separate the validation and the rest of the command logic
here?
No, that after the docstring
the 3 lines after that you are doing validation on the amount the user specified
after that there should be a new line to separate that block from the next one
if I understood it correctly it should be here?
Yup
aight, I'll push it
lines = []
for index, (member_id, score) in enumerate(top_ten, start=1):
rank = format(self.ordinal_number(index), " >4")
score = format(score, " >4")
mention = f"<@{member_id}>"
lines.append(f"{rank}{score} β {mention}")
why doesn't this allign?
Is this good enough for commit message ```py
git commit -m "Seperated if statement from other parts of code"
I didn't read your code
but i am formatting them with >4
sec
lines = []
for index, (member_id, score) in enumerate(top_ten, start=1):
rank = format(self.ordinal_number(index), " >4")
score = format(score, " >4")
mention = f"<@{member_id}>"
lines.append(f"`{rank} | {score} |` {mention}")
but I'm not sure why the score isn't doing it
maybe try lines.append(f"{self.ordinal_number(index): <4}{score: <4} β {mention}")
nope, same embed
@staticmethod
def ordinal_number(n: int) -> str:
"""Get the ordinal number for `n`."""
first_3 = {1: ":first_place:", 2: ":second_place:", 3: ":third_place:"}
if n in first_3:
return first_3[n]
suffix = ["th", "st", "nd", "rd", "th"][min(n % 10, 4)]
if 11 <= (n % 100) <= 13:
suffix = "th"
return str(n) + suffix
``` ignore the func name and doc
could you give me the top_ten values?
What should I do on this case? ```
Trim Trailing Whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
That happens when there is a trailing whitespace on a line. The pre-commit hook should have fixed it for you
you'll notice that there is a new unstaged change now
so if you git add it again, it should pass
jason 
yeah a sec
thanks
shit i reran the bot, and cache got reset, lemme do a quick int eval
erm did I fail on something here, because I don't think I pushed that
it looks like you commited the changes in git, and then didn't pull locally before you added the new line
{797730108206743562: 300, 814305114482278412: 100, 98195144192331776: 30, 736234578745884682: 10}
so when you pushed lcoally it merged the two together
It's fine, we'll squash it before merging
meaning?
Your pagination pr is in the commits too
Looks like the merge brought your other commit messages into the history
ffs
you can cherry pick the required commits, but that's gonna get you even more confused
I don't see that, where is it?
the first commit added it to the history
then your second commit removed it
If we squash before merging it should be fine. Since it all all be shown as one commit in the main history
speaaaking of squashing and merging PRs, can I interest you in a very fun button press Chris?
so, I have fked up the thing?
depends on the colour
all green all the time https://github.com/python-discord/bot/pull/1918
nah, it's fixable, since I've enabled squash commit on your PR
so all of the history will be squashed into one commit and then merged
so I have to do something?
Nope, not this time π
alright back to formatting this embed π
eeey ty chris
ok yeah discord is acting funky and removing the spaces, adding backticks (putting into a codeblock, makes it work perfectly chris
for index, (member_id, score) in enumerate(top_ten.items(), start=1):
mention = f"<@{member_id}>"
rank = ordinal_number(index)
buffer = 4 if index >= 4 else len(rank)+1
formatted_rank = format(rank, f"\u2800<{buffer}")
lines.append(f"{formatted_rank}{score:\u2800<4} β {mention}")
u2800 smart
the issue is that the emojis are super long, so you can't just do <4
since in Python land they're still the :blah: format
yeah, thanks π
but again, they don't really line up since emojis aren't mono-spaced π¦
that should be fine, not really noticeable in your screenshot
Yea, not sure why the lines are so far apart in my screenshot
Time limit is now working!
@thorny obsidian So you mentioned in the scoring that if they answered <2 seconds and they got it incorrect, points would be deducted. What if speed was reduced too? The speed is the total speed / amount of times they answered
So if there was an added 0 to the speed since they answered too fast and got it incorrect, the average would be brought down
What do you think?
let me work through some of my examples with that and I'll let you know
Sounds good, for now I'll just implement what you wanted
Kahoot style scoring works!
I just have to round it now
Also, I'm gonna deduct ~0.5 seconds from all the times, since there is some overhead with the button that'll increase the time a bit
So earlier in #community-meta, there was a discussion about adding a tag referring to str.removeprefix/str.removesuffix
Do adding tags to the bot work like other contributions? Would I make an issue on it and then if that gets accepted, make a PR for it?
Discussion linked here: #community-meta message
Here's your reminder: Review
[Jump back to when you created the reminder](#dev-contrib message)
@eternal owl The otn endpoint is getting migrated to python-discord/api so I am not sure if implementing a new feature on the site right now would be good (doing double work).
Sure, np
when will api come into production?
@cursive relic not got my laptop so can't leave a review but the change to the docstring isn't grammatically correct.py """ By default the top 5 matches are sent, this can be overwritten to a number between 1 and 5 by specifying an amount before the search query. """The , should be changed to a . (meaning this --> This)
"This can be overwritten by specifying an amount between 1 and 5 before the search query." reads better to me
Waiting for volcy's fallback PR to be merged, production setup is already done IIRC
Lemme confirm
Hmm It's about 9pm for me so I might not be able to fix in a while
Hmm I can't find it in the k8s config, so doesn't look like that
As far as I know there's no "feature freeze" on site, there has been only 2(ish) endpoints migrated to FastAPI yet!( π ) and there are serious discussions about the hows of unit testing, so I think it'll take some time until it's ready for production.
Not really, for production it only needs fallback endpoints support I. E. If the endpoint doesn't exist on the API it would pass it on to the site bot API
I know that really well, but I don't think that with the total number of 2 endpoints we're gonna tunnel a bunch of requests to the normal API. (I mean the site API)
would it be worth adding new features to site (imo, I'd wait until api is stable)
There is some plans (if I remember right even PR open) to redirect not migrated endpoints to current API
Yes there is, but I believe but API is not yet stable as of now, and would it be worth to set it up just to tunnel requests? (There are only 2 endpoints, I mean 2 PRs and the hows of testing are really dubious)
That's just my opinion, it's not my choice after all. π
aaaah dpy is copying commands when it's building the cog whyyy
Hmmm I'd rather Iceman's PR got merged before migrating the endpoint
This isn't a model that gets updated often
alr, I can see some of the PR features being implemented in @short snow PR already so it shouldn't be much extra work even if the site PR is merged
@fervent sage Did you ever have to assign attributes to command objects? ;_;
Why don't we use a worker to try to fetch the fast api server and if it fails fall back to django-o?
command.state.thing = value
O
iirc that should be copied over in a way that is useful
wait it might be command.extra[s]
state is fastapi Request
Love it!
That seems like a good solution, but as of now, there's nothing in the API project that would be ready for production, but in the future with more endpoints it seems like a pretty good idea.
Maybe it would be nice to cut over some non sensitive endpoints like the reminders and see how it goes?
I'll CC @hardy gorge on that one
https://github.com/python-discord/api/pull/14 Already does the same using a different logic
Interesting
The value is not being copied π
What are you even doing Zig
i am waiting for the answer for that question since yesterday lol
Terrible terrible things
Tell me more about it 
I'm doing a hack to circumvent dpy's senselessness, hopefully will have a PR soon
Dunno, cannot click links on Android 12 lmao
@thorny obsidian Added the features you wanted and fixed the bugs!
The only thing that isn't added from your review are better docstrings which I'm currently working on
everything else is pushed
Yo that looks amazing
Button navigation soonβ’οΈ
The way I'm doing this currently is I'm assigning a value to the commands with a decorator that tells the help cog to generate these views
My question is: is this something we want by default for all commands?
If a command has no subcommands then it will just show the return button, if it's part of a group
If it has neither then it will show neither
So !pep wouldn't have any buttons?
Here's your reminder: test and review open PRs locally
[Jump back to when you created the reminder](#dev-contrib message)
pep_number
!pep <pep_number>
Can also use: get_pep, p
Fetches information about a PEP and sends it to the channel.
Nope
Yeah, that sounds good
I really like that
Assuming it's available on all platforms (which I'm pretty sure it is)
However I think at the moment it will show the buttons when the help is invoked as part of an error
Not sure if that's good
buttons are available on mobile, yes
Wdym?
For example here
It was invoked because there was an error
Do we want buttons here?
Hmm
I guess not?
We can probably just pass an argument to the send_help or something though saying we don't want the buttons ig
I assume that would be possible
Not sure about that
I mean if needed could we have our own custom send_help?
The error handler just invokes ctx.send_help
So we define a bot.send_help(ctx) or something with a add_buttons kwarg
What I'm saying might be complete bs idk; I haven't worked with custom help commands etc.
hmmm
Yeah I'm not sure how to do that in a way that is not horrendous
I don't know if this is too picky, but if not, can we add a ... at the end of Wikipedia descriptions. It seems to cut off without any indication that it's continued elsewhere.
.wiki test
Test
Test(s), testing, or TEST may refer to: Test (assessment), an educational assessment intended to measure the respondents' knowledge or other abilities
This is a test
This is a test may refer to: The testing of the Emergency Alert System The testing of the former Emergency Broadcast System This disambiguation page lists
!remind 20h life got busy
Your reminder will arrive on <t:1636148704:F>!
the description comes from ["snippet"] which is provided by wikipedia's API. We could probably just add ... on all of them but it seems not all snippets are cut-off mid sentence
but it seems not all snippets are cut-off mid sentence
But it still has more text later in the article, doesn't it?
perhaps. I'm yet to find a snippet that ends with a period though, but some of them does look like full sentences
Woah, thats awesome
ping 
Ha, that's super cool
I had a task to fix grammar for sir-lancebot#940 (the pr) but the pr seems to be closed and I'm not sure if it is fixed
Your PR has been merged, it is now live
The issue gets automatically closes when this happen, because it is solved
also seems like the grammar is fixed in there
@cold island can I PR a fix for bot#1934?
And if so, should the fix take the approach of "return if pin status updated" or "return if the content didn't update"?
I would personally say the latter, if you don't want to retrigger on removing embeds and all
Yeah, that's what I was thinking
Potentially with a safety net for in case discord allows you to edit-in attachments
Sopy if before.content == after.content and before.attachments == after.attachments: return
you can probably do that with a self bot but there is no filter running on attachments, right?
There is an attachments rule
But that's antispam not filters ig
Ah
There's file_format filter
hmm that's true
I think this should be good
not sure if you can compare attachments like that
is that for when you edit attachment and attachment is in blacklist?
Hmm doesn't look like you can from the source code actually
There's no __eq__
Hope's still not lost though
I'll have to get my test bot running
What are you referring to?
I was just wondering where this was related to
oh I c
that's super cool
Yeah
I think in the scope of this issue the former is safer
I've done some testing and the code I sent above works perfectly. Surely it's better to do that just because it circumvents other potential issues, like a moderator removing embeds from a message etc.
Does removing an embed trigger a message update?
Yes
Alr then
π
Will do that now
Should I update https://github.com/python-discord/bot/blob/69fdd3649e2f9a646b97e445bc4d5440440e5890/bot/exts/filters/filtering.py#L471? @cold island
bot/exts/filters/filtering.py line 471
def _check_filter(msg: Message) -> bool:```
That seems to be the best place to insert this logic
wdym
Where should I add the code
The event is on_message_update, and that's where you have the two versions of the message
I'm thinking inside that function
The event calls _filter_message which calls _check_filter to see whether the filters should be run or not
Although I have just realised _check_filter only has after
yeah
So do I add the logic in on_message_edit or have _check_filter take before as well?
_check_filter seems like the smarter place to have the logic because that's the whole purpose of the function
But then it means editing the signature of _filter_message and _check_filter to accept before

