#dev-contrib
1 messages · Page 175 of 1
Ah
Best I can think of that isn't hacky is to:
- 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?
- 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
What if you raise an error from the init?
Well, I won’t have this info ready from the init, but I can try raising an error in the load?
Documentation doesn’t specify what happens in that case, I think I’ll just try it
If that doesn't work you could try asking in the v2 feedback channel in the dpy server
bot#2151 so that we start collecting stats again 😅
We load each cog in their own task, so raising an error is the best way to cancel the load
Is there a particular exception you'd like to see here?
Is there a cog load error or similar in ext.commands?
ExtensionError, ExtensionFailed or ExtensionNotLoaded though the last seems unrelated
are these documented
No idea, maybe a custom error off those, or a custom error from runtime error IG
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
Yea sounds good
It gets logged as an exception from scheduling since it's a task error, but besides that it gets the job done
I shall once I've cooked dinner 😅
Thanks Chris :D
it's horrible, re-write it
Thank you Chris, I appreciate your honesty 🥲
yw <3
Lmfao
This is 26 days late
I also don't know how to delete it anymore
Branches are temporary, but apparently, commits are forever
🥲
yeah
I wanted to push this on April 1st but for some reason forgot about it
https://github.com/python-discord/site/pull/712 is this good now?
hmm why does Sir Robin not use botcore yet
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
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]
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
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
it doesnt use site yet, i intend to do that now
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
no site doesnt have the endpoints either, i'm going to do that too
hm i'll update the compose too then soon
whoo
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
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?
it would be better if it was controlled with an env var
hm, doable
Do we use pydantic settings in robin?
robin compose doesn't have any site in it
you can add it :D
hm
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
that was quick
copied and modified from the bot compose
that's my secret, I rarely write new things
:D
copied over logging and postgres from bot compose too
i get psycopg2.OperationalError: could not translate host name "postgres" to address: Temporary failure in name resolution without adding https://github.com/python-discord/bot/blob/main/docker-compose.yml#L18-L30
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```
You generally don't need to touch config-default.yml, only when you want to change how something works in prod (e.g you add a channel in this server). For dev you open a separate config.yml in which you override the constants in config-default
And then you don't commit config.yml
i see
In the bot repo config.yml is specified in .gitignore, robin should have it as well
ah, ok, I misread the earlier message then
uuuh yeah I think we ripped that out
hm
the contrib page still mentions it
A guide to setting up and configuring Site.

the admin app does exist
we deleted the default one or something
nvm
does seem to be using the default one
yeah I remember we deleted something lol
stackoverflow suggests to put SITE_ID = 1 in settings.py and that seems to work
yeah
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
@brisk brook sorry for being a bother but do you mind?
Yes I saw your changes, thank you!
The branding cog really hammers the GH Api huh
are you working on multi banner support?
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
Is there a way to grab everything we need using github openapi rather than their rest api?
Would likely mean less requests
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
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?
Yes, but it gets every single file independently, so total requests = number of files + numbers of folders
Which is
a lot
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
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
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
Lol
just grab a zip of the entire repo
one request
it has the benefit of being compressed as well
do note that less requests does not necessarily mean less rate limits
eg, making the same requests to the graphql api may count as the same amount of requests, even if it was just one request
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 😄
@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?
That's quite tricky, you could probably set the threshold values to dummy values, which triggers easily than in general.
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.
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!
I can try to take a more involved look maybe Sunday - been too busy lately, sorry 
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
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
Yeah it’s definitely not a problem in prod
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
Thanks for the feedback
@gritty wind I also think this seems reasonable
banners folder only seems cleaner to me.
Yeah it would probably be easier to do that, I can work on it today
It would be like removing a couple if statements
yeah
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!
Hahaha
thanks
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
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
it returns a tons of moduleError from me, despite vs code can locate it
then I found pyproject requires 3.9.x python so the terminal rejected it
do i need to install both bot and bot-core before start working?
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
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
Like what?
Just curious because 3.10 on Windows works fine for me
Build tools because our deps don’t have 3.10 wheels
Oh
For the bot, not in general
Got it, I'm dumb
Just these, right?
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
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
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
@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?
Heya, it was on my to-do list for tonight, will be done in the coming hour :)
thanks-there was another small thing if you could please remove the <br> tags in the code block, they shouldn't be needed
Sure thing
Seems like they are needed as the code block are escaped https://i.imgur.com/GJqUu7w.png
ok let me check
I've kept the <br> after
That's some cool formatted text right?
by mistake
That's why it still went to new line
just linking for easy reference; #discord-bots message
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
Yeah it creates a new paragraph and looks terrible
hm kind wish there were a way to present this raw message within a codeblock itself with monospace font
Hence the <br> used
there is
````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
lol
Note that there's also a <br> on line 47 which can be replaced
me too, cool tip
It's made for specifically this purpose
I should document that in the guide guide, I used it in it but didnt mention it
yes yes
I originally read about it here: https://python-markdown.github.io/extensions/fenced_code_blocks/
there's a <br> in line 50 as well (could just do a quick CTRL+F after to check)
Yup missed that one and also after "Result" just seen
Should be good now
Also changed the picture for the colors with their new names
Wait while you're at it, there's one sentence that has some typos
Oh I thought I broke something 😅
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
Changed that, anything else you've spotted?
Nope, that should be it
Let me know when you have pushed and I'll approve. Looks great!
Thanks for the heads up and help - pushed it 
Oh I kind of failed the images now for some reason - Fixed
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
Have you tried installing with poetry at all
Custom tags?
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
found one case where the expire is not set, hopefully that's the only one
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
The fix I pushed fixes it where the expire may not be set after the cache is deleted and docs are fetched after that
should I delete python:* and refresh docs?
are there any deletedoccache / cleardoccache for python in channels I can't see?
only one I can see was scale running it on disnake 4 months ago
hmm so there could be some other issue then
the old formatting is the better one so I'd say it can wait for https://github.com/python-discord/bot/pull/2156, then the whole cache can be cleared
I'll need to look at the logic around the expire a bit more if it got skipped without a clear
alright cool
lmk if you want more info about the state of prod
redis-commander is a real nice tool for inspecting redis
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
dict[str, dict[str, list[dict[str, str]]]] ?
then you'd have to use Union
I guess:
dict[str, dict[str, str | list[str | dict[str, str]]]]
yeah
God that's horrific
Could use a dataclass if it's alaways categories, name, roles
Maybe. This is loaded directly from a yaml
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)
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
I'll have to mull this over. For context it's for this https://github.com/MrHemlock/auto_guild
(very much still in progress)
could also use TypedDict https://docs.python.org/3/library/typing.html#typing.TypedDict
Fair
No, this channel is for discussion of projects created by the organization such as our bots.
For help, check out #❓|how-to-get-help
thx
Looking at it more I've got no clue how it could've gotten into that state without a clear; is there something external that could've deleted it while the bot was running?
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
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
can probably chalk it up to some bot oddity then
I'm happy to clear the cache completely after merging that PR
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
Why does @stable mountain not delete the original message when we click the trash reaction?
!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
dataclass or, if you want to keep it a dictionary, a TypedDict.
There are some libraries that can automatically map yaml to classes e.g. https://github.com/genomoncology/related but that one isn't maintained anymore
and there's the smartconfig thing
I think pydantic might be able to do this sort of thing too?
pyproject.toml line 14
requires-python = ">=3.10"```
or just fix the bug
instead of reverting markdownify
!pypi markdownify
oo i need to update
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
hello. I am studying python-discord's bot depository and it is a very big application / bot.
My attempts:
- Study each packages imported in the scripts. I studied
asyncio,discord,aiohttp,redis,docker,poetry... etc - Drawing import dependency graph and UML diagram (i doesn't get many insights from it)
- 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
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
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
well, again, what are you hoping to achieve with this?
firstly I want to get help-channel alone works in test server
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
sounds like solving life problems. omg.
maybe I get lost in the way of navigating it
Such as this line, it refers to Bot from bot.py and scheduling from bot-core, so I trace back and read those lines.
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
https://www.pythondiscord.com/pages/security-notice/ this page here says to DM an admin or to contact the admins email
How vulnerabilities in our projects should be reported.
any specific admin or just one of them
You could just use Modmail
the site doesn't specify. although modmail is probably fine, as blue said, since you said it's a moderation hole (I didn't see the edit)
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

not opposed to it, just haven't really had the need for such data thus far
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
nope by all means
yea probably
Sounds good, thanks
Thank you sentient sentry bot 🙏
@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
Ah true lol, will do that in the future
The deployment for the Patsy API, hosted at https://patsy.pythondiscord.com.
Nice domain
Y'all aren't continuing this, are you
namespaces/default/patsy/deployment.yaml line 31
value: patsy.pythondiscord.com```
Chris is the one who works on it, although it's been rather quiet.
It is just NXDOMAIN-ing
I haven't heard otherwise
No wait
I have heard otherwise
How does English work again
I haven't heard anything about the project being discontinued
Ah this is correct, you said "aren't"
Good job vivek
english/10
Nvm,you said "continuing", not "discontinuing"
🗿, you get the idea
I've gotten the manifests that I want to steal, imma go back to my hole 
I almost said the name of the community and got rule 6ed lmao
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
will this PR https://github.com/python-discord/site/pull/712 get merged?
Yup yup
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
They're asking how commits get automatically deployed to K8s
I'm working on writing up an explanation now
What's K8?
Ooh, sorry. I completely read that as "closing issue" 😅
kubernetes
nvm checked pins lol
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
Discussions related to this server's open source projects
Have you heard of pufferpanel?
Most everything here is packaged into containers, and Kubernetes runs those containers for us.
So all the workflow has to do is give a container to Kubernetes, and Kubernetes will stop running the old version, and start running the new version
No, but I just Googled it and I get the idea
Would i be able to do what's needed to link the code on that panel?
What do you mean?
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?
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
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.
As shenanigans mentioned, what we have wouldn't work for you, as our workflows are setup to connect to a kubernetes cluster.
If you are looking to add continuous deployment to one of your projects, #tools-and-devops is the perfect place to learn.
could use an another review on bot#2156 to fix the doc command
bug:
!d typing.Annotated
typing.Annotated```
Is it because it's quite a long paragraph so isn't trimmed correctly?
Yes, the tags aren't looked into recursively
The first description paragraph tag is too long, so it's cut out
Doing !src ot raises the error
AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'```
Thanks for the report! We’re aware of the issue and have a PR to fix it. You can track it here bot#2022
when you run !src paste it gives this (seems like because of it's tag), not sure if it should be mentioned here
would it be possible to link to the tag when running src to tag?
Read the messages just before yours
Oops 😅
Didn't notice it's related to the same thing
Do y'all have readiness checks on your discord bots?
So you can have zero downtime reloads?
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
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.
@blissful onyx re: #community-meta
The bot has no access to the underlying system, it's all isolated via nsjail.
you can load cogs, they don't actually start doing stuff until ready is recieved
Thanks!
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
pretty much, I don't see why you would want to give anyone the ability to delete your entire system or whatever
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
cc @vocal prairie the bot doesn't run under nsjail
nsjail is used for the Eval command, and that has to do with snekbox, which is a separate api
right, my wording was wrong
this was in context of !eval so I wasn't exactly being precise
We do have plans to add tmpfs
There's an issue on that i believe
Ah good to know
how is graphite and statsd configured to collect data? what do the config files look like?
ooh, the python bot uses nsjail too? my bot also does that for code_eval. snekbox is a lot more code than mine, though https://github.com/raylu/sbot/blob/master/code_eval.py#L75
code_eval.py line 75
def python3(cmd):```
I guess you support a bunch of packages. meanwhile, you can't even import some stdlib modules in mine
snekbox is fairly simple, it launches nsjail, runs python in a subprocess, and wraps it all in a JSON API, not necessarily in that order
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?
this channel is about our open source projects, but you can open your own help channel from #❓|how-to-get-help
my bad. thanks
@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
i don't see a config file
you don't need one for statsd?
no
when i tried to run the same image it was erroring without one
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
ah.
😄
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...
Okay I changed my mind, it is not only possible but I just did it haha #bot-commands message
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
I wrote a proof of concept there and actually got a speedup doing this. Time for bed
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.
@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.
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
AFAIK my crazy signals-based approach is the only available IPC -- would love if someone knows otherwise though
File writing is indeed still not supported
Sadly, I can't get the full traceback but multiprocessing didn't work previously
Try searching !e multiprocessing in Discord search
#bot-commands message
All the paste links are dead, but here's an example of what used to fail: #bot-commands message
I believe I heard that Python writes something to some special file, and that also failed?
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
That’s probable yes
!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())
@blissful onyx :white_check_mark: Your eval job has completed with return code 0.
Num processes: 4, total iterations: 20000000, pi ~= 3.141352
^ 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
@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
Haha that’s pretty great
It's probably the most cursed code I've written haha
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).
~~!e https://paste.pythondiscord.com/emowugoxad~~ doesn't work
Aww, right 😔
Which is the main complication that made me decide to avoid doing it at all
It was suggested but never implemented. I think it’s not a bad idea if someone wants to work on it. (The actual suggestion was to combine code from the paste and the message, but just doing the paste is a good enough start)
It can also be entirely done on the bot side, so barrier to entry is relatively low
That's probably from where I thought you could do that
It would go, for example
- a icon 1 banner 1
- all b icons
- a icon 1 banner 2
- all b icons
- a icon 1 banner 1
Etc etc
That's just the logic I proposed above
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, ...
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
Hi guys, I'd love to get into open-source. Any pointers on how to get started here will be appreciated
That part of it can probably be solved just with the current "choose the asset with the fewest usages" system
Have a look at the issue tabs on our repos, and see if anything interests you. We have set up guides you can follow after that
Any particular topic you're interested in? Could better guide you to one of our projects
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
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
but it's very boring so feel free to peruse the others lol
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
Control the branding cog.
Oh actually
No it doesn’t
But it doesn’t randomize
It’s just however it’s sorted, which shouldn’t change in theory
There is a random.choice in there
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
I'm more in the ML side of things, so my python skill in software development side of things isn't so solid yet... So I was kinda thinking maybe starting with documentation first
I'll also check out the repo. Thank you 😊
I'll definitely check that out
I think 'boring' is subjective 😀. .. I've just checked and it's nothing like what I've done before - - which would kinda make it interesting as my 1st time contribution.
is it your first stab at discord.py as well?
Yes. It kinda feels like there's a lot of things I still need to figure out
@cold island can i have your seal of approval on the issue?
^ might be a good first issue for Emyrs
ready for some reading? 
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)
A guide to contributing to our open source projects.
Guidelines to adhere to when contributing to our projects.
A guide to setting up and configuring Bot.
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!
Thanks. I'll do that
Which one do I click?
If you just want to install build tools there's no need to select any extras, just install
alright
Is this related to our projects though? It seems like you might just want a help channel instead
Technically yeah I wanted to run a poetry command (https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/installing-project-dependencies/) but it said i needed Microsoft C++ 14.0
A guide to installing the dependencies of our projects.
Ah I see, here is fine then 👍
Do I need to click anything?
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?
yeah, I get the same error
- sir-lancebot
- not sure, here's my shell output https://paste.pythondiscord.com/egusinuruh
i'll try restarting my PC
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
hiredis should be optional I think
it's required by aioredis 1.X
which async-rediscache currently uses
No it should be optional?
What makes you say that?
setup.py lines 8 to 10
install_requires = ['async-timeout']
if platform.python_implementation() == 'CPython':
install_requires.append('hiredis')```
this is the version that we use
thank you!
Hmm I get this now https://paste.pythondiscord.com/tegigojiqo
put USE_FAKEREDIS=true in your .env file
Thanks agan wookie
no problem
Is there any project i can help with? I do python/django backend
I just need some practice and experience
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
A guide to contributing to our open source projects.
Thanks
Could core-devs please review sir-lancebot#1051 and sir-lancebot#1052? Thanks!
I don't know where to ask this but why is help the in-built function not defined in @stable mountain's eval command?
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
in the eval command, os shouldn't one of the, not sure the word but maybe "blocked", modules?
You're saying import os doesn't work with the eval command? If so, maybe that's because you can't really do much with it in the eval command since it's main purpose is to control an OS, such as os.shutdown() or smth like that. The bot is not an OS :))
os is fine because we have nsjail running. The worst it can do is crash its own instance and then we respawn another
The bot not being an OS doesn't matter. The python programming language can interact with the os, hence the module exists. Our bot doesn't run the eval itself, we use an API for it (snekbox). Snekbox is sufficiently locked down, so allowing the os module is fine
ah okay thank you
@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.
So I just need to go bully a core dev into a review to get that one closed?
Yes; I removed the "waiting for author" one I added previously after LP went inactive, and changed it to "needs review" so that it would be reviewed.
MHm, any core-dev will do 😁
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 😅
Is the list of core devs documented anywhere?
Or do I just walk up to people and go "Hi. are you a core dev?"
I think there might be a GitHub team? Otherwise just check the roles of people here
Just bully Xith or Chris or Zig. That's my goto strat
I already bullied Xith this week about Rust
I'll go annoy Chris
@vale ibex - may I please get a review on sir-lancebot#879?
I heard that Dors4n is very susceptible to annoyance
Oh! You can also bother Hem about it since he was in support of it :D
Mhmmm
Yeah, they're in that list at least
You can try to access https://github.com/orgs/python-discord/teams/core-developers/members
I think it should be visible to staff
@subtle kraken, it is
If its a cool PR you can also ask me since am looking forward to getting back to doing stuff
sir-lancebot#879
Mayhaps
It's a fairly contested feature
I'm not a huge fan myself, I just want to be able to say "I contributed BTW"
I can check it once am on pc
!remind 30M ^
Your reminder will arrive on <t:1652108679:F>!
🙏
Here's your reminder: ^
[Jump back to when you created the reminder](#dev-contrib message)
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
@outer oasis you are responsible for the PR atm?
Yes
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
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]?
I mean you, as in I as core-dev can
What does it take to learn this power?
I recommend becoming core-dev 
I agree
Can you forward me the application?
Sure, you can access it in our staff .env file at https://pydis.org/.env iirc (only accessible to helpers+)
Its somewhere around bottom of the page, try looking for key COREDEV_APP_LINK=
TYSM!
It would also mean a lot to me if you could put in a good word for me
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 is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
yeah we got pr for it bot#2022
does the link only re-direct to where it does if a user is not a helper?
It redirects there for everyone
Lol the link redirected me to the Rick Astley Never Gonna Give You Up video
You are welcome
!otn https://pydis.org/.env would be hilarious
Remove the embed lmao
I dont think you can have slashes and : in the name 😔
big sad
pydis-dot-org-slash-dot-env
I doubt
should also make it dotenv instead of dot-env for a lil pun
Would check but search requires 2 letters minimum
Unleess you want to check regex
👀
Don't mention regex around Robin
It scares him
we can do slashes now, converts to the BIG SOLIDUS unicode character
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.
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)
Ah right thanks. For some reason I thought it went via Metricity 🤔
bot/exts/moderation/infraction/_scheduler.py line 119
async def apply_infraction(```
Metricity exists in essentially a vacuum, all moderation atm goes through bot, with site used for persistence
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.
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
Discord API
Ah I was hoping d.py would have a way to hook into API requests.
is_ratelimited is a thing could only be for the websocket but idk
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
Yeah could do. I like the idea of just recording the rate-limiting data in the headers of each request made (or a random sample of requests) rather than making additional requests just for this purpose. But actually, what you're suggesting would make it independent from the rest of the bot 🤔
Could I get a review or 2 on sir-lancebot#1054? Thanks!
is_ratelimted doesn’t make additional requests iirc but I understand what you mean.
Source is here, we're getting this response which isn't handled properly https://github.com/python-discord/sir-lancebot/blob/6609ceab1600ae5d08c2614f5a0f994b86f8ba5e/bot/exts/fun/movie.py#L56
{errors: ['page must be less than or equal to 500']}
bot/exts/fun/movie.py line 56
async def movies(self, ctx: Context, genre: str = "", amount: int = 5) -> None:```
I see..
@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
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
Hosted API documentation for every OAS (Swagger) and RAML spec out there. Powered by Stoplight.io. Document, mock, test, and more, with the StopLight API Designer.
I'll open an issue on github, thanks for letting us know
np!
.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```
there's an issue bot-core#53
I'll just uncomment it and push to main probably
Yea ran into some issues with coverage with a module so didn't want to hold up the d.py changes
So made that issue instead
Ahhhh
I've uhhh
#dev-core lol
Oh also I picked up the changelog and versioning suggestion myself
Are the names only missing for me?
as far as i can see yeah
Are the HTML elements for it there?
this channel is for discussion about our open source projects, but you can open your own help channel from #❓|how-to-get-help
I am sorry :)
Should add psutils docs to the docs command since a lot of people use it
Added
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!
Could I get some reviews on sir-lancebot#1054? Thanks!
suggestion, support token and user ID as arguments
also support env vars so it doesn't require .env
eg support BOT_TOKEN=... python auto_guild.py
Can someone proxy approve https://github.com/python-discord/site/pull/720 for volcyy?
His force push means policy bot doesn't accept his approval
done
Thanks 😀
@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
How would that work?
Uhh which part?
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?
Sure
That actually sounds pretty easy after I actually put some thought into it
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
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
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
So this would work, keeping the package as just the one file?
https://github.com/MrHemlock/auto_guild/pull/4/commits/65e4fb5cf799f341783c03aa0ce97e4c5b0cd8a9
You should be able to test it locally, just re-run the installation command then do auto-guild
[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
I don't know how pdm works specifically, does it install into your global environment (you don't have one activated right now)
It implements PEP 582, so it installs to ./__pypackages__
[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
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
It's lighter weight than a full venv, it only installs the packages themselves - It still uses the system interpreter, it only loads the packages locally
Venvs aren't particularly heavy, and dependency separation while redundant works much better with the way python works
Yeah, it does
Once the package is uploaded to PyPi, it functions just like any other package
is pdm another poetry replacement
but that's a python thing?
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!
yeah okay that's a Python package manager
Yeah
Have you given it a shot yet? I can start messing around with it
I'll work on that now
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
There we go
Almost uploaded to production
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")```
I did try to make the error more descriptive
But that still won't work with @stable mountain
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
Do the bot's YAML loaders not get the values?
I'll admit I don't understand them yet
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
Oh, right, right, I got two things confused in my head again
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
Right, because it creates the guild for you, and then returns the IDs
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
The theory would be that the output from auto_guild would be the IDs needed to build the YAML config for the bot
I think you're still not seeing my point
Probably not
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
I know you said to ignore it, but why are there two different IDs in your third example?
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
In this case:
356211439872114690 #356211439872114690
and
267631170882240512 #welcome
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
...
Got it
You're including the category ID at the top of your channel list
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
Yeah, I've been trying to think through that
I'm not sure if Hemlock had any ideas about it
The only thing I've come with so far is to take your default config, which is already laid out the way you want it, and str.replace(<default_id>, <auto_guild_id>)
But that's still pretty manual
Though once setup, it would keep working, assuming the default IDs don't change
... I guess you could do it within auto guild, since with the new suggested format you will have those IDs?
.bm
It will make it harder to be a more general purpose tool though
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
Yeah...
I'm not sure how to keep up with everyone using their own config formats.
I think Hemlock decided that was out of scope for his project.
I don't really think auto_guild could, or even should, try to keep up with that...
It could accept mixins/plugins for parsing external configs into it's format
I'm not suggesting that you accept different formats
it could all be dropped into a mapping file, and processed by a CLI tool on the bot repo
I'm suggesting you accept one, that was proposed above, but support more yaml features, such as variables
Yep, I'm considering doing that. Just figuring it all out
hmmm
starting the bot checked out on bot#2163 immediately breaks https://paste.pythondiscord.com/wefifarixu
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
downloading a whole new image is pretty slow >.<
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 
(build not rebuild lol)
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 🎉
what if you had done docker-compose up web --build? (this is a curiosity, I don't actually know)
❯ 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
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
This channel isn't for random video. @clever wraith
Sorry
why line39 of this line could check all services the bot relies on are available through http request? thank you
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
Hello 👋 Can I make a new PR for fix/modpings (https://github.com/python-discord/bot/tree/fix/modpings) as a continuation of PR #2001 (https://github.com/python-discord/bot/pull/2001) ?
I need one more approving review on sir-lancebot#1054 if a core dev wouldn't mind giving one. Thanks!
@cold island @brisk brook thanks for your help with the PR 👍
For real
i thought it would've already happened
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
oh wow, how many prs have you reviewed so far?
There are probably 20-30 that have already been reviewed
They are publicly available at https://GitHub.com/python-discord/infra
Most of the devops team is on personal hiatus, so it’ll still take some time
ooh. why?
....so that's why the devops role name has "ansibling " in it....lmao always wondered what that meant
You are not allowed to use that command here. Please use the #bot-commands channel instead.
#ot0-psvm’s-eternal-disapproval message = \`@everyone \` doesn't trigger @stable mountain
Ex.: `@everyone`
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
K
Bump
does someone have an svg of the trashcan emoji
I see no trashcan emoji in his server
I've got a PR ready to merge as soon as this issue is approved
could someone take a look?
https://github.com/python-discord/sir-lancebot/issues/1057
it's just a one-line fix
mhm
there is still a trashcan that the bots use
that's why i was wondering if the devs have an svg of it
#sir-lancebot-playground message
This is a png, but you could convert to an SVG using a converter if that's what you're looking for...hope that helps!
it's in the staff test server, not here
@thorny obsidian is this new?
where is that from?
A guide to contributing to our open source projects.
@patent pivot what is this?
lol
mistake?
...when did we get a status page
Either I forgot about it or never saw it
@wild prism I really like what you've done with the contribution guide, good stuff
which notification?
Our uptime is just that good. Devops 💪
Presumably this toast
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
i might turn off the hastebin status going public but i see value in it for events i add or scheduled maintenance
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
ah, mb
would it be a good idea to add the internal worker id, process id and increment vales to the
!sf
You are not allowed to use that command here. Please use the #bot-commands channel instead.
command
Are those values used for anything?
not at all
Then probably not 😀
allr
There's a separate emoji server
How many emojis is there in that server?
we have 2 emoji servers, one with 50 and the other with 49
the bot test server also have 46
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 :)
The ones from the test server are probably people needing emojis on their dev bots, or just testing them lol
That was implied when you became a programmer
true
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 🤡
But chrrrrrrriiiiiiiiisssssssss
