#dev-contrib
1 messages ยท Page 19 of 1
If you see an unassigned issue with a linked PR, please let us know. We either forgot and should fix it, someone skipped a step, or it is up for grabs
(bot-py3.11) ฮป poetry run pre-commit
check for merge conflicts................................................Passed
check toml...........................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
isort (python)...........................................................Passed
ruff.....................................................................Failed
- hook id: ruff
- exit code: 2
error: TOML parse error at line 89, column 15
|
89 | "RUF005", "RUF012",
| ^^^^^^^^
Unknown rule selector: `RUF012`
is there something I need to update? idk what I'm even looking at here.
What ruff version do you have installed ?
Did you run poetry install ?
If your depencies file is new, but the ones in your environment don't match, you might run into that (that's my guess)
It could be that the RUF012 rule was added in a new version
great, that fixed it.
I swear, every time I contribute to the bot, so much has changed since last time that I have to relearn everything.
Is this supposed to be like this? Or is it possibly supposed to be postgres?
that's a typo
Does there happen to be an existing issue for it, I don't think I saw one
For something as small as this certainly not
Feel free to just open a PR on site (I'm assuming that's where this is)
I don't think I'm able to make one
You can fork the repository, make the changes on the fork, and then PR to the original
Ah, right. I don't need to pull the repo to local
For such a small change you can use the GitHub site editor, yeah
Just need to pinpoint where the typo is, I'll take a look and try to see where it is and if I have problems finding it I'll ask here
If you press . (you need to be signed in, and maybe on the home page) then it brings up the web ide which lets you search for text (so you can search for the typo)
Thx for the tip! I have never seen this before, wow. Why did I not know of this before
It's a relatively new feature (few months iirc)
ahh, that explains it. But glad I discovered this, it will make working with some of my projects much more easier
what about for commit messages? How much for that level of detail should I explain what i did? Would something like this work? ```md
Typo fix.
Fix typo in bot.md file. Change the typo from psotgres to postgres.
Maybe this?
The first sentence of your extended description should be the commit message instead
"Update bot.md" isn't a useful commit message
github web defaults it to that since it can't generate a useful one for you
oh, right.. Would this be better instead: Fix a typo in bot.md leaving the rest as is
Or using conventional commits Like
fix: postgres typo in bot.md
Yea, that's fine
Done, thank you everyone!
hey
can anyone help me with something please?
like I have a simple project that I need someone to code with me
really simple don't worry
hi - this channel is for questions/discussions about our projects. There are a bunch of issues on the various repos. If you want to work on one of them, you can leave a comment and someone will assign it to you
@stable mountain devs
the bot got problems with converting hyperlinks in the docs command (sometimes)
!d setattr
setattr(object, name, value)```
This is the counterpart of [`getattr()`](https://docs.python.org/3/library/functions.html#getattr "getattr"). The arguments are an object, a string, and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, `setattr(x, 'foobar', 123)` is equivalent to `x.foobar = 123`.
*name* need not be a Python identifier as defined in [Identifiers and keywords](https://docs.python.org/3/reference/lexical_analysis.html#identifiers) unless the object chooses to enforce that, for example in a custom [`__getattribute__()`](https://docs.python.org/3/reference/datamodel.html#object.__getattribute__ "object.__getattribute__") or via [`__slots__`](https://docs.python.org/3/reference/datamodel.html#object.__slots__ "object.__slots__"). An attribute whose name is not an identifier will not be accessible using the dot notation, but is accessible through [`getattr()`](https://docs.python.org/3/library/functions.html#getattr "getattr") etc..
for example
This is probably related to the changes Discord made recently to markdown
We get docs content directly from the source, in this case python.org docs
I couldn't imagine why it would work sometimes then
They added "security" feature to markdown links to ensure text that looks like a link doesn't link to a different url
but I think it's quite rudimental how it flags that, so it's causing false positives when the text has underscores it seems
or maybe it's not recognising the url side of the markdown link as a valid url for some reason
so weird looking link (dunder links) wont get hyperlinked then?
that would make sense somewhere
discord is weird
Yea, it's likely a benefit overall, IE you can't hyper link something like https://google.com
but the way they've implemented it causes some false positives
yeah true
I was struggling with it myself and wanted to take a look at the python bot here so I noticed that
wouldn't know how to fix it while I dont know the flags that cause that
the only way to fix it would be to:
- intercept the docs text and alter it to work
- Wait for Discord to implement a fix
1 is a lot of work, since we'd need to correct all the places where it happens, and also make sure new docs/changes to docs are also fixed
and number 2 may or may not ever happen
so imo we just leave it as it is, and maybe Discord will fix it at some point
yeah hopefully
I think you could change something in the markdown converter to remove/change some of these hyperlinks as long discord wont change something
check if href contains for example underscores (regular expressions or the link)
And it's not even obvious how you would alter it since changing characters can change the meaning of the text
Yea
What is this weird http://o.hi? https://github.com/python-discord/bot/blob/82d0ded4bc634c9fc81a010b2fb10bdacf57b823/bot/exts/moderation/modlog.py#L653
bot/exts/moderation/modlog.py line 653
content_before.append(f"[{sub}](http://o.hi)")```
It looks to be just for formatting, right?
yea, if the original message gets deleted and no other non-bot messages are sent, help channels close after 5 minutes.

@gritty wind For this PR did you figure out how we would install the additional packages (numpy, scipy, etc)? https://github.com/python-discord/snekbox/pull/175 I think we would need to install them separately for each version, right?
Arl suggested installing them separately to ensure we can have different versions for each and such
Someone had a look over the requirements.txt specification and we can specify the version right in there, keep it all as one file
All the python installs are complete, fully-functional installs so pip should work
Wait really? How? Like--
numpy==62;python-version==3.11
numpy==61;python-version==3.10
Seems like a good use-case for try-it-and-see
I believe that should work however
Might need to make that py ver a string
Or maybe not
Use quotes around specifiers in the shell when using >, <, or when using environment markers.
Do not use quotes in requirement files. There is only one exception: pip v7.0 and v7.0.1 (from May 2015) required quotes around specifiers containing environment markers in requirement files.
may i ask when you introduce the 3.12 playground to the bot. I remember there was something like that for 3.11 just dont remember at what phase
I don't think we'll be doing that this time.
There has been an internal discussion about this, and 3.11 was added because we had some big changes that we wanted people to test in an early stage. It's not the same case for 3.12.
But, when mark gets to that pull request we're trying to close on snekbox, it will become easier to add so we might eventually do it.
ah okay sad news then
hope it will eventually come
It's not definitive, of course.
It's just that we didn't come to an agreement of doing it ๐
yeah i just shouldnt assume you will do it
Exactly
@timid sentinel thanks for the quick review! Incorporated your comments with the latest commit
No problem, just noticed one more thing, then all good as far as I'm concerned
https://github.com/python-discord/bot/blob/main/bot/exts/info/information.py#L588-L590
Why doesn't this delete itself?
bot/exts/info/information.py lines 588 to 590
if invalid:
await ctx.send(shorten(":x: Invalid rule indices: " + invalid, 75, placeholder=" ..."))
return None```
I'd say no particular reason
An issue would be great.
It's better to point out that we don't have consistent behavior all across our bot responses.
So we can identify these places as I don't think all responses should be deleted.
I'm not really a fan of timed deletion in general tbh, either chat has gone on so there's no real benefit in deletion, or it's still visible and therefore confusing as it looks like the bot didn't work. Not sure what others think though.
I don't see the benefit of deleting the bot embeds or whatever in the first place. It's not like we pay for message storage, and it's not spammy or clutters the space. Help embeds could be a good appliance, but still
I'm of the same opinion
If we want consistency I'd drop the timed deletion in other places as well lol, not a fan of them either
You could as well do it like in docs command
When its improper symbol then you delete embed with command
Tbh in a real-time chat platform, deleting messages โfor spaceโ or whatever else doesnโt make much sense
A delete button is better than automatic. No deleting is best
So I'm hitting a weird error with altering a docker compose.
I'm altering the dockerfile of snekbox and rebuilding. It builds and runs fine on its own. When I change the reference to the snekbox image in the forms-backend docker-compose.yml, suddenly I get the following error trying to start up snekbox. All I did was change the image name to the new one I built, so I'm not sure what could be going wrong
EDIT: resolved. I needed to add a build: . to my forms docker-compose for snekbox
@clever wraith I'm going to change colourst oa normal class
I just saw the validator and ignored it, but now I see it was just there to convert
Yeah, I added it myself
https://github.com/python-discord/bot/pull/2695/commits/238c9b49da979f14b46a017cad766221b4e203dc is the diff, I'm going to squash a few commits and merge unless you tell me this diff is horrible
But we can eventually just short-circuit the conversion
You forgot to inherit BaseModel
it doesn't need to
I misunderstood, sorry
But now no conversion happens, does discordpy take hex values ?
Nvm
This is not my day
Sweet!
I'm trying to add a new alias for the rule about paid work, where should I create the issue? And is this the correct file to edit? (line 172) https://github.com/python-discord/site/blob/main/pydis_site/apps/api/views.py
where should I create the issue?
Seems like someone else already made an issue bot#2716
is this the correct file to edit?
That should be correct AFAIK
It was very complicated but I think I pulled it off ;)
- ["paid", "work", "money"]
+ ["pay", "paid", "work", "money"]
lol, my test @stable mountain bot contains "discord" in the username and "discord" in the application name. Discord seem to have decided that isn't allowed anymore and I get errors trying to start the bot.
Going into the developer portal, first try changing the application name:
Validation errors:
name: Username cannot contain "discord"
Alright, so i'll change the username first... :
Application name cannot contain "discord"
Now i'm stuck, great...
can probably fix it by making the request manually I guess...
hmm no I think they're different endpoints ๐
I am trying to get my @stable mountain fork running with redis, but it can't seem to be able to connect to the redis server (redis.exceptions.ConnectionError: Error 111 connecting to redis:6379.).
Redis seems to be running fine, except there are no logs whatsoever and running ls in the terminal just hangs without any output.
Also, I'm not sure if it is relevant, but running docker compose up for the first time outputs 'postgres is unhealthy' even though docker says it's healthy. The issue disappears when running docker compose up again.
output (first run and bot error on subsequent runs): https://paste.pythondiscord.com/VC3Q
can you do docker compose pull and then docker compose up --build
I'm still getting the same error
For both redis and postgres?
The postgres unhealthy should mean that it doesn't recognize that user
If you bash into the container and try to connect with those credentials, does it work?
Also, just making sure
- Did you make any changes to the compose file?
- Do you have a .env file that might be overriding the redis credentials?
And if you don't want to block yourself for now, you can use fake redis
I haven't touched the compose file, and .env only has BOT_TOKEN and GUILD_ID
can you do docker compose down, then the 2 commands Chris gave you?
Which os are you on?
And in the create redis connection function , can you check if the host, user and pwd are correct?
Wait, the redis service in the compose file doesn't specify any credentials, so in unsure at what stage that's setup
I can have a look later
(which means that you might not even need any)
Win10
I'll try that again I guess
Nope, still getting both postgres and redis errors
The bot starts with fakeredis, but throws this when I try to load reminders:
โ Failed to load extension bot.exts.utils.reminders:
TypeError: module() takes at most 2 arguments (3 given)```
Do you have the latest changes ?
Did you sync your fork, pull latest main changes, and checkout from that ?
I synced it yesterday
Is there a full stack trace of this ?
Here's the full bot log: https://paste.pythondiscord.com/E6IA
Can you tell me what the output of git log --oneline -n 1 --format=%H is ?
wait I think that might be something to do with my code
436b6dd12aedca818e3cf3f5a33e9ff8b8b492f6
Did you make any changes ? Or do you get that on a clean branch ?
Great
Thanks for the help!
Yes
https://paste.pythondiscord.com/YGLA Here's the log when docker compose up is run the first time.
Everything after 16:16:28 happened after the command exited
Everything after 16:16:28 happened after the command exited
Not sure I get this, are the logs saying that the service isn't healthy, but then it fixes itself ?
Yeah
Then, there's no problem, right ?
What does docker logs {postgres-container-id} give ?
You can get the id by running docker container ls (or from docker desktop)
Does the bot run & connect to the api ?
and persist data ?
I think it might throw off that not ready error as the service is still spawning.
And that by then, pg isn't ready to accept any connections just yet.
But i'm only speculating here
I don't see anything strange in the logs you gave me
I gtg now, hopefully we can fix this next time.
in reference to bot#2722 the pep 0 embed already applies this functionality
!pep 8
!pep 0

If you look at the source code that's because PEP0 has it's own function for building the embed (it's hardcoded, rather than generated from the API)
bot/exts/info/pep.py lines 63 to 74
def get_pep_zero_embed() -> Embed:
"""Get information embed about PEP 0."""
pep_embed = Embed(
title="**PEP 0 - Index of Python Enhancement Proposals (PEPs)**",
url="https://peps.python.org/"
)
pep_embed.set_thumbnail(url=ICON_URL)
pep_embed.add_field(name="Status", value="Active")
pep_embed.add_field(name="Created", value="13-Jul-2000")
pep_embed.add_field(name="Type", value="Informational")
return pep_embed```
yeah i know i was just scrolling through its source and found that
just another reason to implement it in normal peps
is is still possible to work on bot#2692?
is so how should i approach sending other message via user being banned? do i create another CONSTANT in _channel.py ?
That sounds about right, and then you'd have a on_member_ban event listener in _cog.py that calls a new close_channel_from_ban function or something like that which will take the banned user, get their channel, send a custom message, and close it
Ah wasnt quite sure if i should create a new function for that
Could probably even edit _close_help_post to take a custom message argument, which if not provided will just send the current message
Also should i create a ClosingReason for USER_BANNED or something Like that
In _stats
There is the enum
That seems smart, yes
Okay sure ill claim the issue then
I'd probably go for OP_BANNED just to be explicit about which user got banned
Or CLAIMANT_BANNED actually to use consistent terminology
Will do
Hi everyone!
I am Harsh Kumar, a python enthusiast. I want to start open source contribution to my favourite language of all Python. Can someone share any resource for the same?
@full fractal Can you try rebasing onto main ?
@last patio Looking at the history, there's one commit from MArch 18 that's messing things up
If you could, locally, do a hard reset to the commit before the merge one
git reset --hard {commit-hash-before-merge}
Then a git rebase main
You might run into conflicts, if that's the case, you'll need to resolve them then run git rebase --continue
Hey !
We have a couple of projects you could contribute to
!contribute
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
We've documented everything there
Have a look, and you can ask us anything you'd like related to our projects/contributing in this channel
@still comet I know what's wrong with the redis connection
When you're inside docker, you can't resolve 127.0.0.1
Inside docker, the host that will allow you to communicate with redis is the service name, in this case redis
So, if you set redis_host=redis in your .env file, and run again, it should do it
It's weird that it's not mentioned in sir-lance's docs
I'll make sure to add it later
Oh okay, I'll try that tomorrow
You'll need to remove the use fake redis env var
I think this makes sense to do. Packages may not be compatible across multiple versions, especially c extensions and such.
Would like to get some feedback on my current plan:
Use pyenv to install all interpreter versions we want into the image. There are ways to debloat the installs to get them down to ~70 MB per version (I looked at how the official Python image does this). Even if our base image is Python 3.11, still install a separate Python 3.11 interpreter, for example.
This lets us decouple snekbox's interpreter from those NsJail uses. It also means we can consistently use a normal pip install for each version without requiring a PYTHONUSERBASE workaround for one of them.
Using pyenv sounds reasonable.
The 70 MB was for how many versions of python?
We could support the ones that are still officially supported, and making the addition / decommission of versions easy.
Why would we want to decouple the one snekbox uses from NSJail's?
I thought we'd want to pass the version through snekbox, then relay to NSJail
There's no benefit to sharing them other than to save on build times and image sizes. Having them use separate interpreters lets us update them on separate cadences. It also offers more proper isolation - currently there are some quirks with exposing pip setuptools and wheel.
It's 70 MB per interpreter.
1 version = 70MB, 2 versions = 140 MB, etc
Sounds good to me
Ugh I updated the base image to Debian bookworm and now tests are failing - something to do with multiprocessing. But I cannot figure out why
Could you try setting multiprocessing start method to fork?
from multiprocessing import set_start_method
set_start_method('fork')
Iirc this is going to be the default in a few versions
Nice
Honestly it's been so many months since I looked into it I can't remember
But whenever something weird happens with mp this is quite often the fix
Its the fix to a number of windows issues too
I spoke too early - the test_multiprocessing_shared_memory_disabled is still broken
Oh I just misread the test results. Actually everything is still broken
Huh alright, back to the drawing board then lol
It's getting late here, i can look into it more tomorrow though
Thanks. I think I will just drop this change and worry about updating debian some other time.
Ah yea alright, wasn't sure if you were going alpine->bookworm or plain debian bump
here is the dockerfile if anyone wants to mess with it https://paste.pythondiscord.com/XZYA
I've put out a draft here of my approach to installing multiple Python versions in the snekbox image. Would appreciate feedback before I proceed with API changes https://github.com/python-discord/snekbox/pull/181
yo is any of those considered applying
bot#2646
bot#2679
meta#217
Approved both bot issues, feel free to comment if you'd like to be assigned
You should bump the meta issue in #community-meta as the more relevant audience
@timid sentinel you mind helping me why does it still show the commits from the old PR? i already pulled them so idk
I think the issue is cause by you working on your main branch, ideally you should create a new branch for each PR you want to do. I'm not a git expert so since the new changes are fairly small I would probably just copy the new markdown changes to a file somewhere, reset your main branch with the upstream main branch, create a new branch, and recreate the markdown feature commit on that branch.
managed to create a pr and reset the commits to the upstream
Like wookie said, the main branch is made so that we merge into it, we never commit directly.
Looking at your previous PR (attached image), I can see that you're working on the main branch
You should always make a new branch, make your changes there, and then create a pull request from that branch.
If you want to fix what you have now, you can do this
git reset --soft HEAD~2
git checkout -b use-new-markdown-in-help-channel-embed
git commit -am "{{your commit message here}}"
yeah thanks now i know that even on forks i still need branches
i solved it other way arround i fetched the upstream and then i did git reset --hard upstream/main and force pushed to fork repo so the commits are discarded
Yeah, but a hard reset makes you lose your changes
it wasnt big of a deal this time
i guess it can be merged right away
git is great, there's liek 4 ways to do things. this one keeps the 2 seperate commits, rather than squashing into one ```
git checkout -b use-new-markdown-in-help-channel-embed
git cherry-pick main~2
git checkout main
git reset --hard origin/main
not big of a change
cherry-pick i never knew how to use that
basically it's a way to apply a commit to the current branch
so you can give it a git sha, or a commit range and those commits will be added to your current branch
main~2 means the top 2 commits from the branch called main
Yeah, cherry picking is great.
I just never knew i could specify the commits to Cheryl pick like that, awesome
you'll likely not have access to it even if you do authorize
it's the thing that adds the Review requirements check to the actions section
clicking details forces it to refresh, but only staff can do that
Oh it does?
Yea
I thought it just showed you
nah page load triggers a recalc
mhm 
bot#2679
thinking about how to approach it
is there any way you share some API to fetch such information or it would need to be scraped?
scrolling through pinnwand docs and only found how to upload via api
You just need to send a GET to the raw paste
For instance, https://paste.pythondiscord.com/raw/YT6A
Note the /raw/
ah okay i see
C:\Users\PC>curl https://paste.pythondiscord.com/raw/M45Q
print("Hello World")
``` seems to be working
i also asked about that on pinnwand repo and thats what i got in response supakeen/pinnwand#193
i guess ill wait until they add that to api?
Looks like the author already has a PR for that so yeah
https://bpa.st/json/show/LOSA this way i also get the lexer
i feel like yall hate me for finding such small things 
talking bout bot#2728 now
funny how it was there for 2 years now
banned
!dotenv

The example is somewhat wrong too
It should really just be load_dotenv() and not load_dotenv(".env"). It'll automatically look for the env file
You only need to manually specify the path when it's an odd file name or in a different dir
Yeah
Should we add support to !eval for running stuff with Python 3.12, now that it's a release candidate, like we did for 3.11 last year? https://github.com/python-discord/bot/pull/2218
Yea, the intention is there, albeit via native mutli-version support in snekbox https://github.com/python-discord/snekbox/pull/181

You need to decide if you are doing it or not
read the last sentence :D
found the problem for 3 of the 4 issues
/dev/shm doesn't exist in the container, which mp uses for it's SemLock
diff --git a/docker-compose.yml b/docker-compose.yml
index 0613abc..20f7c60 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -26,6 +26,8 @@ services:
volumes:
- .:/snekbox
- user-base:/snekbox/user_base
+ - snekbox-shm:/dev/shm
volumes:
user-base:
+ snekbox-shm:
This is the only remaining error https://paste.pythondiscord.com/637Q
fwiw this is my full diff (including dockerfile changes) on top of your multi-verison PR https://paste.pythondiscord.com/ESSA
The last error seems to be because it can't create the dir /test on the container for whatever reason
or it's not creating the dir by default anymore? ๐คท
is it possible that Function not implemented just isn't the expected failure response when running under bookworm?
Thanks for investigating. Presumably shm is used even in Buster, so I wonder why it's no longer available. Were we relying on the base image to mount it for us?
This is probably the case. There may have been some kernel update or some config change that changed the behaviour of shm_open. Previously we were effectively asserting that it errored out with ENOSYS, but now it fails with ENOENT.
I don't see anything in the kernel suggesting a change, nor has its man page changed the documented error codes it returns
Oh it might be a glibc thing that changed
ah nice, this does make sense now
Yea, I think we were, I'm also not sure if shm has specific properties or permisisons that mounting it int he way I suggested would mean it doesn't work. Might need further investigation
@vale ibex talking about bot#2726 i see almost all tags use the โข symbol for listing and you also specify that in parser i guess thats deliberate action
bot/exts/info/doc/_parsing.py line 226
markdown_converter=DocMarkdownConverter(bullets="โข", page_url=url),```
oh i guess im being stupid and this parser is not being used for tags
it's used for the docs command
i see
so, should i replace all โข in tags to -
let me show you difference
before - after
yea seems fine, I think there'a few command doc strings that use that bullet too
!help mute
!timeout <user> [duration=None] [reason=None]
Can also use: mute, tempmute
Timeout 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.
!src mute
Timeout a user for the given reason and duration.
this uses an indent character for the effect, but a md list might be better, would need ot see what it looks liek
yea that can change
you mean this part ```md
โy - years
โm - monthsโ
โw - weeks
โd - days
โh - hours
โM - minutesโ
โs - seconds
Yea
one second
well didnt go as planned
ill see what i can do about it later on
now let me modify all tags
I think something else is going on, but I don't know what. I tried docker run with debian:bookworm-slim and python:3.11-slim and both had /dev/shm mounted.
bot#2730
my mistake wrong commit name its fix(logs) should be fix(tags) want me to close this pr and create new one with corrected syntax
?
I asked for feedback here and we came to the conclusion that the ".env" is the default value so no need to pass it
Yes, I wasn't talking about that
I didn't see any of the PRs
The issue here is that the other person didn't get assigned to the issue
ah okay
And neither were you, at least not explicitly since wookie told you to feel free to open a PR
well i was told to open a pr about it
i guess thats close to being assigned
Read my sentence ๐
That's what I'm saying
git commit --amend -m "new commit message"
git push --force
You can redo the commit message ^
oh let me try that
thanks! worked
Not quite sure what's going on with the checks/actions though.. CC @clever wraith
https://github.com/python-discord/bot/actions/runs/5961212292/job/16170023845?pr=2730
The community bot for the Python Discord community - fix(tags): resolve SyntaxError in !dotenv command ยท python-discord/bot@a3fb2cb
Looks like the command is wrong (doesn't handle forks properly or something)
That's strange, I tested it on a fork from my github alt account
I'll look into it later
Ah yea, you're right. It's because we have ipc: none in the docker compose which is a private ipc ns without /dev/shm mounted
It worked before since it tried to use /tmp if /dev/shm wasn't avialable
but in glibc change you mentioned it no longer does that
So I think the "fix" it to change what return code we test for, rather than mounting /dev/shm
I didn't have to wait long for it to come in handy
forgot i already have a branch for markdown updates and had to move some so used this git cherry-pick update-markdown~2..update-markdown
Got it, will try to adjust the tests
Very nice
Nice sounds good, I'll keep an eye out for a PR
@vale ibex so pretty much changed everything i saw could be using new markdown
there is only one thing that got me https://github.com/python-discord/bot/blob/82301f2447e2f1df87433cd1d8bc5cffd42931a4/bot/exts/moderation/clean.py#L480-L489
i dont really see a way to use - so discord can format it
bot/exts/moderation/clean.py lines 480 to 489
\u2003โข `โusers`โ: A series of user mentions, ID's, or names.
\u2003โข `โfirst_limit`โ and `โsecond_limit`โ: A message, a duration delta, or an ISO datetime.
At least one limit is required. The limits are *exclusive*.
If a message is provided, cleaning will happen in that channel, and channels cannot be provided.
If only one of them is provided, acts as `โclean until`โ. If both are provided, acts as `โclean between`โ.
\u2003โข `โregex`โ: A regex pattern the message must contain to be deleted.
The pattern must be provided enclosed in backticks.
If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.
\u2003โข `โbots_only`โ: Whether to delete only bots. If specified, users cannot be specified.
\u2003โข `โchannels`โ: A series of channels to delete in, or an asterisk to delete from all public channels.```
when i replace all \u2003โข with dash i get this and i dont really see why its not on new line
might need to put a whitespace unicode character at the start, since we trim docstrings in the custom help command iirc
I guess replace \u2003โข with \u2003- 
Nah tried that too, then it doesnt replace it with markdown
yeah but when it does start with - it results with: #dev-contrib message
What happens if you put an explicit \n in the docstring on the line above?
"""
foo\n
- bar\n
- baz
"""```or something
I imagine it won't make a difference, but worth trying 
bot/exts/info/help.py lines 311 to 313
# Remove line breaks from docstrings, if not used to separate paragraphs.
# Allow overriding this behaviour via putting \u2003 at the start of a line.
formatted_doc = re.sub("(?<!\n)\n(?![\n\u2003])", " ", command.help) if command.help else None```
this is the logic we use to format the help command
seem like this is working fine
should i leave it?
!help clean
!clean [users=None]... [first_limit=None] [second_limit=None] [regex=None] [bots_only=False] [channels=None]
Can also use: clear
Commands for cleaning messages in channels.
If arguments are provided, will act as a master command from which all subcommands can be derived.
โข users: A series of user mentions, ID's, or names.
โโข first_limit and second_limit: A message, a duration delta, or an ISO datetime. At least one limit is required. The limits are exclusive. If a message is provided, cleaning will happen in that channel, and channels cannot be provided. If only one of them is provided, acts as clean until. If both are provided, acts as clean between.
โโข regex: A regex pattern the message must contain to be deleted. The pattern must be provided enclosed in backticks. If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.
โโข bots_only: Whether to delete only bots. If specified, users cannot be specified.
โโข channels: A series of channels to delete in, or an asterisk to delete from all public channels.
Subcommands:
!clean between <first_limit> <second_limit> [channel=None]
Delete all messages within range.
!clean bots <message_or_time> [channels=None]
Delete all messages posted by a bot, stop cleaning after reaching message_or_time.
!clean regex <regex> <message_or_time> [channels=None]
Delete all messages that match a certain regex, stop cleaning after reaching message_or_time.
!clean stop
If there is an ongoing cleaning process, attempt to immediately cancel it.
!clean until <until> [channel=None]
Delete all messages until a certain limit.
!clean users [users]... <message_or_time> [channels=None]
Delete messages posted by the provided users, stop cleaning after reaching message_or_time.
Seems like there are empty lines between the bullet points here
This might need some changing for it to work properly
Well you see the help docstring parser does it Like that
When i dont put new lines its like that #dev-contrib message
Tbh I prefer that anyway
Makes it easier to read
yes, because of the regex above
!embed - โusersโ: A series of user mentions, ID's, or names.
โfirst_limitโ andโsecond_limitโ: A message, a duration delta, or an ISO datetime. At least one limit is required. The limits are exclusive. If a message is provided, cleaning will happen in that channel, and channels cannot be provided. If only one of them is provided, acts asโclean untilโ. If both are provided, acts asโclean betweenโ.โregexโ: A regex pattern the message must contain to be deleted. The pattern must be provided enclosed in backticks. If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.โbots_onlyโ: Whether to delete only bots. If specified, users cannot be specified.โchannelsโ: A series of channels to delete in, or an asterisk to delete from all public channels.
โusersโ: A series of user mentions, ID's, or names.โfirst_limitโ andโsecond_limitโ: A message, a duration delta, or an ISO datetime. At least one limit is required. The limits are exclusive. If a message is provided, cleaning will happen in that channel, and channels cannot be provided. If only one of them is provided, acts asโclean untilโ. If both are provided, acts asโclean betweenโ.โregexโ: A regex pattern the message must contain to be deleted. The pattern must be provided enclosed in backticks. If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.โbots_onlyโ: Whether to delete only bots. If specified, users cannot be specified.โchannelsโ: A series of channels to delete in, or an asterisk to delete from all public channels.
There's a bit of spacing with the native markdown
Ah yes, nice
We should probably go for this output then
@clever wraith basically this needs another lookahead that the line doesn't start with a dash
changing it to formatted_doc = re.sub("(?<!\n)\n(?![\n\u2003])", "\n", command.help) if command.help else None seems to solve the issue but i guess it might break something for others
import re
def f():
"""
Commands for cleaning messages in channels.
If arguments are provided, will act as a master command from which all subcommands can be derived.
- `users`: A series of user mentions, ID's, or names.
- `first_limit` and `second_limit`: A message, a duration delta, or an ISO datetime.
At least one limit is required. The limits are *exclusive*.
If a message is provided, cleaning will happen in that channel, and channels cannot be provided.
If only one of them is provided, acts as `clean until`. If both are provided, acts as `clean between`.
- `regex`: A regex pattern the message must contain to be deleted.
The pattern must be provided enclosed in backticks.
If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.
- `bots_only`: Whether to delete only bots. If specified, users cannot be specified.
- `channels`: A series of channels to delete in, or an asterisk to delete from all public channels.
"""
...
print(re.sub("(?<!\n)\n(?![\n\u2003])", "\n", f.__doc__))
``` results with:
```text
Commands for cleaning messages in channels.
If arguments are provided, will act as a master command from which all subcommands can be derived.
- `users`: A series of user mentions, ID's, or names.
- `first_limit` and `second_limit`: A message, a duration delta, or an ISO datetime.
At least one limit is required. The limits are *exclusive*.
If a message is provided, cleaning will happen in that channel, and channels cannot be provided.
If only one of them is provided, acts as `clean until`. If both are provided, acts as `clean between`.
- `regex`: A regex pattern the message must contain to be deleted.
The pattern must be provided enclosed in backticks.
If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.
- `bots_only`: Whether to delete only bots. If specified, users cannot be specified.
- `channels`: A series of channels to delete in, or an asterisk to delete from all public channels.
but not sure if this regex is pointless now
This replaces a newline with a newline
yep seeing it now
it changes nothing
\u2003 is an emspace, we likely don't want to use that anymore. We likely want to look at another way to have docstrings that are multi-line in code but then not in-help
probably something for another unicode char, maybe a non-breaking space or zero-width space
@clever wraith :warning: Your 3.11 eval job has completed with return code 0.
ย
characters
!charinfo <characters>
Shows you information on up to 50 unicode characters.
well it doesnt even see that
some whitespace gets stripped by Discord, so you might need to use a different zero-width space char
!charinfo x y
\u0078 : LATIN SMALL LETTER X - x
\u0020 : SPACE -
\u0079 : LATIN SMALL LETTER Y - y
\u0078\u0020\u0079
will need some experimentation
hmm just a space
i know for a fact that this one แ
is not being stripped
!charinfo แ
\u115f : HANGUL CHOSEONG FILLER - แ
this will likely be better served with another issue & PR
since we want to discuss implementation
which you can work on if you want, or not if you didn't want to
hmm does it really matter? it's not a character we use anywhere except here
Like, what prompted the idea we should change it?
I was guessing it gets output in discord, which messes with the md
we could use the same character, we'd just need to make sure it gets replaced with a new line
ah, you think there's a character that'll work with the bullet points?
Could be anything really, we'd just need to replace it with a newline in the help formatter
so I imagine we could even get it working with the current emspace, would just need regex changing I think
This is all guessing btw, haven't actually messed with it
all we need is a way to indicate in-code that a newline in doc string = newline in help docs
but by default strip newlines
cant you create a regex that adds new line when on the next line there is a - (im regex noob)
I guess we can scratch our heads on it more properly, but the most immediate solution seems to be to add a (?!-) at the end of the pattern here
okay then bot#2726 is already marked as ready
@clever wraith for bot#2730 we should probably also update the "further reading" link to https://tutorial.vco.sh/tips/tokens/ (the old domain is now for sale)
A tutorial to help you make better Discord bots.
And since we're making a change anyway, there's inconsistent casing of python vs Python and programs in your programs environment is posessive so should be program's
In this bonus section I'll explain the 3 most common methods of storing the token for your bot. Note that for these examples you should assume that there is a bot defined somewhere else in the code, and the line bot.run(token) is at the bottom. I won't show the bot code in each example to show just the necessary information, and make this applic...
It's actually just at https://tutorial.vco.sh/tips/tokens/ now. I.e. vcokltfre purchased a different domain
A tutorial to help you make better Discord bots.
ah okay i see
yeah sure i can change those, you wish to co-author and suggest a change?
I can't sign in to my GH account atm, so if you're able to do it I'll just leave to you :)
Feel free to mention that it was suggested by me if you wish
sure thing will do, so all blame goes on you haha
Looks good, thanks @clever wraith :)
Now you just need to wait for a core-dev to come around and merge it
yeah
dont know if i should re-request review though
oh nvm
I just merged it
already merged
It's so small that I wouldn't've worried about it anyway tbh
!dotenv
.env (dotenv) files are a type of file commonly used for storing application secrets and variables, for example API tokens and URLs, although they may also be used for storing other configurable values. While they are commonly used for storing secrets, at a high level their purpose is to load environment variables into a program.
Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a .gitignore file.
In python you can use dotenv files with the python-dotenv module from PyPI, which can be installed with pip install python-dotenv. To use dotenv files you'll first need a file called .env, with content such as the following:
TOKEN=a00418c85bff087b49f23923efe40aa5
Next, in your main Python file, you need to load the environment variables from the dotenv file you just created:
from dotenv import load_dotenv()
load_dotenv(".env")
The variables from the file have now been loaded into your programs environment, and you can access them using os.getenv() anywhere in your program, like this:
from os import getenv
my_token = getenv("TOKEN")
For further reading about tokens and secrets, please read this explanation.
not here yet
Ah, need to wait for bot to restart
Wasn't sure whether that was the case for tags or not
it is deploying just now
!dotenv
.env (dotenv) files are a type of file commonly used for storing application secrets and variables, for example API tokens and URLs, although they may also be used for storing other configurable values. While they are commonly used for storing secrets, at a high level their purpose is to load environment variables into a program.
Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a .gitignore file.
In python you can use dotenv files with the python-dotenv module from PyPI, which can be installed with pip install python-dotenv. To use dotenv files you'll first need a file called .env, with content such as the following:
TOKEN=a00418c85bff087b49f23923efe40aa5
Next, in your main Python file, you need to load the environment variables from the dotenv file you just created:
from dotenv import load_dotenv()
load_dotenv(".env")
The variables from the file have now been loaded into your programs environment, and you can access them using os.getenv() anywhere in your program, like this:
from os import getenv
my_token = getenv("TOKEN")
For further reading about tokens and secrets, please read this explanation.
.env (dotenv) files are a type of file commonly used for storing application secrets and variables, for example API tokens and URLs, although they may also be used for storing other configurable values. While they are commonly used for storing secrets, at a high level their purpose is to load environment variables into a program.
Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a .gitignore file.
In Python you can use dotenv files with the python-dotenv module from PyPI, which can be installed with pip install python-dotenv. To use dotenv files you'll first need a file called .env, with content such as the following:
TOKEN=a00418c85bff087b49f23923efe40aa5
Next, in your main Python file, you need to load the environment variables from the dotenv file you just created:
from dotenv import load_dotenv
load_dotenv()
The variables from the file have now been loaded into your program's environment, and you can access them using os.getenv() anywhere in your program, like this:
from os import getenv
my_token = getenv("TOKEN")
For further reading about tokens and secrets, please read this explanation.
!dotenv
There we go :)
whop
@clever wraith By chance do you have time to give the required 2nd review for bot#2520?
It's been waiting for quite some time ๐
Sorry, I have to leave now.
I'll try to take a look when I'm back ! ๐
No worries, would appreciate if you could take a look later :)
@still comet I made a small oopsie, I tried to merge your PR, so when I rebased, it appears as if I co-authred
Can you force push your branch ? That'll clear it, and we'll merge it later
i was wondering why it is like that on mine #2730
How do I do that again?
git push --force i would say
(bot-py3.11) danielgu@1 python-bot % git checkout confirm-reminder-edit
Switched to branch 'confirm-reminder-edit'
Your branch is up to date with 'origin/confirm-reminder-edit'.
(bot-py3.11) danielgu@1 python-bot % git push --force
Everything up-to-date
``` Am I doing something wrong?
What does glo output?
*git log --oneline
(bot-py3.11) danielgu@1 python-bot % git log --oneline
25ab875f (HEAD -> confirm-reminder-edit, origin/confirm-reminder-edit) Prevent ghost pings when reminder modification is cancelled
bd7274f4 Ensure view gets deleted if view times out
75202828 Specify which action is being performed in confirmation message
c1829572 Apply changes from code review
34d6a4d3 Mention reminder owner in confirmation message
2a05c7bb Apply name changes from code review everywhere
ab930e68 Reply to original message when sending confirmation prompt
da48f9a1 Apply suggestions from code review
8ad236c0 Apply suggestions from code review
015b9956 Update docstring to better match function behavior
b9eae655 Ask for confirmation when an admin modifies another user's reminders
9d424c09 Create ModifyConfirmationView
c18abf8a Merge pull request #2730 from DownDev/fix-2728
9d2e5b20 feat(tags): update link and syntax in dotenv tag
Which PR is this again?
bot#2719
Hmm, sec
Are you on your forked repo?
I forget what half of my aliases are set to, gimme a sec
You made the changes on your fork, so no, you want to be on your fork
Okay
If you git checkout main && git pull does it say "up to date" or pull commits?
Already up to date.
Actually
I think I'm overcomplicating this
git checkout confirm-reminder-edit && git pull does this say "up to date"?
Also up to date
(bot-py3.11) danielgu@1 python-bot % git remote -v
origin https://github.com/n0Oo0Oo0b/python-bot.git (fetch)
origin https://github.com/n0Oo0Oo0b/python-bot.git (push)
upstream https://github.com/python-discord/bot.git (fetch)
upstream https://github.com/python-discord/bot.git (push)
(bot-py3.11) danielgu@1 python-bot %
What about git pull origin/confirm-reminder-edit?
(bot-py3.11) danielgu@1 python-bot % git pull origin/confirm-reminder-edit
fatal: 'origin/confirm-reminder-edit' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
(bot-py3.11) danielgu@1 python-bot %
(bot-py3.11) danielgu@1 python-bot % git pull origin confirm-reminder-edit
From https://github.com/n0Oo0Oo0b/python-bot
* branch confirm-reminder-edit -> FETCH_HEAD
Already up to date.
(bot-py3.11) danielgu@1 python-bot %
I'm not on the computer where I originally made the commits, does that matter?
I'm trying to remember how to do this
For some reason your local branch differs to the branch on github (https://github.com/n0Oo0Oo0b/python-bot/tree/confirm-reminder-edit)
git pull should fix that 
What happens if you do git checkout a8e9c14 && git push?
(@still comet)
(bot-py3.11) danielgu@1 python-bot % git checkout a8e9c14 && git push
error: pathspec 'a8e9c14' did not match any file(s) known to git
I'm guessing your local branch matches the remote because you've ran git pull
are you just trying to remove bella as a comitter?
But their git log doesn't match the remote log (commit hashes are different)
Yes
what's the pr?
Yeah, since I didn't have the changes on my laptop
^
bot#2719
this git log looks the same as remote to me
if you run git rebase --no-ff 9d424c098c0151a1051d2d86ff4349274b4250a0
then git push -f it should remove the committer info
Right, I was looking at the hashes on the PR rather than the remote
yea, that's where i was looking
the hashes are the same
Those hashes aren't the same..
Oh wait
It's inversed 
yea
That seems to have worked ```
(bot-py3.11) danielgu@1 python-bot % git rebase --no-ff 9d424c098c0151a1051d2d86ff4349274b4250a0
Current branch confirm-reminder-edit is up to date, rebase forced.
Successfully rebased and updated refs/heads/confirm-reminder-edit.
(bot-py3.11) danielgu@1 python-bot % git push -f
Enumerating objects: 76, done.
Counting objects: 100% (76/76), done.
Delta compression using up to 8 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (66/66), 6.30 KiB | 239.00 KiB/s, done.
Total 66 (delta 56), reused 55 (delta 55), pack-reused 0
remote: Resolving deltas: 100% (56/56), completed with 5 local objects.
To https://github.com/n0Oo0Oo0b/python-bot.git
- 25ab875f...ee194289 confirm-reminder-edit -> confirm-reminder-edit (forced update)
(bot-py3.11) danielgu@1 python-bot %
Mb lmao
ah yea, just need to do 1 more acutally
it's exclusive, so doesn't inclujde the commit hash you specify
if you run git rebase --no-ff 9d424c098c0151a1051d2d86ff4349274b4250a0~1
~1 means 1 before this
then git push -f again
is -f short for --force?
ye
(bot-py3.11) danielgu@1 python-bot % git rebase --no-ff 9d424c098c0151a1051d2d86ff4349274b4250a0~1
Current branch confirm-reminder-edit is up to date, rebase forced.
Successfully rebased and updated refs/heads/confirm-reminder-edit.
(bot-py3.11) danielgu@1 python-bot % git push -f
Enumerating objects: 77, done.
Counting objects: 100% (77/77), done.
Delta compression using up to 8 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (72/72), 6.81 KiB | 232.00 KiB/s, done.
Total 72 (delta 61), reused 60 (delta 60), pack-reused 0
remote: Resolving deltas: 100% (61/61), completed with 5 local objects.
To https://github.com/n0Oo0Oo0b/python-bot.git
+ ee194289...2bdd46a4 confirm-reminder-edit -> confirm-reminder-edit (forced update)
(bot-py3.11) danielgu@1 python-bot %
``` like this?
You can see here: https://github.com/python-discord/bot/pull/2719/commits
other than the co-authored ones ofc
Great, thanks for the help!
Taking this snekbox PR out of draft. I think it's better to split the work into separate PRs. I don't see a reason to wait for the API to merge this. https://github.com/python-discord/snekbox/pull/181
Ah alright cool, I'll bump my comment on the approach to an approval then :)
Thanks. Will leave it open for a bit longer to give others a chance to review
Can I please get a second review on bot#2520?
@woeful yew We can merge the RFC PR if you update the branch ๐
i just merged the fork with the upstream
Nice, I've merged the PR.
Thanks !
๐ first PR! :D
Does anyone need contributions?
there is always something to do on python discord repos
you can check issues on any project https://github.com/python-discord
@clever wraith thanks for the review on this; fyi I've just finished addressing your comments and rewriting the core logic. Haven't been able to test it yet but feel free to leave comments :).
Fwiw it helps if you ping me here on Discord when you leave reviews, since I'm not all-that-active on GitHub and can miss things
Sounds good, I'll have another look as soon as I can
Man, why does it post my comments when I cancel the review
Anyway, I was trying to get it but something came up, so i'll try to do it tomorrow
Yeah, no worries, thanks ๐
@static canyon @clever wraith just glancing at the OT name PR, haven't looked at it fully to leave a review, but keep in mind that fetching a name from the site api marks it as used
So you will need to make more requests to site afterwards to enable the ones you didn't use
you could also delete the ones that failed too.
I remeber reading a discussing where hemlock and mark said we don't want to do that as it's a shame to lose all the ones we've accumulated over time
That should be fine, we only don't use the ones that are prohibited, and as soon as discord prohibits us from doing the update, we mark the name as disabled.
Aaaah
I see what you mean
no, i mean you're fetching a lot of names from site up front, which disables them
Yes yes, good point
should the .rfc command be available in pygen or just in the places where ppl have perms to use general lancebot cmds?
By default the commands are limited to #sir-lancebot-playground (maybe a couple other channels) to help prevent spam in main channels, but I think it'd be okay to allow in #python-discussion (and the help channels if it isn't already) since it's not used that often and isn't a particularly spammy commands. It's basically the same as !pep and !pypi in size, which are already both allowed
Sounds worth creating an issue on the lancebot repo
Thanks for pointing that out; I have redone the logic a touch in 3b7364c -- I figured since it's so unlikely for a name to be invalid that it makes more sense to just fetch the extra channel name each time one fails (up to the MAX_RENAME_ATTEMPTS).
And just realised that if the final retry fails it'll still add a replacement (even though it won't be used), so added handling for that too
Unfortunately still don't have the time to properly test the rewrite
Are you sure that fetching a channel name marks it as inactive? I'm testing now and it doesn't seem to...
yea, if the 'random_items' kwarg is passed, then they will be marked as used
how many off topic names do you have in your test site?
async def _fetch_ot_names(self, count: int) -> list[str]:
try:
return await self.bot.api_client.get(
"bot/off-topic-channel-names", params={"random_items": count}
)
except ResponseCodeError as e:
log.error(f"Failed to get new off-topic channel names: code {e.response.status}")
raise```
Is `used` the same as `active`?
no, they're two different fields
No, those are distinct
active is it it'll ever come up again, even in future cycles
Only 3 atm, have only just gotten time to test stuff so am testing various amounts
how many are you requesting?
yea, on the first request, they should be marked at used
on the second call they will be made active again
๐ค
1st call -> succeeds, marks as used
2nd call -> ???
first call you'll get 3
actually yea, looking at the code this should work ust fine
it'll always return those 3, and it'll always set used to False
Yeah, I think it'll automatically reset everything on the 2nd call and then just return them again, and mark as used
Yeah
Yep
Oops
yup, channel edits have a tight rate limit
Do we care about multiple channels being renamed to the same thing being considered valid?
(It's an easy fix if we want that to be considered invalid)
how would that be possible?
Pool of names: ['a', 'b', 'c']
fetch 3 names -> ['a', 'b', 'c']
rename ot0 to 'a'
'a'isn't valid, so invalidate and fetch another name- will fetch either
'b'or'c', since all names are used (so sets to unused) - will try again. It (hypothetically) fetches
'b', which is valid, successfully renames
rename ot1 to 'b'
'b'is valid, so succeeds
ot0 and ot1 are now both called 'b'
I'm 90% convinced we don't want to allow that
So it relies on the pool of names being equal to the number being fetched?
if so, then ignore it, since we won't hit that scenario and it's not worth maintaining extra code
Nope. It's just the idea that the same name could be picked originally AND in a re-roll
how I thought we were getting site to send us all the names up front?
Nah, I changed that
^
so to hit this scenario then, we'd need to be close to the end of the available pool
fetch one that can't be set
We just need one name to be invalid
and then hit the 1 in 1000+ chance to get the same name after refreshing the pool?
If the name for ot0 is invalid, then it'll reroll and potentially fetch the same name as was selected for ot1/ot2
This is literally like a 3 line change
Because we just need to pass params={used: false}
only if the used flag was reset for all anmes, and then site miraculously returns a name that was fetched int he rpevioous call
since we fetch with random items, it will always fetch used=false
No, even without that it would
Oh, if it always does that then it's fine
yea, that's kinda the whole point of the flag
if you call with random_items, then it will fetch unused names
unless it has none left
then it will reset all names to unused and fetch how ever many you need
Right
So yeah, unless this happens it'll never hit a duplicate
yea, so just ignore it
So fyi @clever wraith bot#2520 should be ready for another review whenever you get a chance :)
After a few years this PR is good to go for final reviews I think https://github.com/python-discord/snekbox/pull/113
@still comet thanks for that reminder check PR!
@vale ibex nice test for the installation of deps! Would it be possible to move the find command into an external shell script and reference it in both the test and deployment.yml?
Yea good point that would be better, shiuld be trivial since both CI and the init container have access to the repo files
Can look at it later this evening when I'm home
Thanks I can review later today
snekbox#190
Unsure what's causing the permission issue
docker compose run --rm -T --entrypoint scripts/install_eval_deps.sh snekbox runs fine locally on a fresh image
alright sorted it, likely an issue with the -x bit not being set but somehow working locally
since when is the development category above bot commands ๐ณ
๐ค
docker compose baited me into thinking that the script would be included the actual image, raised snekbox#191
Can we modify dockerignore instead?
Or do you think it makes more sense to explicitly copy it earlier in the build
it already has an entry in docker ignore, we just don't copy that file into the final build stage
Don't we do copy .?
not in the final build step, no
snekbox is pip installed though
I wonder if the files are somewhere in the box
ah, no /usr/local/lib/python3.11/site-packages/snekbox just has the files from the snekbox dir itself (which makes sense thinking on it)
This is why we need to copy in requirements and config manually in the last stage too
please sir robin, just work ๐ฅบ
(I think my old robin configuration from 2022 is outdated)
uhhhh, okay updating the category ID fixed the first crash, but now this
making .rfc work in multiple channels is turning out... harder than expected
even @whitelist_override(bypass_defaults=True) doesnt work??
it's going to be an issue with one of the roles the cj cog needs being missing
I am planning to move to pydantic which will warn on boot if these are missing, rather than giving unreadable errors like this
I just went throught he same pain on the test server, Add ```
CODE_JAM_API=http://code_jam_management:8000
CATEGORY_SUMMER_CODE_JAM=999762973612589187
CODE_JAM_PARTICIPANTS=476190341566038027
BOT_SIR_ROBIN=804448198642892850
BOT_SIR_LANCEBOT=804448198642892850
BOT_PYTHON=804448198642892850
804448198642892850 is my bot's role, feel free to change it to your own bot's role
I've ran into a few dev annoyances around sir-robin, planning to fix each of them in a few PRs
I wonder if the bot could just infer that it's whatever category that has "code jam" in it. Worst case the channel is created in the wrong category
The participants role should be easy to infer as well
it does that already
it also creates one if one doesn't exist
then how did the error happen 
the error was for a role id not being set in config, rather than the category
the error in the screenshot is complaining about an overwrite target being None
Could Sir Robin get the extension reload command?
I'll pay you with my eternal gratitude if you could add that
yeah it took me like half an hour to fix my Sir Robin configuration last night...
would be good to get reviews on bot#2436 and bot#2439 if anyone has a chance, they've both been open for a while
reviewed ๐
hey i have one idea
like, maybe a bot which is assistant? like the feature in stackoverflow where it asks "is question related to these?" we can use it in python-help
or we can add it to sirlance bot
as a feature
I dont think being more like stackoverflow is a goal we should have.
besides that our help forum is meant to be a live conversation, meaning people are seeking help with specific problems, so I personally dont think this would fit in well here.
how would it even work? would we keep a cache of all help posts ever posted, or use discord search (can bots do that?) to find similar posts?
yes
it can make the users find the help a bit fast
if it's quite same
since you are on help channels topic i had an idea for a while to add dwm (did we manage) tag (can be named better just saw this name on few servers) that would simply tell user that if he doesnt need help anymore to run !close :)
ill make this an issue on meta prolly soon
I don't think this is really needed
We used to want people to close posts since we had a limit with the old system
Now that each person gets their own post, the timeout itself will do.
Like vivax said, the entire purpose is to get the conversational part
2 people might have the same question
But they won't necessarily ask the same followup questions
Or have the same base knowledge
The entire purpose of what we're trying to do is to give full liberty to the helpee to ask whatever they want and respond in real time
Plus, the complexity of what you're proposing is a bit not clear as we'll need more details
How will you manage the old posts and index them
And how do you see the content comparison being determined?
fair
Maybe your right
@clever wraith do you think you'll be able to take another look at bot#2520 soonโข๏ธ?
Hey,
I don't think I'll be able to have a look this weekend, I'll try to get to it during the week
Cool, thanks ๐
hey, having trouble running site with docker
full error: https://paste.pythondiscord.com/SB7Q
by investigating a bit i found that it comes from libsass cause they use https://github.com/sass/libsass-python/blob/main/setup.cfg#L9 outdated param it should be license_files quite not sure what to do from now
setup.cfg line 9
license_file = LICENSE```
Try installing the library manually with pip, and opening an issue upstream if it does not already exist
yeah i managed to get it working locally apparently doesnt work when docker tries to install it
we use the latest version of poetry in our dockerfile, so it's likely that new versions of peotry are using a newer version of setup tools to install packages
hi all, what's the status of pydis and hacktoberfest in relation to the hacktoberfest commands for sir lancebot?
according to this
#dev-branding message
we're still keeping the commands. but afaik hackstats is broken (possibly for almost 2 years). plus, we have a stale PR from sir-lancebot#919, which includes suggestions for improvements of logic in the cog, not to mention hacktoberfest accepting gitlab MRs now. I feel like if we're keeping the cog it should be fixed and not be left to grow spiderwebs (pun intended). since I wrote much of the unlinted code (
) for hackstats' 2020 logic, I feel responsible for picking up the work for refactoring the cog.
would this be in scope for sir lancebot? or are there newer updates internally to what we're going to do with this cog?
speaking of updates, the reason I'm unsure is that there were no public announcements in #announcements or #changelog AFAICT in 2021 (nor 2022) about this decision given that pydis participated in hacktoberfest since like 2018. the branding was archived and from a non-staff's perspective suddenly python bot starts announcing the halloween event rather than hacktoberfest. the only explanations visible were in #dev-contrib and #dev-branding
There was an internal decision made about how we (as a server) participate in Hacktoberfest. We didn't feel it necessary to announce we weren't making it a whole event because it wasn't widely participated in in this server and it's not an event we run either.
If someone would like to get the Hacktoberfest cog up and running they're certainly welcome to, but for me it's not at all a priority.
We're not a recruitment board.
if am not mistaken
python/peps#3418 might have broken our !pep command from the looks of it
since they have been moved from the root folder to peps/ folder our cache cant seem to build anything out of the request it gets
looks like we probably just have to update the pep listing api url
currently hitting https://api.github.com/repos/python/peps/contents?ref=main which doesn't have the peps in it anymore
looks like https://api.github.com/repos/python/peps/contents/peps?ref=main is the updated url
if am not mistaken https://api.github.com/repos/python/peps/contents/peps?ref=main would fix it
thanks bast
lmfao
Woulda been faster but github really didnt' want to link me to the actual api docs for some reason
hah
So this? ```diff
diff --git a/bot/exts/info/pep.py b/bot/exts/info/pep.py
index 08ccbddc..2b552dc4 100644
--- a/bot/exts/info/pep.py
+++ b/bot/exts/info/pep.py
@@ -14,7 +14,7 @@ log = get_logger(name)
ICON_URL = "https://www.python.org/static/opengraph-icon-200x200.png"
BASE_PEP_URL = "https://peps.python.org/pep-"
-PEPS_LISTING_API_URL = "https://api.github.com/repos/python/peps/contents?ref=main"
+PEPS_LISTING_API_URL = "https://api.github.com/repos/python/peps/contents/peps?ref=main"
pep_cache = AsyncCache()
lol np just running locally now
do put me on authors list though
looks good
Good/bad news! They're the same list
for a moment, you had me thinking that's an actual feature
what name 
bot#2758
is it even appropriate for me to review a PR I coauthored
Yea
The point of reviewing is to get multiple sets of eyes on the PR, so if multiple people worked on something, so long as they actually review their own code it achieves the same goal
Not to say that sometimes having fresh eyes on something isn't good
how does that work for one-line changes? 
I reviewed it then ๐ฉ
Hah yea, I'm talking more generally
One liners like this are better served by just testing the code works
^ @outer oasis

@fossil veldt Hey, any ideas why this test starts failing when both of the following are done?
- Upgrade the image to Debian Bookworm
- Enable
/dev/shmin the container (by way ofipc=private)
If only one of those is done, then the test passes (though on Bookworm, integ tests fail because shm is needed but Bookworm's newer version of glibc no longer falls back to /tmp when /dev/shm is missing)
tests/test_nsjail.py line 228
def test_file_parsing_timeout(self):```
hm... what's the failing assertion?
Oh sorry, meant to include that. The return code is 0 instead of None
Which I guess means it's not timing out at all.
The tests for the timer utility still pass though
strange, I wonder if it just read the files really quickly, or the symlinks just didn't work in the test script
perhaps add a test for result.files being empty? Or if you break there and see if it returned all the files 
Haven't set up remote debugging so won't be able to set breakpoint.
But yeah I could just try increasing the number of files
also by "enable dev/shm" you mean on the docker running snekbox or the nsjail container?
On the container. But we also merged a change recently to enable it in nsjail.
Though nsjail just uses a new tmpfs mount - it doesn't rely on /dev/shm
Well, I ran the test again with no changes and now it's fine?
IDK what's up
Ah, missed this conversation here and added some comments on the PR.
Found the issue after some further digging
the test is failing due to a timing issue, there's a race between the timeout and the max file size. If your PC is fast enough, you'll parse the number of files needed to hit the max file size limit before the timeout of 1s
so CI passes because it's (relatively) slow
@fossil veldt @tawdry vapor
the only way I've found to make this pass on my PC is to increase memfs_instance_size on that test
I had to double it to make it just go above 1s
It's easier to see this if you change the coverage command to target that test specifically so you get stdout IE ```diff
-'coverage run -m unittest; e=$?; chown --reference=. .coverage; exit $e'
+'coverage run -m unittest tests.test_nsjail.NsJailTests.test_file_parsing_timeout; e=$?; chown --reference=. .coverage; exit $e'
I'm guessing bookworm got faster at whatever that codepath is doing
Why would increasing the memfs size increase processing time? I would expect that to be correlated to the size of the files or the amount of files instead.
it seems to process one file at a time, summing the size of files as they're processed
so it will kepp processing files until either the timeout is hit, or the sum of processed files exceeds the memfs limit given
So increasing the memfs size lets it process more files which means more time spent
yea
and signal.alarm() only takes an integer amount of seconds, so we can't reduce timeout below 1 for the test
I'm confused why there are two different places where it tracks the time
One is with the with time_limit(self.files_timeout):. The other is in fs.files_list which uses time.monotonic. Do we really need both?
I shouldn't think so, the context manager should catch it in all cases since its sending an inturrupt
There was at least a 3rd place I saw us tracking time too, not sure if it's also under that context manager or not
Making some dinner atm
I'd rather not have our tests require a minimum of 1 GiB of RAM. I'm looking into using signal.setitimer instead of signal.alarm, since the former can accept a float
Hah yea seems like a reasonable call
snekbox/utils/timed.py line 34
signal.alarm(0)```
Does this mean it always raises a timeout exception when the context manager is exited?
It's supposed to "disable the alarm" according to one of the examples in the docs
That makes sense - if the code finishes early it shouldn't let the alarm still go through
lol i love snekbox
Haha yea I went through the same process earlier
Annoyingly windows doesn't support sigalrm so I don't get any intellisense feedback on signal.SIGALRM nor signal.alarm
Looking at it, there was a previous change that skips file processing when the the total size exceeds the instance size, so if the memfs instance size is too low it just skips further files and doesn't trigger the timeout - hence the test fail https://github.com/python-discord/snekbox/commit/16b1a13e206fa34bfc7af05363d5e78742e26e40
It might be better to change the test to mock patch the file read / base64 encode to do a time.sleep(2) with a parsing time limit of 1 or something
Was debating that but I was able to change the timer to support floats for timeouts, so we can set the timeout to be so low that pretty much any machine would time out
Why is this doing -5 by the way? https://github.com/python-discord/snekbox/blob/main/tests/test_nsjail.py#L236
tests/test_nsjail.py line 236
for _ in range((size // 1024) - 5):```
Yeah I guess that also works, essentially it just needs to test that it can actually interrupt when the time limit is up
I think it was exceeding the instance size without it or something? Don't really remember, the per file metadata / symlink also takes up some space or something 
The memfs size was being set to 512 MiB while the code was only writing 32 MiB - 5 if I understand correctly
I see symlinks are followed, so the total size includes the underlying file's size for each symlink. But that would mean the total size used by that test code would be like 2.7 GB
wouldn't each symlink be tiny?
Yeah but we keep a running total of the size of all encountered files. And we follow symlinks so we count the size of the underlying file, not the size of the symlink
ahhh right yea
So yea in that case memfs size might be 512MiB but in fact we don't actually use that much ram
But it's a running total so we don't need to set the memfs size to be over the total - it just needs to be large enough that we will timeout before we reach the size limit
I've updated the PR with a fix for that test now
Sorry, an unexpected error occurred. Please let us know!
ClientConnectorError: Cannot connect to host site.default.svc.cluster.local:80 ssl:default [Connect call failed ('10.128.90.73', 80)]
^ happens
Sorry, an unexpected error occurred. Please let us know!
ClientConnectorError: Cannot connect to host site.default.svc.cluster.local:80 ssl:default [Connect call failed ('10.128.90.73', 80)]
Yep, we're aware -- it's being investigated internally
Yea, it's all resolved now
I have an idea... what if (optionally) sharing code in help threads could work as a repository like GitHub? I.e. when a thread is created you get a repo link to which you could push your code to. And helpers could clone the repo to run code and suggest changes? Pushed code would show up as a bot message.
I'm not sure of how much of a benefit that will carry.
Being able to simplify the problem and explaining it is, IMO, a very good exercice for the helpee.
As you might know, we appreciate it when people demonstrate effort in implementing solutions and trying things, since that clearly says '' I've tried this, but it doesn't work and I don't know why '' instead of '' hey, do the work for me ''
Plus, all the implementation that this carries isn't trivial, how would you hook that repo to the appropriate channel? Who owns the repo? Etc.
To resume, I don't belive this will be of value to the system we already have.
Let's not mention people who might put malicious code, so that an innocent people trying to help get caught in it
All fair points. I was envisioning the help thread would still be the central point of communication.
And I guess for 95+% of help threads the user may not be familiar enough with a vcs to effectively use it
And for the 5% that are; they're probably already using one
Yes, that too.
Don't get me wrong, i didn't mean to kill your idea because it could indeed make some things easier.
It's just that when weighing out the pros and cons, it doesn't balance out.
yo @dull swan is there an issue for https://github.com/python-discord/bot/pull/2749?
I donโt think so, we were talking about it in PyGen and I just pushed the fix up real quick. I can make an issue for it.
@dull swan henlo it me again
I tested the PR, works as intended, very nice. Once another person approves, it'll be merged.

Thanks Xith!
@clever wraith Hello, I shall be testing this PR out in the very near future. In the meantime, could you fix the conflicts? Thanks!
sir-lancebot#1197
I have reviewed
Hellew,
I will try to get to it when I can, my pc has been broken for a while so i can't do much
Thanks for reviewing
rip compooper
Indeed, indeed
2 post didn't auto close in #1035199133436354600 after more than 1 hours
Without linking to the posts in question, there's not really anything we can do
(Also keep in mind it's an hour from last message, not an hour from opening)
Yeah
It was closed by a mod manually yesterday
Like one that exist for like 5 hours after last message
And another one have multiple section that have more than 1 hours of inactivity and didn't automatically closed
Again, without links there's nothing we can do
Most of the time though the issue is on Discord's end, not ours
Yeah, iirc those are both around the time discord was having issues yesterday, so I don't think it's anything too noteworthy in this case
But thanks for letting us know :)
1
I found this interesting:
https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_cog.py#L111
Since has_any_role throws an error instead of returning False, does that mean if someone that's not helper tries to use !title in a help channel, it'll throw an exception?
bot/exts/help_channels/_cog.py line 111
if not await commands.has_any_role(constants.Roles.helpers).predicate(ctx):```
If it does indeed throw an error, then yeah
But I imagine it's being handled somewhere
bot/exts/backend/error_handler.py lines 88 to 90
elif isinstance(e, errors.CheckFailure):
log.debug(debug_message)
await self.handle_check_failure(ctx, e)```
Altho it actually just gets silently suppressed in handle_check_failure
So even if it does error, it just gets silently suppressed, meaning you'd never notice it
Actually, think it's classified as a ContextCheckFailure, which means it'll just send a message saying you can't use the command in that channel
Tl;Dr; it errors, but it's handled via a message telling the invoker they can't use the command in that channel
Ah, interesting. I would've thought they'd just have done something like constants.Roles.helpers in {role.id for role in ctx.roles}
I guess it should technically instead use this util that we created: https://github.com/python-discord/bot/blob/main/bot/utils/checks.py#L97-L107
bot/utils/checks.py lines 97 to 107
async def has_any_role_check(ctx: Context, *roles: str | int) -> bool:
"""
Returns True if the context's author has any of the specified roles.
`โroles`โ are the names or IDs of the roles for which to check.
False is always returns if the context is outside a guild.
"""
try:
return await has_any_role(*roles).predicate(ctx)
except CheckFailure:
return False```
or that, yeah
I think it's more explicit
Left a review. @trim cradle cc^
More of a suggestion than requiring changes
@trim cradle ^ would be nice to keep the comment, but not a big thing
Heya fellas, coming through with some concerns involving the configure task in poetry
I'm setting up, plaster the guild id right into my .env, give 'er a whirl, and I'm getting a 404 back.
The route looks fine; I see nothing wrong with it at all. I've quadruple-checked to make sure I'm not pasting in the guild ID wrong or some other shenanigans, but no, everything is as it should be.
Am I missing something, or can someone replicate this behavior?
Which route is this? Also can you paste the traceback, if you have any?
Sure can, just a moment
here's the traceback,
it's on the guilds/{guild_id}/roles route
(also cool, I didn't know we switched to httpx internally
)
Hmmm, I'm a tad curious now, I'm going to mod the script a bit to see if a hunch does something
mmm, no
Perhaps it's transient? Discord did recently just die about half an hour ago. My bots went offline with 503. Maybe it's just that?
Mmm, no, I was having this issue last evening as well.
the earliest occurence being... ~17:00?
I'm assuming you've checked that the bot is already in the server which you're bootstrapping?
:3
well, now I can start working on making !raw a context menu thingie
gracias, robino

I didn't do anything but yeah, haha
Noted next time the API is acting up again. Just look at it funny.
Oh, and feel free to request a review from me on that one. I'm planning on taking on a similar PR (allow !raw to be used while replying to a message) so some insight on how you do it might be helpful
I was actually planning to squash both sequentially
but I will give you a shout for sure
thanks c:
Would be funny if the stable is corrupted
snekbox#195 is up for 3.12
Since the above PR has been merged, bot#2777 is up to update the bot's output
I've also added support for 3.12 in our poetry base image, but a few packages we use, such as mutlidict and yarl, don't support it quite yet. Might be a few weeks until we can bump the version in our projects
!eval command needs updating
#bot-commands message
3.11 eval job completed even though its 3.12
also its not possible to switch to 3.11 either way using !eval 3.11 <code> syntax
and i remember making pr about changing the description to this Currently only 3.11 version is supported. - should be changed also
look 2 messages up
oh. so you have a pr about it
Yea :D
๐
hi, so this is my first time contributing wanna get into open sourcing, have identified a small the issue and commented on it, how does it go from here?
#dev-log message
eventually wanna get to working on bigger bugs and bots issues as well
you wait for the core developer to comment on it and if its a real bug you can be assigned to it and start working to fix it
Oh okay thanks
!rule 6

