#dev-contrib
1 messages · Page 101 of 1
I'll just leave it for now
.
p_star_one = star_one / leaderboard["number_of_participants"]
ZeroDivisionError: division by zero
for .aoc stats command
yeah, since there are no boards specified, so leaderboard is empty
Seb would be the person to ask for AoC stuff
#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
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
yeah understood
Hey, does lancebot work on arm?
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
That'll depend on whether our dependencies work on arm
you may need to build wheels for a bunch of them when installing them
yeah, (like kutie's commit descriptions on adding int e to sir lance)
I would document the code, and update the reasoning
You can see the commit description under the commit title in GitHub, right?
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
.status cat 418 works on python 3.9 now lol
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
Here's a tip for testing the .latex command: don't enable BOT_DEBUG
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
I added logging.getLogger("matplotlib").setLevel(logging.ERROR) to __init__.py in my pfp PR
we should probably cherry pick that if this PR doesn't get merged soon
Not really, it is a bit hard to get running
wdym
but its possible without code changes?
You can probably make sure that the deps are working
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.
Probably not worth the effort though
the first time I called it I got like a billion debug logs and it took forever
yeah
also worth noting this got a bit superseded by my CF access antics
have you done it?
and the project we were going to protect doesn't need it
fwiw the more laughing thing is i've never seen a repo without anything in it
lol
Yeah, it was a mess
I'll probably private it
I had to make it run on the host
:/ donnt
Public gud
lol
when it does something I will
I don't trust a person with private repos
it depends
private sus
public keys > private keys
lol
remember when i once sent my private key to #deleted-channel
#deleted-channel?
I have literally 0 private repositories
Me neither
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
Lol
yeah we removed dm log
it's a balance
DM log proved useful a few times in weedling out DM invite spam before it hit many users
but yeah users have become too accustomed to the belief that DMing bots doesn't go anywhere
Relayed bot DMs to a channel yeah
I use my own bot
Since I don't want random people getting stuff.
i use my alt
One day discord will allow messaging yourself like Slack and all will be well
fwiw the actual thing is: users have become too accustomed to the belief that DMing bots isn't read by people who they talk to daily
Or you can make a group dm with no one in it besides yourself.
dave is ignoring me tho
same
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
I do this sometimes.
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, 
I would argue you'd probably want your private key going to those who you somewhat know, lol. Not sure the difference is too large there.
that was an accidental paste in that situation
and it hadn't been configured yet
i was trying to paste it on a server
ah
i'm staff of a really large bot and we do have a relay cog
which bot 👀
but yeah most of the functionality we implement is ensuring a balance between user privacy, security and moderation
if you want an invite i can dm you
nah was just interested which
gamesrob https://gamesrob.com/
nice
I tested everything on python 3.9, the ones that error are the aoc commands and .pridefact
hey devs how @stable mountain use its docs commands
!src d
Look up documentation for Python symbols.
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
Read that line
OBJECT.INV
there we go i just remembered
no
/objects.inv
what the
did that just
It's in the link.
doc set
You should probably read the source code.
yeah i am reading sorry for that
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.
!d <- that lists all of the inventories
Yeah, it is.
Can you please help me?
Hey! See #❓|how-to-get-help, unless of course you're looking for help regarding contributing to one of the bots here, etc
They were wondering about the source of the docs command.
Ah alright gotcha
@short snow I pushed a bit more improvements to typing and fixed LinePaginator, I can PR now
@patent pivot
Here's your reminder: changelog doc changes if no one else has.
[Jump back to when you created the reminder](#dev-contrib message)
lol
cc <@&267628507062992896>, I can't do that tonight, can someone summarise and changelog bot#1014
I'll do some reading and prepare something
Wonder why this only has 2020
https://github.com/python-discord/sir-lancebot/blob/main/bot/resources/pride/facts.json
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
Well that makes the command useless in 2021
Not true, it still sends random facts as long as one exists
@gritty wind @sleek steppe ^
?
the pride command
Yes, what's your point?
the reason its weird
I still don't get what you mean
Hey if we're talking about changelogs, latex hasn't been done
It still needs to get the memory fixes
Hmm?
It has no resource limits atm, so regular usage can crash the bot
I know that he added a cooldown in a pr
The cooldown on its own won't be enough, as one input alone could crash the whole thing
not the root cause
sir-lancebot#682 I think
True
matplotlib.pyplot.figure to matplotlib.figure.Figure
that is probably a larger fix
He did that as well
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
Yeah, fair
@fallen patrol
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)
@fallen patrol https://github.com/jb3/discord-oauth2-gate
!d aiohttp.ClientSession
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.
No, it does not look bad mostly
Screenshot?
That looks weird.
lmao
Much better on desktop.
do be aware the color is cause of android AMOLED
Yeah ik.
live now and working!
Once you authorize you will be redirected to:
A random place in time and space without light. A black box if you will :)
Cough cough, the black box
*not asking what the privacy policy is but that link
Once authorising you will be redirected to ṫ̴̑ȟ̴̐e̸͛͆ ̸͋̑v̸͑̃ȏ̴͠ḯ̷̅d̷̈̕
I hate those characters.
links to https://pydis.com/privacy/
the option in the dev portal yea
That's nice
my brain just assumes that everyone automatically sees displace patchnotes because of how useful they are 
displace patchnotes?
smh
#notascam
Discord's domains
lol
lol
it has a url that beats even that
what the fuckkkkkk
of course don't forget
lmao
that one too
but yeah oauth2 thing is live now
i would say break it
but i don't think i want that lol
uh oh
cause hoe deployed the oauth thing i think
*joe
oauth is totally unrelated to the bot
Okie
this? #dev-log message
Nah that's unrelated
sure do it, if you haven't already
@placid ermine #sir-lancebot-playground message
ah
because
aight so what is that
even
…
that's on the raw command and the latex command lel
<@&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
I can either unload the cog or Lancebot will just keep restarting. Either way it's Lancebot so it's not critical.
hahastinkypoop has a pr open.
That fixes it at least a little.
It doesn't go over 110 mb.
But hasn't been merged yet
Or 3) review the pr
And goes back down to normal once you give proper input.
Yeah.
I mean... my review won't do much until a core dev can look at it
Also... it's lancebot. Not critical.
i mean, it hasn't respawned in 3 minutes
sir-lancebot#682
finally ironically
Hm what we need is a ping command 
hm
Yes
.uptime
what pr number might that be if it were to exist?
Uh 861 I think off the top of my head
sir-lancebot#861
I think it's dead lol remember
sir-lancebot#681
861? That's far too high.
?
its sir-lancebot#681 not sir-lancebot#861
you thought it was sir-lancebot#861 but in reality its sir-lancebot#681
stop.
Ah
lmao lance died again
Why did dev voice move up again?
9 reconnects in an hour
we archived bounty board
its fine
Either way it's Lancebot so it's not critical.
I thought dev voice was below dev contrib
Yeah ig
ohhhhh
u have android
it is?
ah
same thing occurs in pyweek
why is sir lance dying so often?
Latex
Still matters to me.
sir-lancebot#682 should fix it
sir-lancebot#682
Hopefully
if you wanna drop a like and follow hit up sir-lancebot#682
i really bungled that statement
it's high priority now.
nice
Noice
add a review if you want
since ur a core dev it would mean only one contributor needed
I'll do it if I can
bruh
wait was that you
'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
@fervent sage ping command merged.
aye
@fervent sage another ping, another poke.
https://github.com/python-discord/sir-lancebot/pull/679#pullrequestreview-635178032
i actually saw the comment pop up on my other monitor before the ping :P
lel
the latex thing?
I'll get there.
because it isn't even closing it
hey you guys know about @stable mountain so can you help me in #help-lemon
that would be nice of you
*several commands with bad input
but yeah 😔
the hacky workaround I PRed does seem to do the job tho
gc is stdlib
also i mean
the error is pretty uh
I should use this lib in my projects
well yes
Does gc.collect() have the possibility of effecting other cogs?
granted
probably not
i think
i'm not sure
but Bast said using gc.collect() isn't a good fix
@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
This is the one
yes, yes you did
you typically do not want to manually invoke it, yeah
Is this our only option?
just reload the cog after command execution
I'm still trying to figure out why it isn't getting GCed automatically
and looking at SO, it seems like memory issues are pretty common with matplotlib
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
lol
take your time when debugging
did you unload it?
I agreed with kat that it would be best to do that.
yeah, i'm inclined to agree too 😔
because it was unloaded earlier but the bot reconnected
i think ive come up with a decent one, "parent_command"
oh no, flake8 is unhappy
time for some ✨ rearranging ✨
why?
line too long
just black it
lmfao
btw
running black on the lancebot repo changes like 56 files
black can be weird sometimes with flake8 and conflict
black wouldnt fix it since its a too long string
wouldn't autopep8 work better?
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
wdym
would conflict less with flake8
okie, correct command signature fix pushed
also wow i forgot how good vscode's integration with github PRs is
i’m not sure, but that would be a last, last resort
I ain't ready for the side effects.
lol
haha yeah
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 ... 
xd
@vale ibex mentioned the changes and updated the PR description
@fervent sage what is subcontext?
@vocal wolf more than happy to make that change, but im at a loss for commit message lol (preferably following the format chore: <msg>) 
hm improve code clarity perhaps but it feels like it doesnt quite fit
"Moved variable into if statement"
'made good changes; code better'
there are 2 no 3 no 4 hard things in computing:
cache invalidation
naming
timezones
git commit messages that dont suck
- staying within resource limits
nice!
How can I contribute
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
if all else is awful, at least my commit messages will be nice 
lol
aah guys you said ask help in help channels
no one helped and now that channel is closed by bot
@clever wraith git is an extremely powerful tool. Here's a tutorial to get you started:
Learn how to use Git and Github 🐙🐱 in this interactive tutorial by sending a pull request to this repo in exchange for a free AngularFirebase sticker 🔥https://github.com/codediodeio/gimmie-sticker
ok anyway idk what command to make
should i make a What Harry Potter House are you in?
help me
basically a questionnaire that determines what harry potter house you are in
Sounds like a good idea, I'm pretty darn sure we don't have that.
but since it’s not original i could maybe change it up a bit
duck houses??
which duck house do you belong in
@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.
hmmm
@clever wraith ditch the harry potter houses. Which duck are you?
i’ll try implementing it on my bot first, it it works i’ll try adding it to sir lancebot
i am patient i am waiting from last day
@placid ermine I just found a fix for your latex command

wow
Np
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 
How about the no
does the sir lancebot use load extension?
yes
!src d
Look up documentation for Python symbols.
.src ext
ok so for my command to work i’ll need a setup function right
I hate u lance
yeah you did but now i dont understand all the code in like in a cycle
also yes
wait
oh also xithrius i made the fixes :P
Yes
@fervent sage do you have a tutorial for cogs in dpy?
i do
no no no
You need the setup method and cannot be async
i already know cogs
I think they may have meant the init.py file?
There's no harm in reading another tutorial (I think)
(it depends on the tutorial)
(anything but youtube)
I will stare.
uh there's https://vcokltfre.dev/tutorial/05-cogs for general cog stuff, and https://vcokltfre.dev/tips/cogs for transitioning existing commands to use cogs
Fwiw alec's tutorial is pretty good but I think there was a hole luckily I already knew it
Idr
@clever wraith stare I suggest.
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
lol okay
i’ll check em out
does anyone wanna write the command with me?
i’m kinda trash at python
Wut
@fervent sage gimme tldr https://vcokltfre.dev/tips/optional/
Sometimes in discord.py you'll want optional arguments. The correct way to do this is using typing.Optional, not defaulting the arguments to None.
Why typing.Optional
@fervent sage would this work?
- if subctx := getattr(ctx, "subcontext", None):
+ if ctx := getattr(ctx, "subcontext", None):
+ parent_command = f"{ctx.command} "
- ctx = subctx
nop because if it has no subcommand parent would be undefined later
!d typing.Optional
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...
this is bad advice pls ignore it i need to remove this
here you go
lmao
the issue is which i didnt knwo when i wrote it
Lol but
What does typing.Optional do that = None do?
parent_command = "" is still there btw
@fallen patrol I think this gives pretty good examples.
https://docs.python.org/3/library/typing.html#typing.Optional
of what is correct
hm yes i think that should work, i'll test it now
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
oh actually it should be if ctx := getattr(ctx, "subcommand", ctx) but will fix now
So what does optional do??
Tells you that the argument can be None.
!e
a = 1
if a := None:
pass
print(a)
@fervent sage :white_check_mark: Your eval job has completed with return code 0.
None
ok yeah
Optional[X] is equivalent to Union[X, None]
Union[X, None] means that the arg will either be of type X or None.
that's why i set ctx in that way, it's because otherwise you end up overwriting it as a value you dont want
typing.Union```
Union type; `Union[X, Y]` means either X or Y.
To define a union, use e.g. `Union[int, str]`. Details...
Alright so your current implementation should be the good?
i think so but i need a couple minutes to regain my brain to think about it now 
Same.
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
then your way will remain.
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 callingclose()doesn't remove internal references either
@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
hmm
aaa why you break my code 
oh my god I'm stupid lol
you and me both lol, i didnt even notice when i did the commit for it
revert that and squash push
that is beyond my git knowledge, how do i do?
I will show you de wey
@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>
always a good day when your terminal looks like this at 5am 
lol, xith disappeared
into my dms to show me da wey
I hath shown him de wey

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 
its ok you have the alias in your zshrc
true
until that lies forgotten like 8 of the other ones i only remember when i add more 
docker system prune -a
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 .
@fervent sage we're stupid again (I think).
oh no
ctx.subcontext is used once
in the timed.py file
so why not just replace it with new_ctx in the if statement
because the error handler needs it

that's a very familiar progression of thoughts to me lol
merged.
epic
and yes, I did test the newest version
pretty errors for when we're pretty dumb 
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 
!otn a is california on fire?
if we do that we also need a !otn a yes for that one time in 27 years time when they line up
quackstack#31 needs one core dev review and quackstack gets more closer to the finish line
i should be quackstack core dev 
anything, just one review
but i have a commit anyway so it wouldnt matter lol
actually that should work with just a helper+ review iirc on quackstack
oo i can disable auto merge
unless that changed
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
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)`...
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
read my question again pls
yea
then how @stable mountain find which is real
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
well let me test it pls
why do we store caches with hash of the timestamp, and why not just the timstamp
@gritty wind i was looping in Name now i am going to loop through URI
When the symbol names are the same, the bot will move the latter occurrences to different names depending on some conditions
Added some screenshots to my PR, ready for review now 😄 bot#1524
A tz-naive object is a object which is timezone unaware right?
yea
if there is no timezone given, how does it get the time?
and why did kwzrd use arrow rather than just specifying UTC timezine while doing datetime.datetime and there is utcfromtimestamp
context?
It's likely due to how datetime deals with timezones
read the warning here https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
Arrow makes things like this much easier
yes correct, a naive datetime instance is ambiguous and open to interpretation; it doesnt point to any specific point in time
datetime specifically deals with naive instances as if they were local time
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
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 😄
Like in the help channel cog, much easier to work with
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
Yea, it assumes the time stamp given to it is in local time
so tries to compensate it to utc
uhh, it says utcfrom in the functino name tho
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
explained in the warning here: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp
oh
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
yeah, arrow makes it simpler and clear
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
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?
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
hmm, i will need to look into does.
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
https://blog.ganssle.io/articles/2019/11/utcnow.html found this while i was looking around
A public service announcement about the dangers of utcnow and utcfromtimestamp and the benefits of using their replacements.
That works, I'll try to work on some today.
sure no worries, you can do it at your own pace
Are we trying to upgrade everything that isn't upgraded?
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
Do we even use aiodns? Github code search shows nothing
Should be using it, yes
Considering the code was ported from the bot
And I know for a fact that does use it
No it isn't. It has to be manually configured as far as i know
That's how the docs show it
I know where to look so I guess I'll quickly find the use for you
Changed in version 1.0
Changed in version 1.0: The resolver is aiohttp.AsyncResolver now if aiodns is installed.
Line 33
aha, nice
@sleek steppe should i implement the rest of the typing changes with co authoring you, or you will open a pr from your branch?
Oops. It's sort of documented at the very beginning of the docs ironically but I only ever searched the api reference which leads to a manual example
Never explicitly says anywhere (besides the change log I suppose) that it will automatically use it. That's annoying
maybe we could add a comment in the pipfile to say where it is used
That should be an optional dependency on aiohttp 
Oh nice
Is that what we are doing though?
Nope
We should do that tbh
aiohttp should be a dependency of our code
I can do that now
Sure go ahead then, just squash down to the important commits
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
aha
okay
after 1 day of researching I have found no way where the latex works without a manual gc.collect
What's the context for this?
does the bot reach memory limits if it waits for the gc to do it itself?
Yeah
The latex command was bugged, every time there's invalid input the memory usage increases and doesn't come down
ultimately causes bot to exceed memory limits and restart
Is it running in a thread or process executor
thread
yeah
Have you tried process
yes, and i got hit by a huge error
i redirected the stderr to a file, the file is 21.3 MB
lol
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
Scale was working on changing it to multiprocessing and limiting the spawned process's memory
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
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
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'
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
How are you making the new process
I assume there's no reasonable way to limit the expressions passed to it?
I doubt it
You can limit length - not so much for complexity
with ProcessPoolExecutor() as pool:
image = await asyncio.get_running_loop().run_in_executor(
pool, self._render, text, image_path
)
However
I don't think matplotlib's tex allows much complexity any way
If it's a separate process then it may be possible to use cgroups to limit resource usage, if that is the concern.
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
Does resource work on win?
<@&267629731250176001>
You can learn about Python 
Hello here
Alright then
!tvban 803721494139502632 "2 weeks" Spamming is no way to get voice verified.
:incoming_envelope: :ok_hand: applied voice ban to @woven sand until 2021-04-28 15:39 (13 days and 23 hours).
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
If it's to be used within a docker container, I'm comfortable with that
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
I don't think we should be putting much consideration into the production needs of others.
yeah
As long as development/contribution is feasible cross platform, that's good enough
And if a few things don't work that's okay
@gritty wind since you're working on this, can I stop my fruitless researches then?
Processes?
latex fix
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
that'd be great
@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?
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
Ohhhh
So there are two mod roles
One is a hoist with the perms
The other is for pinging
Right?
more or less
Yea, you may notice that that part is already live 😄
That's cool
pls, have someone rename it
why?
Wdym rename?
moderators: &MODS_ROLE 831776746206265384
mod_team: &MOD_TEAM_ROLE 267629731250176001
the names are final yet. Shouldn't matter for now when trying to ping mods
calls them mod role and mod team role
The naming in the code can be different to show intentions
Ultimately, the role you ping will always be moderators
but it is weird to have them the same in client
It also makes the most sense that the pingable role will be the one users can see in the sidebar
Is it? They serve the same purpose, and for most users, there's only one way to interact with them
like Zig said, this isn't final
But I much prefer it this way
that's a typo I'm pretty sure
oh
@cold island ?
yes lol it's a typo
imo it looks really really weird when looking at a mods roles
I still don't get why
It's the best option anyway.
it would be nice to see which role is which
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
In your own test server, it would take two minutes to change if you want.
we're just setting things up, I really don't see why it's important to be figured out now
Just recolor one role if you want
imo there is a pretty good reason to make a distinction
This is weird. Maybe first should be Active Mods or second Mods Team?
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
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
But they can only ping one role?
And people don't ping individual mods often, when they do, we tell them not to
i would either host them separately or make them different colors
the sidebar could say Mod Team
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.
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
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
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.
at at minimum prefix them with which repo in all cases
Or, if it's all from the same repo: GitHub - vcokltfre/tutorial in the title maybe
this is how it used to be
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
Latex
.help latex
Lol u unloaded it
@vale ibex It's currently using the input hash yeah
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
small thing there
if its identical to the last time and threw an error, cache the error as well?
Sounds about right
yea we could do
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
We only use internal bots.
What does it do?
texes it 🤡
it would also be possible to run https://github.com/chialab/math-api internally as a microservice and just make api queries to it for images right?
is it allowed for anyone to contribute to bots in this server?
yep
is there a list of things that you guys want? like features or some
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
ok
not impossible to set up
okay so
how did you guys make latex not load every start
wdym?
it's only been unloaded twice
the bot hasn't reconnected since yeah
.help latex
it has not
someone add lancebot․do⟮crash⟯ to otn smh
nope just gotta ask staff for them
although
it'd be nice for the bot to have a command just for that lmao
You don't really need more than one emoji
btw you can right click
treashcan

or just any random image you have on your PC
But my fork is deleted
smh
.emoji
.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.
Hmm maybe
git switch -c branch_name --track upstream/main
git commit ...
git push origin branch_name
(you can also all collaborate on the fork if that's your thing)
https://cdn.discordapp.com/emojis/{id}
bot_commands: &BOT_CMD 267659945086812160
what does the &BOT_CMD mean in the config file?
since not everything has that
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
so like
Here are some examples:
https://github.com/python-discord/bot/blob/main/config-default.yml#L225
from constants import BOT_CMD?
These are more variables for the yaml file
ohhh
so it ok
that makes sense and is cool lol
and what does token: !ENV "BOT_TOKEN" do?
since its a !
not a &
pull it from the environment variables
the equivalent of os.environ.get
my config system is now dead on my bot tyvm
I'm pretty sure this is using a custom parser
Basically this entire section
https://github.com/python-discord/bot/blob/main/bot/constants.py#L25-L192
I don't know why we use yaml lol, but I don't care enough to question it
it works
@short snow when can you review the PR? I want to delete this fork lol
the beautiful config format of devops™️
what would you use instead?
I dont like yaml but I'm not aware of anything better 
using yaml allows you to dynamically load attributes from multiple files
that could be awkward with python source code
I've had some joy using TOML recently
Possibly, but mind you I'm usually not configuring 300 constants
Have used JSON in the past
that was fun
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
I think toml is ugly lol but I've never seriously used it
the area where toml fails is lists
its gone now
