#dev-contrib

1 messages · Page 175 of 1

gritty wind
#

I can't do that because during the cog_load function, the cog is not loaded

#

I'd need to call it from inside the cog_load to run after cog_load

cold island
#

Ah

gritty wind
#

Best I can think of that isn't hacky is to:

  1. Modify the dispatcher to take a return value and call unload itself, but that seems like a lot of hassle, and I think the dispatcher is actually in bot-core?
  2. Add a post-load event, but i can't speak to the complexity of that yet
#

A hacky approach would be to just call asyncio.call_later or something

cold island
#

What if you raise an error from the init?

gritty wind
#

Well, I won’t have this info ready from the init, but I can try raising an error in the load?

cold island
#

Ah yeah the load

#

That's what I meant

gritty wind
#

Documentation doesn’t specify what happens in that case, I think I’ll just try it

cold island
#

If that doesn't work you could try asking in the v2 feedback channel in the dpy server

vale ibex
#

bot#2151 so that we start collecting stats again 😅

dusky shoreBOT
vale ibex
gritty wind
#

Is there a particular exception you'd like to see here?

vale ibex
#

Is there a cog load error or similar in ext.commands?

gritty wind
#

ExtensionError, ExtensionFailed or ExtensionNotLoaded though the last seems unrelated

#

are these documented

vale ibex
#

No idea, maybe a custom error off those, or a custom error from runtime error IG

gritty wind
#

An exception raised when an extension failed to load during execution of the module or setup entry point.

#

That's for uh

#

ExtensionFailed

#

ExtensionError is a base, so if this isn't satisfactory, we can subclass that

#

Though it seems to be in the right spirit

vale ibex
#

Yea sounds good

gritty wind
#

It gets logged as an exception from scheduling since it's a task error, but besides that it gets the job done

vale ibex
#

You could add your own callback iirc

#

But probably fine anyway

gritty wind
#

O

#

I've pushed again now, give it a looksie please

vale ibex
#

I shall once I've cooked dinner 😅

gritty wind
#

Thanks Chris :D

vale ibex
gritty wind
#

Thank you Chris, I appreciate your honesty 🥲

austere hornet
#

Lmfao

gritty wind
#

Can’t tell if serious or high-effort meming

#

@last patio explain

last patio
#

This is 26 days late

vocal prairie
#

Is that... phoenix?

#

looks cool

last patio
#

I also don't know how to delete it anymore

#

Branches are temporary, but apparently, commits are forever

#

🥲

last patio
#

I wanted to push this on April 1st but for some reason forgot about it

gritty wind
#

Haha it’s fine

#

Cool Easter egg for the dedicated

surreal veldt
placid ermine
#

hmm why does Sir Robin not use botcore yet

gritty wind
#

A couple large PRs are pending with conflicting changes, so easiest to let them through first

#

Also possible no one has picked that up yet

placid ermine
#

hmm

#

not a big deal

#

however
bigger problem
i have site running in a docker container
i'm trying to use botcore.site_api.APIClient
when i do a GET on localhost:8000/api/healthcheck in my ipython shell, it works

but neither localhost:8000 not web:8000 work when i do it in my bot running in docker, giving me these errors respectively:

CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host web:8000 ssl:default [Temporary failure in name resolution]
cold island
#

If you started the containers separately you should have them on the same docker network. I think there's a page on it in our setup guides

placid ermine
#

oh

#

found it, i need to add COMPOSE_PROJECT_NAME to the .env?

cold island
#

Yeah

#

Hmm at least as I recall

#

If Robin uses the site, does the compose not start the site for you? Or are you modifying the site as well?

#

A third option is to start the bot locally, I've found it to be much more convenient for debugging

placid ermine
cold island
#

If the site already has the endpoints for Robin on the main branch, then you should just modify the compose to include the site. You'll want it to be part of the PR anyway

placid ermine
#

no site doesnt have the endpoints either, i'm going to do that too

#

hm i'll update the compose too then soon

vale ibex
#

if you're making changes to site & robin at the same time, you can set the robin compose to use your local site image, rather than the ghcr image while in dev

placid ermine
#

also, i made the URLs class in robin's constants.py, and currently put site_api = "web:8000/api" there
i imagine in prod it will be "site.default.svc.cluster.local/api" like in @stable mountain's config-default.yml, do i have to change back and forth between the two when in dev and when committing?

vale ibex
#

it would be better if it was controlled with an env var

placid ermine
#

hm, doable

vale ibex
#

Do we use pydantic settings in robin?

placid ermine
vale ibex
placid ermine
#

hm

vale ibex
#
  web:
    image: <name of local image here> OR ghcr.io/python-discord/site:latest
    command: ["run", "--debug"]
    networks:
      default:
        aliases:
          - api.web
          - admin.web
          - staff.web
    ports:
      - "127.0.0.1:8000:8000"
    tty: true
    environment:
      DATABASE_URL: postgres://pysite:pysite@postgres:5432/pysite
      METRICITY_DB_URL: postgres://pysite:pysite@postgres:5432/metricity
      SECRET_KEY: suitable-for-development-only
      STATIC_ROOT: /var/www/static
placid ermine
#

that was quick

vale ibex
#

copied and modified from the bot compose

#

that's my secret, I rarely write new things

#

:D

placid ermine
#

copied over logging and postgres from bot compose too

vale ibex
#

I don't think we need postgres on robin

#

that's what site is for

placid ermine
stable mountainBOT
#

docker-compose.yml lines 18 to 30

postgres:
  << : *logging
  << : *restart_policy
  image: postgres:13-alpine
  environment:
    POSTGRES_DB: pysite
    POSTGRES_PASSWORD: pysite
    POSTGRES_USER: pysite
  healthcheck:
    test: ["CMD-SHELL", "pg_isready -U pysite"]
    interval: 2s
    timeout: 1s
    retries: 5```
vale ibex
#

ah yea lol ofc, site needs postgres to run Facepalm

#

I was thinking prod

cold island
#

And then you don't commit config.yml

placid ermine
#

i see

cold island
#

In the bot repo config.yml is specified in .gitignore, robin should have it as well

placid ermine
#

robin doesnt have a config file

cold island
#

ah, ok, I misread the earlier message then

placid ermine
#

new problem

#

i get this when i go to localhost:8000/admin

cold island
#

uuuh yeah I think we ripped that out

placid ermine
#

hm

#

the contrib page still mentions it

cold island
#

hm, or maybe we didn't

#

I can still open it in prod

placid ermine
#

the admin app does exist

#

we deleted the default one or something

#

nvm

#

does seem to be using the default one

cold island
#

yeah I remember we deleted something lol

placid ermine
#

stackoverflow suggests to put SITE_ID = 1 in settings.py and that seems to work

cold island
#

weird

#

just don't commit it lol

placid ermine
#

yeah

gritty wind
#

We don't really use it, and accessing it is damn impossible

#

Part of that came with dewiki and removal of the access system, the other part was people don't need to access it really

surreal veldt
brisk brook
#

Yes I saw your changes, thank you!

gritty wind
#

The branding cog really hammers the GH Api huh

hoary haven
#

are you working on multi banner support?

gritty wind
#

Yeah

#

I've got it set up with a token because I hit the ratelimit after starting the daemon once lol

#

New idea: pickle and depickle that request because yikes

vale ibex
#

Is there a way to grab everything we need using github openapi rather than their rest api?

#

Would likely mean less requests

gritty wind
#

I mean, this is just as high as it is because I'm starting from 0

#

but it should be lower in prod, and limited to once a day

vale ibex
#

Yea but I mean what does it need to download though? Isn't it just the structure of the events folder and the meta md files?

gritty wind
#

Yes, but it gets every single file independently, so total requests = number of files + numbers of folders

#

Which is

#

a lot

vale ibex
#

Ah yea, openapi would be better for that, since we could get the structure in one request

#

Then it's just a request per md file plus one to get the structure

gritty wind
#

Would we also get all the SHAs and stuff

#

We still need to read all the readmes at startup but that's way fewer requests

#

Yeah what you said

#

But I probably won't work on that in this PR, I'd like to get it done sooner rather than later

vale ibex
#

Pretty sure we can get shas

#

Yea, it's likely something to look into separately

gritty wind
#

I think I'm almost done with this for now

#

I wonder if I can get kwzrd to look at how I murdered his perfect child

vale ibex
#

Lol

fallen patrol
#

one request

#

it has the benefit of being compressed as well

fallen patrol
#

eg, making the same requests to the graphql api may count as the same amount of requests, even if it was just one request

gritty wind
#

This turned out to be much simpler than I expected

#

90% of the diff is just renaming the word "icon" to "assets" and allowing the pre-existing functions to accept either an icon or a banner

#

@tough imp Hey hey, I've put my grubby fingers all over your well-polished branding system. If you've got time, bot#2153 could use a review/sanity check 😄

dusky shoreBOT
brisk brook
#

@molten perch I still have your PR in my notifications. All files appear to be good code-wise as they have all been Marked as Viewed for me so I have read them all.

I am not sure how to continue, I could setup the project and play around with the commands locally but I am a bit unsure how to test it out, do you have any tips in that regard?

molten perch
brisk brook
#

Yeah, right.

#

I'll leave it on my list of things to review and take another full look next time; I wasn't gonna test it today anyways because of time constraints.

molten perch
#

Yeah sure, I'm busy with exams right now, anyways. I can help more in depth later on :)
Thanks for the reviews so far, though!

tough imp
#

however from a quick look, seems like a very solid solution - I would probably always require a banners directory rather than allowing a file or a directory - can always just have 1 file in the dir like we do for icons, then the logic would be the exact same for icons & banners, I understand you probably kept file support for backwards-compat but migrating all events to the new structure should be trivial and would make things simpler and overall cleaner in the long run, I think - also no problems with deploy as the bot only polls at midnight, so a merge in the branding repo wouldn't immediately break anything

tough imp
#

re rate limits, the bot does a lot of caching specifically to prevent re-polling the api during the day, outside of the daily refresh window - the usage is very much within github's rate limits, as long as you authenticate the requests, so I didnt worry about it

gritty wind
#

Wasn’t a problem in dev either since the daemon was off, it was really only a problem because I was actively working on this cog lol

crude gyro
#

banners folder only seems cleaner to me.

gritty wind
#

Yeah it would probably be easier to do that, I can work on it today

#

It would be like removing a couple if statements

crude gyro
#

yeah

gritty wind
#

Thanks Chris

#

I've updated my branding fork now to work with the new changes

#

Oh, and I made said changes

#

Thanks for the idea kwzrd!

vale ibex
#

very cool

#

I'll test this evening

#

one 1 condition

#

you review my huge pr bot#2155

dusky shoreBOT
gritty wind
#

Hahaha

vale ibex
#

thanks

frozen wren
#

hello guys. I directly put the bot-core\botcore folder into the root directory of bot package. VS code imports turns green. But when I try to run it, it said ModuleNotFoundError: No module named 'botcore'. Why is that? thank you

brisk brook
#

It shouldn't be placed in bot, it should be in the root of the project

#

That said, it has frequent releases and you should consider installing it from GitHub

frozen wren
#

then I found pyproject requires 3.9.x python so the terminal rejected it

frozen wren
#

I folked bot depository to begin with, then installed bot-core.
now it said ModuleNotFoundError: No module named 'bot'. That's the root directory lol

gritty wind
#

We don’t really provide support for installing this way (out of poetry), and on unsupported python versions…

#

It gets too complex too quickly

#

And as a windows user, you’re going to need to do a ton of extra work to get 3.10 to work

outer oasis
#

Just curious because 3.10 on Windows works fine for me

gritty wind
#

Build tools because our deps don’t have 3.10 wheels

outer oasis
#

Oh

gritty wind
#

If you have build tools it’s fine

#

But from my help channel days

outer oasis
#

For the bot, not in general
Got it, I'm dumb

gritty wind
#

It’s really difficult for some people

#

You’re fine lol

outer oasis
#

Just these, right?

gritty wind
#

Should be

#

I haven’t exactly had to worry about it since I installed windows tho so

outer oasis
#

Fair enough
I hate trying to develop in Windows
You have to go figure out where to download this thing instead of just downloading the package

#

Everyone praise winget to make them work on it

gritty wind
#

This step is included in the installation steps for other OSes 😛

#

For context, to have it ship with windows would about triple the size of the installer

#

Guess Microsoft just didn’t see that as beneficial when a lot more people would prefer the smaller size compared to having build tools

outer oasis
#

Still pops up a UAC prompt and the installer though

#

Yeah

#

The first time I downloaded Visual Studio (not Code, the big one), I said "why don't I just get everything to try it"

#

And then I ran out of disk space

hoary haven
#

@clever wraith hey Krypton! could we get a status update on site#691?
did you need help figuring out where to put the screenshot as a static image?

dusky shoreBOT
clever wraith
hoary haven
clever wraith
#

Sure thing

clever wraith
hoary haven
#

ok let me check

clever wraith
#

I've kept the <br> after

That's some cool formatted text right?
by mistake

#

That's why it still went to new line

hoary haven
exotic ember
#

the alternative to <br> would be two trailing spaces per the markdown spec, however since some editors tend to trim trailing spaces regardless of the filetype, and that trailing spaces aren't easily noticeable <br> tags are more consistent

#

leaving a blank line between the two lines would also "break" the line, but iirc it does so by creating a new paragraph which would introduce more padding than necessary

clever wraith
#

Yeah it creates a new paragraph and looks terrible

hoary haven
#

hm kind wish there were a way to present this raw message within a codeblock itself with monospace font

clever wraith
#

Hence the <br> used

exotic ember
#
````nohighlight
```ansi
\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
or
\u001b[1;40;32mThat's some cool formatted text right?
```
````
#

gah discord

hoary haven
#

lol

exotic ember
hoary haven
#

how's this?

brisk brook
#

Note that there's also a <br> on line 47 which can be replaced

clever wraith
#

Firs time seeing 4 `

#

Thanks for that tip actually 😅

hoary haven
#

me too, cool tip

brisk brook
exotic ember
hoary haven
#

yes yes

hoary haven
#

there's a <br> in line 50 as well (could just do a quick CTRL+F after to check)

clever wraith
#

Should be good now

#

Also changed the picture for the colors with their new names

brisk brook
#

Wait while you're at it, there's one sentence that has some typos

hoary haven
#

since the netlify thing is broken:

clever wraith
#

Oh I thought I broke something 😅

brisk brook
#

After you've written this, you can type and text your wish, and if you want to reset the color back to normal, then you need to use ... as prefix.

#

I think this should be:

After you've written this, you can now type the text you wish to color. If you want to reset the color back to normal, then you need to use the ... prefix again

clever wraith
#

Changed that, anything else you've spotted?

brisk brook
#

Nope, that should be it

#

Let me know when you have pushed and I'll approve. Looks great!

clever wraith
#

Thanks for the heads up and help - pushed it fastnod

#

Oh I kind of failed the images now for some reason - Fixed

frozen wren
#

hello guys. how would you resolve bot-core git dependencies in your computer?
In dockerfile I don't see it is going to install bot-core for me

#

oh, it's in pyproject

gritty wind
#

Have you tried installing with poetry at all

gritty gate
#

Custom tags?

brazen charm
#

could someone check the redis ttl for bot.doc:python:library/stdtypes ? Was checking some embeds here for #2156 which was caused by changes merged over a week ago, but the embed for str is still using the contents made from before those changes, even though that should've expired already as it's set to expire in a week

#

it seems to be being set as expected locally so I'm not sure what the reason for it staying in redis for longer than a week could be

brazen charm
#

found one case where the expire is not set, hopefully that's the only one

vale ibex
#

yea, ttl is -1 on that

#

@brazen charm

#

there's a few others that are -1

#

randomly checked a few and saw socket & sqlite3 were

brazen charm
#

The fix I pushed fixes it where the expire may not be set after the cache is deleted and docs are fetched after that

vale ibex
#

should I delete python:* and refresh docs?

brazen charm
#

are there any deletedoccache / cleardoccache for python in channels I can't see?

vale ibex
#

only one I can see was scale running it on disnake 4 months ago

brazen charm
#

hmm so there could be some other issue then

brazen charm
#

I'll need to look at the logic around the expire a bit more if it got skipped without a clear

vale ibex
#

alright cool

#

lmk if you want more info about the state of prod

#

redis-commander is a real nice tool for inspecting redis

mellow hare
#

Sanity question: How in the hell would I typehint this:

{'categories': {'available-help-channels': [{'how-to-get-help': 'text'},
                                            {'help-candy': 'text'},
                                            {'help-bagel': 'text'}],
                'logs': [{'all-logs': 'text'},
                         {'big-brother-logs': 'text'},
                         {'duck-pond': 'text'}],
                'miscellaneous': [{'bot-commands': 'text'},
                                  {'general-meta-voice': 'text'},
                                  {'dev-core-contrib': 'text'}],
                'occupied-help-channel': [{'help-apple': 'text'},
                                          {'help-banana': 'text'}],
                'python-help-dormant': [{'help-bread': 'text'},
                                        {'help-burrito': 'text'}],
                'staff': [{'admins-mods': 'text'},
                          {'lounge-helpers-org': 'text'},
                          {'defcon': 'text'},
                          {'incidents': 'text'},
                          {'incidents-archive': 'text'},
                          {'staff-announcements': 'text'},
                          {'dev-logs': 'text'}],
                'voice': [{'voice-verification': 'text'},
                          {'vc': 'voice'},
                          {'staff-voice': 'voice'},
                          {'afk': 'voice'}],
                'welcome': [{'welcome': 'text'}]},
 'name': 'devserver',
 'roles': ['admins', 'devops', 'helpers', 'voice-verified']}
#

Or would it even be worth doing so

rapid swallow
mellow hare
#

Except it isn't always a list

#

'name': 'devserver'

rapid swallow
#

then you'd have to use Union

mellow hare
#

I guess:
dict[str, dict[str, str | list[str | dict[str, str]]]]

rapid swallow
#

yeah

mellow hare
#

God that's horrific

timid sentinel
#

Could use a dataclass if it's alaways categories, name, roles

mellow hare
#

Maybe. This is loaded directly from a yaml

timid sentinel
#

I don't think type-hinting is ideal here as the type of the value depends on the value of the key. I don't think it would be too hard to load the main 3 keys into a dataclass and then typehint the rest.

@dataclass
class SomethingConfig:
    name: str
    roles: list[str]
    categories: dict[str, list[dict[str, str]]]

I do sometimes end up going down the road of making things too complex in order to try and represent them "perfectly" though... (also the single item dictionaries seem a bit weird)

mellow hare
#

And there's only one of these ever loaded per running of the script

#

I could in theory do the same thing with type aliases

#

True

#

(very much still in progress)

timid sentinel
mellow hare
#

Fair

stable mirage
#

Can I post my code and ask for help?

#

here

gritty wind
#

No, this channel is for discussion of projects created by the organization such as our bots.

For help, check out #❓|how-to-get-help

stable mirage
#

thx

brazen charm
vale ibex
#

not that I can think of

#

looking again, the cleardoccache has only ever been ran twice, once on discord and once on disnake. deletedoccache has never been used

brazen charm
#

The only other scenario I can think of is the bot shutting down after setting the key but before the expire, but that seems extremely unlikely to occur even once

vale ibex
#

can probably chalk it up to some bot oddity then

#

I'm happy to clear the cache completely after merging that PR

brazen charm
#

Ah I suppose it could stay in the bot's key cache while being deleted from redis if it runs for longer than a week, guess I'll also expire the bot's cache and then add some sanity checks if the above does happen

gritty gate
#

Why does @stable mountain not delete the original message when we click the trash reaction?

brazen charm
#

!d os Pushed the fix to bot#2156 should be a relatively simple review if anyone's got time and will prevent formatting like this

stable mountainBOT
#
os

Source code: Lib/os.py

---...

tawdry vapor
#

and there's the smartconfig thing

#

I think pydantic might be able to do this sort of thing too?

stable mountainBOT
#

pyproject.toml line 14

requires-python = ">=3.10"```
fallen patrol
#

instead of reverting markdownify

#

!pypi markdownify

stable mountainBOT
fallen patrol
#

oo i need to update

brazen charm
# fallen patrol or just fix the bug

I don't see a reason to maintain more code and open it up to more changes with the updates when it already works correctly with the older version

#

it's not like markdownify is some critical library that needs security updates

frozen wren
#

hello. I am studying python-discord's bot depository and it is a very big application / bot.

My attempts:

  1. Study each packages imported in the scripts. I studied asyncio, discord, aiohttp, redis, docker, poetry... etc
  2. Drawing import dependency graph and UML diagram (i doesn't get many insights from it)
  3. Look at __init__,py, then it brings me to a class, (then there are many classes, which relates and inherits many things, it is like a network of thinks interact itself.)

For me, I have already spent like 6 days on a single depository.

The most difficult part, in my perspective, would be each main class has like 25 attributes inside, and some attributes are related to another class from another module. Which is like a network of things linked to each other.

What keyword should I search (for a subject of knowledge) if I want to learn about the tricks of checking of structure of an application very quickly?

Is there any tricks or underneath knowledge to read a depository quickly?

thank you

cold island
# frozen wren hello. I am studying `python-discord`'s `bot` depository and it is a very big ap...

Reading the code alone makes it difficult. Pick a relatively simple extension (for example pypi). And play with its commands to understand what they do, then look at the code to understand how it happens.

I don't suggest reading the entire repository, sounds like you would get little benefit from it. If a new contributor approached this repository to add/fix a part of it, they would focus only on that part. It might not even be a full extension.

Experience obviously helps. In the end the question is what you're hoping to gain from this

frozen wren
# cold island Reading the code alone makes it difficult. Pick a relatively simple extension (f...

this was my early attempts.

My reading was like: I got a particular function in _cog.py --then goes back-- > bot.py (inside bot folder) --then goes back-- > __init__.py.

Then I goes backward and look at: __init__.py: instantiate bot = Bot... --> bot.py: Bot Class is inherited from BotBase, and BotBase is linked to Bot-core (another depository)

That class object Bot, BotBase almost links to anything in the depository

cold island
frozen wren
cold island
#

Have you tried writing the feature yourself?

#

If you're starting with one channel that moves between categories you don't need 90% of that code

frozen wren
#

Such as this line, it refers to Bot from bot.py and scheduling from bot-core, so I trace back and read those lines.

cold island
#

Right, but, really, start with something of your own. Don't even try to do automatic closing yet. Just have channels that move between categories

fallen patrol
#

who do i report a moderation hole to

#

its about message filters

vocal prairie
fallen patrol
#

any specific admin or just one of them

brisk brook
#

You could just use Modmail

vocal prairie
green oriole
#

Hey good sir @patent pivot

#

What do you think about making metricity record when a user left instead of just whenever they left or not?

#

Please ping me back

patent pivot
green oriole
#

Hmm, okay

#

Would you be opposed to a PR?

#

I assume it would have to be added as a new field to not break existing queries

patent pivot
green oriole
#

Sounds good, thanks

gritty wind
#

@timid sentinel perhaps we should start signing them? 🤔

Makes it easier to have a back and forth on the “I think” part when there’s a name to it

timid sentinel
green oriole
#

Nice domain

#

Y'all aren't continuing this, are you

stable mountainBOT
#

namespaces/default/patsy/deployment.yaml line 31

value: patsy.pythondiscord.com```
brisk brook
green oriole
#

It is just NXDOMAIN-ing

rapid swallow
#

No wait

#

I have heard otherwise

#

How does English work again

#

I haven't heard anything about the project being discontinued

green oriole
#

Hmm'kay

#

Last commit was 6 months ago, that's why

rapid swallow
#

Good job vivek

green oriole
#

english/10

rapid swallow
#

🗿, you get the idea

green oriole
#

I've gotten the manifests that I want to steal, imma go back to my hole lgbeet

#

I almost said the name of the community and got rule 6ed lmao

vale ibex
#

yea, I havne't had time to work on it for a while

#

it's also not going to be public facing anymore, so I remove the dns

#

oh, it doesn't have a dns record lol

surreal veldt
vale ibex
#

Yup yup

surreal veldt
#

How is some bot code linked to a github repo?
Like I've seen times when a PR is merged on github, and the bot immediately gets the new code from the PR

outer oasis
surreal veldt
#

What's K8?

brisk brook
wild prism
slate gorge
#

nvm checked pins lol

outer oasis
# surreal veldt How is some bot code linked to a github repo? Like I've seen times when a PR is...

So...
https://github.com/python-discord/bot/blob/main/.github/workflows/build.yml
This workflow runs on commits to main after all tests have passed.
It builds a Docker container, which it stores in the repository, along with the files themselves.

https://github.com/python-discord/bot/blob/main/.github/workflows/deploy.yml
This workflow runs after the previous "build" workflow completes successfully.
It takes the Docker container that was just created, and sends it off to Kubernetes, and Kubernetes automatically switches to this new version

outer oasis
surreal veldt
outer oasis
outer oasis
surreal veldt
#

Would i be able to do what's needed to link the code on that panel?

outer oasis
#

What do you mean?

surreal veldt
#

Like if I'm currently running code on that panel, can i do the k8 thing and what you said above to make the code linked with merged PRs?

outer oasis
#

Unless you're the creator of the project, you won't have permission to edit the workflows.
But... you could have a script or cron job occasionally check for new versions, and automatically deploy them when they're found

outer oasis
# surreal veldt Like if I'm currently running code on that panel, can i do the k8 thing and what...

Also, to be clear, this process is not linked to PRs at all, and it doesn't link to the code itself.
The workflows run when commits are pushed to main. That is normally when PRs are merged, yes, but they would also run if you pushed directly to main.
And, it's only a pedantic difference, but it's not linked to the code. It puts the code inside a Docker container, and sends that container to Kubernetes.

vale ibex
brazen charm
#

could use an another review on bot#2156 to fix the doc command

fallen patrol
timid sentinel
#

!d typing.Annotated

stable mountainBOT
timid sentinel
#

Is it because it's quite a long paragraph so isn't trimmed correctly?

brazen charm
#

Yes, the tags aren't looked into recursively

#

The first description paragraph tag is too long, so it's cut out

surreal veldt
#

Doing !src ot raises the error


AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'```
gritty wind
#

Thanks for the report! We’re aware of the issue and have a PR to fix it. You can track it here bot#2022

dusky shoreBOT
cursive relic
#

when you run !src paste it gives this (seems like because of it's tag), not sure if it should be mentioned here

cursive relic
#

would it be possible to link to the tag when running src to tag?

vale ibex
#

Read the messages just before yours

cursive relic
#

Oops 😅
Didn't notice it's related to the same thing

green oriole
#

Do y'all have readiness checks on your discord bots?

#

So you can have zero downtime reloads?

green oriole
#

seems like I forgot to press send, huh

#

I was looking at readiness checks for work, and it seems like it would be very trivial to make one for a bot, just write to a file when the bot gets a ready event, and have the check just be a command trying to cat that file

#

although it maaayy have a slight race condition moment because of message commands

#

but I believe that could be solved by catching the exit signal and making sure that the event queue is closed as soon as the pod switches to the terminal state

timid sentinel
#

So like

  • New process starts but doesn't load cogs (I feel this would be necessary to be sure you weren't processing things twice)
  • New process signals to old process to stop
  • Once old process has stopped, new process loads up fully, which would be pretty fast.

Would surely be possible, although I don't think it's something I've ever felt was necessary.

vocal prairie
#

@blissful onyx re: #community-meta
The bot has no access to the underlying system, it's all isolated via nsjail.

green oriole
blissful onyx
#

And the idea is to reduce attack surface? I guess I just wasn't sure why you would want to isolate the bot beyond running it in its own container

vocal prairie
#

pretty much, I don't see why you would want to give anyone the ability to delete your entire system or whatever

jade wasp
#

Can I help anyone

austere hornet
# jade wasp Can I help anyone

This isn't a help channel, if you want to help out you can click through the channels in the Occupied Help Channels category

fallen patrol
#

nsjail is used for the Eval command, and that has to do with snekbox, which is a separate api

vocal prairie
#

right, my wording was wrong

#

this was in context of !eval so I wasn't exactly being precise

rapid swallow
#

There's an issue on that i believe

blissful onyx
#

Ah good to know

fallen patrol
#

how is graphite and statsd configured to collect data? what do the config files look like?

rapid swallow
twilit halo
stable mountainBOT
#

code_eval.py line 75

def python3(cmd):```
twilit halo
#

I guess you support a bunch of packages. meanwhile, you can't even import some stdlib modules in mine

vocal prairie
late python
#

does anyone have any idea on how to make something that can detect position to create a line of trajectory for an object that will appear before you take your shot?

wild prism
patent pivot
#

we use a combined graphite & statsd image so they're both together, from memory we don't use any config outside the defaults, just spin up the docker image and we're good

fallen patrol
#

i don't see a config file

patent pivot
#

yeah exactly

#

lol

fallen patrol
#

you don't need one for statsd?

patent pivot
#

no

fallen patrol
#

when i tried to run the same image it was erroring without one

patent pivot
#

the image we use ships with one that works for graphite already

#

the graphite statsd image?

#

be sure you're not overwriting some volume/path where it's expecting config

#

but I am 200% certain we do not do any configuration for that side of stats

patent pivot
#

😄

blissful onyx
#

More questions about what you can and can't do with !eval... So I've noticed that you can use os.fork() to create new processes but I assume you can't create FIFOs because no tmpfs. Am I right to conclude that the only IPC available is os.kill(), signals etc? (e.g. #bot-commands message)

#

I doubt there is a reliable way to send an ordered stream of bits over POSIX signals...

#

unless...

blissful onyx
#

Okay I changed my mind, it is not only possible but I just did it haha #bot-commands message

blissful onyx
#

Some discussion here of how it works. But yeah I guess this could be a way to do process-based multiprocessing/parallelism in snekbox !eval using only POSIX signals #esoteric-python message

blissful onyx
#

I wrote a proof of concept there and actually got a speedup doing this. Time for bed

rapid swallow
#

gn

brisk brook
# blissful onyx More questions about what you can and can't do with !eval... So I've noticed tha...

I believe that is because of, in-part, this:
https://github.com/python-discord/snekbox/commit/1c75ec573903de8294172e65e0dd88108a524924

I think there is another commit allowing processes to write to a temp-file somewhere so that this fully works.

GitHub

Processes spawned in snekbox now have up to 5 PIDs available, each sharing the same memory limits and environment as the parent python process. As far as I could see in testing this does appear saf...

timid sentinel
#

@fallen patrol hello hello, what's your status on bot#2006, bot#2008, and bot#2017, they mostly seem pretty nearly ready but just waiting on some changes. If you're planning on doing them at so point, that's fine, although I'd be happy to finish them off otherwise.

blissful onyx
# brisk brook I believe that is because of, in-part, this: https://github.com/python-discord/s...

Very cool. What did you mean about the temp file? I was under the impression tmpfs was still an open issue: https://github.com/python-discord/snekbox/issues/114

GitHub

Several users have expressed a desire to interact with files with their executed code. I believe such feature is in scope and that it would be a great feature. Supporting it would require a way to ...

#

AFAIK my crazy signals-based approach is the only available IPC -- would love if someone knows otherwise though

gritty wind
#

File writing is indeed still not supported

brisk brook
#

Sadly, I can't get the full traceback but multiprocessing didn't work previously

#

Try searching !e multiprocessing in Discord search

blissful onyx
#

I believe it is still not supported

brisk brook
#

#bot-commands message

#

All the paste links are dead, but here's an example of what used to fail: #bot-commands message

gritty wind
#

That’s unrelated to file writing

#

It’s the PID thing you linked above

brisk brook
#

I believe I heard that Python writes something to some special file, and that also failed?

blissful onyx
#

Is it fair to say I've created the first parallel program on snekbox? 🏆

#

I'm not aware of any other way to do multithreading or multiprocessing currently

gritty wind
#

That’s probable yes

blissful onyx
#

!e

from lzma import decompress
from base64 import b64decode
NUM_WORKERS=4
NUM_ITERATIONS=5000000
c = """
/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4AtFBAFdADSbSme4Ujxz7TRXz/YuKYOoy6/+/qHJAf2Y
kaj5JrjpXHFk4VJJibh/QOHdouojmx1aK6zmJRS7b+EpB6qvEJ1G+Hy8HiQsVmGnx7C23YXKDeyL
X5YCU0I5Y323MFysA/os8HhUtcNjdHjKuvMVtNyNWUl8TOoxr3mrHUwul2kq+WmRIwxPWQAb4R/O
2X6CGHfKp4WbdRxY2jAWrcwbGsJSgLYzdskDM+e69b/p7Fm2puCipScVM+ncbZncUAu4gWuaq3Ez
ipu9VdHQgGin9PPPMBMRfJU4wgN/p6UJpA9iwdxhZp62MQRkYX3Zdh8gtYwS8iMbJ9EwIdAkppul
7cF3LS+j0RIUJQYYSVwa0ddq7XuWux7myKphLqIbWNW9MNkle8ZomHvIcCa2QsZJmj9FASkF/HKm
eOUlUXZRQq5lSlyoSURpB5Xp/4K0+RcbJ+sQyoLhFencaVcBnMbny3LFuSxKoSJ3PrJNh9Avn+yI
HrCYEy1FPsCRi8l/TWKdzkblOwYgTzgR8piLzuewdM3v97zf2jFTNjAI8iuCZRkMQlflbzD8c6LR
WUOOnRYb9u/PaBW1W0F48VuZ9pVKM6sJbX1fB58IClxqx0ob/C8ugtNmbiqqqpINzpITRlMnhemo
7h1pJtFjgR/k13O705ClamLwPNLxObFWv0BuwQyetFO53ujzCWDPZfDvQoq3X5fMGKTkYZ5++S2F
VB7vCBXjxvW6B1teasm12ljGUu4S9GQAk0KA/g6zrBSPd2eRaDOYRRjeeMw08e/sJfMAYImACGGA
nWi32+Zk5yudIF1HXJYQ3ul2AHudqEs0ongOS4SnZggwG06v4eIzNTt3LNVLdll2/mAhLr359GKy
f4Te6RhHoYNBFaALO/5e9h6HL9cemawAL310syEpcRSeqs6zCNdmrmUaIuFJ2YPNrI15ZSRromXF
SOUIq1NfBw/ra+etxzwlCM76BEyd6WnoXiVwodYANH3hBUgY56LMti6dWG70EGXtiAfqw1LIEC0I
pLzjtuQ9d/ok1U1xPKLXPbjUyObdok0DU3yeQ5FGvLy0Z7YKFdSgl9sIzR3cxB9PRVnZk3DIOtA7
/DYg67V4NOoh8q9wGpgcttfhOJ5ZfLu7dMLk3e8dztorijQMUv9QEYLsFVr6GRvC7oZu4qaChTFp
iO71fR9VFn3nUQdB8lvSMCHr9tuai4Vjodp7MZR+aswUsEmEgWk2ZKMTZwklNyCW3+RsGNAM5NWh
uXVdlzQ6zSBGMM08po8Q2LAhkkhZhXspQgC7IqUDQBzyslgmWAaKEn9S0BI73NKFNUaaKooF8bx3
oUQo5RNYcMxXqUfSdQ8DbtVXUT8LYdnRCY6RuE8LAAAAAPJuudUoMDr0AAGdCMYWAACZ9FAZscRn
+wIAAAAABFla
"""
exec(decompress(b64decode(c)).decode())
stable mountainBOT
#

@blissful onyx :white_check_mark: Your eval job has completed with return code 0.

Num processes: 4, total iterations: 20000000, pi ~= 3.141352
blissful onyx
#

^ here's the code, sorry for the compression but the source is a bit long. And it is a real pain in the butt to code in this style since all of the logic is basically state transitions in the signal handler

timid sentinel
#

@gritty wind agree that the discussion isn't relevant to that PR anymore, but I dont understand how the issue you're saying applies to my proposal. Just pick randomly from least used icons, then pick randomly from the least used banners in that group

gritty wind
#

Haha that’s pretty great

blissful onyx
#

It's probably the most cursed code I've written haha

gritty wind
#

Ok if you have two groups, A and B, and the following assets

A_banner_1
A_banner_2
A_icon_1

-B_assets-

When working through the A assets, you’ll be forced to make a decision how to handle the second round. You can use the same icon twice, or work with assets from B (one of the two other solutions).

gritty wind
#

Which is the main complication that made me decide to avoid doing it at all

gritty wind
#

It can also be entirely done on the bot side, so barrier to entry is relatively low

brisk brook
timid sentinel
#

That's just the logic I proposed above

gritty wind
#

Yeah that's the "smart" system I alluded to

#

But it gets more complicated the more unbalanced groups you have

#

Two unbalanced groups now need to go A, B, A, B, ...

timid sentinel
#

I think I see what you mean, where I said "a icon 1 banner 1" how do you know it's banner 1 not banner 2 since they're selected randomly

mortal garden
#

Hi guys, I'd love to get into open-source. Any pointers on how to get started here will be appreciated

gritty wind
#

That part of it can probably be solved just with the current "choose the asset with the fewest usages" system

gritty wind
#

Any particular topic you're interested in? Could better guide you to one of our projects

timid sentinel
#

There are a couple of issues tagged good first issue on the bot repo at the moment, may be a good place to look at first

hoary haven
#

i have one! but it's moderation-related and you wont get to see the "fruit" of your efforts but it should be very simple. bot#2168

dusky shoreBOT
hoary haven
#

but it's very boring so feel free to peruse the others lol

timid sentinel
# gritty wind That part of it can probably be solved just with the current "choose the asset w...

That would work for keeping track of a given iteration, even with the groups (one banner group may just iterate faster than another if it has less banners), the only thing is once an iteration has finished all the banners will be on the same usage count, so it's possible one just used would be picked again. That's already technically an issue with the current icons implementation I think, although it's not really an issue. We could probably just ignore that

gritty wind
#

I think it actually checks that and rolls again no?

#

!src branding

stable mountainBOT
#
Command: branding

Control the branding cog.

Source Code
gritty wind
#

Oh actually

#

No it doesn’t

#

But it doesn’t randomize

#

It’s just however it’s sorted, which shouldn’t change in theory

timid sentinel
#

There is a random.choice in there

gritty wind
#

Oh yeah you’re right

#

Never mind that

timid sentinel
#

But yeah we could remove that and just select the first element if we wanted to remove that issue

#

Probably doesn't really matter

#

Actually we probably shouldn't unrandomize it

mortal garden
mortal garden
mortal garden
mortal garden
hoary haven
# dusky shore

@cold island can i have your seal of approval on the issue? meow3c ^ might be a good first issue for Emyrs

hoary haven
# mortal garden Yes. It kinda feels like there's a lot of things I still need to figure out

ready for some reading? p_apeachsmile01

https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/contributing-guidelines/
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/bot/

i would probably start with cloning the repo, and trying to get your test bot running. then read up on some intro to git if you've not used it before (you should know conceptually what a branch is, for example)

#

if you feel like too much is being thrown at you, you can just start with the 3rd link

#

i went ahead and assigned you to the issue, do ask for guidance or feedback whenever you need it!

gritty gate
#

Which one do I click?

timid sentinel
gritty gate
#

alright

timid sentinel
#

Is this related to our projects though? It seems like you might just want a help channel instead

gritty gate
timid sentinel
#

Ah I see, here is fine then 👍

gritty gate
#

Do I need to click anything?

timid sentinel
#

Just having it installed should be enough. Did you try running the poetry command again?

#

btw which project is this and do you know which dependency it was failing on?

gritty gate
#

i'll try restarting my PC

timid sentinel
# gritty gate - sir-lancebot - not sure, here's my shell output https://paste.pythondiscord.co...

I'm not sure why it's not detecting you have build tools installed (restarting could help, yeah), but the reason it needs them in the first place is because your poetry environment is in python 3.10 but the bot is using 3.9. If you manage to get that hiredis package to build (which it should be able to), the bot should work fine on 3.10, alternatively if you get poetry to use 3.9 instead that should fix it as there are prebuilt wheels

brisk brook
vale ibex
#

which async-rediscache currently uses

brisk brook
vale ibex
#

What makes you say that?

brisk brook
vale ibex
#

that's on master

stable mountainBOT
#

setup.py lines 8 to 10

install_requires = ['async-timeout']
if platform.python_implementation() == 'CPython':
    install_requires.append('hiredis')```
vale ibex
#

this is the version that we use

gritty gate
timid sentinel
gritty gate
#

Thanks agan wookie

timid sentinel
#

no problem

weak rose
#

Is there any project i can help with? I do python/django backend

#

I just need some practice and experience

wild prism
# weak rose Is there any project i can help with? I do python/django backend

check out https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/
if you want to do django stuff, the Site project will be of interest to you
browse the unassigned issues and if you see one you'd like to work on, request to be assigned to it
if you have your own idea, open an issue for it and wait for it to be approved by a core developer

weak rose
#

Thanks

austere hornet
#

Could core-devs please review sir-lancebot#1051 and sir-lancebot#1052? Thanks!

gritty gate
#

I don't know where to ask this but why is help the in-built function not defined in @stable mountain's eval command?

timid sentinel
#

It's because snekbox (what the eval command uses) runs python with the -S flag which means the site module isn't imported on startup, so a couple of commands like help and exit aren't defined.

I'm not 100% sure why we do that, probably because it gives a small increase in startup speed so code should be executed a bit faster

gritty gate
#

Ah, thanks wookie

#

Is it possible to host snekbox w/o docker?

surreal veldt
#

in the eval command, os shouldn't one of the, not sure the word but maybe "blocked", modules?

austere hornet
thorny obsidian
thorny obsidian
surreal veldt
#

ah okay thank you

outer oasis
#

@brisk brook - I was cleaning up PRs and I just noticed that sir-lancebot#879 is still open.
It looks like Kat said that all that was left was a review from a core dev, and then you removed the "needs review" label?

#

Oh wait I read those backwards - you added the "needs review" label.

dusky shoreBOT
outer oasis
#

So I just need to go bully a core dev into a review to get that one closed?

brisk brook
brisk brook
outer oasis
#

Dammit

#

I thought you were

brisk brook
#

Nah, but I have already approved it so I am counting as that contributor. Go to the checks and check the review-policy action

#

A core dev will count as both another contributor and a core dev 😅

outer oasis
#

Is the list of core devs documented anywhere?

#

Or do I just walk up to people and go "Hi. are you a core dev?"

brisk brook
thorny obsidian
#

Just bully Xith or Chris or Zig. That's my goto strat

outer oasis
#

I already bullied Xith this week about Rust
I'll go annoy Chris

outer oasis
dusky shoreBOT
brisk brook
#

I heard that Dors4n is very susceptible to annoyance

thorny obsidian
#

Oh! You can also bother Hem about it since he was in support of it :D

outer oasis
#

He's a core dev?

#

Nice

thorny obsidian
#

Mhmmm

brisk brook
#

Yeah, they're in that list at least

outer oasis
#

But he's away this morning

#

I'm in a hurry

#

and don't know why 🎶

subtle kraken
subtle kraken
#

Lol

#

Sorry am blind

#

Excuse me

outer oasis
#

👍

#

Wanna review a PR?

subtle kraken
#

If its a cool PR you can also ask me since am looking forward to getting back to doing stuff

outer oasis
#

sir-lancebot#879

dusky shoreBOT
subtle kraken
#

Mayhaps

outer oasis
#

It's a fairly contested feature

subtle kraken
#

Literally will merge it just for what title claims

#

/s

outer oasis
#

I'm not a huge fan myself, I just want to be able to say "I contributed BTW"

subtle kraken
#

I can check it once am on pc

subtle kraken
stable mountainBOT
#
Of course!

Your reminder will arrive on <t:1652108679:F>!

outer oasis
#

🙏

subtle kraken
#

Thats a lot of effort for such command lol

#

Pretty neat

stable mountainBOT
gritty wind
# gritty gate Is it possible to host snekbox w/o docker?

Snekbox is one of our projects that goes a lot deeper into the system than the rest of our projects, so while possible, it’s quite involved. Anything you can do on docker, you can do on an equivalent system however.

If you want to run without docker, you’ll need to manually configure all the dependencies (basically run all the commands in the docker file on your machine). After that it may work, but keep in mind what I said about it being much closer to the system. Snekbox is designed on and for Debian 11 (which is the OS used in the docker image), no guarantees beyond that

subtle kraken
#

@outer oasis you are responsible for the PR atm?

outer oasis
#

Yes

subtle kraken
#

whats the purpose of embed?

#

as in I see it also has some embed option within code and am curious if its actually invoke-able, seems it isnt

#

okay my apologies am simply blind (again)

#

the PR looks good

#

thanks

outer oasis
#

Senjan21 dismissed lemonsaurus’s stale review 18 minutes ago
@subtle kraken - Just out of curiosity, how do you dismiss someone else's review [without new commits]?

subtle kraken
#

not sure if you can

#

I just had option above comments to dismiss reviews

outer oasis
#

You just did it

#

Ah, fair enough

subtle kraken
#

I mean you, as in I as core-dev can

outer oasis
#

What does it take to learn this power?

subtle kraken
#

it was between these two iirc

#

okay I found it sorry

#

bit slow today

subtle kraken
outer oasis
subtle kraken
outer oasis
subtle kraken
#

Literally or figuratively?

#

I can do both, no problem

#

have a good day

atomic ivy
#

hi, IDK if it was raised before, but for some reason the command !source paste fails with this error [#bot-commands message]
I've tried looking through the source of the source command, but couldn't find any glaring issue.

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

subtle kraken
#

yeah we got pr for it bot#2022

dusky shoreBOT
surreal veldt
thorny obsidian
austere hornet
austere hornet
#

Haha

#

!otn a getting-rickrolled-by-a-mod-be-like

subtle kraken
#

I wonder if we have otn that links to rickroll yet

#

That could be fun

sharp crag
#

Remove the embed lmao

subtle kraken
#

I dont think you can have slashes and : in the name 😔

sharp crag
#

big sad

subtle kraken
#

pydis-dot-org-slash-dot-env

sharp crag
#

pydis.org-slash-.env

#

Are dots allowed?

subtle kraken
#

I doubt

sharp crag
#

should also make it dotenv instead of dot-env for a lil pun

subtle kraken
#

Would check but search requires 2 letters minimum

#

Unleess you want to check regex

#

👀

outer oasis
#

It scares him

hoary haven
sharp crag
#

🥶

#

my timbers have been properly shivered

slim widget
#

Hello 👋 Would someone be willing to briefly explain to me how our infraction data is recorded?

#

I mean specifically recorded so it can be displayed on Grafana.

gritty wind
#

Whenever an infraction is created, it’s type, the infracted user, actor, and expiration are shipped off to the site API where they are stored in a database

#

Grafana has access to our db (builtin PG driver)

slim widget
#

Ah right thanks. For some reason I thought it went via Metricity 🤔

stable mountainBOT
#

bot/exts/moderation/infraction/_scheduler.py line 119

async def apply_infraction(```
gritty wind
#

Metricity exists in essentially a vacuum, all moderation atm goes through bot, with site used for persistence

slim widget
#

I see

#

Thanks again

#

Would it be a crazy idea to record rate-limit data for display on Grafana?

#

I'm assuming we don't already do that.

gritty wind
#

Rate limit as in discord API, or channel message limits?

#

D.py handles those without exposing them to the project at all, so it would require patching the library with our code. Doable, but not straightforward

slim widget
twilit juniper
#

I could be wrong but I believe you can just do that in the bot instance

#

Setup a task loop to check, then just export it to grafana

slim widget
austere hornet
#

Could I get a review or 2 on sir-lancebot#1054? Thanks!

dusky shoreBOT
twilit juniper
naive ermine
#

Is there anything wrong with movies command of @dusky shore !

#

It's not working..

timid sentinel
#

Uhh yeah there is something wrong with it

#

lemme have a look

naive ermine
#

Oh it is, must've been a silly error

#

it's working again..

timid sentinel
stable mountainBOT
#

bot/exts/fun/movie.py line 56

async def movies(self, ctx: Context, genre: str = "", amount: int = 5) -> None:```
naive ermine
#

@timid sentinel The issue seems to be the genre argument starting with a upper case letter..

#

Nope- not that, but for a while, it was not giving me response whike using Crime, but when I used crime it gave a quick response

timid sentinel
#

Ah, so the page parameter here https://developers.themoviedb.org/3/discover/movie-discover is documented as having a maximum of 1000. If a topic is chosen with more than 1000 movies it may try and access a page above that limit

#

I'll open an issue on github, thanks for letting us know

naive ermine
#

np!

gritty wind
#

Chris, you wrote tests for bot-core
but then never added testing to CI lol

stable mountainBOT
#

.github/workflows/lint.yaml lines 45 to 53

#      - name: Run tests and generate coverage report
#        run: pytest -n auto --cov --disable-warnings -q
#
#      # This step will publish the coverage reports coveralls.io and
#      # print a "job" link in the output of the GitHub Action
#      - name: Publish coverage report to coveralls.io
#        env:
#          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#        run: coveralls```
timid sentinel
#

there's an issue bot-core#53

dusky shoreBOT
gritty wind
#

I'll just uncomment it and push to main probably

vale ibex
#

So made that issue instead

gritty wind
#

Ahhhh

#

I've uhhh

#

Oh also I picked up the changelog and versioning suggestion myself

trim cradle
#

Are the names only missing for me?

patent pivot
brisk brook
trim cradle
#

it must be my work VPN

#

now I have trust issues.

wild prism
#

this channel is for discussion about our open source projects, but you can open your own help channel from #❓|how-to-get-help

fringe turtle
#

I am sorry :)

gritty gate
#

Should add psutils docs to the docs command since a lot of people use it

gritty wind
#

Added

mellow hare
#

I just completed (functionally but not completely. Still need documentation, testing, etc.) my auto_guild script. It's made for quickly making a development server, giving you the ids for both the channels and the roles, and then making you owner of said server. Hopefully this means it'll be easier for folks to start contributing to the bot.

When you call the script, you'll need to pass it the file path to the template you want to use. I already have one in the examples folder that should give one that'll work for the Python bot.

You'll also need to make a .env file containing your BOT_TOKEN and your USER_ID so that the requests can be made and so that the bot can give you ownership of the guild once you join.

I used PDM for the dependency management, but you should be able to use the pyproject.toml in the same way as a requirements.txt

If you find issues, think there's stuff that could be useful, etc, don't hesitate to submit an issue!

https://github.com/MrHemlock/auto_guild

GitHub

Creates a Discord server based on a template you layout, making it an easy and quick way to flesh out a server to fit your needs. - GitHub - MrHemlock/auto_guild: Creates a Discord server based on ...

austere hornet
#

Could I get some reviews on sir-lancebot#1054? Thanks!

dusky shoreBOT
fallen patrol
#

also support env vars so it doesn't require .env

#

eg support BOT_TOKEN=... python auto_guild.py

vale ibex
#

His force push means policy bot doesn't accept his approval

green oriole
#

F
I don't remember if I'm in the policy bot or not

#

Nah I did remove myself

vale ibex
#

Thanks 😀

gritty wind
#

@mellow hare Gonna try to test out auto guild today. Have you considered publishing on pypi? We can add it as a dev-dependency and developers will just be able to run it when they clone our projects

gritty wind
#

Uhh which part?

outer oasis
#

OH - auto_guild would have an entry point, and the config file could be kept up to date in the bot repo, and there could be a taskipy task to run the entry point with the config?

gritty wind
#

Sure

outer oasis
#

That actually sounds pretty easy after I actually put some thought into it

gritty wind
#

For the package itself, it’s pretty trivial to distribute since it doesn’t need build tools, has minimal dependencies, and is basically a single file

outer oasis
#

Yeah
It's already got all the metadata filled out, so it would just need an __init__.py, and it would be ready to go

gritty wind
#

You can install without an init, or a packge

#

it would just be adding auto_guild:some_function as an entry point, moving the if main stuff into a function (you can still call that function in the if main if you want), and since it's already using pdm, you'd run pdm publish

outer oasis
#

You can do that?

#

Nice

gritty wind
#

You should be able to test it locally, just re-run the installation command then do auto-guild

outer oasis
#
[bradleyreynolds@maximus auto_guild]$ pdm install
All packages are synced to date, nothing to do.

Installing the project as an editable package...
  ✔ Update auto-guild 0.1.0 -> 0.1.0 successful

🎉 All complete!
[bradleyreynolds@maximus auto_guild]$ auto-guild
bash: auto-guild: command not found
[bradleyreynolds@maximus auto_guild]$ auto_guild
bash: auto_guild: command not found
#

Hmmmm

gritty wind
#

I don't know how pdm works specifically, does it install into your global environment (you don't have one activated right now)

outer oasis
#
[bradleyreynolds@maximus auto_guild]$ pdm run auto-guild
usage: auto-guild [-h] structure
auto-guild: error: the following arguments are required: structure
#

Ah, you were right

gritty wind
#

I don't know why you'd want that behavior, but it is what it is

#

When you publish it it should work like other packages though

#

You can publish to test.pypi

outer oasis
gritty wind
#

Venvs aren't particularly heavy, and dependency separation while redundant works much better with the way python works

outer oasis
green oriole
#

is pdm another poetry replacement

gritty wind
#

Closer to npm is the sales pitch

#

No venv

#

Despite ya know... node_modules

green oriole
#

but that's a python thing?

gritty wind
#

I don't understand what you mean

#

pdm advertise the way it works as being more similar to npm in that it does not use virtual envs

#

It installs and manages packages in a similar way to npm that doesn't need to create a virtualenv at all!

green oriole
#

yeah okay that's a Python package manager

gritty wind
#

Yeah

gritty wind
green oriole
#

okay that's on Hem's thing, not the bot

#

gotcha

outer oasis
gritty wind
#

Cool cool cool

#

I guess you need to pass everything in the .env before running the script?

#

It might be helpful to have an error message there besides just letting the key error propagate

#

So right off the bat, you might need to either add a constructor for the !ENVs we have in our config, or suppress them when parsed, because right now the script can't be used on our default config (even if we update to have the correct structure)

#

Ideally, we'd be able to just use the config from our project directly instead of having to maintain two

outer oasis
#

There we go

#

Almost uploaded to production

stable mountainBOT
#

auto_guild.py lines 173 to 177

env = dotenv_values(".env")
if "BOT_TOKEN" in env:
    BOT_TOKEN: str = env["BOT_TOKEN"]
else:
    raise ValueError("BOT_TOKEN not found in .env")```
outer oasis
#

I did try to make the error more descriptive

outer oasis
gritty wind
#

You'd need to actually add the contructors, or allow a way for the end user to add them

#

For instance, you could do something like:

for constructor in ("!ENV", "!JOIN"):
    Loader.add_constructor(constructor, lambda *_: None)
#

That way it won't actually parse those constructors, but it won't error out

#

I think that should work for python

#

You can add the actual constructors too (as defined in our constants), but it's not super important

#

Also, ideally you'd use the safeloader since we don't need anything from the default loader but ultimately it doesn't matter

#

Hm, actually I don't see how we'd make the default config work at all with this system

#

It expects the data types to be defined as values, but we need to use the actual values there

outer oasis
#

Do the bot's YAML loaders not get the values?

#

I'll admit I don't understand them yet

gritty wind
#

They do, but auto-guild expects text or voice, not the actual value

#

I mean, the bot just reads our config-default, and loads them into python values

#

Auto-guild doesn't want values, it wants an outline

#

Hence the problems

outer oasis
#

Oh, right, right, I got two things confused in my head again

gritty wind
#

The only types I'm seeing are voice and text, which might be useful for some applications, but for the python bot it doesn't matter at all

outer oasis
gritty wind
#

Right, how would we make that work without duplicating the configs and maintaining them in two places needlessly

#

Might I suggest that we're at least given the option to not parse those values and just fallback to text

#

That would work for python without breaking the already existing system

outer oasis
gritty wind
#

I think you're still not seeing my point

outer oasis
#

Probably not

gritty wind
#

Auto guild is currently asking for a config file which we do not have. This means, to make it work we'd need to make one (separate to the currently existing one), and maintain two of them with very different formats, with no actual benefits to us as users of auto-guild

#

Since we don't care about creating different channel types, we can settle with auto guild just creating everything as a text channel

#

That would allow us to still use one config file instead of having two

#

It would also require that categories have an ID defined for them, for instance as a key inside them

#

So what I'm proposing is that this current format:

categories:
  welcome:
    - welcome: text

Be converted to:

categories:
  welcome:
    - id: number
    - welcome: text

And accept:

categories:
  welcome:
    - id: 1029048192
    - welcome: 2174897189279

It would ignore the ID key (in both instances) and parse welcome as a text channel

outer oasis
gritty wind
#

There are two different IDs in both of my proposed formats

#

the first one id is the category ID

#

The second is the channel ID

#

For reference, this is what our current config looks like:

categories:
        help_available:                     691405807388196926
        help_dormant:                       691405908919451718
        ...

channels:
        announcements:              &ANNOUNCEMENTS      354619224620138496
        change_log:                 &CHANGE_LOG         748238795236704388
        ...
outer oasis
#

Got it
You're including the category ID at the top of your channel list

gritty wind
#

The bot still needs to get the category ID, so the idea is that it'll be included there in that format as well

#

I'm still kind of confused though, how would you merge the existing yaml config with the new one that's creating by auto-guild

#

There's more to our config than just channel and categories, and there are some items which have variables used in the config

#

For instance, the moderation category, which will be created by auto-guild needs a reference because it's later used by a moderation_categories variable in the config

outer oasis
#

But that's still pretty manual
Though once setup, it would keep working, assuming the default IDs don't change

gritty wind
#

... I guess you could do it within auto guild, since with the new suggested format you will have those IDs?

austere hornet
gritty wind
#

It will make it harder to be a more general purpose tool though

green oriole
#

I had a script to do that back in the days

#

that was quite useful

#

having automatic configuration is pretty much required to make that tool useful

#

creating channels isn't really that much of a problem, as you can just make a few, that doesn't take too much time

outer oasis
gritty wind
#

I'm not suggesting that you accept different formats

green oriole
#

it could all be dropped into a mapping file, and processed by a CLI tool on the bot repo

gritty wind
#

I'm suggesting you accept one, that was proposed above, but support more yaml features, such as variables

mellow hare
#

Yep, I'm considering doing that. Just figuring it all out

full fractal
dusky shoreBOT
full fractal
#

I've tried deleting the site container but that had no effect.

#

main is also broken..?

#

whelp I'll rebuild everything I guess since I have time to kill

#

OK, I can try repulling the site image?

#

... is there a way to update an image / pull a newer image using pre-existing layers instead of completely deleting it and repulling it pithink downloading a whole new image is pretty slow >.<

hoary haven
#

whenever smth doesn't work I do docker-compose up --build
which needs to be done whenever dependencies are changed

dunno if that helps you at this point meow3c

#

(build not rebuild lol)

full fractal
#

docker-compose up --build did not rebuild site so it had no effect

#

I had to manually update the site image and force a new container based off that

#

it's working now btw 🎉

hoary haven
#

what if you had done docker-compose up web --build? (this is a curiosity, I don't actually know)

full fractal
#
❯ sudo (which docker-compose) up web --build
ERROR: No such service: --build
#
❯ sudo (which docker-compose) up --build web
Starting bot_postgres_1 ... done
Starting bot_metricity_1 ... done
Starting bot_web_1       ... done
Attaching to bot_web_1
web_1        | Starting in debug mode.
web_1        | Starting server.
web_1        | Starting in debug mode.
web_1        | Applying migrations.
web_1        | Operations to perform:
web_1        |   Apply all migrations: admin, api, auth, authtoken, contenttypes, home, sessions, sites, staff
web_1        | Running migrations:
web_1        |   No migrations to apply.
web_1        | Collecting static files.
web_1        | Creating a superuser.
web_1        | Admin superuser already exists.
web_1        | Existing bot token found: badbot13m0n8f570f942013fc818f234916ca531
web_1        | Starting server.
web_1        | Watching for file changes with StatReloader
web_1        | Performing system checks...
web_1        | 
web_1        | System check identified no issues (0 silenced).
web_1        | May 16, 2022 - 01:45:55
web_1        | Django version 3.1.14, using settings 'pydis_site.settings'
web_1        | Starting development server at http://0.0.0.0:8000/
web_1        | Quit the server with CONTROL-C.

otherwise it seems to just influence what services are run and attached

#

perhaps it would repull site but I would have to manually replace the local site image with something older which I don't want to do

gritty wind
#

There is docker-compose pull web as well

#

You can optionally add include-deps so it’ll update things like PG while it’s at it

#

I’m not sure if that does overwrite the existing image or not, since I always have site locally

#

I think after that, docker down, docker up should just do it

subtle kraken
#

This channel isn't for random video. @clever wraith

clever wraith
#

Sorry

frozen wren
#

#bot.py

why line39 of this line could check all services the bot relies on are available through http request? thank you

subtle kraken
#

All it does is basically "ping" website, if it responds with 200 code then we assume that it is ready to handle requests from bot

slim widget
austere hornet
#

I need one more approving review on sir-lancebot#1054 if a core dev wouldn't mind giving one. Thanks!

dusky shoreBOT
wild prism
#

@cold island @brisk brook thanks for your help with the PR 👍

hoary haven
#

!!

#

shiny

austere hornet
#

For real

slate gorge
#

heard that y'all were switching from linode to netcup

#

this true?

gritty wind
#

Slowly but yeah

#

Netcup is already on our sponsors list

slate gorge
#

i thought it would've already happened

gritty wind
#

Well it isn’t a 1:1, since we’re doing this to switch from kubernetes to ansible

#

So we need to rewrite our entire infrastructure

slate gorge
#

oh wow, how many prs have you reviewed so far?

gritty wind
#

There are probably 20-30 that have already been reviewed

slate gorge
#

nice

#

i bet there are still a good chunk left

gritty wind
#

Most of the devops team is on personal hiatus, so it’ll still take some time

gritty wind
#

Joe demanded it and he is the supreme commander

#

Nah just seemed interesting

austere hornet
clever dust
stable mountainBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

clever dust
#

Ex.: `@everyone`

gritty wind
#

Interesting

#

Not filtering the ping inside a codeblock is intentional behavior (the goal here is to teach people not to try to use it, not to prevent it from being said entirely), but the codeblock replacement doesn’t account for escaping it like that

#

We could possibly change the regex to not match if it includes an escape, but it might possibly not be worth it because the impact is minimal

#

Thanks for reporting though

clever dust
#

K

austere hornet
fallen patrol
#

does someone have an svg of the trashcan emoji

hoary anvil
fallen patrol
#

there is still a trashcan that the bots use

#

that's why i was wondering if the devs have an svg of it

austere hornet
vocal prairie
vocal wolf
#

@thorny obsidian is this new?

thorny obsidian
vocal wolf
thorny obsidian
#

@patent pivot what is this?

vocal wolf
#

lol

patent pivot
#

ahh

#

lol

vocal wolf
#

mistake?

patent pivot
#

not mistake

#

monitoring detected it

vocal wolf
#

not mistake

#

looks nice imo

patent pivot
#

will reoslve it now

#

it's nice yeah

vocal wolf
#

what I really meant was the notification itself

#

is that new?

patent pivot
#

uhh

#

nah

#

have had it for as long as we've had status page

vocal wolf
#

...when did we get a status page

patent pivot
#

ages ago

#

lol

vocal wolf
#

Either I forgot about it or never saw it

#

@wild prism I really like what you've done with the contribution guide, good stuff

hoary haven
#

can we disable the notif entirely?

#

ime it has been obtrusive

patent pivot
gritty wind
gritty wind
#

I don’t mind it so much. It takes up a bit of the screen, but with how infrequent and useful it is, seems fine

patent pivot
#

i might turn off the hastebin status going public but i see value in it for events i add or scheduled maintenance

hoary haven
#

currently on mobile, but yeah what scale said

#

bc each time you closed it, on a new page load or refresh it would come back

#

shouldn't it remember I've closed it at least for a good hour or so and stop showing it to me?

#

this was as of a couple months ago I experienced this. didn't try it today

hoary anvil
tough tide
#

would it be a good idea to add the internal worker id, process id and increment vales to the

#

!sf

stable mountainBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

tough tide
#

command

cold island
tough tide
cold island
#

Then probably not 😀

tough tide
#

allr

rapid swallow
cursive relic
#

How many emojis is there in that server?

sharp crag
#

About 47

#

and a lot of them are the same ones that are here

vale ibex
#

we have 2 emoji servers, one with 50 and the other with 49

#

the bot test server also have 46

sharp crag
#

Bot test is the one I was looking at

#

You’re telling me there are more ⁉️

vale ibex
#

Yea, that's the staff test server, we have 2 emoji servers too

#

I don't think the bots use any emoji from the test server in prod though

#

ah, no they don't, since the bots aren't even in there :)

gritty wind
#

The ones from the test server are probably people needing emojis on their dev bots, or just testing them lol

vale ibex
#

yea

#

I just added my bot to the emoji servers, because I'm lazy

gritty wind
#

That was implied when you became a programmer

vale ibex
#

true

gritty wind
#

Speaking of lazy, I tested a couple libs for generating different bot-core doc versions, and didn’t like any of them

#

Thoughts on writing a bespoke one 🤡

vale ibex
#

Ehhhhhhhhh

#

Maybe not lol

gritty wind
#

But chrrrrrrriiiiiiiiisssssssss

green oriole
#

Like sphinx ?

#

I mean, it is such a versatile tool