#dev-contrib
1 messages · Page 21 of 1
now coming to think of it, there might've been a few places where I had to manually adjust some color variables to be dimmer/brighter, then set in the css (due to limitations of css as compared to scss), though I tried to keep that a minimum.
I could go and look through them when I get the time, but I'm not sure if it'll be too helpful to note these down, because if someone is working on that area specifically they will see it in the css file (where I have added comments)
I just figure, if they're changing stuff inside that dictionary, they might think the change will affect everything on the site, and it won't. But the tip you gave about search and replacing the hex is pretty good, I think.
just having that bit of information in a nearby docstring may save some frustration for someone in the future
I wouldn't start listing every single place you needed to make changes
just more of a general heads up
I think the comments in the css is enough
as far as I know in terms of color variables there, it does change everything -- where we've used those classes
mm, alright, fair
I could PR something like this soon 👍
sir-robin#112 wil make it easier to stop issueing the completionist role this year, and future years, ratehr than having to comment out the line each time
There's also a bunch of general improvements in the PR that I did while writing & testing this feature
I'll review later today
Nice, ty
@crude gyro where are youlooking for the test output in CI?
I don't think we output a list of tests that ran in the CI anywhere
https://github.com/python-discord/bot/actions/runs/7371282307/job/20058499764?pr=2871#step:7:198 for the test file too
we have test coverage on the tests 💪
Did you try to find it by ctrl f before by any chance?
I did that first, but that didn't work, so I skimmed the list and I probably just missed it
I'm very old, you see
because that's something I hate about github. It lazily loads stuff so you can't just ctrl-f
stupid
mfw looking for a test
Ah yes
hahaha
found it!
pytest should encode the test number in the rgb values of the dot
to make a beautiful rainbow
Yup, and since we use pytest-xdist for multiprocessing, they'll all be in a random order too
i know you shouldn't, but what if you have 17 million tests? also, should there be buffer zones for easier identification? less totals if so
16-bit colour it is then
aren't the monitors that can even display 10-bit colors high-end now?
oh, that's 10 bits per channel, 16 is 5+5+6. nevermind
yea, and greenshould get the extra bit, for obvious reasons
just use ROYGBIV and then rotate back to R
raaainbooow
can we please make the tests a little gayer
I vote we run the whole output through lolcat
it might be neat, and possibly convincable, to get different test functions/classes/files/etc as different colors
bot#2580 is in need of reviews. be there or be less there.
@timid sentinel henlo give review thanks
i take that discord.py doesn't have a feature to detect that in advance?
if it does exist, I haven't found it
- that is not on topic for this channel
- see #voice-verification
.bm
@outer oasis Fix. thanks. sir-lancebot#1404
@tame pebble Yo what's good gamer, can I get uhhhhhhhhhhh sir-lancebot#1197
i feel like there might be some flaws here
oh
there were but in my testing
hey, i want to contribute, how does the process go?
!contribute
We have a bunch of open source projects mostly written in python. There are detailed guides on how to set up the development environment on our website linked below.
Sir-lancebot is a good place to start, it's a discord.py project with fun commands and events/info related commands.
Contributions happen through opening issues and PRs on the GitHub repos. Feel free to discuss in this channel too.
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 contribution guide
- 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

I uh...
I actually need help with regex
I'll go poke pygen in a minute
im tryna figure out gitpod but its really confusing, it says i need to have cloned the repo but then gitpod opens a ssh connection
i dont want to use ssh and instead want to do it locally
do i have to use gitpod then?
No, you can use Docker instead
No, it's just an alternate option
You can setup your enviornment however you want
ah, so a normal venv should be fine?
Yeah, with Docker for any supporting services
For lancebot you don't even really need docker.
ah, thats easier, my docker installation isnt working, it crashes for some reason nvm fixed it by running it in administrator
You just need to remember add REDIS_USE_FAKEREDIS=true to your .env for it to work
You can, but there's duplicated error handling happening and I want to avoid that, which is why I opened bot-core#198, but unfortunately I didn't get any feedback yet.
why am i getting this?
Installing the current project: sir-lancebot (0.1.0)
The current project could not be installed: No file/folder found for package sir-lancebot
If you do not want to install the current project use --no-root```
poetry install this is the command btw
that's fine to ignore
aight!
FWIW it's a fairly new thing in poetry, geared towards library maintainers
for projects like our's it doesn't make sense. https://github.com/python-poetry/poetry/issues/1132 and https://github.com/python-poetry/poetry/pull/8650 look to make this better
I see. Thank you for update, I will poke at people to get feedback, and take a stare myself.
I have pinged the almighty chris in the issue, as well
Thanks, I'll take care of the rest
Does anyone have any idea why on https://www.pythondiscord.com/resources/ in production the titles are in bold
but locally they aren't
I'm pretty sure I'm running on main locally
it seems that the css from bulma.css is being applied in a different order in prod, is cloudflare messing up the css when minifying it??
I've enbaled CF cache dev mode so it temporarily doesn't use the cache
and it still seems bold
Want me to leave it on for a bit?
ah, I've also just disabled CSS minification
which is separate from the cache
The HTML element controlling the text has the card-header-title and subtitle classes, both of which are defined in bulma.css. I tried prettifying the minified version from prod and comparing it to the version served when I run locally, and it seems the relevant definitions affecting the font weight are in a different order on each:
prod:
line 4822: .subtitle font-weight: 400
line 10492 .card-header-title font-weight: 700
dev:
line 675 .card-header-title font-weight: 700
line 6218 .subtitle font-weight: 400
suggesting it could be the minification, but that seems like such an obviously breaking transformation...
how weird
ntos ure where it's getting minfied either
I've disabled everything in cf
do we have something in site itself that's minifying statically served files?
headers suggest it's still being cached+minified for me
ok now it's not minified, but it's still different, so it seems the css is different before minification/cloudflare
I'm not using docker, i'll try just remaking my env
aaaaaah
got it
lol
that was painful
I think it's because django simple bulma uses iterdir here, which affects the order the order of the imports in the scss, which affects the order of the compiled css https://github.com/lemonsaurus/django-simple-bulma/blob/f26264f2155bc30f8afc5153e9245937193c33da/django_simple_bulma/finders.py#L116
django_simple_bulma/finders.py line 116
for dirname in self.bulma_submodule_path.iterdir():```
And iterdir returns the contents of a directory in an arbitrary order
ah lol
Is there a method that garunteees order?
I don't think so, you can sort the result fairly easily though
what i'm not sure about is if there's a "correct" order
other than just being consistent with e.g. alphabetical order
Can anyone tell me what I'm doing wrong? I'm trying to install a simple program with pthon
yea..
I opened an issue here https://github.com/lemonsaurus/django-simple-bulma/issues/98 CC @crude gyro
@vale ibex how did you test the scheduler changes for AoC?
I've also been noticing this issue on resources page, where some icon images (particularly svg, I think) that fails to get styled to the correct width on production site
but they're fine on the netlify preview (and probably local)
I've only observed this to happen on mobile, chrome-based browsers
it may, or may not, have been introduced after dark mode, but I've double-checked that the commit which may affect this does the image styling correctly
I used one of the leaderboards I'm in
ah I saw your comment now, IU thought the question was about the task changes
I tested the other scheduler stuff by changing the arrow.now(EST) call at the start of the while loop within the tasks to different times last year
Also, I lied in github, for some reason sir-robin doesn't hook up to sentry
I'll fix that later
hi @timid sentinel, i noticed u added this comment, i didnt quite understand what u meant by it
pertaining to PR #1440
which repo?
sir lance bot
oh thats cause of #black-formatter
since we use ruff, we have ruff line length configured, but not black
sure
so for the same command
there are a few class variables
but they are all used in one and only one command
should i convert them to normal variables?
do they need to persist across command invocations?
i think the current channel needs to
since it redirects u to the channel
but i dont think self.correct needs to stay
alright, if it doesn't need to persist accross different inocations, then yea we can make them normal variables
aight!
Does the sentry alert propagate anywhere in server? Or would I have to check sentry for it?
Speaking of, @vale ibex I've been meaning to talk to you about Sentry
It marks my commits as being included in several releases, even though we release on every merge
It always says "20 commits [in this release]" -- is it always just taking the last 20 commits?
I don't really know where to start looking with this one
But I did notice that we use a custom action: https://github.com/python-discord/sir-lancebot/blob/main/.github/workflows/sentry_release.yaml#L13
Is there a reason for that?
I've only ever used their offical action, and it's always been fine for me: https://github.com/letsbuilda/anubis/blob/main/.github/workflows/sentry-release.yaml#L15-L22
.github/workflows/sentry_release.yaml line 13
uses: tclindner/sentry-releases-action@v1.2.0```
`.github/workflows/sentry-release.yaml` lines 15 to 22
```yaml
- name: Create Sentry release
uses: getsentry/action-release@4744f6a65149f441c5f396d5b0877307c0db52c7 # v1.4.1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
version_prefix: "${{ vars.SENTRY_PROJECT }}@"```
Should hit #dev-alerts , at least the first time it occurs
no idea on the history of why we use that action
sir-robin#114 for sentry integration
IIRC the official one is not really maintained
I keep forgetting how much lockfile changes inflate diffs
oh actually it might be good now
Would you accept a PR on Lance trying out switching to it?
Sure
Cool
I'll poke at that later today
Yeah would have to double check the reason we weren't using it but this PR from 3 weeks ago updates it from using a 3 year old sentry CLI version so it seems like it's been revived https://github.com/getsentry/action-release/pull/186
@vale ibex is the profiles_sample_rate no longer an experiment?
nope
but they made it backwards compat, so setting it in experiments still works
first PR :D
I think that's a different issue. I can recreate it on desktop in firefox and chrome but only when using a mobile user agent. I think it might actually be cloudflare's fault this time. @vale ibex do we have cloudflare mirage enabled (https://developers.cloudflare.com/speed/optimization/images/mirage), if so could you try temporarily disabling it?
we did, it's off now
Congrats! It was a nice one too :D
Ok nice, I think that does fix the issue
fwiw
My guess at what is happening is that there's a bug in cloudflare mirage's lazy loading. The way it's meant to work is that if it detects you're on a mobile or slow device, then it transforms images in the HTML
<img class="dark-image" src="/static/images/resources_dark/sentdex.png" alt style="height: 50px; ">
to something like this:
<img class="dark-image" data-cfsrc="/static/images/resources_dark/sentdex.png" alt data-cfstyle="height: 50px; " style="display:none;visibility:hidden;"><noscript><img class="dark-image" src="/static/images/resources_dark/sentdex.png" alt style="height: 50px; "></noscript>
And injects some JS that detects when the user has scrolled to the image and sets src and style to the values in data-cfsrc and data-cfstyle, deleting the style that made it hidden (thereby lazy loading it and saving bandwidth).
However, I think that the backend HTML transformation doesn't happen for SVG images, but the style attribute is still removed by the JS when the image is viewed, so the height styling is removed.
ah right, yea that would make sense
to cloudflare's credit, it is still marked as a beta optimisation, so something like this isn't un heard of
Any chance of a second review on sir-robin#112
I'll take a look at it if i make it home early and no one beats me to it
I'm very confused, isn't lazy loading a feature with the stock img tag
Nice , thanks
yeah, I didn't know but it looks like you can set loading="lazy" on an img tag to get it to load lazily. I've no clue what benefit/difference the way cloudflare seems to do it would have over that.
that makes sense! thanks for finding the issue wookie.
looking at the docs, I guess it also does some other optimisation things in addition to lazy-loading
and also @timid sentinel, regarding the font awesome thread was just wondering, what specifically do you mean that django fa plugin can help with it?
AIUI lemon suggests we stop using it entirely and host the icons ourselves (imo because we don't want icons to be served only "sometimes" due to the 10k limit).
doing so would:
- drop the js/css/fonts baggage of resources
- prevent inclusion of icons we don't need
although using that plugin can let us include only css/js files that is needed on the page, it's still under the usage limit right?
btw I'd also include that switching to host our own icons also has these disadvantages
- might need to write some css for fine-tuning the icon styling
- less easy to try-out multiple icons before deciding the one to use during development
I meant https://fontawesome.com/docs/web/use-with/python-django, which which would be a drop in replacement. It just bundles all the js/css/fonts into Django's static files so all that stuff would be served by us and we don't need to worry about kits/tokens/their cdn limits etc. (though the django plugin isn't really necessary for that, it could be better to just copy the files we need into the repo ourself)
Trying to manage each icon we want individually sounds like a bit more of a pain, the current way the icons are packaged using css and fonts is quite convenient, so I'm not sure if it would be worth adding complication just for a bit of a performance increase. I don't know exactly how that would work though so I can't really tell.
ahh I see, my bad 👍
I think I like this approach, seems simple enough.
doubt it'll take much of a performance hit.
what would be a good way to figure out where the head of an avatar img is? i can use cv2 but then the cascades will be a problem since it wont work for everything
Sounds like a non-trivial problem. Most facial recognition models are built to detect human faces, but I'm going to hazard a guess that they'll be a small minority of profile images
but I'm going to hazard a guess that they'll be a small minority of profile images
but a lot of people use pfps which arent humans
Yea, that's my point, you'd need to find a model that's works for those
But most are trained on human faces
oh sorry, i mistinterpreted that 😅
might have to train one myself
but dont really have the processing power
any other ideas?
I agree that the advantage of using fa's framework of css classes outweigh the possibly negligible decrease in performance. And since (I just realized) this plugin lets us host the static files ourselves which doesn't seem to be affected by the usage limits. It's a great idea 
What is this for?
the christmasify command
and what is that command going to do?
its like the easterify and spookify commands, so i thought maybe we add ice/snow and then a santa hat
Ahh right
Maybe a wreath around the edge, rather than a santa hat then?
similar effect, with way less complexity
Cool, sir-robin redis data migration was a success
Also updated the global namespace to be sir-robin instead of bot to make it easier to see what is what
&aoc toggle
:+1: Completionist role issuing is now on.
fyi @thorny obsidian
This has a one character change
bot-core#203
The version's stuck in the past
ah that's annoyiong that I missed that
the tagged version will have 10.6.0 now too
Ah well, this fixes the site at least
Yeah, that's how I first saw it
will wait for CI to finish and merge

@thorny obsidian I also just noticed sir-robin#75 do we still want to increase the time of the loop?
fwiw the loop uses the leaderboard cache, so it's not a huge amount of requests actually making it to aoc
I think it's fine
👍 Closed the issue
Do we have a command to convert Discord timestamp format or a "human readable datetime" to a duration understood by !remind or other such commands?
Commands for managing your reminders.
in 2 hours is not a valid duration string.
!remind [mentions]... <expiration> [content]
Can also use: reminder, reminders, remindme
Commands for managing your reminders.
The expiration duration of !remind new supports the following symbols for each unit of time: - years: Y, y, year, years - months: m, month, months - weeks: w, W, week, weeks - days: d, D, day, days - hours: H, h, hour, hours - minutes: M, minute, minutes - seconds: S, s, second, seconds
For example, to set a reminder that expires in 3 days and 1 minute, you can do !remind new 3d1M Do something.
Subcommands:
!remind delete [ids]...
Delete up to (and including) 5 of your active reminders.
!remind edit
Commands for modifying your current reminders.
!remind list
View a paginated embed of all reminders for your user.
!remind new [mentions]... <expiration> [content]
Set yourself a simple reminder.
Well
I'm the one who needs to go sleep xD
As I apparently am mistaken
Anyway, I could've sworn I've seen it in action before
Would be nice if we could have remind accommodate human readable stuff like the epoch command does
It'd be nice to have a converter command for this like .epoch
Because there are times when you need it for something other than !remind
Such as… ModMail
hello, any ideas why the netlify preview workflow failed for my latest commits in site#1210?
8:21:34 PM: Fetching download URL from https://pythondiscord.com/api/github/artifact/python-discord/site/608cd9580be66df87b63edb051d625917177e165/CI/static-build
8:21:34 PM: {"error_type": "NotFoundError", "error": "Could not find a run matching the provided settings in the previous hundred runs.", "requested_resource": "python-discord/site/608cd9580be66df87b63edb051d625917177e165/CI/static-build"}
https://app.netlify.com/sites/pydis-static/deploys/65bcde2f388d7e00088eae56
The error doesn't seem to suggest it was caused by something from my commit changes
it looks like publish-static-preview somehow did not complete before netlify starts attempting to fetch the artifact it was supposed to publish...
it's because the "normal" github CI doesn't run if there are merge conflicts
and it's our CI that builds the static site that netlify uses
if you rebase onto main, resolve conflicts, and force push, it should just work
Why can’t Netlify build the site itself?
reasons that I can't remember
you can probably find the PR from scaleios that added the static generation to see why
ah yea, netlify only has support for Python 3.8 in its build system
well, and 2.7
🥴
(in reply to chris but the messages further down did not load)
can sir lancebot react with something everytime “python” and “slow” are in the same message
someone should make the bot react with "🤓 ☝️ " every time someone says that
What would you want to say?
"
"?
that works
would it be useful if /aoc join could still let people join the leaderboard for the previous year, when the next event has not started?
I guess the lb is most useful for competing in time to solve, but the number of stars also gives a placing in private leaderboards.
(the leaderboard doesn't change from year-to-year)
yes. what I mean was say someone run /aoc join right now, they cant join the leaderboards, because aoc is not currently happening
yknow, in case they want to catch with 2023 puzzles
I would add a footnote that says "this event is not currently running; it happens in December"
It wouldn't break anything to let people join
But these people are confused and think that the event is currently ongoing, and letting them join a leaderboard would only add to that confusion
ah that's a good point
the aoc join command requires up to date leaderboard cookies, which expire after ~1 month
so we usually only keep on top of those during the event

it's to make sure we're not giving out join codes to full leaderboards
so I've been looking at this:
https://github.com/python-discord/sir-robin/blob/5d26dcebd1d964c594dae66ed71bd31573c7e2d3/bot/exts/advent_of_code/_cog.py#L212-L215
and in constants for AocConfig.year we have this:
https://github.com/python-discord/sir-robin/blob/5d26dcebd1d964c594dae66ed71bd31573c7e2d3/bot/constants.py#L78
it looks as though we are comparing datetime.now().year == datetime.now().year+1 which should never be true.
is this something unintentional that happens to work, so we'll say "leaderboard for this year not yet available" for any month other than Nov and Dec?
bot/exts/advent_of_code/_cog.py lines 212 to 215
if not (
current_date.month in allowed_months and current_date.year == AocConfig.year
or current_date.month == Month.JANUARY.value and current_date.year == AocConfig.year + 1
):```
`bot/constants.py` line 78
```py
year: int = datetime.now(tz=UTC).year```
kubernetes/namespaces/default/sir-robin/configmap.yaml line 6
AOC_YEAR: '2023'```
The idea being that it will work Nov, Dec & Jan
Henlo @tame pebble are you able to finish bot#2839 ? Should I label is as up for grabs and look for someone else to finish it?
Hello,
Yes I'll wrap it up
Thanks.
Sure!
I'll be cheering
Also @lyric temple thank you for the beautifully written issue
Thanks for the easy to follow setup for dev environments. Had a bot up and running in minutes for local testing.
@lyric temple
"\u2764\ufe0f"
"\u2665\ufe0f"
"\U0001f49c"
"\U0001f49f"
Why do only the first two have 2 \u(s)?
https://stackoverflow.com/questions/38100329/what-does-u-ufe0f-in-an-emoji-mean-is-it-the-same-if-i-delete-it
I see
Do they not all need it?
<#bot-commands message>
It's a great question. I'm not sure on the rules of unicode but most didn't.

Alright then
If you're curious I spot checked encoding errors with: https://gist.github.com/Preocts/d5fd9fb231e5af5f06e3a324ac418b7b
I'll never understand Unicode
PyCharm running locally can't see the emojis
But a Codespace in the browser can
The first two are defined as a pair of an existing character and a combining character called a "variation selector".
The latter two are characters outside the original 16-bit code point range (BMP). These characters are defined as surrogate pairs (which use a reserved section of the BMP) and you'd think they could be represented as \uD83D\uDC9C in Python, but Python does not support encoding surrogate pairs for reasons I don't know. So instead we have to represent the character as a single code point.
hey @thorny obsidian, would you mind taking a look at the "annual" and "other" events list to check whether the order and list of events is correct? just want to make sure the high level structure is there in terms of the names of the events to include, before marking PR as ready for review
https://deploy-preview-1210--pydis-static.netlify.app/events/
(note that only light mode is fully readable for now)
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.
Is our site supposed to advertise last years codejam? 
I've included the previous events there for returning users to quickly visit an event they might have participated in, and want to check some info (such as winners, submissions etc)
and also to showcase the sort of events we hosted recently to give newer visitors a sense of what to expect
oh! I just realized you might have meant the hero section on the homepage 
Yes
It looks really weird to advertise event that has already occured
I presume it'd be better to either more explicitly indicate that its over and its a previous event (I myself assumed it meant 2024 and it was merely a typo)
Or to start advertising the 2024 one tbh
Pixels can be bumped down to "Workshops & Other events", the Game Jam can be left off entirely. Otherwise looks great!
Alright, we'll have only two out of three items in the second row for annual events then. Will update accordingly, thanks!
Bug report: @stable mountain suggests the code block language incorrectly, when the original code block language is specified as Python (with P capitalized).
#python-discussion message
Looks like they deleted the message.
def fn():
print("hello, world!")```
This doesn't trigger for me, but should for any non-staff, I think
I suppose Discord made it more lenient now.
hallo! this issue is now up for grabs again. i would love to see a PR for it https://github.com/python-discord/bot/issues/2172
looks like someone really liked that
!reminder edit duration 6557 8d12h5M
That reminder has been edited successfully! It will arrive on <t:1708305299:F>.
Np
hey, anyone with M series mac had issues setting up site repo with docker ?
What kind of issues? Snekbox?
Oh wait, snekbox doesn't get used by site, does it?
https://paste.pythondiscord.com/4EUA
the entire error is here, its a m3 mac
it works fine on linux though (I am new to mac)
@atomic ivy
It's not saying command not found, so that shouldn't imply the command is missing, no ?
It's saying that the command failed because there's a missing file/dir required for the installation, but i'm not sure why
Mina,
Do you know of any other beginner friendly contribs?
Im trying to get more involved and better at git, but I’m scared! :-p
we have plenty on sir-lancebot, a few on site too! :)
Oh good one. I actually havent looked at lancebot. Will have a look when at work!
Hmmm, I'm on an M1 and have gcc and it doesn't error on poetry install
BUT, I also just realized that that error is coming during docker build, which is… weird
on site:
- https://github.com/python-discord/site/issues/1217
- https://github.com/python-discord/site/issues/1214
on lancebot, after a brief look - https://github.com/python-discord/sir-lancebot/issues/707 (it looks like vcokltfre is no longer on it)
- https://github.com/python-discord/sir-lancebot/issues/824
- https://github.com/python-discord/sir-lancebot/issues/945 (depending on what you implement, this might take some more work)
there are also a few issues on sir-robin that looks pretty beginner-friendly, not sure if they're high on priority though but probably nice-to-have:
Adding a platform: linux/amd64 in the compose for site works.
web:
+ platform: linux/amd64
build:
try DOCKER_DEFAULT_PLATFORM=linux/amd64 docker compose up --build
I just remembered
Tizzy had a similar issue before
And Chris suggested this fix
That also works, yeah
Nice
At work now, checking
hey @drowsy ravine by the way you didn't join the org on github?
hmm it looks like you didn't.
but either way, once you do you can just create branches off the main repo, rather than maintaining your own forks :)
what's your github username?
JelmerKorten
invite sent https://github.com/python-discord
You are now a member of Python Discord!
belated but better late than never :D
Hello. everyone.
I am looking some one who can support me.
Plz reply to me if you mind .
What do you need support with?
Hi. Chris.
Thank you for my reply.
where are you from?
I am Umar Chandra from Japan.
I'd like to discuss something with you.
do you have some problems in python ?
No..
what's the problem ?
I am a developer who have rich experience in backend.
I worked at a Corvee company for 3 years, but the company was broken.
And I fired, so I'm finding some work or jobs.
Can you help me?
You're better off asking in #career-advice or in one of the off topic channels
This channel is for discussing Python Discord projects
Oh.. I see, sorry for interrupting to your.
@sharp crag thing
bot#2614
Afternoon all!
Can anyone talk me through, or link me to a document, on the steps to follow on merging the stuff I worked on? (I think the term is "pull request"?)
(contributing noob here)
hey, so you've made your commits locally?
Yessss 👍
have you pushed to the remote branch?
Also yes
alright now can you navigate to the repo on github? if you've pushed to a feature branch from the python-discord repo, open the /pulls page on github
it should show you a button to open a pull request
I pushed to the fork of the repo in my own github, right?
that's fine as well, can you open the github repo for your fork then?
do you see something like a yellow box that prompts you to open a PR?
I've got a contribute button, it's just grey / github coloured.
If I click the little arrow it says
This branch is 2 commits ahead of python-discord/sir-lancebot:main. Open a pull request to contribute your changes upstream.
yeppers that works too
now you can click on it and it should show you a preview of your changes
Able to merge. These branches can be automatically merged.
Create pull request?
yep!
Im scared! 😛
Feel free to refuse if you dont want it hey
put in some descriptive text on your PR and it shall be left to reviewers on what becomes of it :)
and you can always push new commits to the PR, by simply pushing to that same branch on your fork afterwards
Copied.
But don't I need to get like a branch or something? (or is that just for bigger new features?)
it's not really necessary if you work on your fork, and only work on one PR at a time
by the way: in the future, you can just use a branch from the python-discord repo, since you're in the org
for this PR, since you've already made your commits from your fork, it's fine :)
Since I'm not too comfortable with these things yet I rather not until someone show me how and why etc ❤️
no worries! you can continue using your fork for as long as you want to, to get used to the process
and btw I just found out that we do have a guide for PRs:
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/pull-requests/
so in case you need help with it in the feature, it's there :)
A guide for opening pull requests.
Thanks, i've saved that!
Where can I get the poetry files needed to get precommit?
You mean you want to know how to install precommit ?
I guess yes.
pre-commit 3.6.0 A framework for managing and maintaining multi-language pre-commit hooks.
yes, that's the package, that uses yaml to define the things to run in the hook
Then you need to "install" these rules
which puts them in the precommit hook
To do that, you need to run poetry run task precommit
That'll take care of installing the hook
which will then allow it to run before each commit
so I did that, and it cant find task
pCommand not found: task
korty.codes@kortys-macbook sir-lancebot % poetry run task lint
Command not found: task```
(nvm the p in front of the Command, I was too fast typing)
name : taskipy
version : 1.12.2
description : tasks runner for python projects
dependencies
- colorama >=0.4.4,<0.5.0
- mslex >=1.1.0,<2.0.0
- psutil >=5.7.2,<6.0.0
- tomli >=2.0.1,<3.0.0```
I think I fixed all the issues ruff now gave me, but I rather want to do fix myself before it fails again.
Strange
What about poetry env list?
I mean, we can try to run the command directly: pre-commit install
But i'm not sure to why poetry isn't recognizing the command if it's installed
I have now pip install pre-commit
and pre-commit install to install the git command
korty.codes@kortys-macbook sir-lancebot % poetry env list sir-lancebot-k6fhlbY6-py3.11 (Activated)
pip install pre-commit
The installation is handled by poetry
which poetry version do you have ?
poetry --version
>>> Poetry (version 1.7.1)
Strange, I can't reproduce it
I've updated to the same version & made a new env
I'm not sure to what this could be related
Can you try making a new environment ?
If that's via poetry I have no clue how to.
poetry env list
copy the name of the one that has "activated" next to it
sir-lancebot-k6fhlbY6-py3.11 in your case
poetry env remove sir-lancebot-k6fhlbY6-py3.11
then poetry shell
& finally poetry install --no-root
Ok I see how that works.
Thanks for that run through.
Im not sure how it wasnt installed, but in any case I now know how to fix it ❤️
Did that fix it ?
It did! 🙂 Thanks
I was just saying I dont know why/how it wasn't installed in the first place
I'm also new to poetry so just a simple "contribute" turned into learning about bots, poetry, setting up the project etc etc
Feels like the classic high school problem:
In class:
John has five oranges, each orange cost 60 cents.
How much is the total costs of the oranges?In test:
John has 3 apples and a pear.
Calculate the mass of the sun.
That's great ! 😄
And this poetry install --no-root installs from poetry.lock?
Can I see that the same as requirements.txt?
Not entirely, requirements.txt doesn't pin transitive dependencies
Okay I see.
So poetry will lock these dependency versions that those and only those get loaded (if still available of course)
Whereas requirements.txt will download the dependencies but the latest version?
At least, not the usual approach
The equivalent would be to do pip freeze > requirements.txt
But not all people do that
Oh, how else are you making requirements.txt? people typing manually?
Now that we're talking about the pip freeze as well.
If I were to free up disk storage on my computer, and have a few venvs that I don't actively use.
would pip freeze be a good idea, then delete the venv?
If I want to come back to the project I can just create new venv and install the requirements again?
Not entirely.
- With the .lock version, poetry will install exactly all the pinned dependencies, and the transitive ones as well.
- requirements.txt can have a listing of the main dependencies, and let
pipresolve all the tranitive ones.
Example
package1 dependens on transitivePackage > v1.6
package2 dependens on transitivePackage > v1.2
HEre, pip will resolve into installing a version of transitivePackage that's striclty greater than 1.6.
It won't be always the latest as it depends on the python intepreter's version as well
However, with poetry, we also lock transitivePackage, so it'll only install that one
Gotcha. Thanks for explaining that.
Yes, that could be a case
That's what I'm saying
What i'm saying is not all poeple use pip freeze
but with poetry, it locks them for you automatically
true
You can --with-hashes
(I forget the specific flag)
I didn't think pip ever added that?
I thought they were pointing people to pip tools or pipenv for that
Well now that I pull up the docs to reference, I can't find it
I think that's the installation one you're referring to
Not the freezing cmd
you can generate requirements.txt diles with hashes though
poetry export by default includes hashes
https://pip.pypa.io/en/stable/topics/secure-installs/
I see checking, but I don't see generation
Yea
I know I did.... I know I tried it once
Because it failed
But I... Oh.
I think pdm does it as well
you can instruct the format
yea pipenv and pip-tools can too
pip-compile --generate-hashes
Nevermind I'm dumb 
.PHONY: lock
lock:
poetry lock
poetry export --only main --output requirements.txt
pre-commit run --files pyproject.toml poetry.lock requirements.txt
this is why I love make files
lance does too
How do we type hint that something has to be a function ?
Callable[[str], str]
a function that takes in a string and returns a string?
Is that correct?
the function thats type hinted is not async, but the function it’s going into is. Does it then need to be changed?
async def func(fn: Callable):
Nah
Great!
Is there a reload cog command?
.help cog
Did you mean:
c
cogs
colour
.help ext
**```
.extensions
**Can also use:** `c`, `cogs`, `ext`, `exts`
*Load, unload, reload, and list loaded extensions.*
**Subcommands:**
**`extensions list`**
*Get a list of all extensions, including their loaded status.*
**`extensions load [extensions...]`**
*Load extensions given their fully qualified or unqualified names.*
**`extensions reload [extensions...]`**
*Reload extensions given their fully qualified or unqualified names.*
**`extensions unload [extensions...]`**
*Unload currently loaded extensions given their fully qualified or unqualified names.*
.src ext
that one
it uses the filename that the cog is located in, unless the name kwarg is overwritten when creating the cog class
Good stuff! 🙂
!rule 9
I am now developing machine learning model from scratch that do interior design automatically.
What kind of models can I use?
How can I make an approach?
I need someone who can collaborate with me.
#data-science-and-ml is likely the channel you're looking for, this channel is for discussing internal Python Discord projects
@vocal wolf
I had a copy open and decided to just implement the suggestion you made to the pypi package regarding last nights comment. I added "to PyPI" to make it extra clear. Not sure if that's required but yeah.
This what you need?
yuh
I think we should strip the time information though and just provide the date?
yeah we just need date, don't need that much verboseness
@vocal wolf I think I've done this: Add more commits by pushing to the pypi-timestamp branch on Robin5605/pydis-bot. as suggested in the issue. (not too sure though)
if you're PR-ing to robin's fork, might wanna PR to their pypi-timestamp branch instead (rather than main)
because their original PR uses that branch, so new commits to the branch could then be reflected in robin's PR
I did!
oh but the merge is into :main
hmm
you can update the base branch by clicking Edit on the pull request.
although, if you're continuing the work in the original PR, maybe robin can just add you as a collaborator on their fork so you don't have to open the PR there (cc @sharp crag)
must i git push --set-upstream pypi-timestamp mybranch?
no need to push to a different branch, the issue here is with your PR
Okay, I changed the base.
Thanks!
once again, sorry for all the questions on git! ❤️
ah sorry for the late reply. glad things worked out! I hope to check on the PR tomorrow
No worries! Thanks for the patience ❤️
Let me know if you have any questions on this PR - I started it a while ago but I might've written something stupid as is par for the course :p thanks for taking over!
All I did was implement the suggestion on the issue. ❤️
tbh, It's an opportunity for me to get involved in open source 🙂
And I must admit, it really helps doing this actively rather than reading how to do it once then never do it and I forget haha.
I'll try to be better to PR it to the pydis GH next time
I like how it looks in any case.
Maybe i'll have a look and see if I can get these different python versions to work.
potentially with an extra command in the !pypi package --versions (or something)
Not that it needs to be implemented, but just to see if I am able to
Discord changed something with nicknames, this may affect .catify and other commands that affect nicknames
Story: someone on another server started complaining about discord changing name length. I'm bored so I started testing and it seems it's only for fancy Unicode stuff, so far I found that 4-byte Unicode takes 2 characters in nicknames now, Cyrillic (2 bytes per character) takes one character in nickname (ie doesn't affect max length).
Testing method : manual.
I padded my nickname on my test server with digits and just started deleting n last characters, pasting test characters, then tried to fill in the padding
E.g. Ascii only/ascii plus Cyrillic is 32 characters in nickname, but "𝔗𝔢𝔰𝔱" in the middle makes it 28.
Edit: 3-byte 'ࠀ' also takes 2 spaces wait, no, it doesn't, it's just rtl and ate a number I gave to it
Why would that affect nickname commands? 
.src catify because e.g. catify has a check for 26 characters because it adds 6 characters to the name
Wait, wtf... Bot changed my name successfully - exactly 32, but if I go to edit it, the cat's head doesn't exist. So the weird name limit change is only for users and bot can still do it the old way? O_o
Emoji in my name makes it so that if I changed my name manually, I can only fit 5 ascii characters
But bot can fit 6 characters in there
Also, I was wrong above, 3-byte characters take one space in the name not two (I edited my message above). The script used for the cat itself is therefore safe on its own, it's user's previous name that can be weird
I will use that hahahaha
@drowsy ravine 👋
What I've meant to say is, the only change that was supposed to happen is
-def neutralise_string(txt: str) -> str:
+def neutralise_string(txt: str | None) -> str | None:
"""Attempts to neutralise all punctuation and cases and returns a string of lowercase words."""
# take out punctuation
+ if not txt:
+ return None
txt = re.sub(r"([^\w\s]|_)", " ", txt)
The clean_text_or_reply already takes care of raising the BadArgument error
👋
Oh I see. I’ll change it in a bit. Just having dinner quick.
Thanks so far! 🙏🏻
No worries !
Question about ruff.
`- hook id: ruff
- exit code: 1
- files were modified by this hook
Found 1 error (1 fixed, 0 remaining).`
Any way to see what exactly it's done?
(and a way to switch off the auto correct?? I rather manually type it after suggestions so I will actually learn)
Any way to see what exactly it's done?
pre commit hooks never stage their changes, so you compare the code in the staging area with the code that isn't staged
git diff --staged will do it in the command line, most IDEs have a way to do it too, but I'm only familiar with vscode
Okay, so I just check the two files and see whats changed. 👍🏻
Do you use vscode?
vscode shows it like this, where the staged changes are at the top, and then if pre-commit makes a change it appears in the changes section
you can click on the file in the changes to see just the diff from your staging area to what precommit did
Yeah I do. It opens the two files next to each other. Somehow I had struggles to spot the difference between an empty return and a return None 😅😅
ahh lol
fwiw, you can also run ruff . manually and it outputs the change
ruff . --fix is what auto fixes
make sure you're inside the poetry shell though
The type hinting + (i think its) pydantic really makes my code better. Seems a bit much work for quickly testing some things. But its good for me to get used to 🙂
@drowsy ravine I just noticed that you're developping straight on main in your fork
It's better to create a separate branch for each feature/bug fix
Since your main tracks the main branch from the pydis repo, when we merge your pr and then you'll sync, you'll run into issues
Chris, please be careful with logging :p
Yeah I'm still in the process of figuring out how to work with git. Let me see if i can fix it now
The main (as in the source of truth one, which is usually called main or master) should always have production ready code.
Whenever you want to add something new/fix something, you almost always would want to make a separate branch for it
Then you make your changes, get it reviewed, and reiterare until its approved, then it gets merged into main.
What you'd want to do is
- Make a new branch out of your
main - Hard Reset your main onto pydis'
- Change the Pull request's source branch to the one you created in step 1
Okay, so with my current code I did git checkout -b fun-cases
now im going to do git push -u origin fun-cases, correct? (this creates the branch on the remote, which should be my forked pydis repo in my account, right?)
you can configure get to always push up to the remote branch with the same name as the local one automatically
Indeed
But you need to reset your fork's main as well
that would require adding a new remote
So how do I reset the main?
What's the output of git remote -v?
origin https://github.com/JelmerKorten/sir-lancebot.git (fetch) origin https://github.com/JelmerKorten/sir-lancebot.git (push)
you have 2 options, you can either add pydis repo as repo as well, then reset on it
or, you can just locate the last commit hash before you started committing on main, and you git reset --hard {{hash}}
before you started committing on main
The very first one? L:P
the one just before your very first commit
so the one before 90625a1d323e052d8509f55fa49958a2b88bbd8e
once you do that (while you're still checkout out at main), you need to force push
I hear what you're saying. But I'm not sure what to do with the information.
I can click the sync fork button on github.com , it says this will discard the 11 commits, but I've made that branch now, fun-cases so those same commits are still there? I'd prefer to do it in CLI just to get more experience with that.
do what in cli exactly ?
so those same commits are still there?
yes
You also pushed them, so they'll be in your fork as well
reset main to up-to-date pydis. then if I want to work on something new, I can create a branch for myself?
yes, you pull to get latest changes, then branch out
Then how do I change the PR source?
Okay, I think im synced, took me a bit to figure out. Now sleeps!
nn ❤️
Nice !
👋
This is done
Cc @rapid swallow

@vale ibex Re bot-core#48, using a FQN for each type seems to do the job.
However, the deploy preview is off, it still shows 1.7.0, and the new attributes aren't there
But the locally built docs are just fine
Forgot I didn't link the PR 😅
bot-core#204
Sure !
@tame pebble
#dev-log message
Does that mean I did a contribute? 🤩🥹
It means you're about to!
You still need other approvals
@vale ibex, the new line is too long, do you want me to noqa it or just break it up ?
IT's just that I don't like it like this, and I didn't want to break a sentence before it was finished :p
I mean, like this
ooooh, so close! 😛
Do I just create a new PR? (I can't do anything to that current PR right?)
Yea just break it up, I think elsewhere we only tab in the second line by 4 spaces, rather than all the way like that though
You can commit to the same remote branch if you'd like, it's up to you
Committing to the same branch will update the PR, I'd suggest you make a new branch for each new feature you work on
Done
I did that! I have a brand spanking new branch after yesterday's finding out 🙂
Also, I don't think we need a version bump for this, since it's just docs changes
you can leave the line in the changelog, but remove the version specifier
it just works
+ :support:`204` Document the instance attributes of :obj:`pydis_core.BotBase`.
So just like this ?
Yes yes, that part is done
Nice
Alright, pushed
Hey!
I have question! (Again, lol)
Had some struggles with my own tiny github project. I'm still trying to get used to the whole github process.
So what I (thought I) did was:
- Create a repo.
- Add some stuff to it and push to remote, say main.
- Then I branched off locally
git checkout -b newbranch - Did some newbranch stuff locally and eventually pushed to remote
git push -u origin my-branch-name - Decided that it's implemented enough and wanted to merge. This is where my confusion came in.
- I went to GH and it popped up: newbranch has recent commits
Compare - Inside the compare screen, it said, there's nothing to compare, these two branches have no commit history in common (or something pretty close along those lines)
What did I do wrong?
And how to prevent it next time?
(I somehow merged it, but surely not the way I was supposed to)
Can you reproduce this on a public repo ?
Was this repo a new one ?
Maybe it's better to discuss this in a help post
Fair point, I've opened a channel
fakeredis usage
@rapid igloo thanks for your feedback on the repo. I will 100% have a look at it and try to implement. I am however not available until next week unfortunately, working away from base. That okay?
We don't really have time limits on when something should be implemented. unless it's absolutely critical
So don't worry about it
@vale ibex how would I go about testing the postgres logic? Can I trust that you tested it and it works? >_>
I enabled postgres query logging to get the actual query that was ran, and then played with the logic directly on the cluster
The queries I used are in the pr to show the logic is right
How can I do this when I click a button because a Select should come up? How does that work? (in py-cord)?
I think you're looking for #1035199133436354600 or #discord-bots, we don't use pycord in our projects, which this channel is for
hey there, I think we'd much prefer if each PR only included relevant commits. it looks like you didn't sync your PR's base branch from upstream (python-discord:main) before adding your christmasify commit
ideally the PR should only include c4c45a0 and perhaps a merge commit before that to update the branch
(and in the future, try using feature branches instead of main so you can work on each of your PRs separately and sync with upstream independently of each other)
Like hedy just said, it's better if you clean up your branch history.
I've discussed the same topic a few days ago here: #dev-contrib message
So you might wanna do the same
oh, i didnt realise everything came under it, im pretty new to using github so didnt rlly understand. So rn seems like i have to first sync the main branch then push the new code and then make a new pull request?
aight! will take a look
yep! technically you can still reuse the same PR by force-pushing after you've fixed your branch history. but feel free to use a new pull request if it's easier
okay so right now
i move the new stuff to a copy of the repo or rather a different folder for now
then hard reset right?
not really
create a new branch from your main
it will have the relevant commit
recheckout to main
sync your fork, then hard reset your main on the remote one
checkout to a new feature branch
and cherry pick your commit
i think you only have one commit
sorry, what does recheckout mean?
checkout back to main I mean
oooo good to know
(because you use the git checkout command)
ah, makes more sense
how do i figure out the hash
c4c45a0? i thought that was the commit code
git log --oneline will list the commits for you
There's no such thing as a commit code, at least not to my knowledge
It's the hash
Just not the entire hash
Since usually the first 8 characters are enough
you can understand the hash as the "ID" for each commit
now its back to my commit :D
no wait
i think i have to go to a previous commit
right?
ive contributed before
you can use HEAD^ to refer to the previous commit
how would i do that?
first i checked out to a new branch with the old commits
checked out back to main
hard reset up until c4c45a0 (git reset --hard c4c45a0)
and then checked out to a new branch
did you sync your fork first ?
and you should hard reset to main's head
git reset --hard origin/main
yes
then, make a new branch from the clean main git checkout -b christmasify-avatar
then, cherry pick the relavant commits git cherry-pick hash1 hash2
i ran this command but this is still showing up
and my modifications havent been removed
ok, can you run git remote -v
origin https://github.com/SockYeh/sir-lancebot.git (push)```
git remote add pydis https://github.com/python-discord/sir-robin.git
git reset --hard pydis/main
when you're on main
git push -f
then, do this
sir-robin?
PS D:\Python\sir-lancebot> git remote add pydis https://github.com/python-discord/sir-lancebot.git
PS D:\Python\sir-lancebot> git reset --hard pydis/main
fatal: ambiguous argument 'pydis/main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'```
try git reset --hard pydis main
fatal: ambiguous argument 'pydis': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'```
what does git remote -v say ?
origin https://github.com/SockYeh/sir-lancebot.git (push)
pydis https://github.com/python-discord/sir-lancebot.git (fetch)
pydis https://github.com/python-discord/sir-lancebot.git (push)```
👍(•_•)👍
ive been relying solely on vsc's source control
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'```
still the same issue
even after fetch
PS D:\Python\sir-lancebot> git fetch pydis
remote: Enumerating objects: 192, done.
remote: Counting objects: 100% (179/179), done.
remote: Compressing objects: 100% (59/59), done.
remote: Total 192 (delta 135), reused 154 (delta 120), pack-reused 13
Receiving objects: 100% (192/192), 102.71 KiB | 6.04 MiB/s, done.
Resolving deltas: 100% (137/137), completed with 31 local objects.
From https://github.com/python-discord/sir-lancebot
* [new branch] dependabot/pip/pre-commit-3.6.2 -> pydis/dependabot/pip/pre-commit-3.6.2
* [new branch] dependabot/pip/pydantic-settings-2.2.1 -> pydis/dependabot/pip/pydantic-settings-2.2.1
* [new branch] dependabot/pip/ruff-0.2.2 -> pydis/dependabot/pip/ruff-0.2.2
* [new branch] dependabot/pip/sentry-sdk-1.40.5 -> pydis/dependabot/pip/sentry-sdk-1.40.5
* [new branch] main -> pydis/main
* [new branch] reorder-hacktoberfest-commands -> pydis/reorder-hacktoberfest-commands
* [new branch] revert-1432-dependabot/pip/emoji-2.10.0 -> pydis/revert-1432-dependabot/pip/emoji-2.10.0
* [new branch] shenanigansd-patch-1 -> pydis/shenanigansd-patch-1
* [new branch] sim_matches -> pydis/sim_matches
* [new branch] use-botcore-command-error-manager -> pydis/use-botcore-command-error-manager
* [new branch] use-botcore-paginator -> pydis/use-botcore-paginator```
Did you do it like this ?
oh
this one's on me :p
yup its up to date now
Indeed
Nice
on the new branch ?
yea forgot to do that lol
okay now thats done
i push?
no wait i merge
since different branches
Wait
You don't want to merge
you want a branch, with just one commit
which branch are you on ? is it a newly created one ?
from the fresh main
yup
How come you have all that then ?
i cherry picked the commit too
oh wait this is the wrong one
the new one doesnt even show up
did you push it ?
Sure thing!
which branches?
yeah, it's preferable to delete branches
so everytime i have to add a new feature, i do all this?
No
you just need to
- sync fork
- Pull main into your local branch
- Make a new feature branch
- Develop, commit, then push
We did alot of other steps to reset your main
as you shouldn't work on it directly
nice, i was worried i would have to go through all this every time
also, any recommendations on youtube videos for learning git
I like this one https://learngitbranching.js.org/
Also, atlassian have great tutorials
Check them out
( I don't like watching videos to learn )
this looks sick (from a website standpoint)
It's quite nice indeed
will go through with it
interesting
yea sometimes videos become too much
what happened with your first chrismasify PR was that, because you worked off main for the riddle command, and without syncing to upstream (pydis remote), you started to work on the chrismasify PR by adding new commits afterwards. this makes your main diverge off of the upstream pydis main branch.
so when you open your first PR, github tries to find the commits from your main that are different/newly-updated from pydis, which includes commits from the riddle PR. what we want instead is only to include the chrismasify commit.
how Flying Whale helped you fix this issue was essentially:
- save your chrismasify commit elsewhere
- reset your
mainto the last commit that was still in sync withpydis - sync your
mainwithpydisby pulling in new changes from upstream - restore your chrismasify commit
all of this can be avoided if you'd worked on PRs with feature branches, rather than using main, which would skip the steps 1 and 2 from above.
hope this makes sense, if it helps!
(and also correctly me if I'm wrong Bella)
Thanks! Makes complete sense now as to where i went wrong, branches == gud
Correct, you should almost never commit to main directly
You should always branch out, develop, then merge changes into main
I say almost never because hot fixes can be pushed directly in case of emergencies, etc.
hi @timid sentinel, is there a consensus (perhaps among core devs?) for what we should do for site#1232?
.bm
Hey @quick nymph ! I've removed your post since it is off-topic for this channel.
!ot
Please read our off-topic etiquette before participating in conversations.
😢
Added a comment
is it possible to have netlify retry the static preview without pushing another commit?
pr: site#1232
https://app.netlify.com/sites/pydis-static/deploys/65d87c92d20f310008ce0cfd
the gh workflow that runs the build failed at first but worked after I re-ran it.
if anyone with the right perms can trigger such a re-run on netlify's side, (or any other solution) would be appreciated. thanks!
Just kicked off another static build
Does this server pay you for the emotes you make for it?
@timid sentinel I'll be away for quite some time and have no pc access.
I'll just recreate the PR and abandon the changes for now.
To not block the bump
But I just thought it made sense to combine both those changes specifically
Python eval'd my message twice
#1211041719743676496 message
The bot just restarted so presumably briefly there were 2 instances of it running at once
I C
that's probably why I can't delete some other eval output, with interactions failling
Yeah the old bot died so its interaction presumably died with it 😔
That's because it was deploying a new version, so the old instance wasn't killed.
Overlap happens sometimes
Oh, i didn't see sen's response. Discord is acting weird lately
Discord wants me gone
Gotcha
Will keep that in mind
It's been happening quite a few times lately, where a lot of messages are not loaded
Regarding !pypi:
Referring to pygame, but I think this issue will be there for any package.
TL;DR:
pypi site is adjusted for local timezone settings and the API is just in Zulu/UTC, hence sometimes there will be a day difference when comparing (upcoming) !pypi output to the website. What do you want to do?
2023-09-17T22:27:49
Is listed as the source distribution upload time, but since I'm +4 UTC atm, it brings it to 2am on the next day (18th) on the pypi site.
But the api upload_time.date() will still return the 17th. Then when I go check the site, there will be 1 day difference. Which is confusing and will break my OCD.
the upload_time is in Zulu / UTC time, and pypi site reflects adjusted for your timezone settings.
I wonder if using a discord timestamp would be an overkill? it could then use the user's local timezone
To be honest, if that's an option I would go for that.
Seeing 2 different dates is even more confusing than not seeing a date at all.
The problem still arises:
user's local timezone?
What determines what the local timezone is? Because if you use the command, I also get to see the output? Unless that would somehow be different for everyone seeing it with your suggested method?
yes, discord shows the date depending on the user's timezone
you can try it with the .epoch command iirc
.epoch in 2 hours
<t:1708871235:t> (this is an example that shows the time of course)
You can use this util to get a time stamp easily https://github.com/python-discord/bot/blob/main/bot/utils/time.py#L77-L82
bot/utils/time.py lines 77 to 82
def discord_timestamp(timestamp: Timestamp, format: TimestampFormats = TimestampFormats.DATE_TIME) -> str:
"""
Format a timestamp as a Discord-flavored Markdown timestamp.
`timestamp` can be any type supported by the single-arg `arrow.get()`, except for a `tzinfo`.
"""```
The different formats available are in this Enum https://github.com/python-discord/bot/blob/main/bot/utils/time.py#L41-L46
bot/utils/time.py lines 41 to 46
class TimestampFormats(Enum):
"""
Represents the different formats possible for Discord timestamps.
Examples are given in epoch time.
"""```
(Im reading up on this! gimmie a second to wrap my head around it)
Im getting this now xD
Released: <t:1694989669:f>
Which works when I take it out of the embed as we just seen.
Released: <t:1694989669:f>
timestamps don't work in embed footers, you'll need ot add a field
how's this instead? it looks similar to what we previously had as a footer except it's a different font size (note that the date format depends on locale)
The only way I know how to do that is by adding stuff to the description:
embed.description += f"\n\nMessage{time}"
If that's good enough..?
Ok, let me push it and await feedback
this looks better
I'm trying to understand how the bots deal with doing commands on a replied text. instead of providing the text to the argument.
It checks whether there was any text supplied, if there was it uses the text to execute the command, if no text was supplied it checks if message invoking the command is a reply to other message and uses that instead
https://github.com/python-discord/sir-lancebot/blob/2e9c12f4f9ebe22890919e0febbccc946c386685/bot/exts/fun/uwu.py#L167-L176 is an example of that
bot/exts/fun/uwu.py lines 167 to 176
text = text or getattr(ctx.message.reference, "resolved", None)
if isinstance(text, discord.Message):
embeds = text.embeds
text = text.content
else:
embeds = None
if text is None:
# If we weren't able to get the content of a replied message
raise commands.UserInputError("Your message must have content or you must reply to a message.")```
text = text or getattr(ctx.message.reference, "resolved", None)
does this mean that if text is None the statement right of the or will be evaluated
and we then assign that to text instead? Or still None if no reference was made (im assuming the reference here is the reply..?)
or would assign first "truthy" value or last argument (right side of or iirc)
Yes. I think that's what I tried to say xD
Anything more that needs explaining?
@vale ibex What happened in https://github.com/python-discord/bot/pull/2913 ? 🤔
merged it locally and pushed, but it didn't auto-close the PR due to a rebase
so basically, rebase bad
i was very useful because I wanted to merge 3 PRs at the same time without merge commits :P
So can this be closed? https://github.com/python-discord/bot/issues/2912
maybe
Wasn't linked?
The keyword I as thinking of was resolves, not solves
ah
@timid sentinel you approved but it had a few commits since https://github.com/python-discord/bot/pull/2924
Any feedback on my commits are also welcome. 🙏🏻
When I was learning about git I learned they should be small? Open to suggestions in any case! 🙂 thanks
Why are you adding your initials to them?
They already have your name on them.
maybe korty is a group account🤔. how many are you korty?
by the way korty, regarding the case commands PR, I noticed you pushed a few commits that addressed my previous comments. If you're ready, please do re-request my review so I know I can review again.
Not sure! Saw it somewhere and decided I liked the looks of it and have been doing it since. Can stop it if thats preferred?
Its just me 😅
yeah, sure, whatever you say, swarm account
Copy! I think it’s done as for now, will request later today.
And regarding pypi:
I did some tests earlier on a few packages and all [-1] dists were the “source” files. Then if I understand correctly sometimes other distrubution wheels are added later or updated (im assuming hot fixes) and this can lead to a later date. The “front page” for each package seems to reflect the source file upload time.
Hello, your message has been removed due to violating rule 6
oh, sry
Also, comments are for discussing things related with a pull request / issue.
So please refrain from making comments such as 'hi bro' in a pull request
Hi tho 👋🏻
Also, comments are for discussing things related with a pull request/issue. So please refrain from making comments such as 'hi bro' in a pull request,
Not sure saw it somewhere decided i liked the looks of it and have been doing it since.can stop it if thats preferred?
Does this mean that if text is none the statement right of the or will be evaluated and we then assign that to text evaluated
?
!dasm .../!da ... command (dis-assemble) for running !e import dis; dis.dis(...). Feel free to steal the idea.
along the same lines as having a timeit command
only reason it wouldn't be !dis ... is because !dis is the same as !hosting currently
I believe that is because the full tag name for !hosting is !discord-bot-hosting and !dis gets coerced into that
I'm in favor of using !dis anyway because it isn't clear that it leads to !hosting right now
what version of pinnwand are you using in production cause the new api https://pinnwand.readthedocs.io/en/latest/usage.html#api-v1-paste-a-z2-7
does not seem to work
V1.5.0-psql
What's not working?
ah cause the latest release is almost 1 year old
https://paste.pythondiscord.com/api/v1/paste/YOFA
this for example
this api route was introduced in supakeen/pinnwand#194
I cant really work on bot#2679 if its not in production yet
Yea that's fine, just need to wait for a release of pinnwand to be made
might be worth asking in their freenode irc channel if there's anything else that they're waiting on before making a release
hmm there's no one in #pinnwand on both freenode and libera
Ahaha yeah i tried myself
The versioning in pinnwand is not consistent
I'll open an issue for that
how so?
What i mean is, if you take a look at the docker images, you'll only find latest, and the 1.5 one.
There's no unique tag of a particular release that'll allow you to pinpoint a version.
pushing to ghcr was only added in v1.5.0
There are github releases for versions before that
For example, in our case, we use the sha hash to identify versions
I mean, for our packages
Yes you did
But pinnwand's ci has triggered a lot of times in the past period, and it's only overwriting 'latest'
ah right yea, which is why we use the release instead
So if i merge a PR now, the previous version's identifier/tag will disappear
this is quite common for apps that use releases, rather than building & pushing on each commit
usually it wouldn't be a problem if release frequency was higher
But pinnwand does build and push on each commit
as in it doesn't tag each commit because you're either on an unstable tag (latest) or a stable tag (release version)
I'm talking quite generally here for apps that follow this approach
adding a SHA tag would likely be easy to do with CI how it currently is, it has the possibility of burying the version tag though
Yeah
I'll try to see what Simon thinks about it
he may also reply in #pinnwand if you ping him
Man why did i never see this
Someone want to collaborate with me in a python project? Im making a encrypted password manager.
Can I send the link here?
If you're looking for help, #1035199133436354600 is the best place to go, this channel is for discussion python discord projects.
Keep in mind our rule about advertising and recruitment though.
Ok thanks
I havent found that, could you show me?
!rule 6
No Access 
thoughts on site#1235?
yes, I like it
removing code (css) is great
and reducing the effort to add new items to the timeline is a big plus
I have an idea, gimme like 10 mins
Is this something you wanted to implement youself hedy?
or just something you wanted to raise
if it's approved I'd be interested in having a go at it
but I might not have enough time so if I realize that's the case I'll drop a comment there saying so...
thanks @full fractal by the way!
hello, I have two fairly trivial PRs here from the site repo which needs one contrib/staff approval
- site#1226
- site#1231
and also site#1210, though it's not as trivial
reviews would be appreciated!
thank you Chris 
No problem, there's some really nice stuff in that redesign that I'm looking at now
what might go a long way is a basic readme in the events directory on how to add a new event
which mentions the need to update when the event ends
I have a draft of it in my git stash ready! will go about fleshing it out in the coming weeks
Ah very nice, good to know
I'm sure @thorny obsidian will appreciate being able to tell someone "go read this" and it just works for adding events to site :P
When did you become project leads?
~about a day ago as she's been assigned to modernise our timeline impl.
!source
should bot#1603 be closed since the functionality is now native in discord?
note, @thorny obsidian mentioned it could be (in a staff channel) but since that was three years ago, I'm bringing it up just in case.
Looks like @stable mountain doesn't know what to do with a help post with no messages in it for auto-closing. Someone mentioned that a completely empty post has been open for about 9 hours. https://discord.com/channels/267624335836053506/1218220149283360808
Interesting
I don’t think I’ve ever seen one without the embed before
The bot can normally handle that just fine, there must have been a discord API blip, or the bot was down, when that channel was open so it didn't trigger the bot picking it up as something it needs to schedule for closing
I c, freak accident
