#dev-contrib

1 messages ยท Page 19 of 1

clever wraith
#

And don't hesitate to ask any questions in the issue/here

gritty wind
#

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

trim cradle
#
(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.

clever wraith
#

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

trim cradle
clever wraith
#

Ahahahha

#

All good ! ๐Ÿ˜„

cursive relic
#

Is this supposed to be like this? Or is it possibly supposed to be postgres?

atomic ivy
#

that's a typo

cursive relic
#

Does there happen to be an existing issue for it, I don't think I saw one

atomic ivy
#

typos don't need issue approval, I think ๐Ÿ˜…

#

(someone correct me, if I'm wrong)

static canyon
static canyon
cursive relic
#

I don't think I'm able to make one

static canyon
cursive relic
#

Ah, right. I don't need to pull the repo to local

static canyon
#

For such a small change you can use the GitHub site editor, yeah

cursive relic
#

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

static canyon
cursive relic
static canyon
cursive relic
#

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?

vale ibex
#

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

cursive relic
#

oh, right.. Would this be better instead: Fix a typo in bot.md leaving the rest as is

clever wraith
#

Or using conventional commits Like
fix: postgres typo in bot.md

cursive relic
#

Done, thank you everyone!

tall laurel
#

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

sharp crag
left nebula
#

@stable mountain devs
the bot got problems with converting hyperlinks in the docs command (sometimes)

#

!d setattr

stable mountainBOT
#

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..
left nebula
#

for example

vale ibex
#

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

left nebula
#

I couldn't imagine why it would work sometimes then

vale ibex
#

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

left nebula
#

so weird looking link (dunder links) wont get hyperlinked then?

#

that would make sense somewhere

#

discord is weird

vale ibex
#

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

left nebula
#

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

vale ibex
#

the only way to fix it would be to:

  1. intercept the docs text and alter it to work
  2. 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

left nebula
#

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)

cold island
vale ibex
#

Yea

stable mountainBOT
#

bot/exts/moderation/modlog.py line 653

content_before.append(f"[{sub}](http://o.hi)")```
brisk brook
#

It looks to be just for formatting, right?

vocal prairie
#

it's just to make things blue, yeah

#

it's not a real website

clever wraith
#

closed after warn

vale ibex
tawdry vapor
gritty wind
#

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

outer oasis
gritty wind
#

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.

clever wraith
#

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

clever wraith
clever wraith
#

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

thorny obsidian
#

@timid sentinel thanks for the quick review! Incorporated your comments with the latest commit

timid sentinel
#

No problem, just noticed one more thing, then all good as far as I'm concerned

outer oasis
stable mountainBOT
#

bot/exts/info/information.py lines 588 to 590

if invalid:
    await ctx.send(shorten(":x: Invalid rule indices: " + invalid, 75, placeholder=" ..."))
    return None```
clever wraith
#

I'd say no particular reason

outer oasis
#

What are peoples thoughts on adding the timed deletion here?

#

Mostly for consistency

clever wraith
timid sentinel
#

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.

clever wraith
#

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

cold island
#

If we want consistency I'd drop the timed deletion in other places as well lol, not a fan of them either

clever wraith
#

You could as well do it like in docs command

#

When its improper symbol then you delete embed with command

gritty wind
#

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

thorny obsidian
#

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

vale ibex
#

@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

clever wraith
#

Yeah, I added it myself

vale ibex
clever wraith
#

But we can eventually just short-circuit the conversion

#

You forgot to inherit BaseModel

vale ibex
#

it doesn't need to

clever wraith
#

(Do we even need it ?)

#

yeah

#

Ah no

#

No no, never mind

clever wraith
#

I misunderstood, sorry

#

But now no conversion happens, does discordpy take hex values ?

#

Nvm

#

This is not my day

vale ibex
#

hah no worries

#

alright, commits be cleaned

clever wraith
#

Sweet!

plush birch
still comet
dusky shoreBOT
plush birch
#

It was very complicated but I think I pulled it off ;)

- ["paid", "work", "money"]
+ ["pay", "paid", "work", "money"]
timid sentinel
#

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 ๐Ÿ˜

still comet
#

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

vale ibex
still comet
#

I'm still getting the same error

clever wraith
#

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?

clever wraith
#

And if you don't want to block yourself for now, you can use fake redis

still comet
clever wraith
#

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

clever wraith
still comet
still comet
still comet
#

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)```
clever wraith
#

Do you have the latest changes ?

#

Did you sync your fork, pull latest main changes, and checkout from that ?

still comet
#

I synced it yesterday

clever wraith
still comet
clever wraith
#

Can you tell me what the output of git log --oneline -n 1 --format=%H is ?

still comet
still comet
clever wraith
still comet
#

Yeah I made some changes

#

I stashed them and it works now ๐Ÿ™‚

clever wraith
#

Great

still comet
#

Thanks for the help!

clever wraith
#

Sure

#

Let's try solving the other one now

#

Is the postgres container running ?

still comet
#

Yes

clever wraith
#

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 ?

still comet
#

Yeah

clever wraith
#

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)

clever wraith
#

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

still comet
#

I gtg now, hopefully we can fix this next time.

clever wraith
#

in reference to bot#2722 the pep 0 embed already applies this functionality

dusky shoreBOT
clever wraith
#

!pep 8

stable mountainBOT
#
**PEP 8 - Style Guide for Python Code**
Status

Active

Created

05-Jul-2001

Type

Process

clever wraith
#

!pep 0

stable mountainBOT
clever wraith
static canyon
stable mountainBOT
#

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```
clever wraith
#

just another reason to implement it in normal peps

clever wraith
#

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 ?

dusky shoreBOT
static canyon
clever wraith
static canyon
#

Could probably even edit _close_help_post to take a custom message argument, which if not provided will just send the current message

clever wraith
#

Also should i create a ClosingReason for USER_BANNED or something Like that

#

In _stats

#

There is the enum

static canyon
#

That seems smart, yes

clever wraith
#

Okay sure ill claim the issue then

static canyon
#

I'd probably go for OP_BANNED just to be explicit about which user got banned

#

Or CLAIMANT_BANNED actually to use consistent terminology

clever wraith
#

Will do

last trout
#

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?

clever wraith
#

@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

clever wraith
#

!contribute

stable mountainBOT
#
Contribute to Python Discord's open source projects

Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!

Projects to Contribute to
โ€ข Sir Lancebot - our fun, beginner-friendly bot
โ€ข Python - our utility & moderation bot
โ€ข Site - resources, guides, and more

Where to start

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
clever wraith
#

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

clever wraith
#

@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

still comet
#

Oh okay, I'll try that tomorrow

clever wraith
tawdry vapor
# gritty wind Arl suggested installing them separately to ensure we can have different version...

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.

clever wraith
#

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.

clever wraith
#

I thought we'd want to pass the version through snekbox, then relay to NSJail

tawdry vapor
#

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

clever wraith
#

Sounds good to me

tawdry vapor
#

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

vale ibex
#

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

tawdry vapor
#

Cool, that fixed it. Thanks!

#

Any context on why we have to do this with Debian 12?

vale ibex
#

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

tawdry vapor
#

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

vale ibex
#

Huh alright, back to the drawing board then lol

#

It's getting late here, i can look into it more tomorrow though

tawdry vapor
#

Thanks. I think I will just drop this change and worry about updating debian some other time.

vale ibex
#

Sounds good

#

Ooi is it on debian 11 now?

tawdry vapor
#

12

#

Oh currently it is on 11. I am trying to update to 12

vale ibex
#

Ah yea alright, wasn't sure if you were going alpine->bookworm or plain debian bump

tawdry vapor
tawdry vapor
clever wraith
#

yo is any of those considered applying
bot#2646
bot#2679
meta#217

gritty wind
#

You should bump the meta issue in #community-meta as the more relevant audience

clever wraith
#

@timid sentinel you mind helping me why does it still show the commits from the old PR? i already pulled them so idk

timid sentinel
#

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.

clever wraith
#

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}}"
clever wraith
#

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

vale ibex
clever wraith
#

not big of a change

clever wraith
vale ibex
#

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

clever wraith
#

ah nice

#

what does that do

clever wraith
vale ibex
#

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

vale ibex
#

Yea

outer oasis
#

I thought it just showed you

vale ibex
#

nah page load triggers a recalc

outer oasis
#

huh

#

TIL

clever wraith
#

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?

dusky shoreBOT
clever wraith
#

scrolling through pinnwand docs and only found how to upload via api

sharp crag
#

Note the /raw/

clever wraith
#

ah okay i see

#
C:\Users\PC>curl https://paste.pythondiscord.com/raw/M45Q
print("Hello World")
``` seems to be working
clever wraith
clever wraith
#

i guess ill wait until they add that to api?

sharp crag
#

Looks like the author already has a PR for that so yeah

clever wraith
#

https://bpa.st/json/show/LOSA this way i also get the lexer

clever wraith
#

i feel like yall hate me for finding such small things skull
talking bout bot#2728 now

dusky shoreBOT
clever wraith
#

funny how it was there for 2 years now

clever wraith
static canyon
#

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

clever wraith
#

Yeah

zealous spoke
vale ibex
clever wraith
#

You need to decide if you are doing it or not

vale ibex
clever wraith
#

Glad to hear that's it might be available

vale ibex
#

/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:
#

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?

tawdry vapor
#

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?

tawdry vapor
tawdry vapor
#

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

vale ibex
vale ibex
clever wraith
#

@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

stable mountainBOT
#

bot/exts/info/doc/_parsing.py line 226

markdown_converter=DocMarkdownConverter(bullets="โ€ข", page_url=url),```
clever wraith
#

oh i guess im being stupid and this parser is not being used for tags

vale ibex
#

it's used for the docs command

clever wraith
#

i see

#

so, should i replace all โ€ข in tags to -

#

let me show you difference

#

before - after

vale ibex
#

yea seems fine, I think there'a few command doc strings that use that bullet too

#

!help mute

stable mountainBOT
#
Command Help

!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.

vale ibex
#

!src mute

stable mountainBOT
#
Command: timeout

Timeout a user for the given reason and duration.

Source Code
clever wraith
#

the !patreon supporters does use it

#

#bot-commands message

vale ibex
#

this uses an indent character for the effect, but a md list might be better, would need ot see what it looks liek

vale ibex
clever wraith
vale ibex
#

Yea

clever wraith
#

one second

#

well didnt go as planned

#

ill see what i can do about it later on

#

now let me modify all tags

tawdry vapor
clever wraith
#

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

dusky shoreBOT
clever wraith
#

It seems there are 2 open PRs to solve this issue

#

?

#

bot#2729

dusky shoreBOT
clever wraith
#

i see

#

but he didnt solve everything what was supposed to be

#

Let me handle that

clever wraith
#

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

static canyon
#

You can redo the commit message ^

clever wraith
clever wraith
static canyon
#

Looks like the command is wrong (doesn't handle forks properly or something)

clever wraith
#

That's strange, I tested it on a fork from my github alt account

#

I'll look into it later

vale ibex
#

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

clever wraith
tawdry vapor
vale ibex
clever wraith
stable mountainBOT
#

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.```
clever wraith
vale ibex
static canyon
clever wraith
static canyon
#

Hmm, probably because it has to start with a -

#

It might not be possible then

clever wraith
static canyon
#

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 Shrug

stable mountainBOT
#

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```
vale ibex
#

this is the logic we use to format the help command

clever wraith
#

should i leave it?

cold island
#

!help clean

stable mountainBOT
#
Command Help

!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.

cold island
# clever wraith

Seems like there are empty lines between the bullet points here

cold island
clever wraith
static canyon
#

Makes it easier to read

cold island
#

!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.
stable mountainBOT
#
  • โ€‹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.
cold island
static canyon
#

Ah yes, nice

static canyon
cold island
clever wraith
#
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

cold island
clever wraith
#

it changes nothing

vale ibex
#

\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
#

ย 

#

!e print("\u00A0")

stable mountainBOT
#

@clever wraith :warning: Your 3.11 eval job has completed with return code 0.

ย 
clever wraith
#

thats no break space

#

!charinfo

stable mountainBOT
#
Missing required argument

characters

#
Command Help

!charinfo <characters>
Shows you information on up to 50 unicode characters.

clever wraith
#

well it doesnt even see that

vale ibex
#

some whitespace gets stripped by Discord, so you might need to use a different zero-width space char

clever wraith
#

!charinfo x y

stable mountainBOT
vale ibex
#

will need some experimentation

clever wraith
#

hmm just a space

#

i know for a fact that this one แ…Ÿ is not being stripped

#

!charinfo แ…Ÿ

stable mountainBOT
vale ibex
#

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

cold island
#

Like, what prompted the idea we should change it?

vale ibex
#

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

cold island
#

ah, you think there's a character that'll work with the bullet points?

vale ibex
#

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

clever wraith
#

cant you create a regex that adds new line when on the next line there is a - (im regex noob)

cold island
clever wraith
static canyon
dusky shoreBOT
static canyon
#

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

clever wraith
# static canyon <@456226577798135808> for bot#2730 we should probably also update the "further r...
static canyon
clever wraith
#

yeah sure i can change those, you wish to co-author and suggest a change?

static canyon
#

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

clever wraith
static canyon
#

Looks good, thanks @clever wraith :)

#

Now you just need to wait for a core-dev to come around and merge it

clever wraith
#

yeah

#

dont know if i should re-request review though

#

oh nvm

#

I just merged it

#

already merged

static canyon
#

!dotenv

stable mountainBOT
#
Using .env files in Python

.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.

clever wraith
#

not here yet

static canyon
#

Ah, need to wait for bot to restart

#

Wasn't sure whether that was the case for tags or not

clever wraith
#

it is deploying just now

static canyon
#

!dotenv

stable mountainBOT
#
Using .env files in Python

.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.

#
Using .env files in Python

.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.

clever wraith
#

!dotenv

static canyon
#

There we go :)

clever wraith
#

whop

static canyon
#

@clever wraith By chance do you have time to give the required 2nd review for bot#2520?

static canyon
#

It's been waiting for quite some time ๐Ÿ˜…

clever wraith
#

Sorry, I have to leave now.
I'll try to take a look when I'm back ! ๐Ÿ˜„

static canyon
#

No worries, would appreciate if you could take a look later :)

clever wraith
#

@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

still comet
#

Sure

#

@clever wraith ping

clever wraith
still comet
#

How do I do that again?

clever wraith
#

git push --force i would say

still comet
#

So I can't do it on mobile?

#

I'll do it when I get home then

clever wraith
#

Sorry again

still comet
# clever wraith `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?
static canyon
#

*git log --oneline

still comet
#
(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
still comet
#

bot#2719

dusky shoreBOT
static canyon
#

Hmm, sec

static canyon
still comet
#

yeah

#

Should I be on the actual repo?

static canyon
#

I forget what half of my aliases are set to, gimme a sec

static canyon
still comet
#

Okay

static canyon
#

If you git checkout main && git pull does it say "up to date" or pull commits?

still comet
#

Already up to date.

static canyon
#

Actually

#

I think I'm overcomplicating this

#

git checkout confirm-reminder-edit && git pull does this say "up to date"?

still comet
#

Also up to date

static canyon
#

Huh

#

What does git remote -v output?

still comet
#
(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 % 
static canyon
#

What about git pull origin/confirm-reminder-edit?

still comet
#
(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 % 
static canyon
#

Err

#

Maybe a space instead of the /

still comet
#
(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?

static canyon
#

I'm trying to remember how to do this

#

git pull should fix that Shrug

#

What happens if you do git checkout a8e9c14 && git push?

#

(@still comet)

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
vale ibex
#

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?

static canyon
vale ibex
#

what's the pr?

still comet
static canyon
still comet
#

bot#2719

dusky shoreBOT
vale ibex
#

if you run git rebase --no-ff 9d424c098c0151a1051d2d86ff4349274b4250a0

#

then git push -f it should remove the committer info

static canyon
vale ibex
#

the hashes are the same

static canyon
#

Those hashes aren't the same..

#

Oh wait

#

It's inversed facepalm

vale ibex
#

yea

still comet
# vale ibex then `git push -f` it should remove the committer info

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 %
static canyon
vale ibex
#

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

static canyon
#

Yeah

#

All git stuff is exclusive on commits iirc

vale ibex
#

then git push -f again

clever wraith
#

is -f short for --force?

vale ibex
#

ye

still comet
#
(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?
vale ibex
#

yup, that's done it

#

all your's now

vale ibex
#

other than the co-authored ones ofc

still comet
#

Great, thanks for the help!

vale ibex
#

np

#

will merge once lint passes :)

tawdry vapor
vale ibex
tawdry vapor
#

Thanks. Will leave it open for a bit longer to give others a chance to review

static canyon
#

Can I please get a second review on bot#2520?

clever wraith
#

@woeful yew We can merge the RFC PR if you update the branch ๐Ÿ˜„

woeful yew
clever wraith
#

Nice, I've merged the PR.
Thanks !

woeful yew
#

๐ŸŽ‰ first PR! :D

pulsar elk
#

Does anyone need contributions?

clever wraith
static canyon
# static canyon Can I please get a second review on bot#2520?

@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

clever wraith
#

Sounds good, I'll have another look as soon as I can

clever wraith
#

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

static canyon
vale ibex
#

@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.

clever wraith
clever wraith
#

Aaaah

#

I see what you mean

vale ibex
clever wraith
#

Yes yes, good point

woeful yew
#

should the .rfc command be available in pygen or just in the places where ppl have perms to use general lancebot cmds?

static canyon
#

Sounds worth creating an issue on the lancebot repo

static canyon
#

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

static canyon
vale ibex
#

how many off topic names do you have in your test site?

static canyon
vale ibex
#

no, they're two different fields

thorny obsidian
#

No, those are distinct

#

active is it it'll ever come up again, even in future cycles

static canyon
# vale ibex .

Only 3 atm, have only just gotten time to test stuff so am testing various amounts

vale ibex
#

how many are you requesting?

static canyon
#

3

#

Actually, that's another point

vale ibex
#

yea, on the first request, they should be marked at used

#

on the second call they will be made active again

static canyon
#

๐Ÿค”

static canyon
#

1st call -> succeeds, marks as used
2nd call -> ???

vale ibex
#

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

static canyon
#

Yeah, I think it'll automatically reset everything on the 2nd call and then just return them again, and mark as used

#

Yeah

vale ibex
#

yup, channel edits have a tight rate limit

static canyon
#

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)

vale ibex
#

how would that be possible?

static canyon
# vale ibex 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

vale ibex
#

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

static canyon
vale ibex
#

how I thought we were getting site to send us all the names up front?

static canyon
vale ibex
#

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

static canyon
#

We just need one name to be invalid

vale ibex
#

and then hit the 1 in 1000+ chance to get the same name after refreshing the pool?

static canyon
#

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}

vale ibex
#

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

static canyon
static canyon
vale ibex
#

yea, that's kinda the whole point of the flag

static canyon
#

Hmm

#

But does that persist across separate calls?

vale ibex
#

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

static canyon
#

Right

static canyon
vale ibex
#

yea, so just ignore it

static canyon
#

Okay, cool

#

Right, found a few issues in testing that I've now fixed: c8705f8

static canyon
tawdry vapor
hoary haven
#

@still comet thanks for that reminder check PR!

tawdry vapor
#

@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?

vale ibex
#

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

tawdry vapor
#

Thanks I can review later today

vale ibex
vale ibex
#

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

clever wraith
#

since when is the development category above bot commands ๐Ÿ˜ณ

cold island
#

๐Ÿค”

vale ibex
#

docker compose baited me into thinking that the script would be included the actual image, raised snekbox#191

dusky shoreBOT
tawdry vapor
#

Or do you think it makes more sense to explicitly copy it earlier in the build

vale ibex
vale ibex
#

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

full fractal
#

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

woeful yew
#

making .rfc work in multiple channels is turning out... harder than expected

#

even @whitelist_override(bypass_defaults=True) doesnt work??

woeful yew
#

update: i added @commands.guild_only() and it works

#

why

vale ibex
#

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

vale ibex
cold island
#

The participants role should be easy to infer as well

vale ibex
#

it also creates one if one doesn't exist

cold island
vale ibex
#

the error in the screenshot is complaining about an overwrite target being None

full fractal
#

I'll pay you with my eternal gratitude if you could add that

full fractal
timid sentinel
#

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

coarse salmon
#

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

kind flower
#

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?

coarse salmon
#

it can make the users find the help a bit fast

#

if it's quite same

clever wraith
#

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

clever wraith
#

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.

clever wraith
#

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?

patent pivot
#

PR closure speedrun? thoughts?

coarse salmon
#

Maybe your right

clever wraith
#

Great work!

static canyon
#

@clever wraith do you think you'll be able to take another look at bot#2520 soonโ„ข๏ธ?

clever wraith
static canyon
#

Cool, thanks ๐Ÿ˜„

clever wraith
stable mountainBOT
#

setup.cfg line 9

license_file = LICENSE```
gritty wind
#

Try installing the library manually with pip, and opening an issue upstream if it does not already exist

clever wraith
#

yeah i managed to get it working locally apparently doesnt work when docker tries to install it

vale ibex
rapid igloo
#

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 (lemon_grimace) 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

dusky shoreBOT
thorny obsidian
#

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.

atomic ivy
#

We're not a recruitment board.

subtle kraken
#

if am not mistaken
python/peps#3418 might have broken our !pep command from the looks of it

dusky shoreBOT
subtle kraken
#

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

sharp timber
#

looks like we probably just have to update the pep listing api url

subtle kraken
#

if am not mistaken it could be just 1 loc change?

#

yeah yeah

sharp timber
#

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

subtle kraken
#

if am not mistaken https://api.github.com/repos/python/peps/contents/peps?ref=main would fix it

#

thanks bast

sharp timber
#

lmfao

#

Woulda been faster but github really didnt' want to link me to the actual api docs for some reason

subtle kraken
#

hah

vale ibex
#

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()

subtle kraken
#

sgtm

#

but dont put me on the blamelist thanks

vale ibex
#

lol np just running locally now

subtle kraken
#

do put me on authors list though

vale ibex
#

looks good

atomic ivy
subtle kraken
#

just put NO BLAME next to my name

#

thanks

atomic ivy
#

for a moment, you had me thinking that's an actual feature

vale ibex
#

pelase give co-authored-by name & email

#

ty

#

also Bast if you want to be on commit

subtle kraken
vale ibex
#

github Co-authored-by

#

need your gh username and email

subtle kraken
#

sowwy
never used that feat, lemme find my email

#

the gh public one innit

vale ibex
#

yea

#

git config --get user.name && git config --get user.email

#

will do it

subtle kraken
#
Senjan21
53477086+Senjan21@users.noreply.github.com```
#

thanks

vale ibex
#

bot#2758

dusky shoreBOT
subtle kraken
#

is it even appropriate for me to review a PR I coauthored

vale ibex
#

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

atomic ivy
#

how does that work for one-line changes? pithink

subtle kraken
#

I reviewed it then ๐Ÿ˜ฉ

vale ibex
#

Hah yea, I'm talking more generally

#

One liners like this are better served by just testing the code works

outer oasis
tawdry vapor
#

@fossil veldt Hey, any ideas why this test starts failing when both of the following are done?

  1. Upgrade the image to Debian Bookworm
  2. Enable /dev/shm in the container (by way of ipc=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)

stable mountainBOT
#

tests/test_nsjail.py line 228

def test_file_parsing_timeout(self):```
fossil veldt
tawdry vapor
#

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

fossil veldt
#

perhaps add a test for result.files being empty? Or if you break there and see if it returned all the files pithink

tawdry vapor
#

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

fossil veldt
tawdry vapor
#

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

vale ibex
#

Ah, missed this conversation here and added some comments on the PR.

vale ibex
#

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

tawdry vapor
vale ibex
#

so it will kepp processing files until either the timeout is hit, or the sum of processed files exceeds the memfs limit given

tawdry vapor
#

So increasing the memfs size lets it process more files which means more time spent

vale ibex
#

yea

#

and signal.alarm() only takes an integer amount of seconds, so we can't reduce timeout below 1 for the test

tawdry vapor
#

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?

vale ibex
#

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

tawdry vapor
vale ibex
#

Hah yea seems like a reasonable call

tawdry vapor
#

How does this work? Why does it alarm again in the finally block?

stable mountainBOT
#

snekbox/utils/timed.py line 34

signal.alarm(0)```
tawdry vapor
#

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

patent pivot
#

lol i love snekbox

tawdry vapor
vale ibex
#

Annoyingly windows doesn't support sigalrm so I don't get any intellisense feedback on signal.SIGALRM nor signal.alarm

fossil veldt
#

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

tawdry vapor
#

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

stable mountainBOT
#

tests/test_nsjail.py line 236

for _ in range((size // 1024) - 5):```
fossil veldt
fossil veldt
tawdry vapor
#

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

vale ibex
#

wouldn't each symlink be tiny?

tawdry vapor
#

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

vale ibex
#

ahhh right yea

#

So yea in that case memfs size might be 512MiB but in fact we don't actually use that much ram

tawdry vapor
#

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

vale ibex
#

Nice one

#

I love being bleeding edge

cursive relic
#

Rule command seems to be down for some reason (and maybe !d as well?)

#

!rule ad

stable mountainBOT
#

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)]

cursive relic
#

^ happens

stable mountainBOT
#

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)]

static canyon
#

Yep, we're aware -- it's being investigated internally

vale ibex
#

Yea, it's all resolved now

grim prairie
#

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.

clever wraith
# grim prairie I have an idea... what if (optionally) sharing code in help threads could work a...

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

grim prairie
#

And for the 5% that are; they're probably already using one

clever wraith
#

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.

vocal wolf
dull swan
vocal wolf
#

nah, was just wondering if there were other examples of the problem

#

it's all good

vocal wolf
#

@dull swan henlo it me again

I tested the PR, works as intended, very nice. Once another person approves, it'll be merged.

shipit

vocal wolf
#

@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

dusky shoreBOT
vocal wolf
#

I have reviewed

clever wraith
#

Thanks for reviewing

clever wraith
#

Indeed, indeed

devout sand
static canyon
#

(Also keep in mind it's an hour from last message, not an hour from opening)

devout sand
#

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

static canyon
#

Most of the time though the issue is on Discord's end, not ours

static canyon
#

But thanks for letting us know :)

devout sand
#

Oh ok

#

Np

signal saffron
#

1

sharp crag
stable mountainBOT
#

bot/exts/help_channels/_cog.py line 111

if not await commands.has_any_role(constants.Roles.helpers).predicate(ctx):```
static canyon
#

If it does indeed throw an error, then yeah

#

But I imagine it's being handled somewhere

stable mountainBOT
#

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)```
static canyon
#

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

static canyon
sharp crag
#

Ah, interesting. I would've thought they'd just have done something like constants.Roles.helpers in {role.id for role in ctx.roles}

static canyon
stable mountainBOT
#

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```
sharp crag
#

or that, yeah

#

I think it's more explicit

#

Left a review. @trim cradle cc^

#

More of a suggestion than requiring changes

static canyon
#

@trim cradle ^ would be nice to keep the comment, but not a big thing

gleaming jay
#

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?

sharp crag
gleaming jay
#

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 wigglewoo)

sharp crag
#

That route does seem correct. And since you say you've checked the guild ID...

gleaming jay
#

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

sharp crag
#

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?

gleaming jay
#

Mmm, no, I was having this issue last evening as well.

#

the earliest occurence being... ~17:00?

sharp crag
#

I'm assuming you've checked that the bot is already in the server which you're bootstrapping?

gleaming jay
#

Yep yep.

#

Odd, it worked this time.

#

The hell?

sharp crag
#

Discord is drunk again it seems

gleaming jay
#

:3

#

well, now I can start working on making !raw a context menu thingie

#

gracias, robino

sharp crag
#

I didn't do anything but yeah, haha

gleaming jay
#

you gave some mean side-eye

#

put the api back in its place

sharp crag
#

Noted next time the API is acting up again. Just look at it funny.

sharp crag
gleaming jay
#

I was actually planning to squash both sequentially

#

but I will give you a shout for sure

sharp crag
#

thanks c:

devout sand
vale ibex
#

snekbox#195 is up for 3.12

dusky shoreBOT
vale ibex
#

Since the above PR has been merged, bot#2777 is up to update the bot's output

dusky shoreBOT
vale ibex
#

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

clever wraith
#

!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

clever wraith
#

oh. so you have a pr about it

vale ibex
#

Yea :D

clever wraith
#

๐Ÿ‘

median ferry
#

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

clever wraith
median ferry
#

Oh okay thanks

atomic ivy
#

!rule 6

stable mountainBOT
#

6. Do not post unapproved advertising.