#dev-contrib
1 messages · Page 145 of 1
I was up at like 4 am yesterday, see my messages in #async-and-concurrency. I kind of regret it
I'm good
Summary OS: Windows Architecture: 64bit Psutil version: Trying to install 5.8.0 Python version: Python 3.10.0 Type: wheels, installation Description In Python 3.9.7 psutil installs without any prob...
bot#1879
Are you sure about that? I'd at least wait for 3.10.1
yea, it's more just tracking blockers for reference
I'm going to start closing inactive PRs on lance
markov poem gen
and the other one
basically the 2 oldest ones
xd
What're people's thoughts on bulk requests to quackstack (i.e. /ducky/bulk?amount=5 with a limit define by an env var)
Preferably after s3 bucket is my guess
hmm, IG that would only help pre-rendered duckies though
Yea, I think it sounds like a cool idea
cause sometimes i (and lets be honest im the only production user of quackstack) need several ducks at once and dont want to make a bunch of requests lol
This is only for random duckies then yes?
yeah
My email is being bombarded with merges 
well
hm
maybe
GET /ducky/bulk HTTP/1.1
Content-Type: application/json
{
"seeds": [
1234,
5678
]
}
but rthe body is optional
and there's a query param for amount
What do you need the bulk endpoint for generally? Can't it just be the same?
bodies on get requests will be dropped
lol
in the end regardless of s3 or local the response would look like
[
"url",
"url2"
]
quite indeed
(also, the answer to your question is "yes")
@green oriole what do you mean by hotlinking the generation endpoint?
I'd recommend looking at how the hacktoberfest issues command works since that queries the API and works perfectly
You may be able to find the issue by comparing the two
alright thanks!
There's a nice easy PR needing review if anyone has time: sir-lancebot#914
^ has been merged 👍
I wonder if this last week has broken records for how many PRs we've merged
Fyi I've just addressed your review on sir-lancebot#899 @vale ibex
Should be ready for merging now
Fancy collapsibles 🎉
niiiice, a decent guide!
I'm glad we kept my "have fun!" haha
where?
sec will open a PR
It better not be what I think it is
hah
speedmerge
lol
today is like my most productive day in the last month
i've reviewed like
4 (5?) prs
created a few issues
commented on wookie's issue
and implemented a whole shard manager in my discord lib lol
I've always loved my 2020 contributions
It was adding another library to snekbox or something to fix a log error
lmao
The only thing I did all year
is this an opportunity for me to flex my contrib graph
Go ahead lol
I started really contributing in late Aug
Jfc
2021
I've made a few things in the last year 
Ya don't say lol
I feeeeeelll like it is fake lol
Should've gone for this smh
also <rant>
people seem to think that committing a ton to git is a bad thing because you're just commit farming but like, thats a good way to use git, it allows you to rewind more granularly if something is broken so you have the minimal amount of stuff to rollback if something breaks
</rant>
ive never understood people who commit a huge amount of stuff at once because if you need to roll back that commit youre probably removing a bunch of not broken useful stuff too

Alright, bot#1844 and site#593 are ready for review
@green oriole i see you fell into the sue/use trap 
We should 100% sue them tho
The only thing we can do about it is not sue embeds
i do this so often
Same haha
Does anyone know what the ratelimits are for editting channel perm overwrites? Is it the same as edit channel?
if you count how many times in the gtao server i've said "use" and cross reference that with message edit logs showing me correct sue to use the number is almost the same
gimme like 2 mins
Thanks 😄
its definitely better than the 2 per 600s limit on naming, though
Ah cool
I found another typo 
.randomcase you have to take the current ratelimits from the headers as it can change at any moment
YOu HAvE To takE tHe CurReNT rATElIMits from the HeaderS AS IT CAn chANGE aT anY moment
^ reenacting of me every time I ask what the rate limit currently is on the d.py server
lol
Do I fix it? the first hyperlink in https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/#appendix-full-env-file-options
A guide to setting up and configuring Bot.
I guess I should
Huh, client accounts don't get ratelimit information back
I think so, although that link doesn't work for me either
@vale ibex 10 per 15s
? It does work for me
nice nice, thanks
here's the full RL info for editing perm overwrites btw
yep, channel id is a major param so buckets are separated based on it
👌
the only global limit is the 50/s one
my usecase is remove overwrite for a role, send a ping and then add it back
and a very very very high global limit on webhook execs in one day per ip
we just press the recycle button for that
mod_overwrites = channel.overwrites[self.mod_team_role]
await channel.set_permissions(self.mod_team_role, None)
await channel.send(self.config.ping_string)
await channel.set_permissions(self.mod_team_role, mod_overwrites)
ez
basically how ratelimiting works on discord (and i wrote a ratelimit handler yesterday so im quite up to date on this
) is that you have a sort of bucket created from 3 things and the path:
f"{channel.id}:{guild.id}:{webhook.id}-{path}" (for client side handling so this can be formatted however) so for example for editing channel overwrites our bucket is "692093569934164038:None:None-/channels/{id}" (the {id} is part of the string)
That's cool
because there's no guild parameter in channel endpoints
ic
it should be guild_id where thats an optional variable but i didnt feel like writing a whole codeblock for it 
@static canyon would it be possible for me to submit my changes (as PR or otherwise) after you've done your restructuring? no rush, ofc, but I still need a bit more time finding a neater solution for _fetch_url, in hacktoberissues the param argument wasn't used which I'm guessing is why it still works. Apart from fixing hackstats itself I still have to refactor some things as well as removing the oct 3rd logic from last year.
ok but like-
well yes obviously doing that aint great
but commits where you use the word and are usually destined to be multiple commits, for example
feat: add http client and gateway ratelimiter
- Cool but these are totally different things, why are they in the same commit?
its those that annoy me most 
Any chance you remember this @green oriole ? https://github.com/python-discord/site/blob/main/pydis_site/apps/api/tests/test_offensive_message.py#L61
pydis_site/apps/api/tests/test_offensive_message.py line 61
with self.subTest(fied=field, invalid_value=invalid_value):```
is it supposed to be field=field
😄
2 years ago, damn
hah yea bot#616 found it
site#616 even
currently our incidents don't work, bot#1885 fixes that 🙂
Because of 2.0?
yea
Discord.py 2.0 changed how this works, webhooks now look for the MISSING sentinel, rather than None to determine whether files are being passed.
This was updated in this commit: https://github.com/Rapptz/discord.py/commit/a6f7213c89e9d592c69ea3c631b0cb2bdab19577
is now merged
🎉
Which PR is the next victim
I suppose I can do the temp-fix you mentioned above and then you can PR a proper fix once my PR can has gotten merged?
I just wasn't sure if you wanted to do that or not since it means waiting for mine to get merged first.
imagine this pipe dream: less than 10 prs open on bot
Just saying, you can get site to 0 much quicker 👀
I may be saying that because I've got PRs I need morged
links 😋
With the filters PR open? fat chance 
Broooo just hit merge
https://github.com/python-discord/site/pull/596 this one is pretty short, can be merged in the next 5 minutes
Ok I'm sorry I shouldn't be weight shaming the chances
This one is pretty cool https://github.com/python-discord/site/pull/612
I've been looking through the redirects ones for a few mins now :P
heh yeah
I barely understand how it works
on account of me barely understanding how redirects work
i dont understand django so this is fun 
I'm afraid my review will be a "yeah I dont see any glaring errors but like... dont take my word for it" type
The entirety of the redirects app is just throwing the request down an insanely long chain till some function hidden deep within the cursed bowels of django goes oh yeah, I should probably do something with this
Thanks alec :D
This is my favorite explanation of anything today
I've seen some stuff man
xith when he wakes up: holy shit there's another 9 PRs merged to add to the triage section of the meeting
Merggeed thanks Alec
@timid sentinel can you explain your comment here? https://github.com/python-discord/bot/pull/1793#pullrequestreview-781428866
I'm not sure I understand what the linked PR does
At a guess, https://github.com/python-discord/bot/pull/1876/files#diff-5c6a00cef69b61079850c982bba94dbd555b7708e8fccb009e70c8f1c70c7bddR185 will remove the bullets
Hmm why are they removed?
Ok I understand what the regex does now
Now I'm not sure why something needs to be changed in the clean PR though
I'm assuming it's going to split them all into one line
hmmm
The PR merges Hello Worldinto Hello World
yeah I understand, just not sure if it's a good thing
I suppose I can prepend that character
I mean yeah, I think so:```py
Allow overriding this behaviour via putting \u2003 at the start of a line.```
So I guesspy {bullet}...becomespy \u2003{bullet}...
I could be misunderstanding though
@vale ibex is that special character specified anywhere in the codebase?
As a constant or otherwise
Why can't I see the conflicts? https://github.com/python-discord/bot/pull/1793 🤔
Because it is too big LOL
You gotta do it from command line
But what is the conflict? I tried resolving it locally but I don't see anything
Did you
git switch cleanrework
git fetch
git merge origin/main
```?
Aaaaah ok
It's because clean.py was modified but I deleted it
I was looking at the other clean.py
But now I need to figure out what was changed
Yeah it's tough to tell what was modified, because the file itself was merged fine, it's just that it's deleted
Hrrrm but I don't want to force push at this stage
Was it modified in the move to dpy2?
Oh, I know what the changes are
yeah I see it
Some datetime aware stuff
Nope
O really
Hi
I'll just stage the deletion and commit
Hello
What can i do for @dusky shore ?
Check out the list of issues https://github.com/python-discord/sir-lancebot/issues
Ty
@green oriole so what happens if I don't remove the tz info from the message creation time?
You can't compare or do math with unaware date(time)s
You mean aware?
I mean naïve/unaware :D
But you set the tz info to None
When you set it to none it becomes naive
Right. Do you see the contradiction? 😅
You're saying you can't compare unaware times, but setting info to None makes them unaware
Well, if you don't remove the timezone info, it is aware, meaning you can't compare it to naive timestamps
you can also open an issue if you would like to add a feature which is not listed in issues already
You can't compare aware and naive, that's what I meant
Ok, I see now
So what is the meaning of it being aware? that the message holds the timezone of the person who sent it?
It holds the UTC timestamp of the message
Wait, so what was before?
Wdym?
It's timezone aware, but the timezone is only ever UTC?
I believe so, yes
I believe before 2.0 it was still UTC, but the code didn't specify that it was UTC so it was treated as timezone unaware
Hmm.. what is the benefit of it being aware?
And, wouldn't it make more sense to do everything in UTC, than make everything unaware again?
Yeah basically the time was UTC but didn't know it was
It's used it all the places we have times in the docstring
!help mute
!tempmute <user> [duration] [reason]
Can also use: mute
*Temporarily mute a user for the given reason and duration.
A unit of time should be appended to the duration. Units (∗case-sensitive):
y - years
m - months∗
w - weeks
d - days
h - hours
M - minutes∗
s - seconds
Alternatively, an ISO 8601 timestamp can be provided for the duration.
If no duration is given, a one hour duration is used by default.*
Yeah I'm just wondering if it should be specified somewhere that docstrings are now parsed this way
Or have it as a constant somewhere
Yea, IG we could
The advantage is that it means you can compare datetime.datetime() etc. from different timezones and it will automatically convert to same timezone for comparing
how would the constant be used?
Docstrings can't be f strings tho afaik
I think we could have it in contrib guides tho
So instead of datetime.utcnow() and making everything unaware again, we could just use datetime.now(timezone.utc)
Which is recommended in the Python docs
I would like to say "use the name instead of the character" but that would clutter the docstring
Yeah, that's also more in line with Mark's PR
I just think that making everything unaware when the entire library is aware is like fighting the library, which makes using it more difficult
cc @green oriole
That was my comment too
I think using arrow is good for keeping consistency with the lib, but also it's much easier to use, with less pitfalls for new contribs
Since it doesn't have legacy concerns like datetime
Not sure I understand in what scenarios that can be used
We don't have anything that is not UTC as far as I'm aware
Advantage from discord.py's POV
ah
For us, it isn't really useful
@vale ibex I think that if we want that, then we should make that change sooner than later, before we make a bunch of PRs break again
it does some very weird stuff when you try to convert it, but I don't exactly remember. Maybe you remember what the issue was @last patio ?
Convert what?
When being from naive to aware
Why do you need to convert from naive to aware?
I feel like making it aware is more error prone though, since we are working with UTC only
Some of the stuff we get internally is naive
Like?
I do remember what we get from the API is naive
There are probably some other stuff that I don't remember
Converters too?
Converters can be changed to be aware in the first place
I just tried making an unaware datetime aware, and didn't see anything wrong
We can also change it to be aware in the first place
Can you make sure this works if your device isn't in UTC?
My device isn't in UTC
>>> import datetime
>>> b = datetime.datetime.utcnow()
>>> b
datetime.datetime(2021, 10, 17, 18, 18, 56, 69917)
>>> b.replace(tzinfo=datetime.timezone.utc)
datetime.datetime(2021, 10, 17, 18, 18, 56, 69917, tzinfo=datetime.timezone.utc)
It's utcfromtimestamp that caused the issue
It assumes the timestamp given is local time, so shifts the time while converting
Where do we use it?
I refactored it out of the help system last time I was there
Nit sure if we still do
That's in the datetime module, not arrow
Also, datetime.utcnow returns a naive, so when you use other datetime methods on it, it assumes the time is local time
You're talking about dateimte.utcfromtimestamp right? not the arrow one
Yea
So it's used in two places
I think it should be pretty easy to change it to arrow
Also pretty sure Mark's PR does it
Cool
Right, but what I'm saying is we don't ever hold a naive datetime in the first place
The only time I encountered the issue was in the help system, since we store timestamps in redis
So converting those back to datetime, using datetime caused issues due to that behaviour
yeah but if they're aware then it's not an issue right?
Ah ok, now I'm following
Also psql complains about naive times now too
What will take to make everything in psql aware? a migration?
wdym
If you run the site tests, psql will give warnings about naive datetimes
Because you're trying to insert them?
And does it store the TZ info?
So it's already aware in our DB?
And we convert it to unaware when fetching info?
Because if so that's another reason to make everything aware
Usually it is always less pain
Here's your reminder: ^ if not already done
[Jump back to when you created the reminder](#dev-contrib message)
bot/exts/moderation/infraction/_scheduler.py line 506
expiry = dateutil.parser.isoparse(infraction["expires_at"]).replace(tzinfo=None)```
And it's indeed in UTC by default
lmfao @green oriole you mentioned the Python role and not the bot in #dev-announcements
god datetime is such a footgun
Oh yeah just noticed lmfao
hey all, where does python store the blacklisted URLs? im trying to test
python bot*
They're in the site db
ah
pythondiscord.com - A Django and Bulma web application. - site/filter_list.py at main · python-discord/site
Do you have any added?
no
Then that's why 😄
cause i dont know how to add them :P
use !blacklist add domain_name <url>
Did you get an error?
hey what licensing do i need to provide if I use https://raw.githubusercontent.com/python-discord/bot/main/tests/helpers.py in my project's test suite?
never mind i realized i had the owner rank on :P
You need to include the MIT copyright notice , and the permission notice in all copies
I presume just at the top of the file?
"""
Helper methods for testing.
Original Source:
https://github.com/python-discord/bot/blob/06e90af5e19d9dd83ae44ac2ae0eb3eeb43349e2/tests/helpers.py # noqa: E501
MIT License
Copyright (c) 2018 Python Discord
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
Looks good to me
I'm not a lawyer, but I'm pretty sure just having the notice in your source somewhere covers it
but at the top of the file is good
ye
but also I don't think pydis would come after me anyways 😛
its pydis, not pylawyer
joe actually might 😳
also look into the license third party file, I believe something in the test helpers is under a different license, not sure if it's in that file
LICENSE-THIRD-PARTY lines 67 to 72
---------------------------------------------------------------------------------------------------
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
Applies to:
- Copyright © 2001-2020 Python Software Foundation. All rights reserved.
- tests/_autospec.py: _decoration_helper
---------------------------------------------------------------------------------------------------```
which I'm not using, whew
lol i almost used the wrong commit hash
what does this method do?
tests/test_helpers.py lines 222 to 227
class MockObjectTests(unittest.TestCase):
"""Tests the mock objects and mixins we've defined."""
@classmethod
def setUpClass(cls):
cls.hashable_mocks = (helpers.MockRole, helpers.MockMember, helpers.MockGuild)```
it's a method we override from unittest.TestCase
It's called before tests are ran
You have three t in unittest
!d unittest.TestCase.setUpClass
setUpClass()```
A class method called before tests in an individual class are run. `setUpClass` is called with the class as the only argument and must be decorated as a [`classmethod()`](https://docs.python.org/3/library/functions.html#classmethod "classmethod"):
```py
@classmethod
def setUpClass(cls):
...
``` See [Class and Module Fixtures](https://docs.python.org/3/library/unittest.html#class-and-module-fixtures) for more details.
New in version 3.2.
;-; thanks
...and my tests are failing but I don't even use the mock file anywhere lol
In theory I just need to parse both URLs and check for a different netloc
not too difficult
ohh that's why I'm so confused
a bunch of the docstrings on the test/helpers.py file and test_helpers.py are copied and pasted somewhat carelessly from the last method
Usually yeah. The license needs to be present, either like in the file or in its own folder together with that code. Though me and Chris share the "not a lawyer" profession and this isn't legal-advice. pwease don't sue me
hmmmm how can i check a method on a unittest mocked object was called?
and to get the called with attributes
It’s defined as self.blank_number but it is referenced as blank_number
Ah, right. Don't know what I was thinking. Thanks.
that's exactly what I meant. I can send you a patch so you can have hackstats working during testing (or another one to unapply) if you want, and when you submit the PR you could actually include that fix if I don't find a better one before then.
I just thought that 1) the restructuring should just copy the logic over, not too much of modifying existing logic imo and 2) didn't you say a day or two back that you could just import functions from the hackstats file? Did it work? If that method works it'd be a lot easier since I can modify that file simultaneously with the changes you have :)
@thorny obsidian so I have a question regarding the question JSON format for the trivia night, can the question information be formatted like this:
{
"number": 1,
"explanation": "hsidisojedbf",
"answers": ["ahi", "irojfe", "iidif", "oofoff"],
"correct": "iidif"
}
sure!
also will it be certain that there’s only 4 options per question?
I can enforce it, yeah
Awesome
@vale ibex Also, I remember you said something about this — would we want to have a subclassed button instead of using the button decorator
By the way, just curious, are the suggestions read for the “suggest more topics here” and “suggest more facts here”?
https://github.com/python-discord/bot/pull/1888 Please reviews. It is pretty high priority, !server command is not working.
done
So my PR is ready to be pushed now. It would just need the reviews.
In regards to doing the importing, my planned way didn't work so had to change things up a bit. I essentially have _cog.py, containing the commands themselves, and then _utils.py which contains all of the helper functions (such as get_october_prs etc.) and get imported to _cog.py.
We've got two options now:
- I wait until we can find a better fix for hackstats and then I commit with you as a co-author
- I push with the temp-fix, get the reviews, and then once it has been merged you can do a separate PR with any "better" fix you find.
well I've just found the problem by letting aiohttp send to my own CGI script. like I half-suspected yesterday, aiohttp.ClientSession.get is actually query-encoding the params, so when it's supposed to be github.com/api/blah/issues?q=+type:pr+is:public it becomes github.com/api/blah/issues?q=%2Btype:pr%2Bis:public.
A possible solution for this (not that much better than the one I had before imo) is to provide param as a string. Because according to their docs if param is a string aiohttp won't encode it. The line would look like this:
jsonresp = await self._fetch_url(base_url, REQUEST_HEADERS, params=f"q={query_params}")
And of course self._fetch_url's param argument's type hint has to be changed to Union[str, dict]
tell me what to do if you'd like that change committed with me co-authoring. I guess that's the best fix I can find for now (at least I've found the real problem), I don't think they have an option to disable the encoding. After your PR is merged I can submit a separate PR for my other fixes (and a (even) neater fix if I find any). Is that ok for you?
Right, I'll commit this with you as a co-author (I just need to mention you in the commit description for that) and then if you find something better at a latter date you can do a separate PR.
I'll need your GitHub username so I can co-author you
@rapid igloo
hedyhli
@static canyon this is the full patch actually, if you want it http://ttm.sh/eSU.patch
tested with lint task
@static canyon would your PR touch the hacktoberissues file? If it does I'll do sir-lancebot#489 after yours is merged
My PR deletes all three files and merges into _cog.py and _utils.py so you'll have to wait
ok! thanks for clarifying
@patent pivot Dunno who else to ping but could you add pydis/api to #dev-log
it doens't get comments
No perm sadge
bot#1889 is ready for review! Ignore the patch of docker-compose.yml
did not having that patch cause errors?
If so, I'd be interested in knowing what that error was.
It didn't load the .env
Did it show an error saying could not find env file?
It never happened for me. Are you sure that's the problem?
would it be possible if !user command had trashcan?
If that's indeed an error, I'd rather keep the change you made @clever wraith
Should be, now with bot running discordpy2.0 could probably have a button of some sort
It gave an error not loading my token so idk
i had like a reaction for that but its totally personal prefernce
So it seems docker-compose found the env file, otherwise it would error at that point
since it got to the point of running the container
Huh
Can you revert the change and paste the exact error here
!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.pythondiscord.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.
Sure, after class
bot/exts/moderation/modpings.py lines 230 to 233
await ctx.send(
f"{Emojis.ok_hand} {ctx.author.mention} Scheduled mod pings from "
f"{start: %H:%M} to {end: %H:%M} UTC Timing!"
)```
whoever did that, thankyou :D
yea, bot.utils.time
umm how would i do that if i only want to show the hours?
bot/utils/time.py lines 26 to 39
class TimestampFormats(Enum):
"""
Represents the different formats possible for Discord timestamps.
Examples are given in epoch time.
"""
DATE_TIME = "f" # January 1, 1970 1:00 AM
DAY_TIME = "F" # Thursday, January 1, 1970 1:00 AM
DATE_SHORT = "d" # 01/01/1970
DATE = "D" # January 1, 1970
TIME = "t" # 1:00 AM
TIME_SECONDS = "T" # 1:00:00 AM
RELATIVE = "R" # 52 years ago```
These are the formats available
Oh okay thanks
@vale ibex seems to be fine without it
👍
First big PR to bot for me
🎉
@brisk brook we can use the get fetch utility function for getting the helpers role
Also rather than adding is None or try..except can we add a validation functionality which will log all the "invalid" IDs present in the bot
with exception level
basically
just add roles and emojis here
#dev-log message so should i remove them from the modpings PR also?
(i am away from laptop so not logged onto github)
@vale ibex regarding your comment, which blacklisted URLs have a scheme explicitly listed? I don't see any on the test bot
That's because all the domain filters are in teh db
you will only see domains you have added
iirc some filters are there by default
We have 31 domains that start with http
Ah, cool
Where are the docs for dpy 2?
hmm how do I spawn a poetry shell? it says it's spawning it and then does nothing
poetry shell
if poetry shell isn't doing it for you, you can run the active script at /path/to/venv/Scripts/Activate.ps1
changing the ext to whatever os you're on
It should usually spawn a new shell
it didn't
What OS?
This is what I do on windows in pwsh 7 ```powershell
PS C:\Users\Chris\src\bot> & c:/Users/Chris/AppData/Local/pypoetry/Cache/virtualenvs/bot-xr7Q380s-py3.9/Scripts/Activate.ps1
(bot-xr7Q380s-py3.9) PS C:\Users\Chris\src\bot>
Yeah it's weird.. it didn't spawn a new shell but it's now using the right env
Yea, mine stays in the same shell, just with the prefix
Interesting, on fish it does spawn a new shell
This is what I get with just poetry shell ```
PS C:\Users\Chris\src\bot> poetry shell
Spawning shell within C:\Users\Chris\AppData\Local\pypoetry\Cache\virtualenvs\bot-xr7Q380s-py3.9
PowerShell 7.1.5
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS C:\Users\Chris\src\bot>
So yea, no prefix
yeah powershell never gave me prefixes
but I did get a prefix with the pipenv envs on cmd
Doesn't powershell respect PS1 lmao
class discord.Thread```
Represents a Discord thread.
x == y Checks if two threads are equal.
x != y Checks if two threads are not equal.
hash(x) Returns the thread’s hash.
str(x) Returns the thread’s name.
New in version 2.0.
yeah I know
ah okay
still mad about, a true in-character clown moment for d.py
Haha, it took me like 10 minutes to figure it out last time 🤡
So is there a specific reason why in https://github.com/python-discord/bot/blob/main/bot/converters.py#L472 we use dateutil.tz.UTC rather than datetime.timezone.utc?
bot/converters.py line 472
dt = dt.astimezone(dateutil.tz.UTC)```

I guess it didn't matter because the TZ was removed a line later
lol
For a brief moment I was thinking: "oh, it's not that difficult to convert everything to UTC"
And then.. came this.... https://github.com/python-discord/bot/blob/main/tests/bot/test_converters.py#L171-L205
lol
Why are some features already using timezone aware datetimes lol
I thought we didn't want to mix the two
How does that affect us? None of the bots in this server are in over 100.
none at all, just to answer the previous discussion
the gist is yes, this is a new intent and will have to be patched in at that point
Ah, I only saw the utc discussion, mb
He's referring to a discussion here from some time ago when Danny quit
not something recent
Hi, I have a question.
Suppose we want to use face recognition in a mobile application using Python language, what library do we use or how do we link these both together?
Hey, this channel is for contributing to this server's project's specifically
For help in general, check out #❓|how-to-get-help or #data-science-and-ml
In the places where we display a datetime, do we want to include TZ info now?
Why are you doing this to me
What places are you talking in particular? Because if it is always +0000 I don't think it is any useful
bot/exts/moderation/incidents.py line 94
timestamp=datetime.utcnow(),```
Although I suppose that can use a proper Discord timestamp
isn't that one going in a footer
oh
because in their eternal wisdom discord decided to not support links or timestamps in footers
wait
is the time in #incidents-archive local?
even though it's tz naive?
Or maybe because of it
Easiest to just say any markdown
bot/utils/time.py lines 69 to 70
if isinstance(timestamp, datetime.datetime):
timestamp = (timestamp.replace(tzinfo=None) - datetime.datetime.utcfromtimestamp(0)).total_seconds()```
correct me if I'm wrong, but it seems like int(timestamp.timestamp()) gets the same result
2021-10-19 05:44:49 | bot | CRITICAL |
Traceback (most recent call last):
File "/home/shivansh/Programming/pydis_projects/bot/bot/api.py", line 67, in maybe_raise_for_status
response_json = await response.json()
File "/home/shivansh/.cache/pypoetry/virtualenvs/bot-5X3Lakqr-py3.9/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1097, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://api.pythondiscord.local:8000/healthcheck')
while running the bot
uh subdomain migrations happened
yeah works
Can anyone share there view about
https://github.com/python-discord/sir-lancebot/issues/917
This feature, will it usefull
@vale ibex the border for the bat is not perfect, I am not sure if that's okay (since they won't be visible as they are small on the profile pic)
Just left a comment. In the future, in case you didn't know, you can type reponame#issue-or-pr-# here so that Lance can send a link to it right in this channel instead of having to copy and paste the link to the issue/PR yourself. So in this case, you would write sir-lancebot#917
Look how cool that is, huh?
Yo @fervent sage! Do you have any suggestion for a d.py extension to support slash commands and/or context menus?
the bot does not have a un bookmark. Right?
not yet, yes
feel free to open an issue if that's something you want, it sounds quite useful
I'm still bad at detailing
would this be good enough?
(I fixed the last line of it)
Are bookmarks currently stored in a database?
I don't know, I have not read the source
Also keep in mind the bot won't be able to do anything with reminders > 14days old because of API limitations
Which imo makes the feature much less useful
bot won't be able to do anything with reminders? What does that mean
It won't be able to delete the discord message
Bots are limited to deleting messages <= 14days old
I'm not convinced it's worth the hassle of setting up a new database though
why wouldn't it?
@green oriole
but it is detailed enough, right?
I'm 99% sure they aren't?
Well they were at some point 🤷
That's for bulk deletion I am pretty sure
Bots can delete messages older than 2 weeks just fine, they just can't use the bulk delete API to do it. They need to delete them all one by one.
So it is lol
Well then ignore me @cursive relic lol
That issue looks good too btw
posted it 😄
i had a suggestion- instead of giving the people help-cooldown role
the bot can give the user their respective channel name role
for eg.-- the role can be #help-banana, for a person who has their help channel named as help-banana
That would be a lot of roles, we are already making the role modal lag quite a bit
there is a similar issue i think, me and xith discussed possible implementations of it
lemme have a look
I alrd opened it ¯_(ツ)_/¯
You could just provide it message IDs from the DM channel
In which issue?
for unbookmark ^
Ye, Akarys mentioned it 😅. I completely forgot that way
@austere hornet how are you developing sir-lancebot#901? What IDE & how are you committing (via command line or some other tool)?
@brisk brook what exactly are you wanting https://github.com/python-discord/bot/blob/e082596ff49b22dbb47d3bf8aa75ae98e2264620/bot/exts/help_channels/_cog.py#L130-L138 to be changed to for bot#1845? I don't quite underestand.
bot/exts/help_channels/_cog.py lines 130 to 138
if isinstance(message.author, discord.User):
log.warning("`message.author` is a `discord.User` so not handling role change or sending DM.")
else:
await self._handle_role_change(message.author, message.author.add_roles)
try:
await _message.dm_on_open(message)
except Exception as e:
log.warning("Error occurred while sending DM:", exc_info=e)```
Change it to if not isinstance(message.author, discord.Member): and reword it to say "message.author isn't a discord.Member"
Also you probably want to make that an f-string so that when you look at the logs you can make out who it is
if not isinstance(message.author, discord.Member):
log.warning(f"`message.author` ({message.author} / {message.author.id}) isn't a `discord.Member` so not handling role change or sending DM.")
...```?
@brisk brook ^
👍
Will push in a sec 👍
Pushed @brisk brook 👍
@green oriole before you merge I'd like to change log message as @vale ibex suggested
Yup, wasn't going to merge
Excellent
sir-lancebot#909 is a pretty easy review if anyone has time by the way
Just needs a core-dev approval
So to code I use Sublime Text and commit using Github Desktop
@brisk brook since you seemed curious :P https://github.com/python-discord/bot/pull/1893
Huh 🤔
@green oriole how can ban fail with a user if we can ban people outside the server?
lol
Nice, getting 6 emails about cancelled workflows because I pushed too quick
That happens to me all the time whenever I committed suggestions too fast lmao
lol
I'd strongly recommend using PyCharm instead if you're even vaguely familiar with it. It has so many git tools, including access to pre-commit stuff from command line so you don't have to loads of commits fixing linting
👀 just enable pre-commit
That's what I'm talking about
including access to pre-commit stuff from command prompt so you don't have to loads of commits fixing linting
edited or it loaded slowly for me but okay
Access to pre-commit stuff from the command prompt isn't that obvious from all command prompts
what is the link to the inventory of arcade for documentation in python bot?
Like, for python it is https://docs.python.org/3/objects.inv
in almost all cases you can just append objects.inv to the base url
I see
let me try
oh yeah it works, thanks!
so the problem with commands like !d list.append is that these methods are not included in the python inventory?
yes
and then I thought of adding these methods exclusively in the source code, with base url as https://docs.python.org/3/tutorial/ but I realized that these pages donot follow the parsing pattern of the documentation page. So if I want to add these I will have to create a different way of parsing these pages
I certainly know what PyCharm is, but I tried using it one time and something wasn't working, I can't remember what. However, I am willing to try again, so will try in a few hours.
!remind 6H download PyCharm
Your reminder will arrive on <t:1634671498:F>!
Hi I am a psychopath thank you https://github.com/python-discord/bot/pull/1894
I think we need a new priority tag
"pAkarys is being obnoxious"
Could some1 triage this issue https://github.com/python-discord/sir-lancebot/issues/913
@brisk brook I have left a few comments on all your 3 reviews.
Just saw your comment on bot#1892 @timid sentinel, I've made it so that we run the filters against the original, the normalised and the cleaned normalised name
To further explain this, this is only a thing with sphinx built documentation. If a site isn't built with sphinx, this won't work.
MKDocs has an extension to support this
It has become a standard that other tools use as well
@molten perch do you have a screenshot of the last iteration of the .aoc per-day stats output?
Last iteration as in the last day and last star?
as in what it looks like when you PRd it~
Oh, sure.
I'm writing up a changelog for it now
Actually, just partially. After the view reaches a timeout it deletes every button. I'll take a new screenshot.
@thorny obsidian That's it.
is that something we can utilize? Last time I looked at some docs generated with it they all had a tutorial-y look and didn't have ids for anything in the html
Mkdocstrings should have it granted you enable it
may be worth opening an issue for it then if it's something that's feasible to parse programmatically, I think that's the only other major documentation generator
docs/mkdocs.yml line 63
enable_inventory: true```
I haven't tested it but it should be enabled I hope lol
that theme....
Yes I don't think you realize how much I've hacked it together to make it have those colors
btw that thanks for that, adding it for my package to get docs in my terminal 😄
It looks correct on desktop though
I am gonna take another pass over the docs for mobile when I get the time to
I've spiraled (procrastinated) into making a sans-IO implementation of the Discord gateway
Oh? Small screen?
ok yeah, its white on small screens
big screens its ok
i just had the window size on edge
Feel free to DM me like a complete screenshot. I'm going eating I'll be back
Ahh, yeah makes sense
unittests are the bane of my existence
Does @dusky shore support buttons?
yup!
!remind delete 3305
That reminder has been deleted successfully!
Is this ironical lol
No, it fixed my imports without bothering me about it
We take those
@green oriole @vale ibex I think despite its size it's a relatively simple PR, so would appreciate if you could take a look in the next few days, would like to get it out of the way as soon as possible
Happy destruction
Thank you
Just download PyCharm, will start using it from now on. Is there a link maybe that has like a tutorial on how to use pre-commit and the "many git tools" that you mentioned in PyCharm?
And thanks for the suggestion 🙂
If you open the project in PyCharm, does it install everything?
How would I know? Does it say it installed somewhere on the PyCharm screen?
I did open the project but I don't see anything like what you asked
Also idk what you mean by "everything"?
All the dependencies
If it didn't then you need to set up the poetry env
Oh ok got it, let me check
It would be really obvious if it had because there's multiple popups for it
No, there wasn't a lot of popups iirc
I can't really walk you through it because I can't remember how to do it all myself to be honest
Ah ok, no worries
There is Google for that lol
poetry install then poetry run task precommit is how you install the pre-commit hooks
But you'll need to configure poetry first
And then there's this menu for git stuff as well as the three icons in top right
Oh, I think Akarys had asked me to do that a few days ago cuz when I just created the PR, I had a bunch of failed lints so he asked me to do it
Ok, thanks
Yeah; you should really have it installed before committing code
True
Maybe an uncommon opinion, but I think the git commandline works pretty well with the poetry set up and pre-commit hooks installed
I personally prefer using PyCharm for git stuff other than rebasing (git rebase -i {commit_hash}) and git log --oneline
Example of pre-commit saving having to do a separate fix-linting commit
Ok, I see, thanks
Will keep that in mind in the future
I use my terminal for everything
^
Ah shoot sorry for ping
same I only use neovim for editting and the shell for everything else
Does anyone know why discord.py is trying to load a file within a package as a cog?
discord.ext.commands.errors.NoEntryPointError: Extension 'bot.exts.events.trivianight.questions' has no 'setup' function.
I'm not trying to load the questions file as a cog though, just a helper file
Nevermind, turns out you need to prefix _ before the filename to avoid loading as a cog
@brisk brook what is the website you used to deeply search the repos previously?
#dev-log message whats the temp fix for?
it works perfectly fine on my end
the hacktober issues command
it's for our current .hackstats
with the PR yes but currently no #sir-lancebot-playground message
it works for you because tizzy has the temp fix in the PR
but he applied it on hacktober issues not hacktober stats
You mean this?
Added a temp-fix to the already broken
.hacktoberissuescourtesy of hedyhli. I believe they're planning to write a more permanent fix soon™️.
I believe it was a typo
this commit message is right https://github.com/python-discord/sir-lancebot/pull/919/commits/43d51b39614e81f4d9a7b4c1840b54cb782dcb8f
though
Ah okay I mis-undestood your comment
its fine, i thought that the comment was for the commit like the code, but you meant the pr description
oh right got it
@tawdry vapor fwiw..... arrow is not a drop-in replacement for datetime
and I have now learned this in all of the wrong ways
even if it passed the isinstance check, which it doesn't
!e
import arrow
time = arrow.utcnow()
print(time.timestamp)
print(time.datetime.timestamp()) # arrow.Arrow.datetime is the underlying datetime.datetime object of any arrow.Arrow object
@fallen patrol :white_check_mark: Your eval job has completed with return code 0.
001 | 1634702385
002 | 1634702385.805727
I know
ah okay
any other differences that I could possibly be alerted of 😛
Some stuff with classmethods which I vaguely note in that discussion
!e import arrow ; arrow.utcnow().timestamp()
@fallen patrol :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: 'int' object is not callable
commented the above
thanks
@fallen patrol :white_check_mark: Your eval job has completed with return code 0.
0.17.0
corrected the above.
You mean Sourcegraph?
Can I get a super quick review on https://github.com/python-discord/bot/pull/1897 pls? 
I know about #changelog but I see many people reviewing the change, How can I also rewiew
@steady junco You might want to start with making your own contributions first. Once you have some experience with our projects, you can help out with reviewing other people's contributions. See here: https://github.com/python-discord/sir-lancebot#getting-started
Oh great, Thanks
Yeah mb, will fix that when I get to school 👍
!remind 1h10M ^
Your reminder will arrive on <t:1634716652:F>!
Oh, nice.
I feel like we should link a contribution starter guide in this channel's description.
And it should reference that review guide.
Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!
Projects to Contribute to
• Sir Lancebot - our fun, beginner-friendly bot
• Python - our utility & moderation bot
• Site - resources, guides, and more
Where to start
- Read our contributing guidelines
- Chat with us in #dev-contrib if you're ready to jump in or have any questions
- Open an issue or ask to be assigned to an issue to work on
Oh, cool, didn't know about that either.
We decided against mentioning reviews in the tag since it's usually not a good first contribution (it's better to get familiar with the codebase & our styling etc. first)
It was only added a few days ago (like 3 I think)
Can't we link to the review guide in the contribution guidelines somewhere, though?
I mean, even if you're not gonna do a review, you're gonna receive one, so it might be good to know what it's about.
We already do
A guide to contributing to our open source projects.
ok that makes sense
That was a different contribution guide to the one I saw before
maybe !contributing could be an alias?
Actually, the tag link says "contribution guidelines", but links to the contribution guide, and we have a separate document titled "Contribution guidelines", which is why I mixed them up
Tags can't have aliases currently
So maybe the link in the tag should say "contribution guide" instead
There's a PR for adding that ability though
oh I thought I saw them before
ah ok
There's fuzzy matching but not actual aliases
I think it's more like contributing index/homepage
I guess, but it's under https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/
A guide to contributing to our open source projects.
Anyway, "contributing guidelines" is still the name of an entirely different document.
This one: https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/contributing-guidelines/
Guidelines to adhere to when contributing to our projects.
And, again, I think we should link to the guide in the channel description.
For the tag maybe "Contributing guides" is better (like you said but plural). As I understand it "guides" is like tutorials and "guidelines" is closer to rules/conventions, since it links to /contributing/ not /contributing/contributing-guidelines/
Yeah, exactly.
That's good and all, but a reminder that without an issue/PR nothing will change 😛
Yeah Zig did a big refactor to it a while ago
What repo would be appropriate for this kind of issue?
Probably site?
Site to change a tag's content and a channel description?
Oh I thought you meant the guide thing
What's the "guide thing"?
Channel description would be #community-meta / meta repo & tag would be bot repo
Maybe I can just add both suggestions in a single meta issue? They're kind of related anyway.
would it be possible to add a button or reaction (if it makes sense) as some sort of check, to be sure you actually want to remove the bm?
at the sir-lancebot#918
I can add the link to the channel description a bit later, correcting a tag is probably bot
Alright
Here's your reminder: ^
[Jump back to when you created the reminder](#dev-contrib message)
The contents of the !contribute tag as of the time of writing reads: The link that reads "contributing guidelines" leads to the contribution guide at https://www.pythondiscord.com...
Should these comments be created to the issue itself?
Can I work on a Funny gif like a command .funny and it will show a funny gif for @dusky shore
we could go with that, it would require that we store the message ids in redis though
That was a joke command that was added at runtime, rather than being in the bot properly
it's been removed now
cool
Can you answer me @vale ibex
Depends on exactly what you are planning to implement. I'd suggest raising an issue on sir-lancebot with exactly what you intend to do
The things you should cover in the issue is where you intend to source the gifs from, and how you intend to make it less spammy
.src
I can add a slowmode of about 5 sec for the command
I can take the gifs from tenor
Sure, feel free to include all the details in the issue
then everyone can give feedback in their own time
Yes, that's the process to get permission
create an issue, people discuss implementation, then you get permission or it gets closed
I can create the issue from here ?
Yes
Alright Can I also get help from other people here for adding some features like cooldown
Like a team
yup, if it gets approved you can ask questions here, or you can ask people if they want to work on it with you
😁 alright
Should I add that comment to issue itself?
So more people can discuss it if needed.
I've added it in there 🙂
Thx 😄
When they see the issue they will reply in their own time.
Be patient, everyone here is a volunteer.
Oh ok I was patient but actually I didn't how would they know that I created a issue
When a new issue is added, it gets the planning label
we often look over those issue to add thoughts onto them
Hey, just wondering, how long does it take for a resource to be added to the resources page?
Because it's nearly been a month since I submitted my issue on GitHub (yes, I understand a month in the grand scheme of things is nothing)
Just, any specific time range?
which issue are you referencing? I can see if I can find what the status is - we could try table it for discussion in our staff meeting
Resource type Book Where can the resource be found? https://www.goalkicker.com/ What sort of content is in the resource? What areas of Python does it cover? GoalKicker's tagline is &quo...
(Also, cool mask)
haha, thank you
I'll add it to the agenda for this week, if we get a chance we'll talk about it, thanks for the poke
no worries :D
isn't @dusky shore running on dpy 2.0?
yep
does @dusky shore have any access to stats related services?
What are you trying to do?
i want to try and compute a breakdown of where my messages are, total messages, % of messages in offtopic vs on topic channels, % of messages in the three ot channels, my most active channel etc
No, lancebot can't do that. Python has access to the metricity database, but it's mostly admin restricted
sad, so do i just gotta bother admins everytime?
At the moment yes
@trail pilot so, here's a fun concept, unsure how you feel about it
(also cc: @vale ibex for core dev insight)
I want to prevent people from copy+pasting+evaling code question snippets for the trivia night. What if we turn the question itself into an image?
I was semi-serious about using unicode chars for code
dropping a character here and there in keywords would solve that
okay, could i suggest something like https://ddd.raylu.net/guild/181866934353133570/? maybe a github backlog issue?
unicode how? example?
IE if there's a for loop, use some esoteric o symbol that looks similar
scatter those around the place and it means that the time it would take to fix the code, the question would be over
I know @patent pivot maybe had some concerns with stats-on-demand but maybe there's a smart way to do a limited subset of stats available for a user?
how do we do this for shorter questions that don't have as many opportunities?
we had some idea a while ago to do per user stats with commands on metricity
I mean at that point if they're short it wouldn't be much effort to type into a repl
even from an image
true
i think it was messages by hour of day, messages by day and messages by category or something, just needs someone to implement it
we also need to add thread support to metricity
still not fully decided on my implementation there
Is there an issue on metricity for it?
I'd suggest putting it behind discord oauth, so you can only get your own stats
and heavily caching
it shouldn't be too bad, not sure what the indexes are like on messages
not yet
we'll throttle the cpu
idea was in discord
Ah cool
Yeah turning the question into an image be done, and also we can add a secondary check on the eval requests being sent to python? they can run locally also so no point
One simple quick fix: https://github.com/python-discord/sir-lancebot/pull/922
Relevant Issues
Fixes SIR-LANCEBOT-6V
Description
Discord.py 2.0 returns None for avatar if a user has default avatar. display_avatar returns always Asset.
Did you:
Join the Python Discord C...
Ooh, that sounds like an interesting idea. It would probably use PIL I’m guessing
Could I add this in the second iteration?
(see Chris's subsequent comment of using wacky unicode, also a possibility that has an easier implementation)
Hm
But yeah, not a thing that's necessary for MVP
Cyrillic E could work for e
I’m at school rn but when I get home I’ll look into some weird Unicode
insert zero width spaces everywhere?
What’s the copy and paste for zero width spaces?
Or rather the Unicode escape char for python
codepoint 200b, or zero width space for the named escape
ah
On a good note - I finished the basic structure (MVP) for the question and scoreboard and now it’s just adding functionality for the trivia night cog
Also - would anyone want to review sir-lancebot#909
It’s a pretty quick review and just needs a core dev approval; just a few lines of code changed to prevent an error with .challenges
Best free OCR API, Online OCR and Searchable PDF (Sandwich PDF) Service. Try instantly, no registration required. Available as On-Premise OCR Software, too. The Cloud OCR API is a REST-based Web API to extract text from images and convert scans to searchable PDF. Free OCR software as a hosted service and as download.
any other ideas, since an image can be easily put through ocr?
per user?
yep
so that means you'd be able to see when I send messages?
or anyone
@patent pivot ?
i mean
i can alreayd see that
lol
this is a command that allows a user to fetch their own stats
not anyone
just you
And you wouldn't look at it either?
& it would not factor in deleted messages, only internal stats show those
i mean it is inside discord
you run a command in discord and it shows
Fwiw, collecting that data without an explicit user consent is against the developer terms of service iirc
uhhhhh




what did you think it meant?