#dev-contrib
1 messages ยท Page 124 of 1
The issue is this call ```py
# We use d.py's method to ensure our request is processed by d.py's rate limit manager
await bot.instance.http.bulk_channel_update(category.guild.id, payload)
doesn't update the channel in cache with the changes
Can you not do channel.edit(position=x) instead? (which would return the new channel object)
I think we did before
and this change was due to issues with that
from the doc string ```
To ensure "stable sorting", we use the bulk_channel_update endpoint and provide the current
positions of the other channels in the category as-is. This should make sure that the channel
really ends up at the bottom of the category.
I'm guessing that has a story behind it
Presumably some sort of bug with dpy
new_raw_channel = await bot.instance.http.bulk_channel_update(category.guild.id, payload)
channel._update(channel.guild, new_raw_channel)
seems dirty
Why not do channel.category again?
channel isn't updated in cache so has the category of before it was moved (In-Use help channels)
Why isn't it updated?
Because we don't update it ๐คท
Doesn't dpy already does that?
Gimme few minutes, gonna try look for something
It's probably just easier to do the same as what we have for available_category
for the dormant category
to move help channels we have a move_to_bottom function
which calls the http build edit endpoint directly
which skips updating the channel in cache
which led to my review comment on the pr in #dev-log
Doesn't changing the category automatically move it to the bottom?
Pretty sure it does
So just channel.edit(category=CategoryChannel) no?
I am not really good in dpy stuff honestly
Can you test this? @vale ibex
the whole category moving was a mess so I don't think it's using that method for nothing
I personally don't see the issue with await channel.edit(category=dormant_category)
But then at that point we're getting the dormant_category object which kinda defeats the purpose of doing that in the first place
Okay there is a problem
I tested it in my bot and it moved it to the top of the category
welp there goes that idea
What happens if you do position=-1 out of interest? @viscid coral
Tbh this defeats the entire purpose
But don't know if it's possible
The purpose of doing this was to not have to get the category object
Yeah
I can just try_get_channel(constants.Categories.help_dormant) or whatever it is and do .name
thank you ๐
That's a beautiful commit
very beautiful
Thanks Chrisjl ๐
pass in --author="whatever", what do you need it for?
amend it with the flag set then, although I'm not sure what you mean with signing in as the author is just a normal field of the commit
bot#1736 doesn't seem to have closed even though bot#1738 was merged
I suppose I should've done "Closes" or something rather than "Solves"
yea, only these words work close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved
Right, makes sense. Thanks
Fixed
Thanks ๐
It already had a line break? Old message: #help-lollipop message
yea, I guess its just the emoji being a part of it now makes it look off to me
since before the text was bold, so it seems part of the same thing
Since the emoji barely looks any different when it's bold or not, it doesn't look connected to the line below at a glance
whereas before you could tell the two parts of the category name were the same thing, since they were bold
I don't think it's a huge issue though
Right, yeah
There's not much we can do about that other than moving the entire name onto the next line, but then you'd have a weird gap
I guess we could replace the spaces with non break space chars
in the category name
!charinfo
characters
!charinfo <characters>
Shows you information on up to 50 unicode characters.
Non break space chars? So forces it to not change line?
!charinfo non-breaking space
\u006e : LATIN SMALL LETTER N - n
\u006f : LATIN SMALL LETTER O - o
\u006e : LATIN SMALL LETTER N - n
\u002d : HYPHEN-MINUS - -
\u0062 : LATIN SMALL LETTER B - b
\u0072 : LATIN SMALL LETTER R - r
\u0065 : LATIN SMALL LETTER E - e
\u0061 : LATIN SMALL LETTER A - a
\u006b : LATIN SMALL LETTER K - k
\u0069 : LATIN SMALL LETTER I - i
\u006e\u006f\u006e\u002d\u0062\u0072\u0065\u0061\u006b\u0069\u006e\u0067\u0020\u0073\u0070\u0061\u0063\u0065
lol
!charinfo
characters
!charinfo <characters>
Shows you information on up to 50 unicode characters.
yeah
\u00a0
If discord changes it would it even make a difference?
oh
there aren't spaces
it uses a \uff5c : FULLWIDTH VERTICAL LINE - ๏ฝ
which i guess is a line breaking char
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Right, yeah. So it wouldn't work then
Also for bot#1739 do we just want like ```py
content = reminder['content']
if not content.endswith(("?", "!", ".")):
content += "."
send content
I mean at the moment we take the stance of punctuating it for them
Is that something we want to change?
If so we can just get rid of the "." in the string
I'd rather just not add punctuation
Silly question, how would one create a new branch? For example I recently wrote the Real Python Issue and PR, but I could not figure out how to create a branch from Sir-Lancebot (I made one on my local forked repo but is it possible to do the same for the main?)
You don't make a branch on our copy of the repo, you PR from your repo to ours
Sweet, so I followed the workflow I was supposed to ๐
Branches get made on our repos when a staff member contribute, for regular contributors your changes come from the fork
yep
you can make a branch on your repo and PR to ours or you can PR directly from your main to our main
Thanks joe!
Should I PR this then?
I guess.. not sure what others think
I mean I agree with this personally (and so did Jason above). Is there a strong reason to add punctuation?
If there's no strong argument against I'll go for it
I'd just remove automatic punctuation
Sounds good, thank you
Done, bot#1740
If someone has time can they confirm/deny my comment I made on bot#1681? I think it's just a case of refactoring some old code that's redundant now but want to make sure before I change stuff
@static canyon about the discord.User converter won't fail, we are talking even if the user isn't in the guild, right?
Yes
Even if the user isn't in the server, it'll work (as of v1.6)
Which tbf makes sense since discord.User isn't guild-dependant
As long as it's a valid user id, it'll always fetch the user
Alright ๐
I'll start work on this
@green oriole do we want to keep redefining a Union for Union[discord.Member, discord.User] each time or use a variable from bot.converters?
Hmmmm
Currently we're doing a mixture of both so thought I'd ask
Probably a constant
if a user is fine for a function why do we even need member?
Yeah, sounds good
There may be cases where we need the guild? I'll look into it
Call it BaseUser lol
in that case it would be logical to only use member, since user wouldnt have a guild
But you might still want to run even if they aren't in the guild
I'll look into it and see
but if you have Member|User surely User will always suffice since its the lowerst common thing
It probably is redundant
We gate some features behind a member isintance check I think
This is gonna be painful to see if it's redundant or not because each file calls the Union something different lol
In fact, the only times .guild are joined where it's on a Member is on on_member_join so it should be fine
Since that's the only think a Member has that a User doesn't
Or I guess joined_at and nick / display_name
What about performing guild operations such as bans and role applying
Okay I found a case where it might be an issue
async def create_user_embed(self, ctx: Context, user: FetchedMember) -> Embed:
"""Creates an embed containing information on the `user`."""
on_server = bool(ctx.guild.get_member(user.id))
...
if on_server and user.nick:
name = f"{user.nick} ({name})"
...
if on_server:
joined = discord_timestamp(user.joined_at, TimestampFormats.RELATIVE)
...
...```here different things are done depending on whether it's a Member or User
Cache a concern?
So this is an example where we need user: Union[discord.Member, discord.User] @fervent sage
What do you mean?
Can we end up in a situation where we donโt get a member object for someone who is actually on server
No
The MemberConverter will fetch_member, which always get the Member, even if not in cache
I also feel like Iโm missing context here, why is this refractor happening?
There was a change in V1.6 of dpy (fetches discord.User from id even if not in server) which makes some of our converters redundant, so I'm removing them
bot#1681 I think?
What converter for example?
bot/converters.py lines 483 to 492
class FetchedUser(UserConverter):
"""
Converts to a `โdiscord.User`โ or, if it fails, a `โdiscord.Object`โ.
Unlike the default `โUserConverter`โ, which only does lookups via the global user cache, this
converter attempts to fetch the user via an API call to Discord when the using the cache is
unsuccessful.
If the fetch also fails and the error doesn't imply the user doesn't exist, then a
`โdiscord.Object`โ is returned via the `โuser_proxy`โ converter.```
That fetches from API but UserConverter will automatically do it
Oh yeah
Can I please get reviews on bot#1740 by the way? It's literally just removing a "." that we decided we don't want
done :P
thank you ๐
Probably the hardest review for you yet :p
Am I able to change query: t.Union[UserMention, Snowflake, str]) to query: FetchedMember here? @green oriole
.... Excellent question
Ah wait no
We still want string search
btw
What should I be looking at?
There is no . at the end it's good lol
Oh nice
Btw. Instead of linking to the original message where the reminder was invoked, can't we just reply to the original message? ๐
We do have the message jump url, and to get the message object would mean we will have to make an API call
I feel like I am wrong
That sounds doable. I feel like a partial message is enough for replies, isn't it?
One api call is nothing either way
!source remind
Commands for managing your reminders.
Yeah we guarantee to be in the same channel
Do you wanna open an issue for this @molten perch?
!d discord.TextChannel.get_partial_message right?
get_partial_message(message_id)```
Creates a [`PartialMessage`](https://discordpy.readthedocs.io/en/stable/api.html#discord.PartialMessage "discord.PartialMessage") from the message ID.
This is useful if you want to work with a message and only have its ID without doing an unnecessary API call.
New in version 1.6.
Yeah, sure! ๐
Why not a PR with the solution right away?
I feel like that's not the convention ๐
It is easier to keep track who is doing what
Oh ok
There is ont problem tho
If you do discord.TextChannel.get_partial_message(1), it'll really create a PartialMessage, and if you try to reference it, it'll error
Yes, we need the right try/except in case the message has been deleted
So here
reminder = await self.bot.api_client.post(
'bot/reminders',
json={
'author': ctx.author.id,
'channel_id': ctx.message.channel.id,
'jump_url': ctx.message.jump_url,
'content': content,
'expiration': expiration.isoformat(),
'mentions': mention_ids,
}
)```
Instead of sending the jump_url, send the message_id? I feel like that should work, and the channel ID is already there.
Get the channel using Bot.get_channel, and than get_partial_message
Yeah, I guess we can change that but we need to update the site toooooo.. and I'm not sure if we should
I'd have to ask Sebastiaan but he is on vacations for now
You can get a partial channel too iirc
I don't think that exists
Let's put that on an halt until we know if we can modify the site schema to be a message ID instead. Or we continue to use the jump url but that sounds a bit silly.
I guess.. a message ID can qualify as a "jump_url" I agree.
But I'll open the issue anyways, so that I won't forget it.
Ok, I'll comment that there as well
bot#1741
Here it is.
!remind 5d Ask Sebastiaan if he is back from vacations
Your reminder will arrive <t:1629131778:R>!
@green oriole FetchedMember = Union[discord.Member, discord.User] do you think this is a good enough converter name? I'm wondering since it's not strictly a Member that it's fetching. Thought maybe like DiscordAccount of something but that seemed weird. NIR suggested BaseUser earlier which may be good
I suggested BaseUser because it's the parent class( I think this is what it's called) of User and Member
If it was just me I'd call it MemberOrUser haha
lol
class Member(BaseUser):```
That means the `Member` parent class is `BaseUser` right?
>>> discord.Member.__bases__
(<class 'discord.abc.Messageable'>, <class 'discord.abc.User'>)
```base is more pythonic since that's the dunder, not `__parents__`
Ohh ok
So in dpy it's actually Member(User) and then User(BaseUser) I believe
I mean I'm surprisingly tempted by MemberOrUser lol
It subclasses Messageable and _UserTag
lol sounds ok amazing ig
Maybe wait for someone else's feedback
@static canyon If Member is a subclass of User, then Union[Member, User] is the same as User
right?
Nope
wait, there are two different User classes?
What you're thinking of would be Union[User, Member]
A Member will match Member, but User won't
Member will match User
User will NOT match Member
Union[User, Member] is the same as Union[User, Member]
wait... I'm misunderstanding a bit
TLDR; this
What?
It's like doing Union[float, int]
I didn't realize you were talking about converters, sorry
Lol everyone here is a Moderator the entire chat is orange
What do you think a good name would be though?
lol, I learnt Python through dpy
UserOrMember
lol
I mean... it's the most clear and unambiguous way
Yeah
@celest charm lmfao
I like it too to be honest
this is not an English writing class
MemberOrUser though since tries to convert to Member first
if you name your class FuckingMess and it's the most descriptive name, then you're good to go
rofl
right
I'd also add a comment about it not being redundant to just User because it's confusing
Alright ๐
I'm gonna go with MemberOrUser, thanks everyone
MemberOrUser ^
Yeah
Since it is in converters.py it should make sense I think, but a comment doesn't hurt
time to rename all the stuff that I literally just renamed
Well at least your IDE can do the work now
Erm
yeah, most editors have a rename function
Definitely not editing from GitHub website


rofl
The poor commit history
Linting + Chris has always done the testing for me xD
Smh
Time to make 57 rename commits 
AAAAAAAaaaaaaaaaaaaaa
50 some
Are you in the github codespaces preview Tizzy lol
As an example
Literally just doing it on GitHub because I can't remember how to do git
He gits it
I got dinner first but I'll @ you when I get back if that's okay lol
I will try and do in IDE for the 57 edits because otherwise the commit history is going to die 
@green oriole are you free?
Yes, you need to clone the whole repository
When you have the repository you work inside of branches
You have many branch per local repo
This seem weird... Wasn't it just edited before?
Yes, I think you need the https schema though
Like this
I think it happened because discord returned an error, so it felt back on using a second message
Do you have an ssh key setup tizzy?
Nope
Done ๐
Ah alright, only mention it as it's easier to use ssh (no need for a password every time)
How would I do that? @vale ibex
What os?
I think password auth is disabled now
Win10
Well, seems like Chris is handling it
and accept all the defaults
The defaults suck though
PAT or bust tbh
I've never used PAT actually lol
Done
cat out ~/.ssh/id_rsa.pub
What is ssh? What are you even talking about lol
and goto https://github.com/settings/keys
cat is linux I don't know windows equiv
works on cmd also
use type
once you're here click New ssh key and paste in the whole ssh key
try type C:\Users\tizzy\.ssh\id_rsa.pub
maybe cmd doesn't like ~ for home
Yep, that works
.
Once that's done you can click the code button on the repo and choose the ssh tab
Including the @tizzy-DEVICE_NAME?
yup
why not use powershell?
Because I opened command prompt first ๐คท
you're public key shouldlook like ```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDBYx/b++w2CpKyhSl0mY9lL6c093ghb5eD0uNPkgQTa5cCIaYy73q0w3uTmqoIDuaQk3eHVu0Jk2DvUH16u9f5jLXrMIAbeiQv6giPqyGdulqqJ4LsMCXT8xIV1myTpkXwlzJs6R48byOiupALTkO47MUGFMT+dUsKKSYQqZxdXr5EPxYLM0iziYuIvu2D8wF5Hc9HmL86/E6ScxO4iGGEq452k38hH7appQ9BIJDhDKnsxMm/povO7EBwm9q45b7ifnbiDKO+G041hYwpWx78b+ryUrvHoDv9jUjAHc2HDnN95fbXvbYPKRg2naf1A4Ra+4CKywE3sc/u3oZ9UJUHB3fEXir/MgviztrbSkxhMFwWckxEt6l6H3y71HQx0rFXnzYSuj1T647ntxZBeZZUnHw6DkKYbovLzXiOL4wMr9Xq/9tr7kGxEoKgvTYwk69Win8cQfncXyWfacV3311GNOPx6SCFYnWCVNODyPb+s8R8L+6GfGGRy0V8mEwSJu0= chris@DESKTOP-FEC9JN0
(it's fine to share public keys, that's the point)
Do not share id_rsa though
that's your private key
aight
id_rsa=private id_rsa.pub=public
ok once it's all in git, you should be able to clone it with ssh
It gives me git@github.com:python-discord/bot.git
yup
What do I do with that?
git clone git@github.com:python-discord/bot.git
type yes and enter
you'll need to do that as it's the first time you've connected to github using ssh
Right yeah, fair enough
Yep
nice
all that's left to do is set your git name and email
git config --global user.name "Mona Lisa"
git config --global user.email "email@example.com"
Mona Lisa lol
there is a private email addr you can use via github if you don't want to use your personal one
I know a lot of people recommend git kraken for managing things locally
it's seems a lot more approachable than the command line
@thorny obsidian was a strong advocate for that ๐
Done ๐
:D GitKraken is fantastic for dealing with repos, especially with the student github pack thing
lol github doesn't believe the I am a student
do you have a prefered IDE/editor?
sure, someone else might need to take over here, I don't use pycharm
probably best to stick with what you know rather than change now
I mean I've used loads of stuff
key leak
you can probably skip a few steps since we've already done it
yea, it's a leak, definitely don't put it in your allowed hosts and give me the ip addr
Wait I've downloaded the repo but I want my branch @vale ibex
I've already created the branch and edited stuff from GitHub website
you should be able to check it out
@vale ibex sounds good => ssh.akarys.me
you'll find it under remote branches
Can anyone review bot#1717 ? I opened it a week ago, just looking for opinion
I'm surprised Chris didn't try to ssh yet lol
I did, it timed out lol
PS C:\Users\Chris> ssh root@ssh.akarys.me
PS C:\Users\Chris> ssh chris@ssh.akarys.me
PS C:\Users\Chris> ssh ssh.akarys.me
PS C:\Users\Chris> ssh akarys@ssh.akarys.me
PS C:\Users\Chris>
what do you use?
I think I can PR my thing now actually
vsc
Hehe
lol probably want to squash that
No clue how
Someone wrote a page on this
He writes okay stuff at best though
I don't like him
I wouldn't speak like that of everyone but Akarys
damn why is this not public, the title seems great
Hmmmm
Let me check nobody else contributed to the page
And obviously Chris just edited it
lmfao
we tend not to make pages public, since it leaks contributors emails
but only me and AK have edited it, so if Ak is alright with it then we can make this one public
commit messages are great 10/10 Tizzy
(You can change the commit message at the bottom of the github pages before commiting them)
((I used to do this for a long while))
lol actually, Ak leaks his email in the page itself anyway
Yeah I'm fine with it

My email is public on github lol
yeah ak uses his email-- ^
I did change them lol
oh.
A commit message just highlights what you did, in the imperative mood (which is what those do)
it be public
?
wait that's actually a useful guide @green oriole
I would like y'all to take half a second to appreciate that I found the image of an industrial press to use as the page cover. Thank you.
Thank you! 
i thought it was just gonna be press the squash merge button ๐
you sound surprised lol
I am lol
Ak is a verified Python speaker now
need to balance it out somehow lol
makes sense
I'm not ignoring you, I just don't have strong feelings either way. (Others may be the same)
hey guys, i have an old version of sir lancebot on my fork that uses pipenv and running pipenv run start gives socket.gaierror: [Errno -2] Name or service not known, any ideas? i have all of the env vars properly setup
could you paste some more of the error?
easiest solution is to update lance and then try to fix it
specifically what it's trying to connect to
you also have the option to rebase your fork
but you will likely be in merge conflict hell
or just go to github and press fetch from upstream ๐
Oh ok, thanks. Should I just close the issue due to inactivity?
oops wait that wasn't in response to you @viscid coral
Got my hopes up.. jk lol I knew it wasn't for me
Most core devs are on vacations right now - including me - and not able to review much. I would just wait for a bit :)
Ok, thank you!
I'm very confused by this linting error https://github.com/python-discord/bot/pull/1742/checks?check_run_id=3304029440
@vale ibex are you able to assist?
How do I do that?
I think it's poetry run task test?
@static canyon here's how to do test stuff https://github.com/python-discord/bot/blob/main/tests/README.md#tools
well you did change a bunch of files, and a bunch of stuff within those files
uhhhhhh
I haven't had that error before, and I don't have access to my dev environment rn because am on windows
I'd say like 90% of the errors are that
you need the env set up with a bot token, a dummy val should work
How would I set a dummy env?
oh that token, I thought you said 'token' as a placeholder for a different error, such as a class name.
This is what I followed to get a local Sir-Lancebot running prior to contributing the Real Python search: https://pythondiscord.com/pages/guides/pydis-guides/contributing/bot/
A guide to setting up and configuring Bot.
BOT_TOKEN needs to exist in your .env or as a normal env var so the config can grab it; you can set it to whatever like (even an empty val) but it must exist
Would setting it as a system env var work?
The difference between Sir and Bot are the .env variables and the tests? (for the setup) Nevermind there is a decent amount of differences
maybe worth looking into what tests depend on configuration like that, but then again for local dev you'd have everything set up in most cases
[Poetry Project](/pyproject.toml)
uhhhhh, its pyproject not poetry project.
(its a pep to be pyproject.toml)
I believe it should, you can also try replacing bot: token: ... with the value in your config.yml
This worked, thanks
FAILED tests/bot/exts/moderation/infraction/test_utils.py::TestPostInfraction::test_first_fail_second_success_user_post_infraction - TypeError: Subscripted generics cannot be used with...
FAILED tests/bot/exts/moderation/infraction/test_utils.py::TestPostInfraction::test_normal_post_infraction - TypeError: Subscripted generics cannot be used with class and instance checks
FAILED tests/bot/exts/moderation/infraction/test_utils.py::TestPostInfraction::test_unknown_error_post_infraction - TypeError: Subscripted generics cannot be used with class and instan...
FAILED tests/bot/exts/moderation/infraction/test_utils.py::TestPostInfraction::test_user_not_found_none_post_infraction - TypeError: Subscripted generics cannot be used with class and ...
```now got this (same error 4 times)
Example full error: https://paste.pythondiscord.com/avajuqosiy.rb?noredirect
Looks like an actual error due to to the new typing alias
you changed a tuple passed to isinstance into a generic which can't be used with it https://github.com/python-discord/bot/blob/33c86445cb13713e58d5c3d56d5c204517f2998d/bot/exts/moderation/infraction/_utils.py#L82
bot/exts/moderation/infraction/_utils.py line 82
if isinstance(user, MemberOrUser) and user.bot:```
that isn't from a test
Huh
It is?
tests\bot\exts\moderation\infraction\test_utils.py:358: this is a test dir
nvm
>>> import typing
>>> isinstance(3, typing.Union[float, int])
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
isinstance(3, typing.Union[float, int])
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\typing.py", line 703, in __instancecheck__
return self.__subclasscheck__(type(obj))
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\typing.py", line 706, in __subclasscheck__
raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks```this is the issue
You can't do isinstance like that
bot/exts/moderation/infraction/_utils.py line 86
if isinstance(user, (discord.Member, discord.User)) and user.bot:```
Why was it changed in the first place?
I just thought it was redundant
That seems like the best option
Which one?
wait, isn't discord.Member a subclass of discord.User?
reverting it
True
it's possible in Python 3.10 
I guess we can just isinstance(discord.User)
in which case, discord.User should be the same, right?
wait, where is discord.User defined?..
I mean, in discord's source code
because they do a bunch of from ... import * in __init__
discord.user.User
so User is actually a dict?
class
it's inherited from TypedDict
It inherits a whole load of stuff
discord/types/user.py line 39
class User(PartialUser, total=False):```
PartialUser
discord/types/user.py line 29
class PartialUser(TypedDict):```
that means it's a TypedDict, right 
Do we want isinstance(user, (discord.Member, discord.User)) for clarity or just isinstance(user, discord.User) for simplicity?
mind that we're using the 462ba84809f43349296c44cbe6468f631a00edab rev, not master
ohh
(or at least something around it but that's the tag for the version the bot uses)
^
discord/member.py line 159
class Member(discord.abc.Messageable, _BaseUser):```
right?
discord/user.py line 342
class User(BaseUser, discord.abc.Messageable):```
it looks like you'd have to use the User abc if you only wanted a single type in the isinstance, I think it'd be best to just leave the line alone
yeah let's just do the simple thing
@vale ibex btw you have conflicts on https://github.com/python-discord/kubernetes/pull/65 before anyone reviews it ๐
Ah yeah, isinstance(user, MemberOrUser.__args__)
lol
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
lol

*aaaaAAAA
Do we care about lint warnings? (things like deprecations etc.)
the ones from running the project's flake8, don't think there's anything for deprecations there
https://paste.pythondiscord.com/dacugowevu.sql first one is deprecation from the poetry run task test @brazen charm
yeah ignore that it's not even from our code, the testing suite probably emits all warnings
Right, okay
Hopefully it passes linting this time lol
Can I get reviews on bot#1742 please 
If you're not familiar with reviewing, you may want to take a look at this: https://pythondiscord.com/pages/guides/pydis-guides/code-reviews-primer/
An introduction and guide to the world of code reviews!
hi everyone
But in general, you don't always need an approval/denial message, you're just expected to look over the code
do yo know how to user mongo wth django frame
You may want to ask that in #web-development, as this channel is for Python Discord projects.
Ah lol, that might be able to be closed tbh cc @patent pivot @fervent sage
oh yeah that's fine to close
@vale ibex hello i'm going to merge the manifests for threadbot
oh also joe, my pure asgi service 
vco PR me manifests 
lmfao
Cool, I'll enable the depoly stage in threadbot when I'm back tonight
(or someone else can uncomment it out if you want your name on the repo)
@brisk belfry
you said the magic words
wait I don't have push so nvm
darnit

joe will do it before i do it
750 millicores
ah
1000m is 1 CPU core
75% of a core
your service probably needs
10
lol

@brisk belfry
yooooooooo chris bad programmmer #EpicFail
ok how many things are wrong with this? 
time to steal from quackstack 
omg joe
the tls error page for quackstack is... yea
thats great
LOL what
Oh, yea lmfao
Dockerignore
uh joe, my thing exposes port 8000, how do i tell k8s ingress that's the case?
oh is it targetPort in svc
yea
kubernetes#69 funny number
nice.
smh fine
dude no you didn't
omg this is amazing
well I mean joe did say he could
that ghcr link 404s for me
same
lmfao
loll
should be good now
how common are mtls errors anyway?
providing you aren't being a naughty goomba, it'll never be seen
so like
nice
ASGI = โค๏ธ
lolll
uh oh is not happy
ok
works
all is good
but why would you not if you could also yes
because i made that image in my /tmp dir and its gone because its so low effort
bruh
but its high enough effort i cba to rewrite it lmao
no no this is not a sign off on that at all lol
there is contextโข๏ธ behind this
ctx.message
joe, vc, late night
Joe's Late Night Show, with Alec VCO as this week's guest:
"Why do we need to create a website for h?"
yes
most excellent
this is in such serious need of a redesign its not even funny lol
lolol, hold on writing manifests, there's a bit more to it than a single container
need to figure out where I want to put alerts
maybe maybe lol, but it's a really core part of our devops, so I'm going to be figuring it out as we go along
it's the entire method of how alerts get checked and pushed out to Discord & OpsGenie
pager
better than an hour of AWS "You are not authorized to perform this operation." 
imagine using the root user
Do we seriously now have a service to return the letter H? I love it
:D
I love that
joe could you reenable @brisk belfry ?
Should be good now
I've fixed the Dockerignore and turned on the auto-deploy action
If Joe isn't around I could maybe do it, I assume he brought down the number or replicas to zero?
thread-bot/deployment.yaml line 6
replicas: 1```
doesn't seem like it
We don't usually commit those changes to the repo
ahh
But no there is a replica
The auto deployment should work, I don't see anything that should disable it
Hmmm
I just noticed, this url is wrong: https://github.com/python-discord/bot/blob/main/bot/exts/info/site.py#L46
It's just /resources, not /pages/resources
Did you want to fix it?
Ye, I can do that
Noice
there's a few places in that file it's referenced
It might be better to change the constant to a baseurl
The tools link too
Look at the variable
The variable has /pages in it
Yeah I saw, I can fix that
and then add /pages to the 3 places that need it
No I'm saying it's correct as it is
I mean I can fix the wrong links, my bad explanation
PAGES_URL = f"{URLs.site_schema}{URLs.site}/pages"
...
learning_url = f"{PAGES_URL}/resources"```it's correct though?
nope
Resources are at https://pythondiscord.com/resources/
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.
We can remove the /pages part and manually add it when needed
he doesn't care about my traceback
oh lol
lemme look
oh...yea
I'm not gonna fix that
my PR will fix it as a sideaffect
@vocal prairie frequently-asked-questions is /pages/frequently-asked-questions (not just /frequently-asked-questions)
Same for /pages/rules and /pages/guides/pydis-guides/asking-good-questions/
Yeah, I'll manually append /pages
๐
I think the asking-good-questions link is wrong at the moment
Nvm it redirects to the correct one
Is there something special that needs to be set up when running the bot in Docker? I'm getting this error:
bot_1 | 2021-08-11 21:03:46 | bot | CRITICAL | Could not connect to site API. Is it running?
And afaik, compose sets up site by default
you have to change the urls
I have them all configured properly to my knowledge
urls:
# PyDis site vars
connect_max_retries: 3
connect_cooldown: 5
site: &DOMAIN "pythondiscord.local:8000"
site_api: &API !JOIN ["api.", *DOMAIN]
site_api_schema: "http://"
site_paste: &PASTE !JOIN ["paste.", "pythondiscord.com"]
site_schema: &SCHEMA "http://"
site_staff: &STAFF !JOIN ["staff.", *DOMAIN]
paste_service: !JOIN ["https://", *PASTE, "/{key}"]
site_logs_view: !JOIN [*SCHEMA, *STAFF, "/bot/logs"]
I haven't touched anything besides setting the BOT_TOKEN env var and the config.yml
do you have pythondiscord.local set in your hosts file?
Yup, and when I go to http://pythondiscord.local:8000/ in the browser, it works fine
ah if it's all in docker you may need to use the docker names
web:8000 for the site url I think?
Thank you, I found that part in the contrib guide now
personally I run the bot itself normally so it's easier to restart
@brisk brook I've actioned all your comments on thread-bot#1
Can I get two more reviews on bot#1742 please?
It's not a drop-in replacement because our convert had a case that returned discord.Object. Is that an oversight on your part or did you not think it was helpful to keep it?
When would it return discord.Object?
If you just use the default UserConverter it won't as of dpy 1.6
When the fetch API call failed for a reason other than the user not being found
What would be such a scenario?
Discord being broken?
I mean if discord was broken then stuff would break anyway I guess (just further down the line)
I don't really know. I guess it was a robustness thing but I don't have stats to gauge how useful it has been in practice.
But it was a concern that you didn't mention this behaviour at all in your PR
Can you link to the code for this?
bot/converters.py lines 518 to 522
except discord.HTTPException as e:
# If the Discord error isn't `โUnknown user`โ, return a proxy instead
if e.code != 10013:
log.info(f"Failed to fetch user, returning a proxy instead: status {e.status}")
return proxy_user(arg)```
I don't think it's really worth having that to be honest
I did notice that but then forgot to comment about it
The only scenario I can think of where that'd actually be useful is when discord is down or something and so stuff would break anyway
I don't have stats to gauge how useful it has been in practice.
Maybe that's something @patent pivot can help with seeing as it's logged each time it happensMark knew how to do it, sorry for ping
Two small nitpicks then it should be good!
Good point, I actually know how to look that up myself.
Although I cannot tell if it is taking a long time to query or if it just found nothing...
gonna squash some of the commits before I merge
Pretty sure that's finding nothing
Since for me it says like "querying" or something then loads a blank page after
Yeah, if you do say "Dormant" as the search term it's a lot more obvious in comparison
Also get a little spinny icon when it's loading
So basically it's fine to remove it ๐
I think it's not working right
I don't think it's actually querying the entire 2 year range
Even with a query that I know should return many results, I cannot scroll farther than 5th of august
I assume it only shows top 100 or whatever
I'm getting 1000 results tops from the looks of it
Your PR has been Bluenixโข๏ธ certified, very strict rules. Not many PRs get this certification
Yeah
I mean that's definitely feasible seeing as I can't think of a scenario it would
So are you in agreement that it's okay to remove the proxy_user stuff? @tawdry vapor
Yeah I am in agreement.
I'll make a reference to this on the PR to make it clear
๐
@vale ibex Do you have time to review my 3rd PR today too? bot#1742
once I make a PR of my own, 2 secs
๐
uhhh, that's a lot of commits
we should probably squash those down to a few
I don't think it should just be 1 though
ehhh, actually possibly
I was going to squash them but then realised I didn't know how and looking it up didn't really help much
I can squash them all into 1 commit when merging via the github interface
I'm just trying to parse all the changes in my head to see if that makes sense
All the "Verified" ones are one-file edits
otherwise I can check it out locally and squash
The verified ones are really two commits: updating converters and removing unused imports
Suppose can merge that into one though tbf
I'm thinking
- 1 commit that adds the MemberOrUser converter, and changes all of the type hints, and removes unused imports
- 1 commit that removes the redundant isinstance check
- 1 commit that removes the FetchedUser and proxy_user things
Yeah, that sounds good
cool, feel free to review bot#1744 in the mean time
not too sure of the implications, I guess try it and test things ๐
someone sent me a guide on this btw, https://www.notion.so/pythondiscord/Squashing-a-Pull-Request-191e8efa2fbb4d72840fd17ca37cf7fa
you might find it useful
Does the thread bot ping both Mods and Admins in the thread? @vale ibex
Edit: Nvm, just remembered it's open source so can check myself and it does
๐
someone lol
lol yup
also, just squashed
noice
annoyingly, since I forcepsuhed that rebase I'm actually disqualified from counting towards review bot
just remembered that lol
lol
4 people reviewed bot#1738 and none of them noticed that the categories are already instance attributes of the cog ๐
Congratulation on finishing your first project! Our bot uses the discord.py library though, and can't be used to add various unneeded scripts. Please make sure to be assigned to an issue before submitting a PR, or come discuss this with us in the #dev-contrib channel.
can someone help me? i dont understand this ^^
context?
sir-lancebot#807
The Sir Lancebot project is our bot, @dusky shore. I don't see how your project fits into the bot.
You can make a command that implements a calculator, which could be useful.
i dont understand
Scientific calculator ^
Our bot isn't just a collection of personal beginner projects, it's a Discord bot with some fun commands.
maybe @green oriole can clarify their message
Yes, our project is a discord bot. You are free to contribute commands that uses the discord.py library.
The sirlancebot is a discord bot, it contains fun commands to play with on the server, you have made a calculator which isn't using the python discord.py library which we use to add commands to the bot, so your command won't be added to the bot even if the PR is merged.
Secondly, I don't see how the command fits our needs, it is just too "simple" to be added as a command if you could make it a scientific calculator then it could have been better but it doesn't adhere our contributing guide as we need to make an issue first which would get approved by a core developer and then a PR can be made
But your contribution was just a script in the root folder, it doesn't have anything to do with the bot
I would honestly love to see a proper calculator be added, just because parsing and interpreting a mathematical expression is quite interesting. But I don't think other core devs would agree with me haha
Congratulations on finishing your first project though @echo narwhal! If you want to easily share it putting the file in a gist (https://gist.github.com, basically a website for showing and sharing various script) would be a great idea!
!e
print(23*3)
@rapid swallow :white_check_mark: Your eval job has completed with return code 0.
69
A scientific calculator is an interesting idea
๐
My bad, I thought you said it was your first project. Well, even if it isn't it is still a good achievement 
it is
my 1st one
good job,m but python file has a .py extension
Can I have some more reviews on bot#1742 please?
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
guess this is the life of using unreleased versions lol
doesn't the lockfile lock it to a specific rev? or do you have to do that manually if wanted
ahh this guy opened his pr 
just checked, you can pin it to a specific rev/tag
but I didn't so I guess this is my own doing really lol
I would do that if the lockfile doesn't do that already (which tbh I think would make more sense), always better to manually update when you know about it to fix something instead of getting a new version every time
i think lockfile does pin it to a specific commit, which gets changed when you relock?
not sure
Yea true, think I need to install git on the image now though
i had the same issue an hour back
small price to pay though IG
I think the issue is I was specifying the archive zip url, rather than the repo
since I didn't want to have to install git
and that archive zip is the latest version of master
that might be it, the lock file currently only keeps track of the version which I assume doesn't change until they go into a beta/stable
Yea
rm -rf /var/lib/apt/lists/* chris why did u do this?
I wanted to copy your approach on one bot
Since there's no need for them to be there using up image space
what does it contain?
that's where apt-get update things go
๐
Anyone on bot#1724
@surreal veldt would you like to work on it?
there's already bot#447 which I'd say overlaps with the above issue
Sure
Was thinking of using the difflib module
oh
Oh, good catch num, thank you
Would you like to work on that one @brazen charm? Asking since it has been a bit since your last comment
no, not at the moment
Alrighty, then if you comment on the issue @surreal veldt I can assign it to you
sorry uh what do i comment lol?
keep in mind that there are more than a 100k symbols from the loaded invs so naive fuzzy matching probably won't work very well in the majority of cases, only for things like typos
i was thinking difflib
you can change how accurate you want the results to be given your input
and change how many results max should it get
as an example this is how many results I get with a simple containment check for context locally with fewer inventories that are a bit outdated
In [4]: len( [s for s in bot.get_cog("DocCog").doc_symbols if "context" in s.lower()])
Out[4]: 746
Thats fuzzy thing?
!int e len( [s for s in bot.get_cog("DocCog").doc_symbols if "context" in s.lower()])
In [2]: len( [s for s in bot.get_cog("DocCog").doc_symbols if "context" in s.lower()])
Out[2]: 792```
Does this have anything to do with discord.py? As far as I can see, it doesn't https://github.com/python-discord/sir-lancebot/pull/809
It was already discussed above and denied I thought
they submitted another PR
Oh wait, there were two
Yeah, they submitted another one for some reason
#dev-contrib message for some reason they opened it again
oops wrong ping
sorry, dawn ^
Akarys closed the first
@echo narwhal Why did you submit another PR? I think we explained that we don't randomly merge other people's projects into the bot, we only merge new commands or changes to existing commands.
cc: @echo narwhal why did you open it again?
oh god
discord is glitching so much
sorry for double ping
sry did that on accident and i am new to github so i dont understand anything
no just a simple check for all symbols containing context, I'd imagine fuzzying would get you more matches unless you went for doing it on the whole symbols which would most likely fail because of the library namespaces before the symbols
Build the containers again
Ill use difflib, best for this imo
docker-compose build
docker compose up --build also works
whats the issue again?
whats your settings.p?
gessing it is django
when you said bulma
the TIME_ZONE variable to be specific
weird, can you confirm it is 2.8.6 in poetry.lock
to what ver?
psycopg2-binary 2.9.1 psycopg2 - Python-PostgreSQL Database Adapter
in poetry show --tree
lol yea
change ~=2.8 to ~2.8
aha, nice, sometimes poetry acts weird
should be fine after this
~=2.8 is the same as >=2.8, ==2.*
