#dev-contrib

1 messages · Page 101 of 1

short snow
#

not sure, maybe ask ks, they are the code owner

sleek steppe
#

I'll just leave it for now

short snow
#

ok_handbutflipped.

sleek steppe
#
    p_star_one = star_one / leaderboard["number_of_participants"]
ZeroDivisionError: division by zero
#

for .aoc stats command

short snow
#

yeah, since there are no boards specified, so leaderboard is empty

thorny obsidian
#

Seb would be the person to ask for AoC stuff

short snow
#

#dev-log message @vale ibex is this because of too much jumping of files, i am thinking of moving helpers into games/cog i.e. the file where they are getting used

thorny obsidian
#

In general you want to add some reasoning for why you're doing things. Like proper commit messages providing context and basic reasoning so people can follow the general logic and not guess at your intentions

short snow
#

yeah understood

fallen patrol
#

Hey, does lancebot work on arm?

vale ibex
#

Yea, that's it. I don't mind having helper functions in other files, they can be very useful in larger cogs. But a lack of any comments explaining why you chose to do things in a certain way makes it difficult for reviews to follow your thought process

vale ibex
#

you may need to build wheels for a bunch of them when installing them

short snow
#

yeah, (like kutie's commit descriptions on adding int e to sir lance)

I would document the code, and update the reasoning

vocal prairie
#

You can see the commit description under the commit title in GitHub, right?

thorny obsidian
# short snow yeah understood

I'd also recommend doing that for reviews in general. Instead of saying "Make this a constant" with no other reasoning, it's helpful to add why you think things should be like that. It makes it easier on both sides for the review because the person submitting the PR knows your intentions and it cuts down on some of the clarifying back and forth

sleek steppe
#

.status cat 418 works on python 3.9 now lol

short snow
#

right, I would remember these points while reviewing/commiting next time

#

one problem with the investigate to py3.9 issue is:

new prs are getting merged quite frequently, so we need to mention the changes in those prs till the second our pr gets merged

sleek steppe
#

Here's a tip for testing the .latex command: don't enable BOT_DEBUG

patent pivot
#

yeah I haven't made it yet because we didn't need it in the end

#

we might add it in future but we needed to limit a certain service to helpers only but it turned out being fine without that for now

vale ibex
#

we should probably cherry pick that if this PR doesn't get merged soon

green oriole
fallen patrol
green oriole
#

You can probably make sure that the deps are working

sharp timber
#

gc.collect() is a bit of a hack, and triggers a global python GC. You're not supposed to ever have to do that. I would expect this to be cleaned up by reference counting, so if it's not then we should look into where we're making a reference cycle and deconstruct that better.

green oriole
#

Probably not worth the effort though

sleek steppe
vale ibex
sleek steppe
#

yeah

patent pivot
#

also worth noting this got a bit superseded by my CF access antics

fallen patrol
patent pivot
#

and the project we were going to protect doesn't need it

fallen patrol
patent pivot
#

lol

green oriole
patent pivot
#

I'll probably private it

green oriole
#

I had to make it run on the host

fallen patrol
patent pivot
#

doesn't need to be public

#

it has code locally I just haven't published it

green oriole
#

Public gud

patent pivot
#

lol

fallen patrol
#

^

#

public > private

patent pivot
#

when it does something I will

fallen patrol
#

I don't trust a person with private repos

fervent sage
sleek steppe
#

private sus

patent pivot
#

but right now it is, as you noted, empty

#

lol I have more private repos than public

fallen patrol
#

lol

#

remember when i once sent my private key to #deleted-channel

vocal prairie
#

#deleted-channel?

short snow
#

I have literally 0 private repositories

vocal prairie
patent pivot
#

Oh actually that project does have working code lol

#

Whoops

sleek steppe
#

I'm looking at this for the pridefact command

Sendable = Union[commands.Context, discord.TextChannel]

When this could have been abc.Messageable 😩
Also .pridefact always sends Error parsing date: String does not contain a date: ct

fallen patrol
vocal prairie
#

Lol

fallen patrol
#

back when dm-log was a thing

#

HappyThink its gone now

patent pivot
#

yeah we removed dm log

fallen patrol
#

it wasn't the best feature

#

i found out about it the hard way

patent pivot
#

it's a balance

#

DM log proved useful a few times in weedling out DM invite spam before it hit many users

vocal prairie
#

What did dm log even do?

#

Python's dms?

patent pivot
#

but yeah users have become too accustomed to the belief that DMing bots doesn't go anywhere

patent pivot
vocal prairie
#

I sometimes dm bots links and stuff just to remember.

#

But now I use my own bot.

sharp timber
#

I use my own bot

vocal prairie
#

Since I don't want random people getting stuff.

fervent sage
#

i use my alt

thorny obsidian
#

One day discord will allow messaging yourself like Slack and all will be well

fallen patrol
vocal prairie
#

Or you can make a group dm with no one in it besides yourself.

fervent sage
#

dave is ignoring me tho

sleek steppe
sharp timber
#

But yeah, trusting a random bot with your links is generally not the beset of ideas, although enough people were doing it it was kind of concerning

vocal prairie
fallen patrol
#

if a bot support server staff can read my messages, then idrc there's a lot of people

#

if the mods of a server which i talk to are reading them, thonk

patent pivot
fallen patrol
#

that was an accidental paste in that situation

#

and it hadn't been configured yet

#

i was trying to paste it on a server

patent pivot
#

ah

fallen patrol
#

i'm staff of a really large bot and we do have a relay cog

fervent sage
#

which bot 👀

patent pivot
#

but yeah most of the functionality we implement is ensuring a balance between user privacy, security and moderation

fallen patrol
#

it only forwards it if >

fallen patrol
fervent sage
#

nah was just interested which

fallen patrol
#
fervent sage
#

nice

sleek steppe
#

I tested everything on python 3.9, the ones that error are the aoc commands and .pridefact

fallen patrol
#

but

#

.pridefact

#

errors here too

sleek steppe
#

ment

vocal halo
#

hey devs how @stable mountain use its docs commands

fallen patrol
#

!src d

stable mountainBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
vocal halo
#

like once one of you told me there is a object.i something file on site

#

and we have to use that

#

can you name that file again pls

vocal halo
#

thanks mate

#

😄

fallen patrol
#

OBJECT.INV

#

there we go i just remembered

#

no

#

/objects.inv

#

what the

#

did that just

vocal prairie
#

It's in the link.

fallen patrol
#

replace my query

#

lmao

vocal halo
#

sorry but i forgot how to use that file

#

what module we need?'

sleek steppe
vocal prairie
vocal halo
#

yeah i am reading sorry for that

vocal prairie
#

It's the best way to get answers.

#

!d discord

stable mountainBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

sleek steppe
#

!d <- that lists all of the inventories

vocal prairie
#

Yeah, it is.

vocal halo
#

Can you please help me?

magic arch
vocal prairie
magic arch
#

Ah alright gotcha

sleek steppe
#

@short snow I pushed a bit more improvements to typing and fixed LinePaginator, I can PR now

stable mountainBOT
#

@patent pivot

It has arrived!

Here's your reminder: changelog doc changes if no one else has.
[Jump back to when you created the reminder](#dev-contrib message)

sleek steppe
#

lol

patent pivot
#

cc <@&267628507062992896>, I can't do that tonight, can someone summarise and changelog bot#1014

dusky shoreBOT
gritty wind
#

I'll do some reading and prepare something

sleek steppe
gritty wind
#

The intention from the code appears to be allowing people to fetch facts from a given day

#

I do not know why

#

let's see

sleek steppe
#

Well that makes the command useless in 2021

gritty wind
#

Not true, it still sends random facts as long as one exists

sleek steppe
gritty wind
#

or nvm, I misread

#

yea

#

idk, the whole thing is weird

fallen patrol
#

@gritty wind @sleek steppe ^

gritty wind
#

?

fallen patrol
#

the pride command

gritty wind
#

Yes, what's your point?

fallen patrol
#

the reason its weird

gritty wind
#

I still don't get what you mean

clever wraith
#

Hey if we're talking about changelogs, latex hasn't been done

gritty wind
#

It still needs to get the memory fixes

clever wraith
#

Hmm?

gritty wind
#

It has no resource limits atm, so regular usage can crash the bot

clever wraith
#

I know that he added a cooldown in a pr

gritty wind
#

The cooldown on its own won't be enough, as one input alone could crash the whole thing

fallen patrol
#

not the root cause

clever wraith
#

sir-lancebot#682 I think

dusky shoreBOT
fallen patrol
#

matplotlib.pyplot.figure to matplotlib.figure.Figure

#

that is probably a larger fix

clever wraith
#

He did that as well

gritty wind
#

The bigger fix would be adding actual memory constraints, so we don't have to depend on random fixes to cut down on the usage bit by bit

#

I'm working on converting the whole thing to use processes, but I'm somewhat busy

clever wraith
#

Yeah, fair

stable mountainBOT
#

@fallen patrol

It has arrived!

Here's your reminder: if the docs command still looks bad because discord changed markdown on mobile talk about making an issue..
[Jump back to when you created the reminder](#dev-contrib message)

patent pivot
fallen patrol
#

!d aiohttp.ClientSession

stable mountainBOT
#
class aiohttp.ClientSession(*, connector=None, loop=None, cookies=None, headers=None, skip_auto_headers=None, auth=None, json_serialize=json.dumps, version=aiohttp.HttpVersion11, ...)```
The class for creating client sessions and making requests.
fallen patrol
#

No, it does not look bad mostly

vocal prairie
#

Screenshot?

fallen patrol
#

yes i am aware that is basically impossible to fix

vocal prairie
#

That looks weird.

vocal prairie
#

Much better on desktop.

fallen patrol
#

do be aware the color is cause of android AMOLED

vocal prairie
#

Yeah ik.

patent pivot
#

live now and working!

vocal prairie
#

Noice

#

OAuth2 is quite interesting.

fervent sage
fallen patrol
#

what is that

fallen patrol
#

*not asking what the privacy policy is but that link

patent pivot
vocal prairie
#

I hate those characters.

patent pivot
vocal prairie
#

Oh, that became user facing?

#

Nice

patent pivot
#

the option in the dev portal yea

vocal prairie
#

That's nice

patent pivot
fervent sage
#

my brain just assumes that everyone automatically sees displace patchnotes because of how useful they are kek

vocal prairie
#

displace patchnotes?

fallen patrol
#

bruh

vocal prairie
#

smh

fallen patrol
#

#notascam

vocal prairie
#

Discord's domains

patent pivot
#

lol

fervent sage
#

discord has one domain to trump all others

patent pivot
#

lol

fervent sage
#

it has a url that beats even that

fallen patrol
patent pivot
#

of course don't forget

fallen patrol
#

lmao

#

that one too

patent pivot
#

but yeah oauth2 thing is live now

#

i would say break it

#

but i don't think i want that lol

vocal prairie
#

That works?

#

Noice

#

Triple deploy.

fervent sage
#

uh oh

fallen patrol
#

*joe

fervent sage
#

oauth is totally unrelated to the bot

patent pivot
#

lol

#

yeah

#

oauth stuff sits on cloudflare edge

vocal prairie
#

Quadruple deploy

#

What is going on.

vale ibex
#

Resetting the bot to deal with an on-going mod issue

#

nothing to worry about

vocal prairie
#

Okie

vale ibex
#

Nah that's unrelated

short snow
fallen patrol
#

ah

#

because

#

aight so what is that

#

even

#

#

that's on the raw command and the latex command lel

fallen patrol
#

<@&267628507062992896> latex cog causing crashes again

#

Tbf

#
.latex $L(x):=\sum_{j=0}^kyj(\prod{\begin{smallmatrix}0\le m\le k\m\ne j\end{smallmatrix}}\frac{x-x_m}{x_j-x_m})$
``` that kills it in one shot
thorny obsidian
#

I can either unload the cog or Lancebot will just keep restarting. Either way it's Lancebot so it's not critical.

fallen patrol
#

Unload ig?

#

Was prev unloaded for the same thing

vocal prairie
#

hahastinkypoop has a pr open.

#

That fixes it at least a little.

#

It doesn't go over 110 mb.

fallen patrol
#

But hasn't been merged yet

vocal prairie
#

And goes back down to normal once you give proper input.

vocal prairie
thorny obsidian
#

I mean... my review won't do much until a core dev can look at it

#

Also... it's lancebot. Not critical.

fallen patrol
vocal prairie
#

sir-lancebot#682

dusky shoreBOT
fallen patrol
#

finally ironically

fervent sage
#

Hm what we need is a ping command mmLol

fallen patrol
#

hm

fallen patrol
#

.uptime

fallen patrol
fervent sage
#

Uh 861 I think off the top of my head

fallen patrol
#

sir-lancebot#861

fervent sage
#

I think it's dead lol remember

fallen patrol
#

sir-lancebot#681

dusky shoreBOT
vocal prairie
fervent sage
#

?

fallen patrol
#

its sir-lancebot#681 not sir-lancebot#861

dusky shoreBOT
fallen patrol
# fervent sage ?

you thought it was sir-lancebot#861 but in reality its sir-lancebot#681

dusky shoreBOT
fallen patrol
#

stop.

fervent sage
#

Ah

fallen patrol
#

lmao lance died again

vocal prairie
#

Why did dev voice move up again?

vocal prairie
vocal wolf
#

we archived bounty board

fallen patrol
vocal prairie
#

I thought dev voice was below dev contrib

fallen patrol
#

ohhhhh

fallen patrol
vocal wolf
fallen patrol
#

that's why

#

its an android bug

vocal wolf
#

ah

vocal prairie
#

Oh

#

I see

vocal wolf
#

gosh darn it discord

#

anyway

fallen patrol
#

same thing occurs in pyweek

vocal wolf
#

why is sir lance dying so often?

vocal prairie
fallen patrol
#

buttt

vocal wolf
vocal prairie
#

sir-lancebot#682 should fix it

dusky shoreBOT
fallen patrol
#

sir-lancebot#682

dusky shoreBOT
vocal prairie
#

Hopefully

fallen patrol
#

i really bungled that statement

magic arch
#

ill subscribe 🙂 👍

#

lol

vocal wolf
#

it's high priority now.

fallen patrol
#

nice

vocal prairie
#

Noice

fallen patrol
#

add a review if you want

#

since ur a core dev it would mean only one contributor needed

vocal wolf
fallen patrol
#

ok

#

fun

#

there's also room for abuse #bot-commands message

fallen patrol
#

wait was that you

placid ermine
#

no

#

bruh

fervent sage
#

'room for abuse' applies to basically everything that takes user content and passes it back in some form, it's a thing that happens and the only real way to deal with it is just to moderate it case-by-case

vocal wolf
#

@fervent sage ping command merged.

fervent sage
#

aye

vocal wolf
fervent sage
#

i actually saw the comment pop up on my other monitor before the ping :P

vocal wolf
#

lel

fallen patrol
#

hey

#

are you guys able to review the bot killing bug?

vocal wolf
fallen patrol
#

yeah

#

it like

#

dies after several commands rn

vocal wolf
#

I'll get there.

fallen patrol
#

because it isn't even closing it

vocal halo
#

hey you guys know about @stable mountain so can you help me in #help-lemon

#

that would be nice of you

placid ermine
#

the hacky workaround I PRed does seem to do the job tho

#

gc is stdlib

vocal wolf
#

huh

#

ty

#

oh interesting

fallen patrol
#

the error is pretty uh

vocal wolf
#

I should use this lib in my projects

placid ermine
#

yes

fallen patrol
placid ermine
#

well yes

fallen patrol
#

its

#

an interesting error

#

because the ^ never points to the error

placid ermine
#

O lol

#

interesting

vocal wolf
#

Does gc.collect() have the possibility of effecting other cogs?

fallen patrol
#

granted

placid ermine
#

probably not

#

i think

#

i'm not sure

#

but Bast said using gc.collect() isn't a good fix

vocal wolf
# fallen patrol granted

@sullen phoenix I feel like I've seen you talk about the gc module before. Are you able to comment on this?

#

wait I replied to the wrong thread

fallen patrol
#

yes, yes you did

sullen phoenix
#

you typically do not want to manually invoke it, yeah

vocal wolf
fallen patrol
#

just reload the cog after command execution

placid ermine
#

and looking at SO, it seems like memory issues are pretty common with matplotlib

fervent sage
#

ok, timed command looking nice is success, but i've had to switch up the code a bit:

        prefix = ""
        if subctx := getattr(ctx, "subcontext"):
            prefix = f"{ctx.command} "
            ctx = subctx

        ...  # more code and logic

            embed = self.error_embed(
                f"Your input was invalid: {error}\n\nUsage:\n``{ctx.prefix}{prefix}{ctx.command} {ctx.command.signature}``"
            )

i really dont like the name prefix here for the parent context's command so i'd love suggestions for alternative symbol names for it

vocal wolf
#

Latex cog unloaded.

#

@placid ermine @fallen patrol also taken off of high priorty.

fallen patrol
#

lol

vocal wolf
#

take your time when debugging

fallen patrol
vocal wolf
#

I agreed with kat that it would be best to do that.

fallen patrol
#

ah

#

so if it gets loaded again ping someone?

placid ermine
#

yeah, i'm inclined to agree too 😔

fallen patrol
#

because it was unloaded earlier but the bot reconnected

fervent sage
#

oh no, flake8 is unhappy

#

time for some ✨ rearranging ✨

fallen patrol
fervent sage
#

line too long

fallen patrol
#

just black it

#

lmfao

#

btw

#

running black on the lancebot repo changes like 56 files

vocal wolf
#

black can be weird sometimes with flake8 and conflict

fervent sage
#

black wouldnt fix it since its a too long string

vocal wolf
#

wouldn't autopep8 work better?

fervent sage
#

the only way was for me to split it into a couple parts which black doesnt know how to - and shouldnt even attempt to - do

fallen patrol
#

like

#

\

fallen patrol
vocal wolf
#

would conflict less with flake8

fervent sage
#

okie, correct command signature fix pushed

#

also wow i forgot how good vscode's integration with github PRs is

vocal wolf
#

lol

#

I can't computer

#

this works well

sullen phoenix
vocal wolf
#

lol

sullen phoenix
#

haha yeah

fervent sage
# vocal wolf

lmao you almost gave me a heart attack i thought for a sec that i'd somehow made a mystery bug that added an extra 2 .s but its just that your prefix is ... lmao

vocal wolf
#

xd

short snow
#

@vale ibex mentioned the changes and updated the PR description

fallen patrol
#

@fervent sage what is subcontext?

fervent sage
#

@vocal wolf more than happy to make that change, but im at a loss for commit message lol (preferably following the format chore: <msg>) kek

#

hm improve code clarity perhaps but it feels like it doesnt quite fit

vocal wolf
#

"Moved variable into if statement"

fallen patrol
fervent sage
#

there are 2 no 3 no 4 hard things in computing:
cache invalidation
naming
timezones
git commit messages that dont suck

fallen patrol
#
  1. staying within resource limits
vocal wolf
#

git commit -am "I updated files." && git push

#

There.

clever wraith
#

I finally understood how cogs work!

#

I would like to contribute

vocal wolf
#

nice!

clever wraith
#

How can I contribute

fervent sage
#

if there is one thing i pride myself on it's my git commit messages which over the past year i have successfully wrangled from "aaAAAaAaaAAa" to actual readable useful commits

clever wraith
#

Lol

#

I never use git and github

#

this will be a first for me

fervent sage
#

if all else is awful, at least my commit messages will be nice kek

clever wraith
#

lol

vocal halo
#

aah guys you said ask help in help channels

#

no one helped and now that channel is closed by bot

vocal wolf
clever wraith
#

ok anyway idk what command to make

#

should i make a What Harry Potter House are you in?

vocal halo
#

help me

clever wraith
#

basically a questionnaire that determines what harry potter house you are in

vocal wolf
clever wraith
#

but since it’s not original i could maybe change it up a bit

#

duck houses??

#

which duck house do you belong in

vocal wolf
#

@vocal halo We're all volunteers here, you must be patient when receiving help. If you don't get an answer to your question, try to be more specific on what the problem is and what you've already tried.

clever wraith
#

hmmm

vocal wolf
#

@clever wraith ditch the harry potter houses. Which duck are you?

clever wraith
#

i’ll try implementing it on my bot first, it it works i’ll try adding it to sir lancebot

vocal halo
clever wraith
#

yes which sucks

#

duck

fallen patrol
#

@placid ermine I just found a fix for your latex command

vocal halo
fallen patrol
#

It fixes all issues with it

#

rm -f latex.py

clever wraith
#

wow

placid ermine
#

oooh

#

that makes so much sense

#

many thank

fallen patrol
#

Np

fervent sage
#

i was 50/50 on saying "what remove it?" but i thought you were gonna propose a real solution, my disappointment is immeasurable and my day is ruined kek

vocal wolf
vocal halo
#

hey bro i found but no one helped can you @fallen patrol

#

objects.inv

clever wraith
#

does the sir lancebot use load extension?

fallen patrol
#

Ah I think I did answer when u originally asked

#

But

fallen patrol
#

!src d

stable mountainBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
fallen patrol
#

.src ext

clever wraith
#

ok so for my command to work i’ll need a setup function right

fallen patrol
#

I hate u lance

vocal halo
fervent sage
#

oh also xithrius i made the fixes :P

fallen patrol
#

Yes

vocal wolf
#

@fervent sage do you have a tutorial for cogs in dpy?

fervent sage
#

i do

clever wraith
#

no no no

fallen patrol
clever wraith
#

i already know cogs

fallen patrol
#

I think they may have meant the init.py file?

vocal wolf
fallen patrol
vocal wolf
#

(anything but youtube)

vocal wolf
fervent sage
fallen patrol
#

Fwiw alec's tutorial is pretty good but I think there was a hole luckily I already knew it

fervent sage
#

o.O what hole

#

i plug holes

fallen patrol
#

Idr

vocal wolf
placid ermine
#

anyway
for some reason
it looks like there's 13 references to the fig variable when there is bad input, but only 7 when the input is good

clever wraith
#

lol okay

#

i’ll check em out

#

does anyone wanna write the command with me?

#

i’m kinda trash at python

fallen patrol
#

Wut

#

Why typing.Optional

vocal wolf
#

@fervent sage would this work?

-       if subctx := getattr(ctx, "subcontext", None):
+       if ctx := getattr(ctx, "subcontext", None):
+            parent_command = f"{ctx.command} "
-            ctx = subctx
fervent sage
#

nop because if it has no subcommand parent would be undefined later

clever wraith
#

!d typing.Optional

stable mountainBOT
#

typing.Optional```
Optional type.

`Optional[X]` is equivalent to `Union[X, None]`.

Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default does not require the `Optional` qualifier on its type annotation just because it is optional. For example:

```py
def foo(arg: int = 0) -> None:
    ...
```  On the other hand, if an explicit value of `None` is allowed, the use of `Optional` is appropriate, whether the argument is optional or not. For example...
fervent sage
clever wraith
#

here you go

fervent sage
#

the issue is which i didnt knwo when i wrote it

fervent sage
#

that d.py supresses conversion errors when using it

fallen patrol
#

What does typing.Optional do that = None do?

vocal wolf
#

of what is correct

fervent sage
#

hm yes i think that should work, i'll test it now

vocal wolf
#

So it's more like

#
+       parent_command = ""
-       if subctx := getattr(ctx, "subcontext", None):
+       if ctx := getattr(ctx, "subcontext", None):
+            parent_command = f"{ctx.command} "
-            ctx = subctx

@fervent sage

fervent sage
#

oh actually it should be if ctx := getattr(ctx, "subcommand", ctx) but will fix now

fallen patrol
fervent sage
#

wait

#

no

#

thats why i made it that way in the first place

#

hang on

vocal wolf
fervent sage
#

!e

a = 1
if a := None:
  pass

print(a)
stable mountainBOT
#

@fervent sage :white_check_mark: Your eval job has completed with return code 0.

None
fervent sage
#

ok yeah

vocal wolf
#

Optional[X] is equivalent to Union[X, None]

#

Union[X, None] means that the arg will either be of type X or None.

fervent sage
#

that's why i set ctx in that way, it's because otherwise you end up overwriting it as a value you dont want

fallen patrol
#

Wait what is union aaaaAAAA

#

!d typing.Union

stable mountainBOT
#

typing.Union```
Union type; `Union[X, Y]` means either X or Y.

To define a union, use e.g. `Union[int, str]`. Details...
vocal wolf
fervent sage
#

i think so but i need a couple minutes to regain my brain to think about it now kek

fervent sage
#

thought process as i regain said brain:

        # current version
        parent_command = ""
        if subctx := getattr(ctx, "subcontext", None):
            parent_command = f"{ctx.command} "
            ctx = subctx

        # proposed version
        parent_command = ""
        if ctx := getattr(ctx, "subcontext", None): # this overwrites ctx unconditionally which we dont want
            parent_command = f"{ctx.command} "

        # fixed proposed version
        parent_command = ""
        if ctx := getattr(ctx, "subcontext", ctx): # this will always be truthy which we also dont want
            parent_command = f"{ctx.command} "
``` i have concluded that i believe the current way is the good way
vocal wolf
#

then your way will remain.

placid ermine
#

Deleting all references to the figure, and/or using the window manager to kill the window in which the figure appears on the screen, is not enough, because pyplot maintains internal references until close() is called.
mfw when calling close() doesn't remove internal references either

vocal wolf
#

@fervent sage on current branch:

Traceback (most recent call last):
  File "/home/xithrius/.local/share/virtualenvs/sir-lancebot--q_Shpea/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/xithrius/Repositories/PythonDiscord/sir-lancebot/bot/exts/evergreen/timed.py", line 24, in timed
    if not ctx.subcontext.command:
AttributeError: 'Context' object has no attribute 'subcontext'

Caused by ...timed uwu

fervent sage
#

hmm

vocal wolf
#

oh my god I'm stupid lol

fervent sage
#

you and me both lol, i didnt even notice when i did the commit for it

vocal wolf
#

revert that and squash push

fervent sage
#

that is beyond my git knowledge, how do i do?

vocal wolf
#

I will show you de wey

sharp timber
#

lmao oof

#

I've done this before ;-;

short snow
#

@sleek steppe @vocal prairie i divided the dependencies here: https://github.com/python-discord/sir-lancebot/issues/549#issuecomment-818877028

I followed pattern toxic-me-dawn

If you guys want any changes let me know, and you can directly push to my fork if you are sure or if you are not sure just push to update/python3.9/<name>

fervent sage
#

always a good day when your terminal looks like this at 5am kek

short snow
#

lol, xith disappeared

sharp timber
#

He is finding materials

#

to show da wey

fervent sage
short snow
#

oh

#

i thought he was doing intense stackoverflow

vocal wolf
#

I hath shown him de wey

sharp timber
fervent sage
#

de wey has been very successfully shown by xithrius

#

and now i bookmark the resources because there's a 110% chance i will have forgotten de wey by the next time kek

vocal wolf
#

its ok you have the alias in your zshrc

fervent sage
#

true

#

until that lies forgotten like 8 of the other ones i only remember when i add more kek

vocal wolf
fervent sage
vocal wolf
#

docker system prune -a

short snow
fervent sage
#

best alias is alias mkbot="sh /home/vcokltfre/mkbot.sh"

#

which executes

echo "Name: "
read name
cd /home/vcokltfre/projects/python_discord

git clone https://github.com/vcokltfre/yatb $name
cd ./$name
rm -rf .git

git init
git commit -m "feat: initial commit" --allow-empty

code .
vocal wolf
#

@fervent sage we're stupid again (I think).

fervent sage
#

oh no

vocal wolf
#

ctx.subcontext is used once

#

in the timed.py file

#

so why not just replace it with new_ctx in the if statement

fervent sage
#

because the error handler needs it

vocal wolf
#

nevermind you're not stupid, I am

#

lol

fervent sage
vocal wolf
#

everything is fine

#

nothing is on fire

fervent sage
#

that's a very familiar progression of thoughts to me lol

vocal wolf
#

merged.

fervent sage
#

epic

vocal wolf
#

and yes, I did test the newest version

fervent sage
#

pretty errors for when we're pretty dumb kek

#

i love how i got woken at 4am to deal with some people breaking tos on gta online server, and ended up staying awake another hour and a half from being sidetracked by code lmao

short snow
fervent sage
#

if we do that we also need a !otn a yes for that one time in 27 years time when they line up

short snow
#

quackstack#31 needs one core dev review and quackstack gets more closer to the finish line

dusky shoreBOT
fervent sage
#

i should be quackstack core dev mmLol

short snow
#

anything, just one review

fervent sage
#

but i have a commit anyway so it wouldnt matter lol

#

actually that should work with just a helper+ review iirc on quackstack

short snow
#

oo i can disable auto merge

fervent sage
#

unless that changed

vocal halo
#

hey devs I figure out how to do that

#

but i still dont understand how @stable mountain diffrence between one name for two or more URI?

#

like if i check the objects.inv file there are 3 lists and when i do

#

!d list

stable mountainBOT
#

class list([iterable])```
Lists may be constructed in several ways:

• Using a pair of square brackets to denote the empty list: `[]`

• Using square brackets, separating items with commas: `[a]`, `[a, b, c]`

• Using a list comprehension: `[x for x in iterable]`

• Using the type constructor: `list()` or `list(iterable)`...
vocal halo
#

it give me one list

#

how it find which one to give?

gritty wind
#

It doesn’t - a URI is not a URI if it isn’t unique. They have different paths

#

It finds the ones that match the exact given path

gritty wind
#

Only one of the 3 lists is actually just “list”

#

The other 2 have different paths

vocal halo
#

then how @stable mountain find which is real

gritty wind
#

When you call docs with list, it pulls the one that’s just list

#

Because they have different paths

#

That’s what makes it a U(nique)RI

vocal halo
short snow
#

why do we store caches with hash of the timestamp, and why not just the timstamp

vocal halo
#

@gritty wind i was looping in Name now i am going to loop through URI

brazen charm
#

When the symbol names are the same, the bot will move the latter occurrences to different names depending on some conditions

vale ibex
#

Added some screenshots to my PR, ready for review now 😄 bot#1524

dusky shoreBOT
short snow
#

A tz-naive object is a object which is timezone unaware right?

vale ibex
#

yea

short snow
#

and why did kwzrd use arrow rather than just specifying UTC timezine while doing datetime.datetime and there is utcfromtimestamp

vale ibex
#

context?

short snow
vale ibex
#

It's likely due to how datetime deals with timezones

#

Arrow makes things like this much easier

tough imp
#

datetime specifically deals with naive instances as if they were local time

short snow
#

yeah i read that, it was mentioned in your pr description, but like it said you can specify the timezone to be UTC, that won't take it to be naive

tough imp
#

you can, but I find the code to be ugly ~ arrow makes tz-aware objects by default, which I like

#

we've also started using arrow for this reason elsewhere

#

as the descr explains 😄

short snow
#

ah ok, that was my question

#

thanks

vale ibex
tough imp
#

by the way, datetime.utcfromtimestamp sucks

#

it creates a naive timestamp again

#

I don't fully understand why ~ you're basically creating an unusable object, because the library itself will misinterpret it

vale ibex
#

Yea, it assumes the time stamp given to it is in local time

#

so tries to compensate it to utc

short snow
#

uhh, it says utcfrom in the functino name tho

tough imp
#

yes, it won't convert the timestamp to local time

#

but the object won't know that it's in UTC

#

so the library itself will understand it to be local time

short snow
#

oh

tough imp
#

simply using utcfromtimestamp is not enough

#

you need to specify the tz manually

#

which makes no sense to me as a user, I'm already saying it's utc

#

arrow does not behave like this, both utcnow and utcfromtimestamp will produce aware objects

#

which makes more sense to me

short snow
#

yeah, arrow makes it simpler and clear

tough imp
#

yea so while datetime does support tz-aware objects, I find the API cumbersome in that case

#

I don't know whether it necessarily justifies adding a dependency, but since we already adopted it elsewhere, I decided to do the same

#

because it makes tz-aware objects by default, there's less risk that someone else will make the same error as I did later on

#

although at least comparing a naive and aware object raises an exception

short snow
#

right, seems much clear now, thanks!

#

yes, it won't convert the timestamp to local time
but the object won't know that it's in UTC

If this is a known bug, why don't the maintainers fix it?

tough imp
#

it's probably not a bug

#

it's documented behaviour

#

I just find it unexpected that utcnow().timestamp() does not work at all

#

it seems intuitive to me

short snow
#

hmm, i will need to look into does.

tough imp
#

afaik some parts of the stdlib mimic the behaviour of Java libraries, so maybe they wanted it to behave the same way

#

or maybe the way it behaves makes perfect sense and I'm just missing something

short snow
vocal prairie
short snow
#

sure no worries, you can do it at your own pace

sleek steppe
short snow
#

whoops copied it twice

#

updated it

sleek steppe
#

Are we trying to upgrade everything that isn't upgraded?

short snow
#

kind of, since on updating packages, they get support for python3.9

#

like if we upgrade to python3.9, but don't upgrade discord.py from 1.5, it won't have python3.9 support

sleek steppe
#

Do we even use aiodns? Github code search shows nothing

tawdry vapor
#

Should be using it, yes

#

Considering the code was ported from the bot

#

And I know for a fact that does use it

patent pivot
#

Pretty sure it's a use if present thing under the hood of aiohttp

#

I forget though

short snow
#

lemme see one minute

#

grep helps

tawdry vapor
#

No it isn't. It has to be manually configured as far as i know

patent pivot
#

It isn't used in the code base

#

Hm

tawdry vapor
#

That's how the docs show it

#

I know where to look so I guess I'll quickly find the use for you

patent pivot
#

Changed in version 1.0

#

Changed in version 1.0: The resolver is aiohttp.AsyncResolver now if aiodns is installed.

tawdry vapor
#

Line 33

patent pivot
#

aha, nice

short snow
#

@sleek steppe should i implement the rest of the typing changes with co authoring you, or you will open a pr from your branch?

tawdry vapor
#

Never explicitly says anywhere (besides the change log I suppose) that it will automatically use it. That's annoying

short snow
#

maybe we could add a comment in the pipfile to say where it is used

green oriole
#

That should be an optional dependency on aiohttp lemon_pensive

patent pivot
#

if it's used in the code that's fine

#

it is

#

pip install aiohttp[speedups]

green oriole
#

Oh nice

#

Is that what we are doing though?

#

Nope

#

We should do that tbh

#

aiohttp should be a dependency of our code

short snow
#

Sure go ahead then, just squash down to the important commits

tawdry vapor
#

I question if that still works

#

The Boolean is always false with the line potentially setting it to true commented out above

#

I'm on mobile so I'm boot able to check if it gets set elsewhere

#

Yeah it's disabled by default

patent pivot
#

aha

placid ermine
#

okay

#

after 1 day of researching I have found no way where the latex works without a manual gc.collect

tawdry vapor
#

What's the context for this?

brazen charm
#

does the bot reach memory limits if it waits for the gc to do it itself?

placid ermine
#

Yeah

green oriole
#

Hmmmmm

#

Isn't CPython supposed to call the GC when the memory limit is reached?

placid ermine
tawdry vapor
#

Is it running in a thread or process executor

sleek steppe
#

thread

placid ermine
#

yeah

tawdry vapor
#

Have you tried process

placid ermine
#

yes, and i got hit by a huge error

#

i redirected the stderr to a file, the file is 21.3 MB

#

lol

tawdry vapor
#

No idea what that could be

#

Anyway, using an actual latex install instead of matplotlib may still be viable, if you're desperate for solutions.

#

They can actually be pretty small and quick (like maybe 10 MB, most of which would be fonts) - it's just that the popular distributions aren't

vale ibex
#

Scale was working on changing it to multiprocessing and limiting the spawned process's memory

brazen charm
#

Nothing really wrong with calling it yourself imo if it works properly for large inputs without complicating it through limited processes. the allocation thresholds could also be adjusted but that's a larger impact

placid ermine
#

so uh
bug fixed?

#

interesting

brazen charm
#

Running it in a separate process will let the os take care of it, but if there are problems with that's I don't think it's really necessary if the manual call does everything properly

placid ermine
#

Okay so I started going through the large error and this is what it boils down to:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'E:\\Python Projects\\Sir Lancebot\\sir-lancebot\\bot\\log\\hackbot.log' -> 'E:\\Python Projects\\Sir Lancebot\\sir-lancebot\\bot\\log\\hackbot.log.1'
gritty wind
#

The manual call can do everything properly - and still error (presuming you stick with matplotlib). What happens if you pass in an input long or complex enough where you simply need more ram. No optimizations can basically beat the numbers game

#

How are you forking it

placid ermine
#

how am i what

#

I just run it in a ProcessPoolExecutor

gritty wind
#

How are you making the new process

brazen charm
#

I assume there's no reasonable way to limit the expressions passed to it?

placid ermine
#

I doubt it

gritty wind
#

You can limit length - not so much for complexity

placid ermine
#

However
I don't think matplotlib's tex allows much complexity any way

tawdry vapor
#

If it's a separate process then it may be possible to use cgroups to limit resource usage, if that is the concern.

gritty wind
#

I got it more or less working with the resource library

#

Though just the process takes up quite a bit of ram on its own

brazen charm
#

Does resource work on win?

woven sand
#

ht

#

ther

placid ermine
#

<@&267629731250176001>

trim cradle
#

You can learn about Python py_strong

green oriole
#

Hello here

tawdry vapor
#

Are you just spamming to get voice verified?

#

Yes

#

Please don't

trim cradle
#

Alright then

#

!tvban 803721494139502632 "2 weeks" Spamming is no way to get voice verified.

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied voice ban to @woven sand until 2021-04-28 15:39 (13 days and 23 hours).

tawdry vapor
# brazen charm Does resource work on win?

Dunno but it seems very linux-y to me based on naming conventions. Windows support isn't important as long as its use can be disabled to avoid outright crashing on Windows

mellow hare
#

If it's to be used within a docker container, I'm comfortable with that

gritty wind
#

Resource doesn't work on windows, but I handled it like:
if (has-resource) or (doesn't have resource && debug): add cog
else: don't add cog

#

I figure no one is hosting prod on windows yet

tawdry vapor
#

I don't think we should be putting much consideration into the production needs of others.

gritty wind
#

yeah

tawdry vapor
#

As long as development/contribution is feasible cross platform, that's good enough

#

And if a few things don't work that's okay

placid ermine
#

@gritty wind since you're working on this, can I stop my fruitless researches then?

gritty wind
#

Processes?

placid ermine
#

latex fix

gritty wind
#

If you'd like to still work on it, I have to get some other important things done first

#

otherwise, yeah I'll do it

placid ermine
vocal prairie
#

@cold island Just curious, allowing mods to go off duty would be good so that they wouldn't get pinged while they aren't on Discord, right?

fallen patrol
#

si

#

they would still keep the helper role

#

and they would still be hosted in the right

#

just not under moderators

#

it would either be mod-team or helpers

gritty wind
#

They will still be hoisted in the mods section

#

Both roles will exist

vocal prairie
#

Ohhhh

#

So there are two mod roles

#

One is a hoist with the perms

#

The other is for pinging

#

Right?

gritty wind
#

more or less

vale ibex
vocal prairie
#

That's cool

fallen patrol
gritty wind
#

why?

vocal prairie
#

Wdym rename?

fallen patrol
#
        moderators:         &MODS_ROLE      831776746206265384
        mod_team:           &MOD_TEAM_ROLE  267629731250176001
cold island
#

the names are final yet. Shouldn't matter for now when trying to ping mods

fallen patrol
#

calls them mod role and mod team role

gritty wind
#

The naming in the code can be different to show intentions

#

Ultimately, the role you ping will always be moderators

fallen patrol
#

but it is weird to have them the same in client

gritty wind
#

It also makes the most sense that the pingable role will be the one users can see in the sidebar

gritty wind
#

like Zig said, this isn't final

#

But I much prefer it this way

fallen patrol
#

are

gritty wind
#

that's a typo I'm pretty sure

fallen patrol
#

oh

gritty wind
#

@cold island ?

cold island
#

yes lol it's a typo

fallen patrol
#

imo it looks really really weird when looking at a mods roles

gritty wind
#

I still don't get why

fallen patrol
vocal prairie
#

It's the best option anyway.

fallen patrol
#

it would be nice to see which role is which

gritty wind
#

tbh that looks fine to me

#

There is no real reason to be able to make the distinction

#

It'll be pretty clear anyways because they either have 2 roles or 1

vocal prairie
#

In your own test server, it would take two minutes to change if you want.

cold island
#

we're just setting things up, I really don't see why it's important to be figured out now

vocal prairie
#

Just recolor one role if you want

fallen patrol
#

imo there is a pretty good reason to make a distinction

cold moon
#

This is weird. Maybe first should be Active Mods or second Mods Team?

cold island
#

Like I said.

#

We're just setting things up.

fallen patrol
#

if you're going off duty, being the same as the other mods is gonna get you about as many pings as when ppl look to the list and ping a mod for help with their code

gritty wind
#

The moderators name will stay in at least 1, so users can still ping them
& in my opinion it makes the most sense that the role visible in the side bar, is the role you are used to pinging

vocal prairie
#

But they can only ping one role?

gritty wind
#

And people don't ping individual mods often, when they do, we tell them not to

fallen patrol
#

i would either host them separately or make them different colors

fallen patrol
gritty wind
#

but you can't ping mod team

#

you can only ping mods

vocal prairie
#

It isn't final. So why does it matter now?

#

And it's actually clearer if there are two roles with the same name.

#

Because if one role is named one thing, and then somebody goes to ping it and it isn't available, that could cause confusion.

fallen patrol
#

vcokltfre/tutorial#1 vcokltfre/tutorial#2 vcokltfre/tutorial#3 vcokltfre/tutorial#4 vcokltfre/tutorial#5 vcokltfre/tutorial#6 vcokltfre/tutorial#7 vcokltfre/tutorial#8 vcokltfre/tutorial#9 vcokltfre/tutorial#10 vcokltfre/tutorial#11 vcokltfre/tutorial#12 vcokltfre/tutorial#13 vcokltfre/tutorial#14 vcokltfre/tutorial#15 vcokltfre/tutorial#16

#

imo there shouldn't even be an error message, or just the first 5 and then say only 5

fervent sage
#

as a side note i think now that we allow linking of any org/repo we should probably prefix the links with where they come from, like

:prmerged: vcokltfre/tutorial#1 - feat: mention tokens tip in index and below codeblocks
vocal prairie
#

I think we should do that if at least one of them isn't from us.

#

If they're all from PyDis, then i don't think it matters

#

Or at least from the same PyDis repo.

fallen patrol
#

at at minimum prefix them with which repo in all cases

vocal prairie
#

Or, if it's all from the same repo: GitHub - vcokltfre/tutorial in the title maybe

fallen patrol
#

this is how it used to be

fallen patrol
#

Lmfao

#

.latex $lancebot.do(crash)$$

#

FYI @gritty wind rn it crashes after about 7 uses

#

Because memory leak

#

Idk about the new pr but the current implementation does

gritty wind
#

what are you talking about? No such command exists

#

lol thanks

gritty wind
#

.help latex

dusky shoreBOT
#
Query "latex" not found.
fallen patrol
#

Lol u unloaded it

gritty wind
#

@vale ibex It's currently using the input hash yeah

vale ibex
#

So @gritty wind summary so far, latex cog checks local cache for a file with the same hash as the args, if it doesn't exist, spawn a subprocess, passing the latex args as command line args

#

then within the subprocess we generate the file, and save it with the hash

#

then within the cog itself read the file and ctx.send

#

with the subprocess being limited & set with a high nice value

fallen patrol
#

if its identical to the last time and threw an error, cache the error as well?

green oriole
#

Sounds about right

gritty wind
#

I'm not sure if I'm going crazy or what

#

but the resource library seems to not know what bytes are

#

apparently need to dedicate like a GB 400mb to the subprocess to get a basic 4 letter word to process

#

something is definitely wrong

vocal prairie
#

We only use internal bots.

cold island
#

What does it do?

tough imp
#

texes it 🤡

fervent sage
clever wraith
#

is it allowed for anyone to contribute to bots in this server?

fervent sage
#

yep

clever wraith
#

is there a list of things that you guys want? like features or some

fervent sage
#

there's the issues tab on the bot repos which have some feature/bugfix/etc. suggestions, some of which i believe arent claimed, you can also make your own issue if you want to implementa a feature

clever wraith
#

ok

gritty wind
#

but its similar enough

fallen patrol
#

how did you guys make latex not load every start

gritty wind
#

wdym?

fallen patrol
#

or is someone actually unloading it every reconnect

#

oh

gritty wind
#

it's only been unloaded twice

fallen patrol
#

the bot hasn't reconnected since yeah

gritty wind
#

.help latex

dusky shoreBOT
#
Query "latex" not found.
gritty wind
#

it has not

fallen patrol
#

someone add lancebot․do⟮crash⟯ to otn smh

fallen patrol
#

nope just gotta ask staff for them

#

although

#

it'd be nice for the bot to have a command just for that lmao

gritty wind
#

You don't really need more than one emoji

fallen patrol
#

btw you can right click

gritty wind
#

treashcan

fallen patrol
gritty wind
#

or just any random image you have on your PC

fallen patrol
#

ah that sucks

#

get better soon

gritty wind
#

yes, if embeds are enabled

#

yes

sleek steppe
#

.help emoji

#

Ah right I was gonna make a pr for this command

fallen patrol
#

.enoji

#

.emoji

sleek steppe
#

But my fork is deleted

fallen patrol
#

smh

cold island
#

.emoji

dusky shoreBOT
#
Command Help

.emoji <emoji>
A group of commands related to emojis.

Subcommands:
count [category_query]
Returns embed with emoji category and info given by the user.
info <emoji>
Returns relevant information about a Discord Emoji.

sleek steppe
#

Can you PR from a fork of a fork lol

#

Yeah that won't work

#

Guess I'll wait

vale ibex
#

Change origin to the main repo

#

Upstream I mean

sleek steppe
#

Hmm maybe

git switch -c branch_name --track upstream/main
git commit ...
git push origin branch_name
vocal prairie
#

You can still get the id I think.

#

And then pull it from the cdn.

gritty wind
#

(you can also all collaborate on the fork if that's your thing)

sleek steppe
#

https://cdn.discordapp.com/emojis/{id}

fallen patrol
#

bot_commands: &BOT_CMD 267659945086812160

#

what does the &BOT_CMD mean in the config file?

#

since not everything has that

gritty wind
#

It's a variable

#

You can reference BOT_CMD later

#

if you dig through, you can find how it's used in other parts

#

If I wasn't lazy, I'd open up my config and point out certain ones

fallen patrol
#

so like

gritty wind
fallen patrol
#

from constants import BOT_CMD?

gritty wind
#

These are more variables for the yaml file

fallen patrol
#

ohhh

#

so it ok

#

that makes sense and is cool lol

#

and what does token: !ENV "BOT_TOKEN" do?

#

since its a !

#

not a &

gritty wind
#

pull it from the environment variables

fallen patrol
#

wtf that's

#

i-

gritty wind
#

the equivalent of os.environ.get

fallen patrol
#

my config system is now dead on my bot tyvm

gritty wind
#

I'm pretty sure this is using a custom parser

fallen patrol
#

Meh

#

I'll borrow it

gritty wind
#

I don't know why we use yaml lol, but I don't care enough to question it

#

it works

sleek steppe
#

@short snow when can you review the PR? I want to delete this fork lol

sullen phoenix
tough imp
gritty wind
#

I'm a bit mad and just put everything in good ol' python

#

I mean, we basically do

tough imp
#

I dont like yaml but I'm not aware of anything better sadclown

#

using yaml allows you to dynamically load attributes from multiple files

#

that could be awkward with python source code

patent pivot
#

I've had some joy using TOML recently

gritty wind
#

Possibly, but mind you I'm usually not configuring 300 constants

#

Have used JSON in the past

#

that was fun

tough imp
#

but I think there are some significant advantages to keeping most constants in source code, eg that your editor can actually guide you to the definition

#

vanilla json doesnt have comments

tough imp
patent pivot
#

the area where toml fails is lists