#dev-contrib
1 messages · Page 99 of 1
isn;t that uploaded seperately as well
yeah, this is probably worth going upstream
yeah but it becomes the embed
as in, uploaded to the thumb
yeah imma go there
but I think like
but at this point i just wanted to explain it to scale
pulling down and uploading the server icon for every thread is a bit of a weird implementation
yes ik its not a big deal this is like the only server that updates it often
lol I'd need to look into dpy's embeds, probably easier if I tinker with it haha
I'd open an issue with them and see what they say before writing a fix
or ask in the server
imo a different solution would be to actually add it as a config feature
Anyways, you'd better open that issue soon, from my experience issues don't get addressed for weeks
so a server can set a specific icon to show in the footer
and it will always show that icon
in that case this server could also make it a static pydis image
and a bonus is if it were an icon hosted on the site then 😄 it could actually be updated and not break embeds
fwiw, its a minor enough issue and won't affect 99% of servers
its just the server that changes their icon 3/week
which means that the last thread has broken embeds and even then its just a transparent spot
but enough to annoy me
drop an issue on the tracker or in https://discord.gg/F34cRU8
I'll make an issue for the below if even one helper+ says yes
.colo[u]r command for @dusky shore to show info about a color
Probably just here
Ah
I wasn't thinking of an api
I was thinking generating the color on our own and everything, yeah
then yeah, I think that's an issue we could approve
I do like the idea of being able to fetch the nearest identifiable colour 
Sir lancebot is standalone, yeah? Aka no other pydis projects needed
Unlike python
Chirag Mehta - Personal Web Log - 'blog - Chime Softwares - Indian Blogger live from Saint Petersburg, Florida, St. Pete, FL
uhhh
yeah
... Would that be an api?
it has APIs and stuff and optionally redis (you can use fakeredis locally)
no, if it is API only then it's a no go
but that site has openly available JavaScript
As of now I can see a way to do everything except get a near named color
i have redis and it errored when not using fakeredis 
pillow iirc
near named can be done by distance from closest value, that doesn't really need an api, just some static data
PIL is the module pillow provides is it not?
guess I uh need to figure out how to represent colors lol
Distance from closest value of what
RGB
hex and rgb both are the same values, so yeah i don't see much of a difference on what you pick
it's just whatever it's stored as, really
https://github.com/ryanzec/name-that-color/blob/master/lib/ntc.js has a set of them
A command line utility that uses the library that the name that color project (http://chir.ag/projects/ntc/) uses that also provides additional functionality - ryanzec/name-that-color
Oh
1,566 to be precise
949 on that list
or if i want to
im uh
gonna put myself as wanting to write this
there's no stress regardless
yeah fwiw don't expect this done any time soon 😂
good place to start is specifying out the issue and tagging on what needs to be done
i've never worked with pillow, never worked with colo[u]rs, never worked with etcetra
there's no rush as it's not a priority. just keep up communication/updates as you go so it doesn't look abandoned
ok
also uh
i want to set the base right here
color or colour.
I would perfer color
unless pydis specs are british/eu
colour
lol
i will make both work
most internal spelling is british for pydis
true joe
but its which one im gonna use as the base var
but I don't think we've set a standard
colour because colour is correct 
how about i write it as color and then when its done i'll just replace everything with colour
but we never use all the z's you americans keep putting in words
its amerizans
and that's zeds, not zees
fwiw my current discord language setting is
doubt you'd notice much of a difference on discord ui
DECOUPLE TIMESTAMPS FROM LANGUAGE
only with their weird spellcheck thing that i have disabled
going by the previous discussion, some ideas are:
– random rgb or hsv color
– color conversions
– color to name
– color generation with pillow
- complimentary/analogous/triadic/tetradic colors
only timestamps unfortunately
no that's a system setting
i like 24 h so i set to UK
yeah..
actually i once tried changing system time and discord was correct to my timezone so
yeah this
it doesn't have to implement everything in one hit though
just put out something basic to begin with if you want and progressively update
yeah, we can always leave the issue open and mark things off as checkboxes
no it must be perfect 
all the more reason to keep it simple lol
how i typically roll with my own development is i implement one feature and then do other stuff for a week, and then come back to it and implement something else and then repeat
i uh, haven't touched my bot code in around 3 days
which sucks because it has like 3 total commands
what are colo[u]r conversions?
hex to rgb values to blah
RGB to HSV/HSL/CMYK/etc
and vice versa
there's some values that honestly don't need to be included because they wouldn't be used anyway
I think it'd be interesting to have some of the more abstract ones as a demo of how they actually convert
cmyk and rgb are common. hsl is weird
HSV probably
HSL is weird
hsv prettier
though colorsys has both doesn't it
>>> colorsys.rgb_to_hls(255, 255, 255)
(0.0, 255.0, 0.0)
>>> colorsys.rgb_to_hls(255, 255, 0)
(0.16666666666666666, 127.5, -1.007905138339921)
wut
stdlib
!d colorsys
Source code: Lib/colorsys.py
The colorsys module defines bidirectional conversions of color values between colors expressed in the RGB (Red Green Blue) color space used in computer monitors and three other coordinate systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation Value). Coordinates in all of these color spaces are floating point values. In the YIQ space, the Y coordinate is between 0 and 1, but the I and Q coordinates can be positive or negative. In all other spaces, the coordinates are all between 0 and 1.
one more core dev approval needed on quackstack#31 if anyone has got some time
Closes #26
Uses implementation of the staff PyWeek submission
Adds colors.py which contains all util functions i.e. make_color, make_duck_colors, make_man_duck_colors.
Get rid of random RGB ge...
@ mods that says colors not colours
really had to be an account with the name mod smh
Would it be worth it to allow !clean to skip certain messages, and only clean ones from a certain time? For example, if a mod wants to purge 10 messages and skip the last two that were posted, they can't do that right now. Is that something that could help, or would that be pointless?
!src clean
Commands for cleaning messages in channels.
Unable to convert '!purge' to valid command, tag, or Cog.
!src purge
Commands for cleaning messages in channels.
are you
fucking
…
TIL if you click a link, even by accident, on github while writing an issue it just follows the link
and if you go back, you've lost all of your progress
@patent pivot i'll make that color issue soon i was almost finished too
but github was like nope

That's why you constantly keep saving to your clipboard…
go to open issue back, your stuff would be there
where
on the new issue editor
ah, that's why its not, I was on preview
i clicked it when on preview and not when on create
colo[u]r
w/e i'll remake it later smh
By this I mean sorta like slice(), but in this case, you can choose how many messages back you want to start purging.
yeah am fixing that
oh my bad, i thought about the quackstack pr
in this screenshot
bot#1498
It would be great if someone could reply on this, https://github.com/python-discord/bot/issues/1154#issuecomment-785466997
I think we specifically don't want to do this for eval, especially with py-gen. Because all it does is have people run !eval on code that could take up quite a bit of room and then go to bot-commands to get the result.
done
But I'll to find previous discussion on it to make sure I understood the consensus correctly
its been there for 7 days if you wanna comment on it
Uh, does anyone know how long on average it takes to docker-compose the public-stats repo? It's been about 10 minutes, and I'm still waiting.
that's fine, that's just the output of graphite
Oh, okay.
you should be able to browse to localhost:8898 I thikn
That localhost worked, although the actual graphs are blank. Strange. Probably data still loading.
https://xkcd.com/color/rgb/
https://github.com/ryanzec/name-that-color/blob/master/lib/ntc.js joe
pillow
don't mind me
there isn't any data in the graphite is probably why
Oh, that would make sense.
graphite is empty after initial startup, you can fill it by running an instance of the bot or with some dummy scripts
I probably have to set up the bot and site api.
I'm not sure of the cleanest way to seed such data
are you planning on amending the stats portal?
I was thinking about it. Possibly. I also wanted to see how the graphs are generated so nicely.
The UI is really nice.
Cool, thanks for the link!
What do you think of a stat for most used topical channels?
Like messages per topical channel.
sounds pretty interesting, although we don't track channel categories on the graphite circuit so such a chart is more suited for metricity data, which could probably come with a later iteration of the stats portal
That makes sense. I'll look forward to it!
metricity#3
i should uhhh
Should I open an issue so that the idea isn't lost?
ffs why did i bring it up
it's definitely one on my list for if we ever migrate
Okie.
I was going to put something out today anyway and then the new policy goes live next Saturday
sunday tho i thought you were gonna give a weeks notice
and today is sunday almost monday
alright, sunday then
Your goal is to delay this as much as possible, isn't it
a good week
yeah pretty much
Sunday at 12 UTC is the date
hello
Your reminder will arrive in 6 days, 10 hours and 6 minutes!
good game
https://pydis.com/privacy
double redirect smh
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
wait no
it redirects me through all of that smh
…well played
What is this change for
no more ability to opt out of metricity
remove opt out functionality from metricity
hm
for merging it
don't people who opt out have to consent to opting back in?
yeah
the announcement doesn't say that part
not really, because it's not an opt out as a measure of compliance, it's just disabling a feature
Why would they have to consent to opting back in? The announcement is letting people know there won't be opt out functionality and while they remain in server they'll have the metricity data tracked
right
it would be as simple to say that's how you agree
by sending messages
or even remaining in the server
that would be considered consent, no?
it's not even a matter of "by doing X you consent" really
think of it more as a feature toggle
people disabled the feature toggle but now we're removing that toggle entirely
it's not something people need to consent to
how does one link to a header within markdown
its [text](#Proposed%20Implementation) right?
I'm trying to link to a header within my issue yes
[text](#Proposed-Implementation) if I remember correctly.
Yeah you can't do that within issues/PRs unfortunately
Someone please still assign mel
This was talked about in server with Joe and scragley
you could link to the context, in reasoning section
Can't/won't add it to the issue rn because I'm laying in bed at 1am but
Will add it tomorrow if I remember
Your reminder will arrive in 5 hours!
@fallen patrol
Here's your reminder: add [this context]([#dev-contrib message](/guild/267624335836053506/channel/635950537262759947/)) to [sir-lancebot#677](https://github.com/python-discord/sir-lancebot/issues/677).
[Jump back to when you created the reminder](#dev-contrib message)
bump sir-lancebot#668
#bot-commands message boom

hey @ashen isle dont wanna step on your toes, mind if i upload a screenshot of what the tag for bot#1517 looks like for people :P
eh, can't people use the preview thing
preview thing?
Yea, there's the md previewer in github, but it'll look slightly different as an embed
oh, yeah sure
random side note i really appreciate how github handles images
wdym
pasting an image in comments in github uploads it and formats it to be an image automatically
ah
yeah
even better

I made this pr https://github.com/Run1e/AceBot/pull/32 that used 4 images because i went crazy
yes
Issue for what?
!src HelpChannels
An interactive instance for the bot help command.
should be the help channel cog, ya?
because
if argument.lower().startswith("help"):
return ctx.bot.help_command
should be
is / ==
instead
!src helpnomatterwhatiputhere
An interactive instance for the bot help command.
ah, yeah
==
im not gonna be the one to commit it
if someone wants to just make the fix right now i'll skip the issue
i mean
if someone is present and wants to do it
I mean I can do it
if you have a bot instance that runs lol
all my commits on bot are so small lol
lol
(i am once again bumping sir-lancebot#668)
Hah my first few PRs were tiny too, just look at bot#1392 bot#1390 and bot#1388
so that's why i like the first one more
btw could someone assign me to sir-lancebot#677
You'll get assigned once it's approved 😄
Yea, sure, but as joe said we still need to think about your proposed solution
We're all volunteers, so please don't expect that all of your PRs will be looked at straight away
The fact that it's in the list of open PRs means that we will take a look at it at some point
sure thing
😦 i mean 😛
sorry if i appeared a bit pushy
No it's fine, just wanted to set your expectations 😄
bot#1519
good first issue 😛
not sure if we needed the issue lol
since i'm not the one who's going to submit a fix, i made an issue
if i was going to make the fix, i wouldn't have made the issue
but
i don't/won't set up @stable mountain
@fervent sage can you do it again 🥺 i don't have the bot setup
How do you install packages on docker? I keep on getting ModelNotFound errors lol
pipenv sync --dev
docker-compose up --build
ah
Oh, i thought it was pipenv
I feel like there's no need to test this change tho
there is
because
there's a default help command and that's why that code exists
in the issue i noted that i think it could be removed entirely
because that code isn't on sir-lancebot
.src src
i hate u
I don't think that's a good idea
https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/source.py#L37-L48
https://github.com/python-discord/bot/blob/main/bot/exts/info/source.py#L51-L62
Because sir-lancebot doesn't use commands.HelpCommand
The type of the command itself is discord.ext.commands.help._HelpCommandImpl
which of course isn't on the repository
Yep. However, it's registered as a command as a _HelpCommandImpl object.
hmm interesting
#dev-log message
@ashen isle that's how i make mistakes
lul
https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/help.py#L331-L334 here's how it adds the command
commiting was scarier than writing the code
Ehh I'm just gonna push because docker is taking too long
I used to commit by copying the file, pasting my changes into it, running it, and then copying the file back to github and pasting it
bruh
That's what I used to do.
Until I learned version control.
lol i fucked it up yesterday
So I had 7 commits instead of 1.
@ashen isle I added a screenshot to yar Pr
yay docker started after 8 minutes
I'm gonna make convert a staticmethod too 
hey you should wait until the issue is approved 
bot#1519
holy shit
wait it got merged?
no idea
it's in dev log
!d str.join
str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](#bytes "bytes") objects. The separator between elements is the string providing this method.
bot#1014
nice
but what is it
read the PR body
Doc Improvements
I can't summarise all changes on mobile
It's an improvement to the docs command, read the PR 😄
🎉 🎉 🎉 🎉 🎉 🎉 🎉 Thaaaannnnkksss @brazen charm, the doc PR is merged! 🎉 🎉 🎉 🎉 🎉 🎉 🎉
yeah, huge shout out to Numerlor
…who's writing the #changelog then
was about to ask that haha
we don't have a requirement to changelog within 5 minutes of PR merge lol
I guess the person who merged it 👀
I'll happily write a changelog later today
thanks for volunteering /s
I don't mind writing one either, but I don't know much about the PR
Hot damn that's a beefy PR
ya
Hah yea, hit the limit of github for review bot too 😅
lul
largest pr to the bot yet
and it does stuff
That may be one of the largest, yeah
numelor's third in commits now 😄
str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
!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.
nice
Wait you can link to discord now
first one was the new one already lol
!d discord
AYYYYY THAT'S NEW
!remind 5h changelog
Your reminder will arrive in 5 hours!
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.
It used to not find it 😔
ok done spamming
I'll write my pr now
@brazen charm Wonderful job! 🎉
I can fix this issue too...
Or should I just leave it?
Yeah I don't think the help extension will be unloaded
nah, they're different enough that difflib didn't pick it up
difflib.get_close_matches(word, possibilities, n=3, cutoff=0.6)```
Return a list of the best “good enough” matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).
Optional argument *n* (default `3`) is the maximum number of close matches to return; *n* must be greater than `0`.
Optional argument *cutoff* (default `0.6`) is a float in the range [0, 1]. Possibilities that don’t score at least that similar to *word* are ignored.
The best (no more than *n*) matches among the possibilities are returned in a list, sorted by similarity score, most similar first.
bot#836 and bot#954 need review
i uh
One of them have been open over a year, another little bit less
why did sir-lance allow this riddle?
messages between the dialogs have been removed for clarity
Yea, we should remove that
Nice the bot removes those random trashcan reactions now
sir-lancebot#678
uh
@vale ibex these riddles are just
lemme perhaps find a better list and jsonify it
Why was the little girl sad after the race?
Because an egg beater
That's.... no.... it was a race between the little girl and an egg, and the egg won the race
bot#1521
I made it a staticmethod because I didn't like the unused variable

lmfao
chris made a pr to remove it
lesgoooooooo
And latex is here!
While y'all are here, please give a review to sir-lancebot#642
.latex j^{oe}_{mama}

.latex $j^{oe}_{mama}$
Nice
interesting
$ is for math things, like this
.latex $\lnot (p \land q)$
Your input was invalid:
\lnot (p \land q)
^
Unknown symbol: \land, found '' (at char 9), (line:1, col:10)
Usage:
.latex <text>
wat
interesting
this means I can't do truth tables
literally unusable /s
@green oriole automatic linking has been merged. Thank you, @cold moon!
bot#1521 needs reviews 😀
Huh
….wait
i-
why does it not show the repo and name anymore 😔
sir-lancebot#1 bot#1
quackstack#12
bot#1
sir-lancebot#2
beautiful
We're not gonna talk about how this linked #1?
hmmmmmmmmm
bot#1521
sir-lancebot#200

ohhhhh
without looking at the code, the regex is fucky
its not getting anything after the first number
(maybe)
sir-lancebot#200 is not 2
then that's issue 1 for sir-lancebot
@green oriole this was your commit, sir-lancebot#642
that ain't good
ahhh, pr 6, exactly what i wanted
its just using the first digit of the number
Why was the number .+ anyways
yeah
it's PR time
there's more to the regex than that
do get this not being caught either bot#2
because its matching the entire message
I'm a little rusty on regex but I'll see what I can do
How would I add the reddit emojis to my server?
I need them for the stackoverflow command
Copy image addresses & download 
for those who wanna help with the regex for linking
AUTOMATIC_REGEX = re.compile(r"((?P<org>.+?)\/)?(?P<repo>.+?)#(?P<number>.+?)")
that's the regex that matches issues
As in, how would I put it in my code? If i just put the id of the emoji as a constant, wont it be unique to my server? so it wont work for the python server right?
it matches everything before the # on the same line and only one character after the #
oh sick
#123
paste it so we can test it 🥺
What did I do
@green oriole your regex broke
Wait, the PR is merged?
the regex went buh bye
yeah
Yep and it broke
the regex is actually quite bad on the first look
Oh cool
im gonna extend my fix to exactly represent gihub naming rules/limits
was it not supposed to be merged? say yes
I forgot the word boundaries didn't I
Well, not really haha, but that's my fault
.+ is never usually good lol 
it matches everything before the # on the same line and only one character after the #
I was still making sure that everything worked correctly
@whole forge yeah please do it, my regex experience isn't very good
np
u should've converted it to a draft pr smh
gonna base it off of the limits listed here because there are no official ones
https://github.com/isiahmeadows/github-limits
preventing it from being merged at all
\w+? seems more appropriate
. should be [\w-] most probably
hello cat
I mean how many people approved lol
two
4
More than two
anyway, I'll get something working in regexr
+? is the same thing as * right
Nah
((?P<org>[\w\-]+?)\/)?(?P<repo>[\w\-]+?)#(?P<number>[\w-]+?)
It is between 1 and infinite but lazy
bast youre missing numbers and +? is bad practice
heres mine
\w does numbers
!e ```py
import re
print(re.match("\w+", "abcd123").group(0))
@sharp timber :white_check_mark: Your eval job has completed with return code 0.
abcd123
@surreal venture replying to your comment on the stackoverflow command, I hope you're able to finish it off this week :D
Why is +? bad practice?
becasue that matches really long thins like shfisdahfkjdsafhnsadjfsakdfhkdasjhahskdf\askdfjvasdjvasdjfvsjdafvjsdavfjasdvfjsdfvj#1 too which arent even valid repo names
I mean, if we have a length limit we should use that
should always try to match as exactly as posinle
I just didn't think there was one
Wow 100
Yeah that could be.. interesting
^
So ((?P<org>[a-zA-Z0-9]{1,39}?)\/)?(?P<repo>[a-zA-Z0-9\-\.]{1,100}?)#(?P<number>[0-9]+)?
I don't think we need the ? lazy specifier at all
Since we always have hard match edges, there's no reason to "match as little" because we should always match a given amount
yea nope
no need
also @vale ibex my regex101 link has \w since apparently as bast proved that does numbers
tho i wonder
The only place it makes a difference is when the terminating characters can be within the original match sequence, and that's not the case here, / is not valid in usernames or repo names I believe
nope, alphanumeric and - for user, alphanumeric and - and . for repo
If you want a very accurate regex for github org/repo then this is it:
(?P<org>(?!-)(?:[^\W_]|-(?!-))+(?<!-))/(?P<repo>[\w.-]+)
It has some strange rules about where hyphens can go for org names
why the double negative?
Are _ not valid for org names?
No apparently. I researched this a while ago so feel free to confirm
It isn't for usernames either.
It's from here https://github.com/python-discord/bot/pull/1028
It'd be clearer to use [A-Za-z0-9\-] I think, rather than the double negative
The regex is complicated to account for the hyphen rules
updated mine https://regex101.com/r/V2ji8M/3
That being said, I don't think you really need to obey the hyphen rules
It's good enough without them
Well, we have the regex to deal with them now anyway, so no harm in obeying them
If you can come up with a better regex for that then go for it
just .strip('-') after the regex 
lol
actualyl @tawdry vapor yours doesnt obey the - rules eitehr
Even though the error message they give doesn't say that
can't start with one though
Oh sorry
honestly this is regex torture
his matches the org / repo
he never said anything about matching the issues
I think I may have only done it for org names and not for repo names, but I guess you can copy it over
Can't start or end with one either with org/usernames
If we are going to enforce these reqs, we should enforce them in the surrounding python
*can't
if match and not org.startswith("-") or org.endswith("-") and "--" not in org
or something like that
I don't think it is worth enforcing edge cases here as the API will just return 404 of the user doesn't exist
this is a legit question, can you slowmode this channel for now 😂
We can afford a failed request
having a better regex does mean less requests to github
so if someone is spamming stuff it won't end up making a bunch of requests
Yeah and that's why I didn't actually ask for them to use that regex in the PR. I just wanted to mention it for correctness sake.
like
i think we should just ignore leading dashes
that way if someone writes
-python/cpython#123 it still works
in that case, just strip('-') after the regex
Cannot include consecutive hyphens
why is it unreadable
because you have a custom dark theme?
Do you have a dark mode addon?
uhm, yes
that's why 😄
and the website has a darkmode too
underscores are allowed in repo names so [\w.-] is fine to use.
wait are they, lemme check
this is @whole forge's but as you can see it doesn't work https://regex101.com/r/HmSS7Z/1
it matches
wut/sd--f#1
We can have multiple regexes for different parts
wait so repos can have double --?
well then
okay then ye
((?P<org>[a-zA-Z0-9][a-zA-Z0-9\-]{1,39})\/)?(?P<repo>[a-zA-Z0-9\-\.]{1,100})#(?P<number>[0-9]+) works, its what @whole forge sent
not quite
its missing the underscore
in repo name
one sec, let me try to get the double dash thing figured out
We have 5k requests/h, who cares
in that case lets ignore the double dash
They'd get automuted before they can do anything meaningful
I can't think of a better way in regex than [^\W_]|-(?!-)
enforce the non-double dash in python
GOT IT
the reason to use regex here is for processing speed, so we don't need to interact with it through python exactly. A for loop over every message is unclear, and so is parsing out every little part
((?P<org>(?!-)(?:[^\W_]|-(?!-))+(?<!-){1,39})\/)?(?P<repo>[a-zA-Z0-9\-\.\_]{1,100})#(?P<number>[0-9]+)
because the -- isn't valid
i think at this point its better to just let the API error out
but applying some validation in python on top of that doesn't sound like a problem and sounds like the right way to do it if there's some difficulty doing it in regex
right but then the whole regex needs to fail
wait hm
do we assume that someone with a double dash made a typo, or that a double dash is part of the rest of the message
i would assume typo, then it shouldn't match anything
part of the rest of the message
right but whats more likely, that someone has a message that goes--repo/name#1 or that someone typos hello--world\name#1
You're matching on a word boundary anyway, right?
I don't think we are at the moment
You probably should since this could very well match part of some arbitrary URL
good point
Wait, you can have #s in urls?
yea
Yes they're called fragments
I thought that could only be after a /
for example: https://vcokltfre.dev#extras
Oh, oops
Not necessarily e.g. https://example.com/index.html#12
Yeah, that's a problem
If you match by a word boundary then it'd be better to have the entire match fail when a hyphen issue is detected. That seems easier to do in Python rather than in regex.
Having the regex partially match to skip the hyphen issues would be a bad idea
!e ```py
import re
print(re.search(r"((?P<org>[\w-]+?)/)?(?P<repo>[\w.-]+)#(?P<number>\d+)", "https://example.com/index.html#12"))
Eventually I'll figure out why this isn't matching
it shouldn't be
Cause you're using match rather than search
could you not jsut use sth like regex101 isntead of evaling?
I could
I wanted it to be a clear example though. That ship has sailed.
matches on the site, so why doesn't it match here..
matches com/test.html#15
Also you aren't excluding the underscore from org name
Yeah, this was an earlier one I grabbed because the ones after I couldn't make work
I think we should match cases with -- preceding because people will want to do that sometimes
What do you mean
You might be running into an issue with regex--python-discord/bot#15--or it might be something else
if we want to put in the effort to match that, imo, we should. It doesn't match at the moment for some reason
I think there'd be no reason to type it in any way other than exactly like python-discord/bot#15
Anything else should fail
What about in parentheses?
at this point regex is not sufficient as a parser
Well the hyphen checks can easily be done in Python after the regex has a match
Yeah, good point
wdym?
I was talking about what Mark said.
That anything but it exactly should be ignored.
well i definitely not anything, precedding dot, slash or the word being too long should be ignored imo
because urls
It may be easier to make exceptions for certain characters like brackets rather than trying to blacklist
That would probably be best.
well if you want to do that, knock yourself out
hm
another thing the command needs is
a check, if there is a command invoked in the message
oh my god
Why?
lol
why was this authorized
i mean
mistakes happen
thats just the way things are
sorry
@vale ibex ty for pr
NP 😄
Do our containers support simd instructions?
I'm just wondering if it's worth swapping lancebot to pillow-simd in this image PR
bot#1521 needs one more review from a staff/contributor.
lmfao
I might experiment with our high resolution repo to see
we have uhh
12 AMD EPYC 7601 32-Core
no, we don't
wait
what do we have lol
uhh maybe we do? trying to interpret /proc/cpuinfo
either way, /proc/cpuinfo suggests we have several of the required instruction sets for SIMD
yeah one sec
I initially thought 4 cores but the core ID on each processor doesn't increment
nice
@fervent sage Context: https://github.com/python-discord/sir-lancebot/pull/676
"google" will be the only key that is ever fetched. Would you mind including the fix in your PR?
Problem: https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/easter/april_fools_vids.py#L17
oop, not my code originally but sure i'll fix that
Thanks!
additional problem: the current logic means that google has an equal chance of every other creator to be pulled and isn't related to the video count at all
😩
imo i would reformat the entire json
list(self.yt_vids) please
i think i will
wait
that would make almost more sense if the json was formatted better
imo it'd be better to have a list of
{
"url": "",
"channel": ""
}
``` since video name is never used anyway
that's just needlessly complex imo
in order to not reformat the json
well, sorting the json by who, makes it a bit nicer to read
👏
@sleek steppe vn
!source HelpChannels
Manage the help channel system of the guild.
yes
wow RNG doesn't like me today
i tested the command almost 100 times before it chose one other than google
was beginning to think it was somehow broken, but alas randomness sucks lol
are you just picking randomly from all of the videos?
fools
also is this a better name for the PR by now?
ugggh fighting pipenv to install pillowsimd
can't find the right version to install which has wheels available
diff --git a/bot/exts/easter/april_fools_vids.py b/bot/exts/easter/april_fools_vids.py
index efe7e67..1882fd7 100644
--- a/bot/exts/easter/april_fools_vids.py
+++ b/bot/exts/easter/april_fools_vids.py
@@ -8,28 +8,22 @@ from discord.ext import commands
log = logging.getLogger(__name__)
+with open("bot/resources/easter/april_fools_vids.json", encoding="utf-8") as f:
+ ALL_VIDS = load(f)
+
+
class AprilFoolVideos(commands.Cog):
"""A cog for April Fools' that gets a random April Fools' video from Youtube."""
def __init__(self, bot: commands.Bot):
self.bot = bot
- self.yt_vids = self.load_json()
self.youtubers = ['google'] # will add more in future
- @staticmethod
- def load_json() -> dict:
- """A function to load JSON data."""
- p = Path('bot/resources/easter/april_fools_vids.json')
- with p.open(encoding="utf-8") as json_file:
- all_vids = load(json_file)
- return all_vids
-
@commands.command(name='fool')
async def april_fools(self, ctx: commands.Context) -> None:
"""Get a random April Fools' video from Youtube."""
- random_youtuber = random.choice(self.youtubers)
- category = self.yt_vids[random_youtuber]
- random_vid = random.choice(category)
+ random_youtuber = random.choice(ALL_VIDS)
+ random_vid = random.choice(ALL_VIDS[random_youtuber])
await ctx.send(f"Check out this April Fools' video by {random_youtuber}.\n\n{random_vid['link']}")
static func ehhhh
static func is just unnecessary
yea
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
tbh i can simplify the whole thing to basically https://paste.pythondiscord.com/muxonogake.py
which removes a ton of needless bloat
Anyone fancy helping out here, been stuck for like 10 mins
upgrading and downgrading my pip and pipenv
trying different versions of pillow-simd
!pypi pillow-simd
channel, url = video["channel"], video["url"]
Do we allow this here lol
Pillow simd uses simd instructions, among other speed improvements, which makes it considerably faster than regular pillow
should i make an issue to
add https://pillow.readthedocs.io/en/stable/ to the docs command
inv: (https://pillow.readthedocs.io/en/stable/objects.inv)
nvm ^
Look up documentation for Python symbols.
issued?
how do you add them?
dang
so never an issue
!d PIL
takes an integer like 0.3234234 and truncates it to a set length
!e ```py
integer = 0.1234123
print(f"{integer:.3f}")
@patent pivot :white_check_mark: Your eval job has completed with return code 0.
0.123
yep, so the outputs in !ping are to 3 decimal places
!remind 2h try again <#dev-contrib message>
Your reminder will arrive in 2 hours!
although if you use cython you can run faster than cpython
pypy
on the subject of this sorta thing, something else that might interest you is this
You can combine them together too
>>> format(123123123.123123, ',.3f') # Does the same thing as f"{123123123.123123:,.3f}"
'123,123,123.123'
alright what is ooming lol
lmao
lol is it the latex command
so thats why lancebot is dying repeatedly
do we not
just give it more ram and pretend everything is fine :)
200Mi limit on lancebot
so
yeah
i could just give it more
lol
probably the latex command
Can you
is it a problem with constantly gaining ram or just that something (likely latex) needs more than it can give during one op
pull eexact crash timestamps
uhhh
yea
2021-04-12T19:44:19Z
2021-04-12T20:16:01Z
2021-04-12T2
24Z
great
brilliant emote
2021-04-12T19:44:19Z
2021-04-12T20:16:01Z
2021-04-12T20:20:24Z
is the int e patched added yet
im curious why for int e jishaku isnt used? is it just because the bot is meant to be do-it-yourself-y or is there another reason idk about?

