#dev-contrib
1 messages Β· Page 106 of 1
I meant figured out in the sense of working together
cool
Hey @fallen patrol! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
oh nothing
just didn't click the ide
and then typed it and pasted it and entered it
sadly

since staff can edit this being its a wiki page
dependancies
we're in a wiki freeze right now, no edits
there are pros & cons to it. cons are that if the system fails for whatever reason then we've just published someones token wider, the real killer would be discord adding a token invalidate endpoint
we'll hopefully transition to dewiki soon so that non-staff can contribute typo fixes
pipenv sync
Mind the --dev
That'll install things like precommit and flake8 so you can lint locally
yes
ah nice
No, nothing's in dev-log
i am totally stealing this!```py
[scripts]
start = "python -m bot"
lint = "pre-commit run --all-files"
precommit = "pre-commit install"
taught me something i don't know!
What PR? The eval one?
Redundancy
Wellll no
str(command) is the same as command.qualified_name, not command.name
!d discord.ext.commands.Command.qualified_name
qualified_name```
Retrieves the fully qualified command name.
This is the full parent name with the command name as well. For example, in `?one two three` the qualified name would be `one two three`.
def qualified_name(self):
parent = self.full_parent_name
if parent:
return parent + ' ' + self.name
else:
return self.name
@fallen patrol i'm working on a converter rn for the colors
yeah
well no, i meant converting strings to a discord.Color object
yeah, but i;m gonna add some niceties to it
@clever wraith your branches should track upstream/main so you don't have commits from other branches
it seems it broke should i close the pr?
Probably, because of merge conflicts
color converter will only work for some stuff
Yeah. subclassing ColourConverter should be fine
Hey, any idea why the member mock doesn't have an async assert?
Or well, it's missing them for some functions
aight fixed it is there now
Hmm. It seems like 50% of the time I start bot it exits with code 69 because the bot and the site are starting at the same time
Reasoning
Added because of approved Issue
@clever wraith just a heads up, this field is meant for you to describe why you used the solution you did instead of others, not why you made the PR.
I've proposed reworking of that template to better explain that
The updated one is:
<!-- Outline the reasoning for your implementation, instead of other possible ones. -->
<!-- Note: This is not meant to replace the the Relevant Issues section. Do not say "this was approved", or similar. -->
ohh
Is this good for the embed?
@clever wraith 699 nice
oop thatll be fixed momentarily
cc @tawdry vapor I'm specifically looking at member.move_to and ctx.invoke
ok yes i can write cog
ok
the biggest thing will actually be writing the converter lol
did you make the fork
always has been
wtaf
i just got a dial tone from youtube
@clever wraith so what i actually don't know is how to be able to convert the args and all to the rgb
I think he'd need to know what branch it is
make a branch
haven't made it yet π
WELL MAKE IT
its locallllll
@fallen patrol what's that branch :angery:
pre-commit sorry
gtg make it happy
@vocal prairie @clever wraith what are you guys interested in doing?
would the converter be in the same file?
doesn't seem like it would need to go in utils but yknow
it would be nicest
create-color-command
not sure of the structure of the project but since someone else is writing it it would result in least blame conflicts to resolve if its in a util file
wat
*push access
I don't know. The mixin should be responsible for making sure mocks of async functions use AsyncMock.
I didn't write that mixin
In what?
ok
Is there an issue on lancebot's repo about the .ext list command?
We have 100 helpers? Wow
I think there's still a wiki freeze in place, but that does remind me to changelog!
While things are being migrated over we're not editing things on the website. I forget which components are wiki and which aren't though
oh that's probably a PR change then
Can I pr it now, or should I open an issue?
@sleek steppe regarding your review, what would you suggest? the module doesnt include any error handling
When you send an invalid character...does it raise an error?
just an exception, does except Exception work?
It's small enough that you can just PR
π
all /pages are wiki
I guess so. You shouldn't except BaseException really, as only exceptions that are exiting exceptions (i.e SystemExit, KeyboardInterupt, GeneratorExit, CancelledError)
alright
looks good so far!!
that's the format of rgb
actually the hex is technically wrong for what everything else expects it as
lmao
done
the basis of the command is done
next is a whole converter that will be about as large as the rest of it
and creating a script to parse the two scripts online
CYMK is a formula I dmed to you
Can I be assigned to site#366?
done~
Thanks!
does rgb(a, b, c) work
wdym
.colour rgb(123, 221, 111)
I thought rbg was numbers though π€
I'm looking for ways to contribute to the bot, but I have 0 ideas.
What should I do?
oh
RGB is numbers
You can check out the issues on the repositories.
π
Those are big embeds
You could take a look at the 1.7.1 colour converter π https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/converter.py#L506-L586
lol
i don't think i'm defining the args correctly
async def color(self, ctx: commands.Context, *user_color: ColorConverter)
should absorb the rest of it
unless
i could actually convert the type after the header
No I was thinkingasync def color(self, ctx: commands.Context, *, user_color: ColorConverter)
is it not the same
@bot.command()
def foo(ctx, *args):
await ctx.send(args)
# <prefix>foo 1 2 3
# Sends: ('1', '2', '3')
@bot.command()
def foo(ctx, *, args):
await ctx.send(args)
# <prefix>foo 1 2 3
# Sends: '1 2 3'
Yeah it doesn't work with 1.5.1, only 1.7.1 (which I said in the message)
I was talking about your own ColourConverter
I just meant you should copy get some inspiration from that
hm what? i didn't copy it LOL
I didn't say that
100% didn't
anyways it now has a converter and i didn't write any of it
it defintely didn't come from 1.7
now you need one for CMYK, HSL and HSV
really?
.colour #6563C7 .colour cmyk(49, 50, 0, 22) .colour hsl(241, 47, 58) .colour rgb 101 99 199
CMYK is built already
Some code joe had
sir-lancebot#677
Didn't joe have a list of websites that you could pull from?
Might not have been joe.
But someone did.
Yeah
You linked two in the issue
Just pull from those.
and hsv is in colorsys
bump
Alright. I'm up for a bit cause health stuff. Who wants a review for lancebot stuff?
I can give it a try, not completely sure on how to implement the repetitive reminders tho
i mean, id take a review on sir-lancebot#699 . Sorry that health stuff has you up!
Using colorsys would make it really simple, it has everything you need for this feature
we can merge sir-lancebot#697
2 approvals are there
amazing how little info the github actions gives me -_-
@patent pivoteeeeeeeeeeeeeeeeeeee, I don't know why the github actions hates me ;_; I pushed a green button and I don't know what I did wrong (re: merging the .catify fix)
try re running them, github actions faced some internal issues
tried my best lol
the duck could be a pond
https://fastapi.tiangolo.com/tutorial/body-fields/ and we could do this for keeping some keys optional in the requests
FastAPI framework, high performance, easy to learn, fast to code, ready for production
both would be using the same colorscheme
or different, dunno which would be better
imo if it can be customised it should be able to be customised independently of everything else
sorry, i didn't get you
don't need this, it is more simpler than i thought, here it is: https://fastapi.tiangolo.com/tutorial/body/#create-your-data-model
FastAPI framework, high performance, easy to learn, fast to code, ready for production
if something, like the duck, can be customised in whatever way, like changing its colours, then you should be able to individually control each aspect of that, rather than it being dependent on something else i.e. the manduck
hmm
also wdym by 'keys'
say if this is the request:
{
"name": "Foo",
"description": "An optional description",
"price": 45.2,
"tax": 3.5
}
then name, price are the keys
that's what i call them
ah, technically they're all just fields in the request body
like we discussed here.
and we already do that, that's what the models are in the models.py file
the issue i was facing when i originally looked at it was that we wanted the values to default to random values, rather than static defaults
yeah, that's what i was seeing rn, we would need to add some logic the color gens, so it can take the colors given my the user and generate the rest depending on that
now youre starting to see why i gave up on doing it initially 
lol :doge_kek:
i dont think it should be that hard, it just takes more sitting down and thinking than i can reasonably achieve in a session lol
yeah, once we understand the way, it would be easy, just need to figure out a good efficient way to do it
i thinkβ’οΈ we could do it like this: (i'll miss out a bunch of fields because laziness, but you should get the general idea)
def fill_defaults(duck: dict): # this dict is dict(the_duck_request_body)
data = {
"accessories": {
"hat": choice(hats),
"outfit": choice(outfits)
}
}
data.update(duck)
return data
we'd probably have a helper function to generate the random defaults, and then update that with the request body
just get the random values and over write them with the ones the user gave?
yep
but wouldn't it be as smooth as the ones generated, as the ones got generaed randomly are based of a color scheme and are of similar type
the issue there is i'm not sure update will work how I want it to, for example let's say we have
{
"something": {
"a": 1,
"b": 2
}
}
```and we call .update() on that with
```py
{
"something": {
"b": 3
}
}
```I'm fairly sure `something.a` just disappears from it
yeah we can leave that aside, lets think on the way to do it, implementation can be figured out later
i'm gonna go have breakfast and think about this 
good, this is the only problem there is with the current idea
I dont think there's really a perfect solution for this, if it's totally customized by the user they get what they asked for, if it's completely randomly generated then they get it with a colour scheme, if it's half and half then how are we supposed to know what they even want. I guess we could generate it precisely the same as the full random ones, that way at least the random parts follow the same colour scheme
I think that's the way to go, but I don't think my way of calling .update will work because (see replied message)
yeah, i will look into the implementation
i will have to wait for the pr to get merged before i can open a pull request 
@fervent sage ok, so this should work, #bot-commands message
yeah
i think it is over complicated a bit, lemme see if i can simplify the merge function
options:
a - just generate two random duck and man duck and join them with a rope
b - generate two of them using the same colourscheme and join them with a rope
hmmm, probably b
Try rerun
ok, so we have four features pending, should i open a small issue for each of them?
1 - your - Random() model thing
2 - mine - allow to pass input for man ducks
3 - mine - allow passing only some inputs and rest would be taken thro the default (random generator)
4 - mine - pet ducks
that'd be awesome, yep
GET /helper_count on the API when
ok cool, lemme open them
i think you can open describe Random model issue better than me 
yup
how can i create a message object mock and get its link (writing tests for bot#1446 )
and @green oriole what all do want in tests?
like when i put a message link, then do you want to check for the webhook message content too or just the number of embeds sent?
what i came up with is:
- put a message with 3 links, test if there are one message with three embeds sent
- edit a message to have 4 links, test if there are four embeds
- edit a message to have 0 links, test if the message gets deleted
- delete a message, check if the message gets deleted
- on adding action/rejected emoji, does the message get deleted or not
Sounds about right
You probably only need 2 links every time but that should be fine
yeah right, I will start it once i can get #dev-contrib message this done
@cold island bear in mind user mentions in embeds are pretty broken across all platforms, one of the reasons for the feature is to get a user ID since jump links on mobile don't work and I don't think the user embeds either
maybe in addition?
yeah in addition would be alright
the author is already mentioned
i will mention the channel id
lemme see about golddd
I see a @ sign and the username, it doesn't seem like a mention
going by the ss you sent
ok
the channel should still be there
yeah
i thought it is not needed since we can just right click on it
no
k
ok, i think channel mentions always render
discord is good at fucking it up
lol, just id or even the name
name + mention imo
that would look repetitve, we can get the name thro the id anyways, if we put that
like we do for format user
Difference is
if the mention doesn't work but you see the name you can just scroll to the channel
whereas there's not much to do with the channel ID
The user mention is useful to pull up the profile, but mods can get the relevant info from the user ID

pushed, just need to figure out tests now
@patent pivot which library do we use to generate those nice graphs, the npm lib
uhhhhh
i remember you said it in the ot channels, but i can't remember it
yes, thanks!
@clever wraith could you push π
no
AttributeError: 'NoneType' object has no attribute 'version_sort'```
i keep getting this
just started getting it now
@sleek steppe
In your command?
no
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\core.py", line 2512, in do_run
ensure_project(
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "C:\Users\VIncas\AppData\Roaming\Python\Python38\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 328, in find_all_python_versions
path_list = sorted(versions, key=version_sort, reverse=True)
AttributeError: 'NoneType' object has no attribute 'version_sort'```
i might be running it wrong
omg
im stupid
im running form the wrong dir
i think u were wrong with that Image.Image @sleek steppe
im getting errors now from my command
Attribute errors?
I have no idea what error you'd be getting; I haven't seen your current code
The command is super cool by the way! I was playing with it last night locally
coolest is the 193600 squares if u are talking about mine
cuz it can create some cool imgs
ill show mine and my friend's
i think thats pretty cool
Yeah! It's super cool
thanks
i prefer lower number of squares myself, otherwise it looks kinda random
but yeah its an awesome feature
I'm hoping to today once I answer some work emails~
ok thanks
No, the emoji didn't show.
pain
u approved it?
different PR
@patent pivot Uh, is this normal? The emoji just disappeared.
yeah I think it's just a bug that we can't work around
I mean it's been happening
The emoji is certainly there in the payload, it just seems that Discord strips it out
weird
wait don't merge splitify, i got a change
Can't merge anyways, needs a core dev approval
no one is gonna
yeah
but since ur a contributor urs counts as 1 of the staff right?
so if kutie approves it today then it should be merged i think
Kutie isn't a core-dev
kutie isnt a core dev i dont think
oh rip
this is a bad sentence
@short snow what do you mean use it instead of I and we?
No apostrophes 
nope, not a core dev
"I use Image.(something) to do {something}" would be "It uses Image.(something)...", for example
I do not know our stack or d.py well enough at all to even be remotely considered for core dev
so if i say: I make a for loop, you want me to instead say it make a for loop?
i dont get it
@short snow
we should have a place where all the stack is there, if it is not public then make it public
it helps
since you're not personally carrying out what you're saying the code does, it should be using the wording "it does" "it changes" rather than "i do" "i change"
it loops through .... can be used rather
haha, I've actually been through that a few times >_>
lol
or rather, I've read through it and plan on incorporating some stuff in a smaller bot I'm making for a different server
@clever wraith needs more clarification this
latex unload
.ext unload latex
:ok_hand: Extension successfully unloaded: bot.exts.evergreen.latex.
Hey @clever wraith, are you linting your PR locally before committing?
Yeah
You have quite a bunch of fix commits right here
couldn't you have waited 5 seconds 
my .latex $69 \cdot 6 - 9 + 6 + 9 = 420$ didn't get rendered π
:ok_hand: Extension successfully loaded: bot.exts.evergreen.latex.
.latex $69 \cdot 6 - 9 + 6 + 9 = 420$
.ext unload latex
:ok_hand: Extension successfully unloaded: bot.exts.evergreen.latex.
perfect
@placid ermine there you go
30% of it was me talking to myself
but uh
scaleios, mark, kutiekatj, and joe have participated in the convos
Oh boy
Regarding https://github.com/python-discord/bot/pull/1546#issuecomment-824094690, do you think Due or Done at makes more sense?
I've asked in the core dev chat about latex rendering as it is scrolling slower than this channel, will get back to you once I have an answer
"Due" sounds better imo
@clever wraith have you tested your pr before committing a push?
You have a lot of changes which are kind of breaking
"Done at" sounds awkward
I've forgotten a few times smh
Test your pr and go through each requested change and see if the they work and are resolved
"Done at" sounds awkward but given the dot it may be the best we have, not sure
I wanted to see how awkward it could get if I change my phone's locale to another lang but it said it'd have to restart and I'm not ready for that kind of commitment
Haha
!stream @vale ibex 3d
@vale ibex
β @vale ibex can now stream.
It also worth mentioning that it's possible to be a date too
Yeah, we should do this for such commands
iOS has a pipe too
!rstream 126811506632294400 REVOKED
β Revoked the permission to stream from @vale ibex.
So the wording needs to work when its both Today at XX:XX and XX/XX/XXXX
Chris using this opportunity to grant themselves extra perms π
Lol
Due sounds good to me
Y'all better not let the coffee be too powerful
Pushed.
wait really

any core Dev if you have time off, could you review the quackstack PR, it is holding off the other features.
^^^
I'll have a look at setting an environment to test it tonight if I get a chance
I'm not familiar enough with the code to tell from just the PR changes
fwiw quackstack is reviewable by any staff member
Hmm, one staff and one core Dev right?
nope
Or just two staffs
1 staff member
On it 
yeah
SMH π€¦ββοΈ Alec
.randomcase sorry
SOrRY
Lol, not at all
Merged before the checks passed π¬
!remind 2h Look at this swanky new time feature
Your reminder will arrive in 2 hours!
That's enforced by Discord
Isnβt it a dot?
Mobile I think
the separator is a pipe on mobile and a dot on desktop
Oh
my life is 7x worse now that i know this
@vale ibex the weird image being outside of the embed bug for the .spookyavatar only happens when I mention lancebot π€ but when I make lancebot the one who's invoking the command then it doesn't do that
maybe there isn't a point of trying to fix it
lmao
One thing I notified in QuackStack: This currently installs also dev-dependencies in Dockerfile, but there we need only production dependencies.
Yes, easiest way is using Docker
poetry install --no-dev, someone can just commit to main?
Yep yep
If you're using docker you don't need to do the site setup
compose will spin up a site container for you
just do the bot
I usually use pipenv install --system --deploy, what does --no-dev do?
that's the poetry command to not install dev deps
lmao, I am so blind
poetry installs dev deps default
Duck using new colors generation: https://quackstack.pythondiscord.com/static/993c510e9d10c027c75139f029562847449127f1.png
Yeah, yeah, I didn't see that it wasn't pipenv for some reason
Wait, do we really have quackstack as a critical project haha
Guess we do, huh
Top priority π€£
No main commit for me
The bot project has a docker-compose.yml which defines which services need to run; it contains the site service as well, so just by following the bot instructions if you use docker and compose, it will run site for you
Yeah, this new branch protection policy don't let main-pushes anymore.
Well, only to critical projects
It can launch a site container for you. If you want to work only on the bot side of things then that's all you need
I guess permissions on this projects are a bit funky since I don't have access to most of the settings
btw I think this still isn't addressed
the guide just recommends running fakeredis
Alright, that should probably be changed after the wiki freeze
We're in a wiki freeze atm, while we're working on the dewikification
Ah yea, what Akarys said
!remind 2w Suggest to use the Redis container on the Python docs
Your reminder will arrive in 14 days!
linting from within
will my approval be enough lmao
One way to find out 
devops has to approve as well
approving
Thanko
merged
joe the merger
legend amongst men
do we need to be making the virtualenv as well 
Quackstack uses poetry? 
heck yea
π₯Έ
poetry config virtualenvs.create false

@vale ibex
Here's your reminder: Look at this swanky new time feature.
[Jump back to when you created the reminder](#dev-contrib message)
i made the initial stuff so ofc 
ah yes
I hate mobile
i made the change with pronouns @sleek steppe its way worse now but oh well
Not sure if this is the right place to ask, but I noticed an issue with the response from the python bot when typing !d if.
We were trying to show a user how to use the if/else syntax for python, but it returned irrelevant django syntax instead. I also noticed that if isn't on the tags list, so I wonder where it's even coming from... π€
!if
if __name__ == '__main__'
This is a statement that is only true if the module (your source code) it appears in is being run directly, as opposed to being imported into another module. When you run your module, the __name__ special variable is automatically set to the string '__main__'. Conversely, when you import that same module into a different one, and run that, __name__ is instead set to the filename of your module minus the .py extension.
Example
# foo.py
print('spam')
if __name__ == '__main__':
print('eggs')
If you run the above module foo.py directly, both 'spam'and 'eggs' will be printed. Now consider this next example:
# bar.py
import foo
If you run this module named bar.py, it will execute the code in foo.py. First it will print 'spam', and then the if statement will fail, because __name__ will now be the string 'foo'.
Why would I do this?
β’ Your module is a library, but also has a special case where it can be run directly
β’ Your module is a library and you want to safeguard it against people running it directly (like what pip does)
β’ Your module is the main program, but has unit tests and the testing framework works by importing your module, and you want to avoid having your main code run during the test
if
The {% if %} tag evaluates a variable, and if that variable is βtrueβ (i.e. exists, is not empty, and is not a false boolean value) the contents of the block are output:
{% if athlete_list %}
Number of athletes: {{ athlete_list|length }}
{% elif athlete_in_locker_room_list %}
Athletes should be out of the locker room soon!
{% else %}
No athletes.
{% endif %}
```...
Yeah sorry I think it was !d if
That was before Numelor's PR
How recent was that
sad
Rip
was hoping to get this https://docs.python.org/3/reference/compound_stmts.html#the-if-statement
!d if makes sense, but why on earth would it be returning django π
the docs command scans documentation for matching statements, its returning django because django has a documentation piece called "if" for their templating language
So it's not just scanning python docs?
!d
β’ gitpython
β’ kivy
β’ matplotlib
β’ more_itertools
β’ networkx
β’ numpy
β’ pandas
i belive the approprite way to go about this is to exclude every reserved name, statement and builtin function in python from being pulled from any other source than the python docs
!d label.if works
Oh I see
8.1. The if statement
The if statement is used for conditional execution:
if_stmt ::= "if" assignment_expression ":" suite
("elif" assignment_expression ":" suite)*
["else" ":" suite]
``` It selects exactly one of the suites by evaluating the expressions one by one until one is found to be true (see section [Boolean operations](https://docs.python.org/3/reference/expressions.html#booleans) for the definition of true and false); then that suite is executed (and no other part of the [`if`](https://docs.python.org/3/reference/compound_stmts.html#if) statement is executed or evaluated). If all expressions are false, the suite of the [`else`](https://docs.python.org/3/reference/compound_stmts.html#else) clause, if present, is executed.
Alright I'll use label.if for now, thx.
Errr
Even that snippet looks ridiculously confusing
yeah its the grammar for if statements
8.1. The if statement
The if statement is used for conditional execution:
if_stmt ::= "if" assignment_expression ":" suite
("elif" assignment_expression ":" suite)*
["else" ":" suite]
``` It selects exactly one of the suites by evaluating the expressions one by one until one is found to be true (see section [Boolean operations](https://docs.python.org/3/reference/expressions.html#booleans) for the definition of true and false); then that suite is executed (and no other part of the [`if`](https://docs.python.org/3/reference/compound_stmts.html#if) statement is executed or evaluated). If all expressions are false, the suite of the [`else`](https://docs.python.org/3/reference/compound_stmts.html#else) clause, if present, is executed.
There's no way that would be helpful to someone asking for help π
Do you have something in mind for explaining if/else? We could turn it into a dedicated tag
the issue if people using !d if would still persist, i think there should be a way to handle docs for things like if too
people are going to use !d if because that seems to make sense
I explained it like this in a pinch
if condition:
# do stuff
elif condition2:
# elif is optional
else:
# default condition.β
But it could definitely be explained better
Or shown better
not quite accurate, elif: will raise a syntax error, it needs a condition
Hmm It would be cool for tags to parse the markdown to fine the bolded title and made it the embed title
!d tut-if is the closest you can get to anything like that, but is still a more technical tutorial which I don't think is as suited to complete beginners. The tutorial pages also don't expose the symbols nicely so you pretty much have to look for the ids yourself
I think in this case an !if-else tag or something would be nice
yes but that does not fix the issue of people mistakenly using "!d if"
imo the statement is something that should mostly be explained personally if someone needs to understand it
I think the tag could be nice to provide an example boilerplate you can then use to explain personally
to be perfectly honest, I don't think a lot of peope use the !d if to pull built in stuff. Even if we fix it, the fix doesn't really... help in this case.
Yeah it would be good to have something uniform and agreed upon, I'm sure everyone's examples would be slightly different
I'm surprised the docs command doesn't require specifying a library before the keyword
in many cases it does
Like !d <python/py> <keyword>
aiohttp
!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.
there we go
I was about to say that it is a stdlib haha
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function, when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
python isn't a library though
hu
Wtf lol
It depends on the symbol, if isn't a method or anything like that for django so it's just if directly in the docs, but if it had a conflict that wouldn't be a label or something else we move, then it'd be prefixed with django. The role of the django template tags could be added to the list of groups that's currently moved out of the way in case of a conflict (which includes the label group), but that'd also need additional handling as I believe currently it'll just depend on which one came first if they're both moveable
There won't be multiple symbols pointing to the same docs (except for rare cases where they're provided multiple times by the inventories)
i would definitely make sure that no library can have anything thats in python as a !d label
!d else
8.1. The if statement
The if statement is used for conditional execution:
if_stmt ::= "if" assignment_expression ":" suite
("elif" assignment_expression ":" suite)*
["else" ":" suite]
``` It selects exactly one of the suites by evaluating the expressions one by one until one is found to be true (see section [Boolean operations](https://docs.python.org/3/reference/expressions.html#booleans) for the definition of true and false); then that suite is executed (and no other part of the [`if`](https://docs.python.org/3/reference/compound_stmts.html#if) statement is executed or evaluated). If all expressions are false, the suite of the [`else`](https://docs.python.org/3/reference/compound_stmts.html#else) clause, if present, is executed.
for
Loops over each item in an array, making the item available in a context variable. For example, to display a list of athletes provided in athlete_list:
<ul>
{% for athlete in athlete_list %}
<li>{{ athlete.name }}</li>
{% endfor %}
</ul>
``` You can loop over a list in reverse by using `{% for obj in list reversed %}`...
Yikes lol
8.6. Function definitions
A function definition defines a user-defined function object (see section The standard type hierarchy):
Well, it'd be impossible to take care of all cases but as I said the django template things have their own group so handling can be added for that. Best to open an issue for it if you'd like to see it handled
Relevant poetry and vsc news:
nice
Weee lezzz go, quackstack PR got merged οΏΌοΏΌοΏΌπ
I see οΏΌοΏΌοΏΌπ
- [ ] Read all the comments in this tempelate.
- [ ] Ensure there is an issue open, or link relevant discord discussions.
- [ ] Read the [contributing guidelines](https://pythondiscord.com/pages/contributing/contributing-guidelines/).
@gritty wind Should these sentences end with ??
Sure
What's happening?
I can't see it on Windows. Just says obj
yeah I meant i saw the three obj and then π
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Dafuq?
Lol, I need some sleep, night
Night!
Summer starts, schedule fucks up
True
Ok, welp am stuck here, and dunno why
this is my code: https://paste.pythondiscord.com/awahimojuc.py
i am kinda rewriting the manduck generator to support from options
but, the pants and dress color are always coming the same
dunno why that is happening
i can push the code to my fork, if you want to see the rest of it
sir @fervent sage i need your help
lol, i will try debugging more, if anyone can help let me know
nvm, thats the wrong screenshot
it was fixed long ago
correct ss
ok the colors are correct
but the generator generates them too close
If y'all know stuff about unit tests, please review these two very old PRs.
https://github.com/python-discord/bot/pull/954
https://github.com/python-discord/bot/pull/836
!remind 6h look over quackstack#35
Your reminder will arrive in 6 hours!
Hi may I know how do I pull the python bot in my own server?
I had forked it and also tried the webhooks function, but it doesn't work.
well if anyone how to create message object mocks and get there link in unit tests let me know.
Need them to write tests for one of the pr on bots ( 1446)
have you looked at the existing tests? I'm sure they create mock messages
is the link an attribute you want to set?
that line sets two attributes: content and attachments
you can set any other attribute the same way
like, this is a message object, then i want to get its message link like this: #dev-contrib message
I want to create like akarys send for the enhance incidents pr you reviewd recently
i went thro the tests already, didn't see anywhere how to get the message links, rest i can do ig
what will you use the link for?
is the link normally an attribute on the message object?
i think so, lemme see
I've written the existing tests so you can ask me about them if you have any questions
the existing tests are ok and i can understand them perfectly, this is what i want to do with the tests: #dev-contrib message
I think I'd have to read your implementation to help you write tests for it
the way unit tests are written is that you isolate a piece of code that you want to test (e.g. a function, or the regex), and you mock the inputs (and/or state if not pure) to simulate each scenario that you want to test, and then make assertions about the outputs (or state, if side effects)
so for example to test the regex, I think you only really need to provide a mock message link
and observe whether the regex identifies the link as it should
you don't need an actual message object to do that
for another example, to test extract_message_links, you would pass a MockMessage(content="my content here") which includes some message links in the content
and then observe whether the function returns the desired amount of embeds
if you wanted to test the embed content as well, you would have to mock e.g. make_message_link_embed as well
that would allow you to test the function in isolation, without depending on what make_message_link_embed returns (because you would mock its return value)
however a valid approach would be also to just let make_message_link_embed run
I'm not really able to tell you which one would be better in this case, I'd have to spend more time reading the implementation
ultimately, something needs to be mocked at some point, because you cannot get a real Context object anyway
so i would need to make message link embed and extract message link functions separately?
and not in the flow of the on_message ?
well, consider what on_message is responsible for
its responsibilities are to check whether the message is an incident, and if so, pass it to add_signals, extract_message_links, and the return value of that, conditionally, to send_webhooks
it's not responsible for sending the webhooks directly
of course it is possible to write a test that will ascertain whether the webhook is sent correctly on a simulated event propagating through the listener
but that is more difficult to orchestrate
and I think that's closer to integration testing
if you're just testing on_message as a unit, you only need to test that it does what it's responsible for
i.e. correctly delegating to other functions
the current testing suite is written using this approach
though I'm not able to tell you whether it's the best approach, and how useful it ultimately ends up being lol
again, please review this class here: https://github.com/python-discord/bot/blob/ce819ade482e82ecbc474bce5fb8ac9dd8b37b40/tests/bot/exts/moderation/test_incidents.py#L746
it doesnt assert whether the signals are added
it only asserts whether the add_signals function is called as it should
add_signals is responsible for adding the signals, not on_message, so that behaviour is tested elsewhere
the function docstrings explain the behaviour that is being asserted, so in this case, it is specifically that:
- Messages qualifying as incidents are passed to
add_signals. - Messages not qualifying as incidents are ignored.
I think, it is much clear to me now, I will try writing tests for them
if i get stuck, i will let you know π
thanks!
yea no worries
So to sum I need to add these tests:
-
Mock a message containing two links, see if two links are returned on
extract_message_links. -
Mock two
make_message_link_embedembeds and pass it to the webhook and test whether 2 of them are sent into the channel. -
Delete the incident, test if the delete function is called or not.
-
On editing the incident, is the extract message links function called
You can follow this guide to setting it up. https://pydis.com/pages/contributing/bot/
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.
Can I pass off the implementation of an !about command? It was discussed here: #dev-contrib message. I've been rather busy lately, so I haven't had the time to do it, and I'd rather not leave it sitting there.
!about
Hmm
I think we have something like that
!info
Maybe we yeeted it
.about
Yeah, why not
!bot info
A utility bot designed just for the Python server! Try !help for more info.
181230
Why is that a hidden command π€
Β―_(γ)_/Β―
people in general are calling me dumb for saying python is slow lmao
im so glad this channel exists
But it isn't
I think it's a bit unfair to compare a statically typed with dynamically typed language.
I haven't had any issues with speed with python
im not saying it causes issues
@njit and all my problems are solved π
Not exactly the channel to go to because you didn't like general
i just appreciated it and then it developed into this
I'm seeing this everywhere so I'll just throw in my blanket statement. Python is slow. However, there's plenty reasons for it not mattering, such as it being dynamically typed or the speed difference not being noticeable.
Does that satisfy your statement?
whoops
Speed isnβt everything
yes
but i never said python is worse than other languages
i was particularly talking about the speed
Programming is a facet of engineering, it is about tradeoffs
I don't think anyone would disagree, but when you make a statement like that its usually going to be taken as "and thus, worse than other languages" to some
It is off-topic for this channel anyway
it depends on what ur making
don't the new async frameworks give golang like speeds? uvloop is pretty fast (although not a web framework)
For the search feature on the website, would you rather it use a search API or a manual search? I'm personally leaning towards manual, just to try it out.
^ That's a pydis dev question, not about python's speed.
worse in terms of speed, yes
but thats all
Well I don't want to clog this chat so... have a good one
yeah i said everything i had to
It isnβt a reason to not stick to channel topics
For context, this is in regards to site#366
if someone has approved my pr and i do a new commit, does the approval stay?
Yes
cuz im pretty sure it does and i dont think it should be that way
I'd be down for trying to roll our own, although I'm not sure how core devs feel.
what if ppl approved it and i sneaked in something malicious
Our own search? π do we really need to?
You can re-request a review
Well we look at it before merging
Idrc, I'm fine with either
yeah ik but thats not what im talking about
it is rare that a pr stays with 2 approvals without being merged anyway
Well, core dev approvals
manual search, the api is completely been moved out for dewifikation
Not our own API
I'm talking about something like Algolia.
i don't think we want to depend on external service for that
could we, like, just use a search library?
We just have to search a few local files
we have difflib
That's what I meant by manual.
Hmm sounds like that wouldnβt be great performance wise
@tough imp
It would probably be fine, it's that it might be harder to make the search live.
What I mean by live is where results pop up as you're typing.
Which isn't necessary.
But I'm sure there would be ways to make it more efficient if that's something that's needed.
Would it be cool if a tag started with **bold** text, then we'd use that for the embed title?
are you searching thro the full content or just the headers?
one minute, i think my dewification, there is a short description field added
ok yes they are added, maybe we can just search thro them,
searching thro the entire content wouldnβt be great performance wise
in my opinion, worth asking lemon as the issue opener
Could have some kind of a header for arbitrary embed attrs so we don't have to rely on some special parsing which may not be obvious
or just json but I don't really think that's worth it and loses the md preview
I mean it wouldn't be too hard to do
line = file.readline()
if match := re.fullmatch(r"\*\*(.+)\*\*", line):
embed.title = match.group(1)
Yes, but it is something you need to know about and may not want
it's a markdown file why not just use markdown?
# Title
body
that makes far more intuitive sense i think than using a file format with built in header syntax and using a different way of defining titles
the event definitions use markdown with YAML frontmatter, the bot already has a dependency to parse them
Was thinking things like urls could also come in handy. With something like ?url=... or ?title=... as a header being simple to parse in the code, or html style comments which don't seem to be rendered by github
@fervent sage
Here's your reminder: look over quackstack#35.
[Jump back to when you created the reminder](#dev-contrib message)
@short snow am getting 500s while making manduck requests
bot#1298 and bot#1299 can be closed (or their scope changed) with the board being archived
π€ webhooks are weird
I'll add :shipit: to every approval until it works

I tracked down the issue
It's when the user's name isn't file safe
Ah that makes sense
just writing a quick func to escape invalid filename chars now
Ah nice
pushed
just make the name simple lol?
Hmmm, I will have a look
Could someone review bot#1531?
I think you are missing a return on line 144
Yeah, good catch
@gritty wind care to explain this a bit more?
Certain edge cases may occur if a module changes names while unloaded, and in such cases, it may be best to ignore it in code, and send a warning in a dev channel.
Like, how can a cog change its name on unload, and even if it does what warning do you send to Dev channel
Is it like, you donβt load all cogs found in cache and those which are present in cache but not in the cogs are sent as warning?
Say you have a module titled "chritsmas"
Someone notices that typo after it has already been merged, and decides to rename it
now the module will be called "christmas"
if chritsmas had been unloaded for some reason
You presumably still want it to be unloaded when it becomes christmas
But that seems difficult to figure out dynamically
so just let people figure it out with something like:
"Couldn't find unloaded module: chritsmas"
Ah, I think I see your confision
it doesn't change name on unload, it changes name on restart after being unloaded
Ok, so basically what I said afterwards, send a warning for all cogs which are present in cache but couldnβt be found
Yeah
Whoops, didnβt see the label π·
woops accidentally made a comment instead of an approval
hey! why use poetry for stuff that will be published on pypi?
Like over pipenv?
It has native support for it
More reminiscent of something like yarn or npm than pipenv
wdym
You can package your module and push it to pypi with one command
well, two
but they are simple commands, not manual steps
!pypi poetry
@fervent sage changes pushed, you can test it thro this:
curl -X 'GET' \
'http://127.0.0.1:8000/manduck' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"variation": 1,
"colors": {
"body": {
"r": 252,
"g": 79,
"b": 242
},
"wing": {
"r": 252,
"g": 98,
"b": 243
},
"eye": {
"r": 50,
"g": 1,
"b": 47
},
"beak": {
"r": 252,
"g": 77,
"b": 137
},
"eye_wing": {
"r": 254,
"g": 205,
"b": 252
}
},
"dress_colors": {
"shirt": {
"r": 173,
"g": 250,
"b": 41
},
"pants": {
"r": 175,
"g": 250,
"b": 46
}
},
"accessories": {
"hat": "santa",
"outfit": "ninja",
"equipment": "radio"
}
}'
sorry for taking space
so is the reason to switch to poetry for @dusky shore why?
Speed, and apparently works better on Mac
cause that's a bot and doesn't seem like it'll be going on pypi any time soon
Poetry is way faster
yeah lol i normally launch a shell for pipenv since its so slow
unrelated
vsc isn't running my bash_profile script on the integrated terminal, how to fix that?
its
.β¦
add -l to terminal.integrated.shellArgs.linux
thanks stack overflow
One, if you do poetry publish --build π
inb4 tests don't run
poetry should run tests before pushing to pypi if it does not already lol
I appreciate how simple they've made it already and run tests myself
Hey! currently I can't talk (sadly) I would love to but I cant, does someone need some help coding, then dm me.
):
Hmm hello so high staff help me please aww );;;
!voice
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@clever wraith
sir-lancebot#615 can have good first issue label
i think you missed this comment @gritty wind , https://github.com/python-discord/sir-lancebot/issues/685#issuecomment-824425749
I saw it, but haven't had a chance to action it
Don't know if I agree with it
Oh, that's a different comment
#dev-log message here, am thinking of making a command which can edit the cache (remove, list).
list - listing all cache enteries along with the status of they are loaded or not.
remove - removing a entry
@tough imp , in case you missed this
I don't think such a command would be necessary, the cache probably shouldn't be user-facing, it's just state for the extensions module
You can already list extensions and see their status
The cache should be a reflection of that
I'm not able to answer this, sorry ~ I'd have to read your implementation to try to help you figure out which tests to write
try to think about which parts of it would be worth testing
starting with the regex sounds good



