#dev-contrib

1 messages Β· Page 150 of 1

gritty wind
#

lol it's just the admin and mod ID which are not reusable, and optional

fallen patrol
#

fucking github

#

!remind 18s .

stable mountainBOT
#
Yeah okay.

Your reminder will arrive on <t:1635878673:F>!

stable mountainBOT
fallen patrol
#

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

gritty wind
#

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

gritty wind
fallen patrol
#

ah

gritty wind
#

I could technically delete it by transferring it to a "garbage" repo

#

like devops /s

worn swallow
#

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?

gritty wind
#

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

gritty wind
worn swallow
#

Bind for 0.0.0.0:8061 failed: port is already allocated.

#

to what I wonder

gritty wind
#

I'm guessing you still have the original one running

#

try docker container ls

worn swallow
#

I shouldn't, although I didn't close it nicely. Just CTRL+C

gritty wind
#

hm

worn swallow
#

yes they are still rinning

#

8060 and 8061

gritty wind
#

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

worn swallow
#

I just done this by myself for once I feel accomplishment today

gritty wind
#

noooice

worn swallow
#

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')

fallen patrol
gritty wind
gritty wind
worn swallow
#

Logs from snekbox

#

hmm

gritty wind
#

docker logs <container>

worn swallow
#

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

gritty wind
#

Could you post the traceback

worn swallow
#

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("")

gritty wind
#

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

worn swallow
#

If you're referring to the output of docker logs, the output is twice as large as that traceback

#

Maybe a bit more

gritty wind
#

That's unfortunate, post it anyway lol

#

Should be able to use the pastebin for that

#

!paste

stable mountainBOT
#

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.

gritty wind
#

Hastebin*** lol

worn swallow
#

one moment

gritty wind
#

Could you run sudo cat /etc/mtab | grep cgroup

worn swallow
#

yes I can just a second

#

cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0

gritty wind
#

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?

worn swallow
#

Yes

#

Laptop running Ubuntu 21.10

#

Do you need my specs as well or have I passed the inspection πŸ˜…

gritty wind
#

Haha yeah that's enough info

worn swallow
#

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

gritty wind
#

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

worn swallow
#

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

gritty wind
#

I believe you shouldn't see any functional differences

worn swallow
#

Then I'm fully on board py_guido

gritty wind
#

Alright, while I figure this out

#

Go ahead and uninstall docker for now

#

Do you have a /etc/default/grub file?

worn swallow
#

I do

clever wraith
#

Might want to remove that last issue from #dev-log haha

worn swallow
#

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

gritty wind
#

I thhhhink we should be fine

#

Uninstalling is a precaution anyway

#

Alright, I'll need you to edit it

#

specifically

worn swallow
#

it's show time

gritty wind
#

the GRUB_CMDLINE_LINUX variable

#

I wish I had an ubuntu machine on hand

#

wait I do brb lol

clever wraith
#

Modifying the grub config for testing akarys_stare

worn swallow
#

Currently GRUB_CMDLINE_LINUX=""

gritty wind
#

add this inside the quotes systemd.unified_cgroup_hierarchy=0. I think that should be all the config we need

gritty wind
clever wraith
#

Alright, if you are testing in prod akarys_thinking

worn swallow
#
** (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
gritty wind
#

If you're done with this, sudo update-grub, reboot, and then we'll check groups again

#

uh um

clever wraith
#

Uuuh

#

Backup your grub config first

gritty wind
#

Oh this may just be a generic gedit error

#

yeah that seems to be it

clever wraith
#

cp /boot/grub/grub.cfg /boot/grub/grub.backup.cfg please first @worn swallow

#

Might need to sudo

worn swallow
#

yes and yes

#

done

#

Now I can go ahead and sudo update-grub?

clever wraith
#

Yup yup

gritty wind
#

The power of virtualization \o/

worn swallow
#

done

clever wraith
#

It is free, duh

worn swallow
#

reboot, yeah?

gritty wind
#

yes please

clever wraith
#

No, pray first

gritty wind
#

that too

clever wraith
#

Appease the GRUB Gods

#

Then reboot

clever wraith
#

Excellent

gritty wind
#

it should be a fairly mundane change, but caution is never a bad idea

worn swallow
#

Here we go

#

If I'm not back in like 5 mins assume It fucked up or I died or wifi is down

gritty wind
#

You'll be remembered

clever wraith
worn swallow
#

New grub alert

gritty wind
#

You're suddenly making me very nervous about copying a well defined option lemon_sweat

clever wraith
#

The change in itself isn't bad, at worst you have more alerts in your system logs than atoms in your computer

gritty wind
#

lol

clever wraith
#

It is just regenerating the config that is a non trivial operation

worn swallow
#

Awaiting instructions, I'm going to study while I do this

#

just @ me

gritty wind
#

Are you back from your adventure

worn swallow
#

my adventure? The grub reboot?

gritty wind
#

yea

#

and system reboot lol

worn swallow
gritty wind
#

oh lmfao

worn swallow
#

πŸ˜…

clever wraith
#

Did it fully boot?

worn swallow
#

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

clever wraith
#

Yeah, do you see your desktop like normal

worn swallow
#

If that's what youre asking

clever wraith
#

Cool

worn swallow
#

yep

gritty wind
#

In that case, redownload docker, run the docker run again, and hopefully it should work this time

clever wraith
#

I also feel sorry for your system log

#

What is the warning?

worn swallow
#

alalalalal let's do this

worn swallow
#

docker runs

#

if thats a surprise to anyone lol, just thought I should say

gritty wind
#

The only surprise here is how fast you are blasting through these steps

#

Genuinely shocked

clever wraith
#

Haha, yes

worn swallow
#

Oh damn really? lmfao

#

I felt guilty for taking up so much time

gritty wind
#

I thought you were still going to reboot after you had already installed and rebooted everything...

clever wraith
#

Yeah, it is usually 30 minutes to ask people to give us the content of a file

#

So not so bad haha

worn swallow
#

we run !eval print("")

#

and we get

#

πŸ₯

gritty wind
#

πŸ‘€

worn swallow
#

[No output]```
#

let's fucking go ladies and gentlemen

gritty wind
#

:O

worn swallow
#

and then we get

#

Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

clever wraith
#

Yaaayy

gritty wind
#

this is the most hyped I've been about no output

clever wraith
#

It is lacking add rΓ©actions

#

Thanks spellchecker

worn swallow
#

lol

gritty wind
#

a little french-flare every now and then doesn't hurt

worn swallow
#

Am I getting missing permissions for not having mod or admin roles? I have included an environment variable for the emote

#

And it works

clever wraith
#

The worst is it does that every time for add reactions because it doesn't make sense to has an s here in English

gritty wind
#

The bot is missing permissions on the server

clever wraith
#

You probably only need to give it that one

#

Better be safe with bot perms

worn swallow
#

Which perm lol I thought I gave it administrator role

#

oh

#

good 2 know

gritty wind
#

Um.. if it has admin role it should work lol

worn swallow
#

thats what im saying

vocal prairie
#

These gifs are all on point haha

gritty wind
#

traceback?

worn swallow
#

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

gritty wind
#

Been there way too many times lol

clever wraith
#

Hahaha

worn swallow
#

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

clever wraith
#

I would probably blame it on discord heh

worn swallow
#

Uyy this one is going to require a hastebin one sec

#

!hastebin or something?

#

damn

clever wraith
#

!paste

stable mountainBOT
#

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.

gritty wind
#

!paste

worn swallow
#

yay thank you

clever wraith
#

Hehe

worn swallow
clever wraith
#

Oh that's silly

#

It neeeeeeeeedds

#

Manage reactions?

#

If that isn't a thing then manage messages

gritty wind
#

it uses reaction.remove

#

I think it's just manage messages

worn swallow
#

so needy

#

It has admin role, am I to change this in the server or in the bot's settings in discord dev portal?

clever wraith
#

Hmmmmmmmmmm

#

What did discord smoke again

gritty wind
#

just the server's, but I'm confused why admin isn't working

clever wraith
#

Can we just reboot discord?

worn swallow
#

Waiting to see an error message, role has been given

#

Just done !eval print("")

gritty wind
#

Try clicking the πŸ” emoji

worn swallow
#

1 minute has passed since I last put in an !eval command

#

There are no errors

gritty wind
#

ah, okay

worn swallow
#

but i must remain vigilant

gritty wind
#

the timeout is 10 seconds lol

#

true, true

worn swallow
#

clicked on wastebin

#

message removed

gritty wind
#

must watch it... forever

gritty wind
#

Please hold for a short customer satisfaction survey

worn swallow
#

no less than 11/10

dim pelican
#

Please rate your experience with @gritty wind from a range of dice_0 to dice_9

worn swallow
#

dice_9 + dice_2

#

what did I say no less than 11/10

gritty wind
#

lol

worn swallow
#

Now I want to get this bot hosted, nothing bad should happen

clever wraith
#

How do you rate your assistant helper, @clever wraith ?

dim pelican
#

Our system sees that you rates Scale as a dice_2 , please let us know what went wrong and how we can improve our performance

gritty wind
#

Do I rate them, or does the customer

clever wraith
#

Yay!

worn swallow
#

yo what the fuck

dim pelican
dim pelican
#

I'm just messing, Scale and Ali are great!

worn swallow
#

tell me something I don't know

#

That was a journey and a half

gritty wind
#

You're great too bud, this was the most productive help session I've participated in on this server in terms of results:time

clever wraith
#

Oh 100%, I would have expected having to change boot params to take at least 2-3h

austere hornet
#

Lol

worn swallow
#

I'll come back here if I have any problems related to the bot when I try to host it

gritty wind
#

So, idk what your hosting situation is, but the bot has a docker container published πŸ‘€

vocal prairie
worn swallow
#

I was thinking about hosting it so that I dont need to have my laptop and two terminals on at all times

worn swallow
vocal prairie
#

Ignore what I just said, they have "DISCORD BOT HOSTING" on their home page.

#

I blind

clever wraith
#

Hehe, good luck with your next adventure!

worn swallow
#

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 πŸ™‚

molten perch
#

Yeah, about that.
Could someone take a quick look at api#25? 😎

dusky shoreBOT
molten perch
#

I guess, so. πŸ˜‚

gritty wind
#

I would if it wasn't past midnight

#

I might get to it this weekend

dim pelican
#

Is there a webhook for linking issues to here?

brisk brook
#

What do you mean?

dim pelican
#

sir-lancebot#938

dim pelican
#

Turns out, yes

dim pelican
stable mountainBOT
#
Alright.

Your reminder will arrive on <t:1635974163:F>!

thorny obsidian
dim pelican
#

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

vale ibex
#

you should be able to self assign things now too, if you wanted to claim things πŸ˜„

austere hornet
#

True, you're PyDis staff, after all, Brad

dim pelican
#

Imposter syndrome I guess

slow steppe
#

Still need an approval one more approval on sir-lancebot#937

dusky shoreBOT
austere hornet
cold island
slow steppe
#

Then why is there a 1 out of 2?

cold island
#

Because you selected one option out of two boxes

#

At the bottom of the issue description

slow steppe
cold island
#

Because of this. 1/2

#

Unrelated to approval

static canyon
# slow steppe

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

slow steppe
#

Ahh ok, got it.

green oriole
#

I think we should use something here btw, since that's a thing

white light
#

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.

thorny obsidian
white light
#

shame.

#

I assume it's too much custom code for a simple eval bot

thorny obsidian
#

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

patent pivot
#

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.

thorny obsidian
#

oooh neat, I missed that

cold island
#

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?

cold moon
#

I don't think text field exists. There is dropdown

brisk brook
cold island
#

OK that kiils one thing I wanted to do

#

The other is more important anyway

brisk brook
#

You essentially have 3 things you can create..

  • Link buttons
  • Buttons
  • Select menus*
    • *select one thing
    • *select multiple
cold island
#

Does the bot have more_itertools?

green oriole
#

if it doesn't feel free to add it

cold island
#

Eh, feels excessive for what can be solved with a list comprehension

#

Ah, we do

#

Excellent

clever wraith
cold island
#

That is true

clever wraith
#

I doubt most of more_itertools cannot be factored to a small list comp or something like that too

gritty wind
#

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

clever wraith
#

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

stable mountainBOT
gritty wind
# clever wraith I think adding C deps is more problematic than pure Python, strict pinning of ve...

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

cold island
stable mountainBOT
#

arthur/exts/kubernetes/deployments.py line 68

@ui.button(label="Cancel", style=ButtonStyle.grey, row=0)```
cold island
#

Ah ok, dpy does dynamic funky stuff

vale ibex
#

Yea, the button deco adds it to the view when you subclass the view

cold island
#

damn, discordpy is fighting me

#

What I'm doing is clearly not the intended use πŸ˜‚

vale ibex
#

if you want to subclass buttons directly, ather than define N behaviours

#

What are you trying to do?

cold island
#

Hopefully I'll be able to show it soon

stable mountainBOT
#

discord/ui/view.py line 195

return item._rendered_row or 0```
cold island
#

But my view children are buttons

#

Which don't seem to have this attribute

vale ibex
#

buttons need to be added to a view

#

which stores which row they're on

cold island
#

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

vale ibex
#

buttons subclass items

#

what issue are you having that's led you down the rabbit hole of d.py internals?

cold island
#

That the buttons don't seem to have this attribute

vale ibex
#

Yea IG I'm asking why do you care

cold island
#

Because ctx.send with a view leads to the line above

vale ibex
#

ctx.send takes a view, which is made up of items

#

items are implemented by buttons and selects

cold island
#

I created the buttons with the decorator

#

But the decorator doesn't set this attribute anywhere

vale ibex
#

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

cold island
#

hmm

#

The Button class is attached to the callback function, but the callback itself is not a Button

#

And doesn't have the attr

vale ibex
#

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

cold island
#

Because it doesn't have that attr

vale ibex
#

could you paste the error and your code?

cold island
#

AttributeError: 'function' object has no attribute '_rendered_row'

#

Because the callback is a function, and not a Button

vale ibex
#

What's your code look like?

cold island
#

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)
vale ibex
#

you're missing the self attr

#

the button decorated function needs to be within a view class

cold island
#

hmmm

#

Is it not enough that I append it to the children?

vale ibex
#

hmmmm I'm not sure

cold island
#

It looks like you're doing that in that PR in the edit part

vale ibex
#

Yea, I subclass button though

#

rather than use the deco

cold island
#

Hmmm.. I guess I can subclass as well

#

But all the init_subclass is doing is appending the callbacks to self.children

vale ibex
#

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
cold island
#

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
vale ibex
#

So doesn't init anything then and there, I'm not sure how and when the __discord_ui_model_type__ gets inited

cold island
#

So it just finds the callbacks and appends

vale ibex
#

aha

#

at what point is the Button being initialised tho?

cold island
#

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

vale ibex
#

huh alr

#

that seems to do it, where is that?

cold island
#

View init

vale ibex
#

So I'm guessing the issue is that you're adding the button decorated func to the view after it's inited

cold island
#

Ooooh

#

Riight

#

I need to move the super call to the end

#

Or to just subclass Button

vale ibex
#

Yea, may be slightly less esoteric

cold island
#

Considering how esoteric my code is atm that would be a good thing lol

stable mountainBOT
#

bot/exts/utils/utils.py line 169

name=f"Snowflake{'s'[:len(snowflakes)^1]}",  # Deals with pluralisation```
vale ibex
#

πŸ˜„

green oriole
#

adding context :D

trail pilot
#

@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!

cursive relic
#

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.

green oriole
#

.pr

dusky shoreBOT
#
I can't believe you've done this

You must have at least one issue/PR!

#
Command Help

**```
.issue <numbers> [repository=sir-lancebot] [user=python-discord]

**Can also use:** `issues`, `pr`, `prs`

*Command to retrieve issue(s) from a GitHub repository.*
green oriole
#

I don't think it makes sense if we have a default argument

cursive relic
#

Wrong command Then

cursive relic
green oriole
#

.help rp

dusky shoreBOT
#
Command Help

**```
.realpython <user_search>

**Can also use:** `rp`

*Send 5 articles that match the user's search terms.*
green oriole
#

Sure

vale ibex
#

.rp Python

dusky shoreBOT
#

Here are the top 5 results:

How to Use Python: Your First Steps
MATLAB vs Python: Why and How to Make the Switch
Python import: Advanced Techniques and Tips
Python Bindings: Calling C or C++ From Python
vale ibex
#

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?

cursive relic
#

erm I was more likely curious if it would fit to command and if yes I could open a issue.

vale ibex
#

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

cursive relic
#

I will try to find a some sort of message for it

dim pelican
#

And feel free to ask me about the program!

cursive relic
#

about the code?

dim pelican
#

Yeah, I wrote it originally

cursive relic
#

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?

dim pelican
#

Looks good to me

cursive relic
#

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"}

vale ibex
#

yup

cursive relic
#

so if there was argument amount = Optional[int] or something the number 5 would be replaced by amount

vale ibex
#

It would be amount: int = 5

cursive relic
#

oh right

vale ibex
#

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

cold island
#

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 πŸ€”

vale ibex
#

are you doing it with a decorator?

#

or are you trying to do it to more than just one command?

cursive relic
#

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 πŸ˜…

vale ibex
#

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?

cursive relic
#

I think I have to

vale ibex
cursive relic
#

Ah thx πŸ˜„

vale ibex
#

and feel free to ask any questions here πŸ™‚

cursive relic
#

I will πŸ‘

stable mountainBOT
#
It has arrived!

Here's your reminder: Check, implement, test reviews for color command
[Jump back to when you created the reminder](#dev-contrib message)

dim pelican
#

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

cursive relic
#

I have forked @dusky shore repo, do I need to pull the changes from there to update my repo as well?

dim pelican
#

Add the original repo as upstream and your fork as origin

cursive relic
#

huh?

dim pelican
#

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

cursive relic
#

ah I see, seems to be up to date

cursive relic
#

seems like it's working, the improvement to .rp command

#

hmm nvm, if I don't give the argument it throws a error

static canyon
cursive relic
#

Like this? ```py
async def realpython(self, ctx: commands.Context, amount: int = 5, *, user_search: str) -> None:

static canyon
#

I think you need Optional[int] = 5 because of how dpy works

cursive relic
worn swallow
#

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

cursive relic
dim pelican
worn swallow
#

But now just the poetry run python -m bot works, without using docker

static canyon
#

And if it's <= zero set to 5

#
if not 1 <= amount <= 5:
    amount = 5```
rapid igloo
#

might wanna send an error message if it's <= 0 though?

cursive relic
#

Hmm

#

Or use 1 in that case

static canyon
#

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

rapid swallow
#

.rf 1-5 python

#

okay, good edit

static canyon
#

Or if amount not in range(1, 6)

#

But I think I prefer the prior method

static canyon
#

Yeah

cursive relic
#

Then I'll put it there

static canyon
#

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

cursive relic
#

Be in backsticks? What does that mean.

#

And I will come back after I eat, ~10mins

static canyon
#

Literally in backticks

#

`amount`

cursive relic
#

Oh you mean the error message πŸ˜…

cold island
vale ibex
#

is the decorator after the d.py command deco?

#

it may be getting overwritten

cold island
#

It's above, so like after in chronology

vale ibex
#

hmm odd

cursive relic
#

The current dockstring is this, what should the new be? ```py
"""Send 5 articles that match the user's search terms."""

dim pelican
#

"""Send a variable number of articles that match the user's search terms."""

cursive relic
#

thx πŸ˜„

dim pelican
#

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

cursive relic
#

I can wait for others opinion about which one should be used

short snow
#

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

cursive relic
#

well if you want.

short snow
#

sometimes the fifth article might help

cursive relic
#

Just a feature I noticed when someone happened to ask about the amount of articles and I decided to come here

short snow
#

I am fine with more number of articles, but choosing less than 5 is πŸ€·β€β™‚οΈ

cursive relic
#

this can be useless feature, but you still get 5 by default

short snow
#

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

cursive relic
#

I don't have a specific reason for it myself.

dim pelican
#

If I know the top article for searching vim is the first link, and don't want to send the entire embed

#

.rp vim

dusky shoreBOT
#

Here are the top 5 results:

VIM and Python – A Match Made in Heaven
Qt Designer and Python: Build Your GUI Applications Faster
Python IDEs and Code Editors (Guide)
Build a Platform Game in Python With Arcade
Kickstarting Flask on Ubuntu – Setup and Deployment
dim pelican
cursive relic
#

well if ran in general the whole embed can "flood" the chat a bit

fervent sage
#

so can most tags, and far more than the realpython embed

cursive relic
#

I will anyways be making a pr even if it would be denied after

short snow
#

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

fervent sage
cursive relic
#

alrd did

short snow
#

you should wait till this gets approved properly

fervent sage
#

was it approved?

cursive relic
#

and it's approved

dim pelican
#

It is

short snow
#

where?

cursive relic
#

oh nope

#

it's not yet

short snow
#

@vale ibex your opinions on the above ^

#

it is approved

dim pelican
fervent sage
dim pelican
#

I think its a good quality of life thing to add

cursive relic
#

seems like my page ain't updated πŸ˜…

vale ibex
#

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.

cursive relic
#

anyways now comes the hard part, the commit message

#

I will give it the last tests and see if it works fine

short snow
#

I am still against it but fine... if we add it realpython we should do it for others too then

cursive relic
thorny obsidian
#

If the default is still 5 and it doesn't impact current usage... why be against it?

thorny obsidian
short snow
cursive relic
#

so I will add multi-line dockstring πŸ‘

thorny obsidian
cursive relic
#

isn't lancebot like community bot and made for kind of random things

dim pelican
#

Yup, and is meant to be like an "intro" to contributing

cursive relic
#

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 πŸ˜…

vale ibex
#

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

static canyon
#

Since it shows up in the .help I think we should keep it short

dim pelican
#

Yeah I like that more ^^

static canyon
#

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.
"""```

cursive relic
#

Which one do you prefer?

static canyon
#

I guess the latter

cursive relic
#

I will probably make the pr in 2 hours

thorny obsidian
trail pilot
#

Sounds good!

short snow
static canyon
thorny obsidian
#

oooh that's nice! @trail pilot

trail pilot
#

Thanks!

cursive relic
trail pilot
#

The only worry I have so far is rate limits. The counter and the confirmation embed are both done when a user answers

cursive relic
#

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)

dim pelican
#

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

cursive relic
#

I might use that as well

#

Just wanting to be sure, does this look good commit message?

#

the inclusive may not fit in there

thorny obsidian
#

Is your commit title there the Pr enchantment?

cursive relic
#

ye, I think so

thorny obsidian
#

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

cursive relic
#

oh I see

dim pelican
#

"When applied, your commit will:" Is how I think of commit messages. But then I converted to atomic commits

cursive relic
#

Now I came up with this, but the title still does not seem to be quite good

dim pelican
cursive relic
#

I should use that?

thorny obsidian
brisk brook
#

(but capitalized A)

thorny obsidian
cursive relic
trail pilot
thorny obsidian
trail pilot
#

Ah, not yet

thorny obsidian
#

😬 sorry in advance

trail pilot
#

For some reason I don’t get notifications for PR reviews on my phone

thorny obsidian
brisk brook
#

I am looking over it again and I'll approve it afterwards

thorny obsidian
#

It's met the tag speedrun criteria, just requires a core dev to push the button

brisk brook
#

Don't hate me.. but yes I have one more comment

cursive relic
#

looks good?

short snow
#

bluenix zig commented on your review on enhanced incidents PR, could you look into it?

#

make the pr title, the commit title

trail pilot
# thorny obsidian 😬 sorry in advance

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

cursive relic
#

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

dim pelican
#

Did you make a branch off of the upstream main?

cursive relic
#

I think so

#

and the status only had that file there

dim pelican
#

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

cursive relic
#

how should I fix this?

dim pelican
#

Remove the file changes from your PR-linked branch

thorny obsidian
dim pelican
# cursive relic how should I fix this?

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

cursive relic
#

how was is before? I forgot

#

i'm dumb, I see it there

dim pelican
#
contents, ctx, embed
cursive relic
#

so after I commit the changes, what do I do next?

dim pelican
#

Is it still in the PR?

#

Oh wait, after commit, push

cursive relic
#

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 πŸ‘‹

trail pilot
#

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

dusky shoreBOT
dim pelican
stable mountainBOT
#
I'll allow it.

Your reminder will arrive on <t:1636060441:F>!

dim pelican
#

Thanks for the reminder Front πŸ˜‰

cursive relic
#

linting failed == ?

dim pelican
#

isort and Flake8

#

Do you have the pre-commit hooks installed locally?

cursive relic
#

no..?

dim pelican
#

poetry install pre-commit
then it will run the checks on each commit

static canyon
stable mountainBOT
#
Yeah okay.

Your reminder will arrive on <t:1636049832:F>!

static canyon
#

Will review when I get back home

cursive relic
cursive relic
gritty wind
#

poetry run task precommit

dim pelican
#

Ahhh

#

This is why I'm just a helper, not a core dev

gritty wind
#

Yeah core devs have just hit their heads against the walls more times than you have so far

#

Don't mind the concussions

cursive relic
#
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,
gritty wind
#

Did you setup your poetry? environment first

#

It shouldn't try to create a new one

cursive relic
#

nope, I have not done anything like that

gritty wind
#

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

cursive relic
#

oh

#

nope

gritty wind
#

but after poetry install

cursive relic
#

both failed

gritty wind
#

I had an error in the first one, just updated it

cursive relic
gritty wind
#

Yeah, that or the task one

#

Either will work

cursive relic
gritty wind
#

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

cursive relic
#
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)
gritty wind
#

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

dim pelican
#

run poetry run!

cursive relic
#

now it's doing smth

gritty wind
#

first time install is my guess

trail pilot
#

@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

cursive relic
#
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?
thorny obsidian
gritty wind
#

Your imports in that file were not according to our style rules

trail pilot
gritty wind
#

So the check failed, but then isort fixed them

trail pilot
#

isort changes your files though so you should just be able to run it again and it'll work

dim pelican
#

Gotta add it again, commit it again

cursive relic
#

oh I see

dim pelican
#

And if the checks pass, then push it

cursive relic
#

it was in wrong line

#

what sort of commit message I should make for this?

dim pelican
#

"fix: typing import issue from isort"

cursive relic
#

so I would not need any body for it?

gritty wind
#

probably squash that when merging it anyway

cursive relic
#

so now I can use -m in git commit?

dim pelican
#

yeah

gritty wind
#

yeah

cursive relic
#

now it passed it πŸ˜…

#

thx you all, now I got to read for my tomorrows exam

cursive relic
#

what does this mean?

vale ibex
#

It means I've left comments on your PR and asked for some changes πŸ˜„

dim pelican
#

They left a review and requested changes - Chris beat me to it

vale ibex
#

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

short snow
#

which one looks better,

cursive relic
short snow
#

i like 2

#

but i kinda like the medals

vale ibex
#

imo, the first would be better if you didn't put 4th in code blocks and made them line up

vale ibex
#

to separate the validation and the rest of the command logic

cursive relic
vale ibex
#

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

cursive relic
#

if I understood it correctly it should be here?

vale ibex
#

Yup

cursive relic
#

aight, I'll push it

short snow
#
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?

vale ibex
#

since the scores have a different number of characters

#

oh wait

cursive relic
#

Is this good enough for commit message ```py
git commit -m "Seperated if statement from other parts of code"

vale ibex
#

I didn't read your code

short snow
#

but i am formatting them with >4

vale ibex
#

sec

short snow
#

k

#

it worked when i use `

vale ibex
#

So Discord emojis aren't mono-spaced

#

so it'll never perfectly line up

short snow
#
        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}")
vale ibex
#

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}")

short snow
#

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
vale ibex
#

could you give me the top_ten values?

short snow
#

damn it

#

look at this

cursive relic
#

What should I do on this case? ```
Trim Trailing Whitespace.................................................Failed

  • hook id: trailing-whitespace
  • exit code: 1
  • files were modified by this hook
short snow
#

when i add bacticks to it

#

discord removes the spaces ig

vale ibex
#

you'll notice that there is a new unstaged change now

#

so if you git add it again, it should pass

vale ibex
short snow
#

yeah a sec

vale ibex
#

thanks

short snow
#

shit i reran the bot, and cache got reset, lemme do a quick int eval

cursive relic
#

erm did I fail on something here, because I don't think I pushed that

vale ibex
#

it looks like you commited the changes in git, and then didn't pull locally before you added the new line

short snow
#

{797730108206743562: 300, 814305114482278412: 100, 98195144192331776: 30, 736234578745884682: 10}

vale ibex
#

so when you pushed lcoally it merged the two together

short snow
#

thats leaderboard

#

top_ten = leaderboard.most_common(10)

vale ibex
#

It's fine, we'll squash it before merging

cursive relic
#

good

#

did you have anything else in mind to fix?

vale ibex
#

oh wait, no

#

it's got your other PR in there

cursive relic
#

meaning?

vale ibex
#

Your pagination pr is in the commits too

dim pelican
#

Looks like the merge brought your other commit messages into the history

cursive relic
#

ffs

short snow
#

you can cherry pick the required commits, but that's gonna get you even more confused

cursive relic
vale ibex
#

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

thorny obsidian
#

speaaaking of squashing and merging PRs, can I interest you in a very fun button press Chris?

cursive relic
#

so, I have fked up the thing?

vale ibex
#

depends on the colour

thorny obsidian
vale ibex
#

so all of the history will be squashed into one commit and then merged

cursive relic
#

so I have to do something?

vale ibex
#

Nope, not this time πŸ˜„

cursive relic
#

oh good πŸ˜…

#

Thx again

vale ibex
#

alright back to formatting this embed πŸ˜„

thorny obsidian
#

eeey ty chris

short snow
#

ok yeah discord is acting funky and removing the spaces, adding backticks (putting into a codeblock, makes it work perfectly chris

vale ibex
#
        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}")
short snow
#

u2800 smart

vale ibex
#

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

short snow
#

yeah, thanks πŸ‘

vale ibex
#

but again, they don't really line up since emojis aren't mono-spaced 😦

short snow
#

that should be fine, not really noticeable in your screenshot

vale ibex
#

Yea, not sure why the lines are so far apart in my screenshot

trail pilot
#

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?

thorny obsidian
#

let me work through some of my examples with that and I'll let you know

trail pilot
#

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

trail pilot
#

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

stable mountainBOT
short snow
#

@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).

eternal owl
#

oh

#

thanks for the info! I will look into that o/

short snow
#

Sure, np

eternal owl
#

when will api come into production?

static canyon
#

@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

short snow
#

Lemme confirm

cursive relic
short snow
#

Hmm I can't find it in the k8s config, so doesn't look like that

molten perch
# eternal owl when will `api` come into production?

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.

short snow
#

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

molten perch
#

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)

eternal owl
cold moon
#

There is some plans (if I remember right even PR open) to redirect not migrated endpoints to current API

molten perch
#

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. πŸ˜„

cold island
#

Hmmm I'd rather Iceman's PR got merged before migrating the endpoint

#

This isn't a model that gets updated often

eternal owl
cold island
green oriole
#

Why don't we use a worker to try to fetch the fast api server and if it fails fall back to django-o?

cold island
#

O

fervent sage
#

iirc that should be copied over in a way that is useful

#

wait it might be command.extra[s]

#

state is fastapi Request

cold island
#

tnx

austere hornet
molten perch
green oriole
#

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

short snow
green oriole
#

Interesting

cold island
green oriole
#

What are you even doing Zig

short snow
#

i am waiting for the answer for that question since yesterday lol

cold island
green oriole
#

Tell me more about it akarys_worried

cold island
#

I'm doing a hack to circumvent dpy's senselessness, hopefully will have a PR soon

green oriole
#

But for what

short snow
#

i pusehd this about 5 hours ago

green oriole
#

Dunno, cannot click links on Android 12 lmao

trail pilot
#

@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

cold island
#

o shit

#

I'll make it viewable in Discord

static canyon
#

Button navigation soonℒ️

cold island
#

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?

static canyon
#

Yes

#

That would be really nice

#

(Or at least for those commands with subcommands)

cold island
#

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

static canyon
#

So !pep wouldn't have any buttons?

stable mountainBOT
cold island
#

pep

#

!pep

stable mountainBOT
#
Missing required argument

pep_number

#
Command Help

!pep <pep_number>
Can also use: get_pep, p

Fetches information about a PEP and sends it to the channel.

cold island
#

Nope

static canyon
#

Yeah, that sounds good

#

I really like that

#

Assuming it's available on all platforms (which I'm pretty sure it is)

cold island
#

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

vocal prairie
cold island
#

It was invoked because there was an error

#

Do we want buttons here?

static canyon
#

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

cold island
#

Not sure about that

static canyon
#

I mean if needed could we have our own custom send_help?

cold island
#

The error handler just invokes ctx.send_help

static canyon
#

What I'm saying might be complete bs idk; I haven't worked with custom help commands etc.

cold island
#

hmmm

cold island
#

Yeah I'm not sure how to do that in a way that is not horrendous

vocal prairie
#

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

dusky shoreBOT
#
Wikipedia Search Results

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

dim pelican
stable mountainBOT
#
Of course!

Your reminder will arrive on <t:1636148704:F>!

austere hornet
#

Eyy

rapid igloo
vocal prairie
#

but it seems not all snippets are cut-off mid sentence
But it still has more text later in the article, doesn't it?

rapid igloo
#

perhaps. I'm yet to find a snippet that ends with a period though, but some of them does look like full sentences

short snow
short snow
#

ping pithink

clever wraith
cursive relic
#

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

dusky shoreBOT
clever wraith
#

Your PR has been merged, it is now live

#

The issue gets automatically closes when this happen, because it is solved

cursive relic
#

also seems like the grammar is fixed in there

static canyon
#

@cold island can I PR a fix for bot#1934?

dusky shoreBOT
static canyon
#

And if so, should the fix take the approach of "return if pin status updated" or "return if the content didn't update"?

clever wraith
#

I would personally say the latter, if you don't want to retrigger on removing embeds and all

static canyon
#

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

clever wraith
#

you can probably do that with a self bot but there is no filter running on attachments, right?

static canyon
#

But that's antispam not filters ig

clever wraith
#

but it is about filters not antispam

#

yeah

static canyon
#

Ah

clever wraith
#

hmm that's true

clever wraith
#

not sure if you can compare attachments like that

static canyon
#

Yeah I'll test it

#

Pretty sure you can but I'll check

cursive relic
#

is that for when you edit attachment and attachment is in blacklist?

static canyon
#

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

static canyon
cursive relic
static canyon
#

It's for filters

#

bot#1934 is the context

dusky shoreBOT
cursive relic
#

oh I c

green oriole
cold island
static canyon
cold island
#

Does removing an embed trigger a message update?

static canyon
#

Yes

cold island
#

Alr then

static canyon
#

πŸ‘

#

Will do that now

stable mountainBOT
#

bot/exts/filters/filtering.py line 471

def _check_filter(msg: Message) -> bool:```
static canyon
#

That seems to be the best place to insert this logic

cold island
#

wdym

static canyon
#

Where should I add the code

cold island
#

The event is on_message_update, and that's where you have the two versions of the message

static canyon
#

I'm thinking inside that function

static canyon
#

Although I have just realised _check_filter only has after

cold island
#

yeah

static canyon
#

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

cold island
#

I think the former is better. check_filter is a general function to check the context of a message, and this would overload it with extra responsibilities

#

That if that needs to be added is only useful for that particular event