#dev-contrib

1 messages ยท Page 142 of 1

fallen patrol
#

I think it's possible to lose the cache if a second instance of the bot is run at the same time

#

So it may be a deployment race issue

molten perch
#

At first it is, yeah. It should fire up the postgres and api containers.

#

I don't really know. I only added the posgres part. However it didn't take so long for me.

clever wraith
#

Why

molten perch
#

It must be the Token Authentication Middleware.

#

But as of now, there's nothing that you would need from the API.
You can test the models with just an interactive python interpreter.

#

Well.. I resorted to a very inconsistent solution.. I exec'd inside the api container and ran an interactive python shell ๐Ÿ˜‚
It's a temporary solution. But you can install the modules as well and connect to the database that you're running in the container.
(ofc. you'll need to create the engine and a session to test out the models, (that'll be a dependency in the actual API))

#

No, but you can run python

molten perch
#

It seems like with one of the last commits I introduced a minor error, I pushed a fix, and it successfully built the relationships. The only thing to test is the embed validation. ๐Ÿ™‚

#

But you can always check the relationships, just to make sure. lemon_fingerguns_shades

#

Yeah, you have to create one.

#

I mean, you don't have to test the checks that are fairly straightforward. More like the ones that are more.. difficult.

#

That Constraint was generated from the actual database that is being used now. So, I don't think we should modify, there's a validation on the ORM side anyways.

#

Have you created a role with that id?

#

Hmm, have you run Base.metadata.create_all(bind=engine)?

#

Well.. yes. ๐Ÿ˜„

#

you can also use the "metadata" variable from the database package.

#

๐Ÿ‘

austere hornet
#

Hmm weird

#

I've seen it since I downloaded it a month ago iirc

#

Yeah

#

Ahhh

#

Ok

molten perch
#

Even the embed validation?

#

Nevermind, it should work anyways. Thank you for the rest! ๐Ÿ™‚

#

๐Ÿ˜† Even better.

stable mountainBOT
#
Sure thing!

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

trail pilot
#

Would any core dev in their free time look at sir-lancebot#860? I think it just needs one more core dev approval before a merge

dusky shoreBOT
gritty wind
#

Ughhhhh joeeee git completely wiped out all my work when I merged the new main in :P

#

I'm gonna be dealing with merge conflicts for weeks ๐Ÿคก

vocal wolf
#

joe needs more e's in his name

dim pelican
gritty wind
#

Ok managed to unfuck it

vocal wolf
vocal wolf
#

.topic

dusky shoreBOT
#
**What is your earliest memory of Easter?**

Suggest more topics here!

vocal wolf
#

yep

dim pelican
#

hmmm

vale ibex
#

I could lie and say it was on purpose to avoid extra api calls, but it was just an oversight lol

vocal wolf
#

prob should add remove reaction stuff so that we can reroll it multiple times easily

vale ibex
#

yea, sounds like a good idea

vale ibex
vocal wolf
#

it's the oldest one on sir lance

static canyon
#

Hey @brisk brook I completely forgot about bot#1836, I'm not able to do it tonight but I'll try to do it tomorrow

dusky shoreBOT
static canyon
#

Will ping you when I do ๐Ÿ‘

#

!remind 24h Do this if haven't already ^

stable mountainBOT
#
Yep.

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

patent pivot
#

yeah, probably a more generous one than normal projects for now though

#

1 staff review & devops for devops files

molten perch
#

They do. Afaik. contribs count as staff.

patent pivot
#

hmmmm

#

for now we'll say staff only 1 review

#

i am proposing a 1 review requirement

molten perch
patent pivot
#

i'm fine with a notice like that yep, just need someone to draft it up

#

do which bit

#

not a form, just an addition to the template

#

just needs a basic one then

#

what did you change, what issues does it address, checkboxes

stable mountainBOT
#
It has arrived!

Here's your reminder: Bump api#17
[Jump back to when you created the reminder](#dev-contrib message)

green oriole
#

For what

#

Ah, uhh

#

Like in python?

patent pivot
#

markdown

#

not yaml

#

we don't want a form

#

we just want a markdown file

#

so google moved us over to www.

#

that got picked up fast, google bot loves us

gritty wind
#

What's the standard error for something considered a "programming error" (I'm thinking opposed to runtime error). I'm trying to raise an error if someone (programmer) passes a value to a function that isn't an expected input (the input is basically an enum)

#

The arg is always of type str, just that str is one a set of three possible values

#

Think a literal

stable mountainBOT
#

exception ValueError```
Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
gritty wind
#

Right, that's technically correct, but it doesn't feel like it expressed the right idea

gritty wind
#

more precise exception such as...

#

Does enum raise anything

green oriole
#

I'd just use valueerror and call it a day

#

TypeError perhaps?

#

One of the two

gritty wind
#

This is mostly to please intelisense anyways

#

It's always a str, so I'd just leave that to the type annotations

green oriole
#

!d TypeError

stable mountainBOT
#

exception TypeError```
Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch.

This exception may be raised by user code to indicate that an attempted operation on an object is not supported, and is not meant to be. If an object is meant to support a given operation but has not yet provided an implementation, [`NotImplementedError`](https://docs.python.org/3/library/exceptions.html#NotImplementedError "NotImplementedError") is the proper exception to raise.

Passing arguments of the wrong type (e.g. passing a [`list`](https://docs.python.org/3/library/stdtypes.html#list "list") when an [`int`](https://docs.python.org/3/library/functions.html#int "int") is expected) should result in a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError"), but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "ValueError").
green oriole
#

Yeah, use that one

dusky shoreBOT
gritty wind
#

Rewrote the function so I never hit that error branch ๐Ÿคก

green oriole
#

lol

#

That solves it

dusky shoreBOT
patent pivot
#

uhhh

#

i think we should use comments with a brief description of the content instead of examples

#

and we don't need an extra section I don't think for api

#

under the i confirm section

#

or

#

hm

#

sure, keep the section, add a comment above both telling people how to actually check it

#

also just shared this in staff but here is migration to www for all to enjoy

#

html comments

#

yea

#

probably not necessary

#

actually

#

we do on other repos

#

just stay in check with the other repos

#

lol

patent pivot
#

put the comments inside the blocks, also that "must be completed" bit can go, you just need to tell users how to actually check the boxes

#

yea

#

but say "replace with [x] to check boxes"

#

wrong bracket on line 10 otherwise lgtm

dusky shoreBOT
gritty wind
#

Guys can someone explain how the redirects app works?

#

Like

#
roles_redirect:
    original_path: pages/roles/
    redirect_route: "content:page_category"
    redirect_arguments: ["server-info/roles"]
#

what's what here

#

redirect route is fine

#

but wth is original_path and redirect_argument

#

Like if I go to the main pydis site now, /pages/roles works with no redirect, but /server-info/roles 404s

patent pivot
#

uhhh

#

no it doesn't

gritty wind
patent pivot
gritty wind
#

I c

patent pivot
#

it loads the content:page_category app (mounted at /pages/) with the arg of server-info/roles

#

nope, we need to split out API before we consider anything major for Django site

gritty wind
#

I mean, what is there to consider until the API is done

#

right

patent pivot
#

ah, well we do have an issue open that talks about moving to a python ssg

vocal prairie
#

site#500 does briefly discuss that in steps 2, 3, and 4

dusky shoreBOT
thorny obsidian
vale ibex
#

just hook into google calendar at this point lol

#

wouldn't be overly difficult with a decent scope

thorny obsidian
patent pivot
#

some form of calendar is the answer

vale ibex
vocal prairie
#

You could probably connect it to Notion (I think the API could do that)

patent pivot
#

or just follow jamstack and have another database somewhere with all our events

patent pivot
thorny obsidian
patent pivot
#

we would likely go for a python ssg so I don't know how much dynamic stuff we can get in there as opposed to if we did something like gatsby

gritty wind
#

K, update on current static site: I've got redirects working (sort of, it doesn't update the URL, just displays the content as if you were redirected). Now we're just waiting on notion

patent pivot
#

do you mean waiting on netlify

gritty wind
#

bleh

#

too many n companies

patent pivot
#

yeah they approved this morning lol forgot to tell you

gritty wind
#

Joe!

#

Okay nice nice

patent pivot
#

i am only like

#

8 hours late

gritty wind
#

Lol it's alright

thorny obsidian
gritty wind
#

Static previews :O

thorny obsidian
#

... time to google then

gritty wind
#

Basically like what we had on forms

#

Where a PR would publish to a site, and anyone could access it

#

Without spinning up the project themselves

#

You're two days late bud ๐Ÿ˜›

thorny obsidian
patent pivot
vocal prairie
patent pivot
#

we'd be using a python ssg which takes in templates (probably some sort of jinja thing) and spits out HTML

#

we can throw JS in there, but it'd only be fairly primitive browser JS compared to what all the fancy frameworks are doing nowadays

#

or we source events from somewhere at build time I guess

#

and then just have to rebuild site to add new events

thorny obsidian
patent pivot
gritty wind
#

Can I like

#

get on your team

patent pivot
vocal prairie
patent pivot
patent pivot
gritty wind
#

Also that's not a lot of minutes ๐Ÿ˜•

#

Considering each deploy takes ~3 mins

patent pivot
#

just as a matter of principle we would like to stick with python

thorny obsidian
patent pivot
vocal prairie
thorny obsidian
gritty wind
patent pivot
#

ahh

gritty wind
#

Unless there is some way to log into netlify cli with PRs?

patent pivot
#

hmmmm

gritty wind
#

Right, but that won't get the secret will it?

dusky shoreBOT
gritty wind
#

At least from my tests on my repo, the secrets aren't give to PRs

patent pivot
#

oh you're right yeah

#

hmmm isn't that where you can rnu the pull_request_target things?

gritty wind
#

Yeah, but that feels like dropping a layer of security, and I'm not sure if it's worth it yet

patent pivot
#

yea

gritty wind
#

If I fix caching, we should drop the time significantly from 3 minutes

patent pivot
#

๐Ÿ‘

gritty wind
#

But, worst case scenario we're looking at ~300 builds a month

#

Would that be enough

#

Me and 50 commits

patent pivot
#

we did a bit of trolling

gritty wind
#

I'll clean up the branch and PR it while you get on the teams part joe

#

kthxbrb

vocal prairie
#

commented again, sorry for all the disjointed stuff

#

How does removing the word "OR" change that?

#

I clicked the plus on that line ๐Ÿคทโ€โ™‚๏ธ

patent pivot
#

@gritty wind do you have a netlify account

gritty wind
#

Oui

#

I uhh

patent pivot
#

dm me the email on it

gritty wind
#

Right, one sec

dusky shoreBOT
gritty wind
#

lol nice

#

it was probably just bot.prefix at some point

#

Perhaps before it got the ping

#

Yup that's it

#

Game added october 2020, mention added august 21

austere hornet
#

Same with Fronto's

#

Ah

gritty wind
#

Is there any way for an HTML redirect to copy a fragment of the request URL?

i.e:
if someone makes a request to /a/b/resource_name, and I want to direct them to c/resource_name, is it possible to have /a/b/<anything> go to /c/<anything>

#

Ideally avoiding JS

#

Nah, just pure HTML

#

The whole "dynamic" part of the app doesn't super fly with the static site :P

#

The other alternative is generating tons of extra HTML files

late wolf
#

sry for that

gritty wind
#

The first google result will be an IBM link if you're curious lol

late wolf
#

but anyway, umm what are the fonts available in sir lancebot?

gritty wind
#

Thanks

#

Seems that page suggests you use JS hm

#

Wdym by fonts

late wolf
#

uh for image drawn using pillow

late wolf
gritty wind
#

This is the part I'm referring to:

It's not an ideal solution and it's discouraged to use at all

late wolf
#

right

#

So like, ex: I want to use fire code for typeface command which has the text displayed on an image, how would I do that?

late wolf
hoary haven
#

still want something? sir-lancebot#881

dusky shoreBOT
hoary haven
#

@clever wraith

clever wraith
#

Oh ty

cursive relic
#

why does @dusky shore react when .topic is ran? And why nothing happens when someone reacts to it as well, if anything is supposed to happen.

green oriole
#

.topic

dusky shoreBOT
#
**What's the best pastry?**

Suggest more topics here!

green oriole
#

It does work

#

Did we mess up the check?

#

@cursive relic can you run topic and then click the reaction?

cursive relic
#

.topic

#

uuh

green oriole
#

lol

#

.source topic

dusky shoreBOT
#
Command: topic

Responds with a random topic to start a conversation.

Source Code
brisk brook
#

I think it is by design that I can't refresh it if it was Akarys who triggered the command.

cursive relic
#

I can't refresh if I do it myself tho

stable mountainBOT
#

bot/exts/utilities/conversationstarters.py line 77

if is_moderator or user.id == message.author.id:```
green oriole
#

Hmmm

#

!e print(False or 42 == 42)

stable mountainBOT
#

@green oriole :white_check_mark: Your eval job has completed with return code 0.

True
green oriole
#

Is it raising an error perhaps

#

Aha, it does

#

Wait, that's unrelated lol

cursive relic
#

so there is just smth wrong but no error is raised?

green oriole
#

Yeah

#

There is a logic error here I believe, but I can't spot it

#

It probably need proper debugging

#

Would you like to open an issue?

cursive relic
#

does it raise error on last line, it raises False anyways

stable mountainBOT
#

bot/exts/utilities/conversationstarters.py line 80

return False```
cursive relic
#

if you'd like to guide me on that, then I can surely open it

vocal prairie
cursive relic
#

ah thx

#

uuh I'm bad at writing all the info. I can't come up with anything

#

All I came up with was ```
When user reacts to bots reaction, nothing happens on it.

green oriole
#

Yup! If you need feedback on what to write, feel free to ask. It doesn't have to be really detailed, this is a simple issue

green oriole
cursive relic
#

oh, right

green oriole
#

If you feel like it, you can even link to the relevant portion of the code

cursive relic
#

the check code part?

green oriole
#

Yup

cursive relic
#

as a link?

green oriole
#

Do you know how to highlight lines on github?

#

If so, you can click copy perma link and paste the link in your issue

cursive relic
#

hmm I don't think I know how to do it

green oriole
#

If not.. I'll let someone else guide you through because I am late to my class

cursive relic
#

Oh, have a good class. I will wait if someone knows how to write that

green oriole
#

But what you should ask yourself when writing an issue is "What information do I need to give someone who doesn't know anything about the bug so they know what is the error and what we explored so far"

#

A'ight, bai

cursive relic
#

Cya, I will try to add that info

fresh rock
cursive relic
#

Any other information I should add? I can't come up with anything

hardy gorge
#

What would be the reason for loading them dynamically?

cursive relic
hardy gorge
#

I don't think I would normally do that in a work project, since it adds some complexity, introduces a bit of magic, but does not seem to add that much over explicitly listing the subrouters

#

It's also easier to temporarily disable routers for debugging purposes if you have an explicit list

#

But I also don't see a great harm in it

cursive relic
#

what do I put here?

green oriole
#

You could put for example

  1. Use .topic without any mod role
  2. Click the reaction
  3. Nothing happens
cursive relic
#

Oh I think I will put that I there

#

I have explained what happens/what should happen. And platform desktop/mobile. And also the one who can implement it.

#

what about here?

green oriole
#

Here, if you don't know how the bug is caused, you can remove that section

cursive relic
#

I had this on desc, should I remove it? ```
There may be a problem on a check function here. But it's just a wild guess.

#

now it looks like this and I think it's good enough, I'd like to know if it is before making it

green oriole
#

Lgtm

cursive relic
#

sir-lancebot#894 is now opened

dusky shoreBOT
cursive relic
#

it was weird opening a issue first time

green oriole
#

That's a good learning experience :D

static canyon
#

@cursive relic it's supposed to work for both the message author and moderators. If you're not either of those, then it won't work (as intended) https://github.com/python-discord/sir-lancebot/pull/880/commits/515c6390563f33a02af2e46fe6f3d13b15353a0a#diff-ace24dfc4bb3c55afff79de98551d97f9f6a0ecbd7b4d51d15ea1e32e2a0df2dR77

GitHub

Relevant Issues

Closes #868
Description

Using the command while it's on cooldown will hit the error handler, which sends an error message showing how long is left on the cooldown, which ...

cursive relic
#

If I try to do it myself it wont work

static canyon
#

Well I know what the issue is

#

It's listening for a reaction from message.author which is the bot

#

But then the bot doesn't trigger it either because there's an if statement stopping that

#

I'll fix this later today @cursive relic, thanks for the report + issue ๐Ÿ‘

cursive relic
#

Good to know, thx!

fresh rock
#

hey, not sure if this is a right channel - I'd like to start with Lancebot and got a workflow question: can I insert my bot's token into a cloned sir-lancebot's repo and 'simulate' full lancelot on my server? Or should I develop my own bot locally and later in further steps merge it to lancebot?

#

got a bit lost, sry for noob question

static canyon
#

You just specify the token in the env/config file (can't remember which)

fresh rock
#

oh wow thank you

static canyon
fresh rock
#

yes I am, I got lost following that guide

static canyon
fresh rock
#

so maybe you could guide in one more issue - as I understand a gitpod is an alternative to local docker develpment, am I right?

#

If im using docker, shall I separately install poetry?

static canyon
#

@brisk brook have just pushed the asyncio-tag changes to bot#1836

dusky shoreBOT
static canyon
#

Gitpod is alternative to docker, yes -- I use docker myself so can only help with that

fresh rock
#

ok, thank you

static canyon
#

You may have to create the file if it doesn't already exist

fresh rock
#

exactly

#

it does not exist

static canyon
#

Yeah, just create it then

#

It's because we've configured it so that git ignores .env files so you don't accidently upload your token etc.

#

And so the .env file isn't there when you clone/fork

fresh rock
static canyon
#

Yeah, you do

#

It's a pain I know; we're working on something to make the setup easier

fresh rock
#

ok, and once it's done I need to run main.py ?

static canyon
#

For reference, this is my .env file```c
BOT_TOKEN="MY_TOKEN"
BOT_DEBUG=true
BOT_GUILD=476190141161930753
PREFIX="'"

USE_FAKEREDIS=true

AOC_ROLE_ID=651730380898041862
BOT_ADMIN_ROLE_ID=476190234653229056
LOVEFEST_ROLE_ID=795910065424171028
ROLE_HELPERS=476190429960732672

AOC_CHANNEL_ID=476190141161930755
AOC_COMMANDS_CHANNEL_ID=476196062214750219
CHANNEL_ANNOUNCEMENTS=476196024512413698
CHANNEL_COMMUNITY_BOT_COMMANDS=476196062214750219
CHANNEL_DEVLOG=476196115432210443
CHANNEL_REDDIT=476197119762366464
REDDIT_WEBHOOK=637295388998500352```

#

You may not need all of those though

static canyon
fresh rock
#

ohhh, ok, sry for noob questions

#

thank you vm

static canyon
#

I guess so you can re-roll multiple times, but then surely once it timeouts we want to break the loop?

vale ibex
#

Yea, there should be a break after the supress block

static canyon
#

๐Ÿ‘

#

Right, time to test now

static canyon
dusky shoreBOT
cursive relic
#

Thx, it was weird opening a issue

static canyon
#

@vale ibex with the suppresses, would it bepy with suppress(discord.NotFound): await message.edit(embed=self._build_topic_embed(message.channel.id)) await message.remove_reaction(reaction, user)orpy with suppress(discord.NotFound): await message.edit(embed=self._build_topic_embed(message.channel.id)) with suppress(discord.NotFound): await message.remove_reaction(reaction, user)?

#

I suppose the prior since if the message is deleted there's no point trying to remove the reaction

#

Or perhaps a try/except would be better, because then we can break

#

akapy try: await message.edit(embed=self._build_topic_embed(message.channel.id)) except discord.NotFound: break else: with suppress(discord.NotFound): await message.remove_reaction(reaction, user)

#

I think I prefer the try/except/else

clever wraith
#

Morning all

dim pelican
#

Morning GitPodifer

clever wraith
#

Lol

#

Morning brad

vale ibex
#

both would work

#

I'm pretty sure if the first line raises an error the context manager will break anyway

#

rather than try the second line

#

worth double checking but I think that's the defined behaviour

#

!e ```py
from contextlib import suppress

with suppress(ValueError):
int("t")
print("context manager continues")

stable mountainBOT
#

@vale ibex :warning: Your eval job has completed with return code 0.

[No output]
vale ibex
#

yea, thought so

static canyon
#

What about what I said with the try/except/else? @vale ibex

#

So that we get a break when the message is deleted

vale ibex
#

what I showed above is that supress does that for us

#

if the first line raises NotFound, the second line isn't evaulated

static canyon
#

supress will exit the while True: loop?

vale ibex
#

oh, you're referring to the while true

static canyon
#

yeah

vale ibex
#

I think we just add the break outside the suppress

static canyon
#

but then it'll always break

#

Which we don't want

#

We only want to break when the message is deleted

vale ibex
#

can you show the code here?

vale ibex
#

I'm not quite following, probably because I don't remember

#

nah, the whole func

static canyon
#
    async def _listen_for_refresh(
        self,
        command_invoker: Union[discord.User, discord.Member],
        message: discord.Message
    ) -> None:
        await message.add_reaction("๐Ÿ”„")
        while True:
            try:
                reaction, user = await self.bot.wait_for(
                    "reaction_add",
                    check=partial(self._predicate, command_invoker, message),
                    timeout=60.0
                )
            except asyncio.TimeoutError:
                with suppress(discord.NotFound):
                    await message.clear_reaction("๐Ÿ”„")
                break
            else:
                try:
                    await message.edit(embed=self._build_topic_embed(message.channel.id))
                except discord.NotFound:
                    break
                else:
                    with suppress(discord.NotFound):
                        await message.remove_reaction(reaction, user)```
vale ibex
#

ah right ok, i get it now

#

lemme think

#
    async def _listen_for_refresh(
        self,
        command_invoker: Union[discord.User, discord.Member],
        message: discord.Message
    ) -> None:
        await message.add_reaction("๐Ÿ”„")
        while True:
            try:
                reaction, user = await self.bot.wait_for(
                    "reaction_add",
                    check=partial(self._predicate, command_invoker, message),
                    timeout=60.0
                )
            except asyncio.TimeoutError:
                with suppress(discord.NotFound):
                    await message.clear_reaction("๐Ÿ”„")
                break

            try:
                await message.edit(embed=self._build_topic_embed(message.channel.id))
            except discord.NotFound:
                break
            with suppress(discord.NotFound):
                await message.remove_reaction(reaction, user)
#

I think this is more readable, rather than the else blocks on the tries

#

since they're not needed and lead to more indentation

static canyon
#

right, yeah. If we're breaking then the else isn't needed

vale ibex
#

yea

static canyon
#

Okay, will go for that and then re-push

vale ibex
#

๐Ÿ‘Œ

static canyon
#

Pushed ๐Ÿ‘

#

Btw, can I make a separate PR for changing constants.py to use config for moderator role and owner role instead of hardcoding to the ids for this server?

vale ibex
#

as long as you keep the defaults

static canyon
#

yep

static canyon
green oriole
#

Thank you sir jl

vale ibex
#

IE one to change the name in all the places, another to make it pull form env var

#

will make it easier to review

static canyon
#

Right, okay

#

And finallypy admin = int(environ.get("BOT_ADMIN_ROLE_ID", 267628507062992896))should I rename the value to be ROLE_ADMIN so it's consistent with the others? @vale ibex

vale ibex
#

I'd argue that if they're in a Role class, having a role suffix at all is redundant

static canyon
#

Since in the .env there's no "classes"

vale ibex
#

yea, envs make sense, since there's no context

static canyon
#

I'm referring to that here

vale ibex
#

I assumed you were referring to the variable name not having the role suffix

static canyon
#

get("BOT_ADMIN_ROLE_ID", ...) --> get("ROLE_ADMIN", ...)

vale ibex
#

Ah, I thought you were referring to the variable name not being consistent

static canyon
#

i.e. without changing it would be```py
class Roles(NamedTuple):
owner = int(environ.get("ROLE_OWNER", 267627879762755584))
admin = int(environ.get("BOT_ADMIN_ROLE_ID", 267628507062992896))
moderation_team = int(environ.get("ROLE_MODERATION_TEAM", 267629731250176001))
helpers = int(environ.get("ROLE_HELPERS", 267630620367257601))
core_developers = int(environ.get("ROLE_CORE_DEVELOPERS", 587606783669829632))
everyone = int(environ.get("BOT_GUILD", 267624335836053506))

vale ibex
#

changing actualy env var names isn't a good idea since it may lead to confusion to contribs since their .env won't work anymore

static canyon
static canyon
#

I'll leave it then

#

Also I suppose the contributing docs would need to be updated

vale ibex
#

yea, there's no need to update them before this gets merged

#

since you're adding more options, rather than removing them

static canyon
#

mhm

vale ibex
#

it may also be something that wants to wait for Zig's pr to be merged too

#

since I'm not sure if it would conflict

static canyon
vale ibex
#

Yea, anyone can submit to that

#

it's on the site repo

vale ibex
#

seems about right yea

#

not sure if Zig's PR changed those files or not

static canyon
#

I'll check before I do the PR

static canyon
dusky shoreBOT
static canyon
#

Have pushed these changes to site#607 and sir-lancebot#896; think I've linked them as best as I can (just mentioning the other issue)

CC @vale ibex

dusky shoreBOT
late wolf
#
def convert_to_image(text:str, filename) -> discord.File:
    """Converts the given text into an image."""
    im = Image.new("RGB", (1200, 1024), "black")
    font = ImageFont.truetype('bot/resources/fun/FiraCode-Retina.ttf')

    draw_image = Image.Draw(im)
    text = text.split()
    split_text_evenly = '\n'.join(
    ' '.join(text[i : i + 8]) for i in range(0, len(text), 8)
        )  
    draw_image.multiline_text(
            (10, 10), 
            split_text_evenly,
            font=font,
            fill=255
        )

    buffer = BytesIO() 
    im.save(buffer, format="PNG")
    return discord.File(buffer, filename=filename)

Should this function be ran in an executor?

molten perch
#

Would someone mind to take a look at sir-lancebot#857 ? It's close to be merged.

molten perch
#

If I may, I think we should migrate a few endpoints to FastAPI to get used to the context etc. etc.(We should also test to those endpoints) (and migrate the models first of all ๐Ÿ˜‰ )
(Also, we can just introduce a decorator to temporarily disable routers based on a list.)

clever wraith
#

@vocal wolf , cowsay was closed because the branch was stale and a new branch was created. ill open a new PR once the rewrite with cowpy is donw

#

done

clever wraith
#

the branch was 2 months old lemon_sweat

vocal wolf
#

I don't know SQLAlchemy

stable mountainBOT
trail pilot
#

What happened to sir-lancebot#778?

dusky shoreBOT
trail pilot
#

It seems like it's been approved for a while

#

Also, when threads can be used by the Python bot, I think the quiz command and hangman command (multiplayer, suggested by Bluenix in sir-lancebot#872) should migrate to threads because quiz uses the entire channel

dusky shoreBOT
trail pilot
#

What do you all think?

brisk brook
#

Yeah I think all of those commands should use threads

patent pivot
#

which PR?

patent pivot
#

looks fine to me?

#

uhhh canโ€™t right now, maybe later

#

!remind 2h that

stable mountainBOT
#
Okay.

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

molten perch
#

Yaay, thank you for the PR campaign ๐Ÿ˜†

static canyon
#

@thorny obsidian for sir-lancebot#861 which of these two were you envisioning (or something else)?

thorny obsidian
#

That way if we ever did want a future .stats command to pull fun pydis stats it won't conflict (as a hypothetical example)

static canyon
#

Right, okay

#

There's also the fact that current there's 3 different files for hacktoberfest (excluding __init__.py)

#

One file for issue-finder, one for hacktoberstats, and one for timeleft.

If we want to move them all into the hacktoberfest subcommand namespace then I'm guessing we'll have to combine these files into one file (which will be messy)? @thorny obsidian

#

Unless imports work I guess

#

There's no actual "hacktoberfest" command currently so we'd need to decide how to structure it all

#

I don't like the idea of having it all in one big file (said file would be ~650 lines)

thorny obsidian
#

Hmmmm, let me take a look after I'm done working and I may be able to provide better clarification

static canyon
#

Ping me when you respond please as I'm going to bed now, so will look when I wake up ๐Ÿ‘

dim pelican
#

Hey Rick, got time to push that color file?

#

Not that I'll likely have time to work on it over the weekend lol

stable mountainBOT
#
Aye aye, cap'n!

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

dim pelican
#

No worries, !sleep -force doublevcodes

#

oof

austere hornet
#

Lmao

dim pelican
#

shoulda sudo'd

stable mountainBOT
fervent sage
#

-word removes the whole benefit of being able to do multiple flags following a single -

stable mountainBOT
#
It has arrived!

Here's your reminder: push colour file smh
[Jump back to when you created the reminder](#dev-contrib message)

late wolf
#

Uh, the bot just randomly sent this in my test server.
wut just happened?

vocal prairie
#

Sir Lancebot doesn't have any functionality like that, are you sure it isn't a different bot?

late wolf
#

Absolutely, cause thats the only one there.

sir-lancebot  | 10/09/21 11:59:09 - bot.exts.fun.typerace TRACE: Running convert_to_image in an executor
sir-lancebot  | 10/09/21 11:59:59 - bot.exts.holidays.halloween.spookyreact DEBUG: Ignoring reactions on self message. Message ID: 896366383984701480
vocal prairie
#

Oh wait, that probably is a Sir Lance command, nvm

#

I thought you meant as an unprovoked message

#

You most likely accidentally triggered one of the commands inside the cog, that's all

molten perch
stable mountainBOT
#

bot/exts/holidays/halloween/spookynamerate.py lines 215 to 216

@tasks.loop(hours=24.0)
async def announce_name(self) -> None:```
late wolf
#

ah

vocal prairie
#

...why? I don't see what's the point in that.

molten perch
#

It's a game. ๐Ÿ˜„

vocal prairie
#

Yeah, but do we really want an unprovoked message every 24 hours? Or is it a core part of the game to happen that often?

#

Oh I see, it's sort of like a leaderboard

#

I personally think it would be better to have that as a command rather than a looped message

molten perch
#

I mean, it's sort of the point of the game that it runs every day, and everyone can play. Then the next day it announces the winners of the last day as well.

timid sentinel
#

what's up with the <function when mentioned or... bit, seems like bot.command_prefix isn't a string? Is that something that changed at some point?

timid sentinel
#

I think we should just be using constants.Client.prefix instead

molten perch
#

Might be the best, this callable it returns needs: a bot instance, and a message as arguments, I'm not sure why though.

vale ibex
#

@stable mountain help

stable mountainBOT
#
Command Help

Big Brother
!bigbrother
Monitors users by relaying their messages to the Big Brother watch channel.
!bigbrother unwatch <user> <reason>
Stop relaying messages by the given user.
!bigbrother watch <user> <reason>
Relay messages sent by the given user to the #big-brother channel.

Bot
!echo [channel] <text>
Repeat the given message in either a specified channel or the current channel.
!embed [channel] <text>
Send the input within an embed to either a specified channel or the current channel.

BotSource
!source [source_item]
Display information and a GitHub link to the source code of a command, tag, or cog.

Branding
!branding
Control the branding cog.

Clean
!clean
Commands for cleaning messages in channels.

timid sentinel
#

yeah the problem is that we're using bot.command_prefix in help commands to show the user the prefix

vale ibex
#

Yea, in the help command we should just use the constant then

timid sentinel
#

yep

molten perch
#

This function(the one that gets returned) also returns the prefix, but I don't think it's worth the effort at all, when we can use the constant ๐Ÿ˜„

gritty wind
#

We have quite a few commands that send stuff like this for different months

#

We have for valentine too

#

The probability anyoneโ€™s ever seen that hovers between 0 and zilch

#

But youโ€™ll have seen it if you tested the bots in those months

#

We have a lot of inexplicable stuff like that, most very old

#

Thereโ€™s that candy minigame which adds random candy emotes to certain messages, and keeps a leaderboard for who clicks them

#

But without context (which it always will be) itโ€™s just confusing and pointless

dusky shoreBOT
gritty wind
#

@hardy gorge would you like to get one in first?

last patio
#

I can also merge it, up to you

hardy gorge
#

If it's been reviewed, it's fine to merge it

last patio
#

merged master

#

gonn await for CI and then merge

molten perch
#

Wow, Thank you!ย @last patio

vocal prairie
#

You can click "edit" in the upper right (the one you click to change the name" and change the branch iirc

#

oh wait, yeah, oops

gritty wind
#

If you really wanted, you can merge your new branch into your main, but there is no problem with opening/closing provided you don't have any reviews yet

cold moon
green oriole
#

You can use a RunPython step inside your migration for that

patent pivot
#

do we use enums for infractions?

#

can't we use something like ALTER TYPE colors RENAME VALUE 'purple' TO 'mauve';

cold moon
#

I don't think so. Looks like just choices at code side.

patent pivot
#

raw SQL for the whole application is bad because then generally no one does migrations

#

but for migrations raw SQL is fairly common providing the ORM understands the before and after

patent pivot
#

!remind 1h that

stable mountainBOT
#
Of course!

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

green oriole
#

I feel like using python for this is way simpler and will avoid making django understand one type is gone but the other isn't, and it actually has to recreate voice_ban but it has to add voice_mute to its internal registry

molten perch
#

@cold moon Would you mind opening an issue in the API repository regarding your recent model changes? I believe a pull request template was added to indicate this, but it's relatively new. ๐Ÿ˜„

cold moon
molten perch
cold moon
#

Oh, looks like if you create PR using recent push notification, then you don't see templates.

#

I will open issue tomorrow

#

!remindme 12h this

stable mountainBOT
#
Of course!

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

stable mountainBOT
vale ibex
#

It's shouldn't do no

#

Shouldn't really take >5 seconds

#

Do you have a branch I can checkout?

#

alright

#

sure, send me the config

gritty wind
#

Did you google how to make your own search engine?

#

Happens to the best of us

#

Just sign the non-compete form - provided you can find it

vale ibex
#

Do you share the network with others?

gritty wind
#

Lol are you on a pub network

vale ibex
#

Yea, then it's likely that either you, or someone on that network is sending traffic that looks like automated scraping

#

it could also be from an extension you have

vale ibex
#

I think it's the --diff arg on the flake8 call that's causing the issue

#

flake8 will wait to be passed a diff via stdin

#

pre-commit itself does the pruning of files anyway, so there's no need to use --diff

#

So I'd just go for ```yaml
repos:

  • repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
    • id: check-merge-conflict
    • id: check-toml
    • id: check-yaml
    • id: end-of-file-fixer
    • id: trailing-whitespace
      args: [--markdown-linebreak-ext=md]
  • repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.9.0
    hooks:
    • id: python-check-blanket-noqa
  • repo: local
    hooks:
    • name: Black
      description: Runs Black within the project environment
      id: black
      entry: poetry run black . --check
      language: system
      types: [python]
      require_serial: true
    • name: Flake8
      description: Runs Flake8 within the project environment
      id: flake8
      entry: poetry run flake8
      language: system
      types: [python]
      require_serial: true
stable mountainBOT
#
No problem.

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

vale ibex
#

and that's managed by pre-commit

gritty wind
#

Oooooooooooookay it's taken some work but I've now gotten static previews PR open

#

I'll hammer out some caching stuff, but it should be otherwise basically good to review

#

site#609

dusky shoreBOT
vale ibex
#

oh nice nice

gritty wind
#

I'd also like thoughts on the redirects app

#

I've left a comment there describing the problem

#

I tend to agreetothis

vale ibex
#

What do we use redirects for in the site?

gritty wind
#

I think an old article or guide still had an old URL

#

which is fine, it just goes through a redirect on the main site

#

but that's not easy here

#

Let me find it

vale ibex
#

Ahh yea, there's also https://www.pythondiscord.com/pages/*/ -> https://www.pythondiscord.com/*/

gritty wind
#

Funny enough, I got all page redirects working

#

It's just "two" that don't work yet

vale ibex
#

Ah right, are they important? or can they just be removed

gritty wind
#

/resources/reading, etc

gritty wind
#

Acc I may have fixed /events/resources, gotta check real quick

vale ibex
#

lol

#

Just saw that post

gritty wind
#

Nop, /events/resources is still broken :)

#

Acctually... I'm not seeing a redirect called /events/resources

#

Must've imagined that one

#

I also just figured out the other issue, so now it's down to /resources/<...>

#

How come every time I complain about something, it just works

full fractal
#
bot_1        | Traceback (most recent call last):
bot_1        |   File "/bot/bot/api.py", line 66, in maybe_raise_for_status
bot_1        |     response_json = await response.json()
bot_1        |   File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1097, in json
bot_1        |     raise ContentTypeError(
bot_1        | aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://api.web:8000/healthcheck')
bot_1        | 
bot_1        | During handling of the above exception, another exception occurred:
bot_1        | 
bot_1        | Traceback (most recent call last):
bot_1        |   File "/bot/bot/bot.py", line 251, in login
bot_1        |     await self.ping_services()
bot_1        |   File "/bot/bot/bot.py", line 99, in ping_services
bot_1        |     await self.api_client.get("healthcheck")
bot_1        |   File "/bot/bot/api.py", line 80, in get
bot_1        |     return await self.request("GET", endpoint, raise_for_status=raise_for_status, **kwargs)
bot_1        |   File "/bot/bot/api.py", line 75, in request
bot_1        |     await self.maybe_raise_for_status(resp, raise_for_status)
bot_1        |   File "/bot/bot/api.py", line 70, in maybe_raise_for_status
bot_1        |     raise ResponseCodeError(response=response, response_text=response_text)
bot_1        | bot.api.ResponseCodeError: Status: 404 Response: <!DOCTYPE html>

what did I fuck up this time ๐Ÿ˜ฆ

#

I'm trying to setup an instance of the @stable mountain bot using the staff bot test server (and its instructions) and I get this error at startup...

gritty wind
#

What do you see if you navigate to http://api.web:8000/healthcheck

#

Maaay have to change api.web to localhost to give me an answer

#

Ah actually, I do know

#

Either your bot or site is out of date

#

Make sure to pull main

full fractal
#

I did gh repo clone python-discord/bot earlier today ...

#

sigh

brazen charm
#

weren't subdomains removed recently or something like that

gritty wind
#

Yup, but I think that happened yesterday

#

hmm hm

#

Ah it might be your config

full fractal
brazen charm
#

try web:8000/api for the url

gritty wind
#

That wouldn't get updated with the clone

full fractal
#
bot_1        | Traceback (most recent call last):
bot_1        |   File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
bot_1        |     return _run_code(code, main_globals, None,
bot_1        |   File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
bot_1        |     exec(code, run_globals)
bot_1        |   File "/bot/bot/__main__.py", line 15, in <module>
bot_1        |     bot.instance.run(constants.Bot.token)
bot_1        |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 723, in run
bot_1        |     return future.result()
bot_1        |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 702, in runner
bot_1        |     await self.start(*args, **kwargs)
bot_1        |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 665, in start
bot_1        |     await self.login(*args, bot=bot)
bot_1        |   File "/bot/bot/bot.py", line 256, in login
bot_1        |     await self.cache_filter_list_data()
bot_1        |   File "/bot/bot/bot.py", line 87, in cache_filter_list_data
bot_1        |     full_cache = await self.api_client.get('bot/filter-lists')
bot_1        |   File "/bot/bot/api.py", line 80, in get
bot_1        |     return await self.request("GET", endpoint, raise_for_status=raise_for_status, **kwargs)
bot_1        |   File "/bot/bot/api.py", line 75, in request
bot_1        |     await self.maybe_raise_for_status(resp, raise_for_status)
bot_1        |   File "/bot/bot/api.py", line 67, in maybe_raise_for_status
bot_1        |     raise ResponseCodeError(response=response, response_json=response_json)
bot_1        | bot.api.ResponseCodeError: Status: 401 Response: {'detail': 'Invalid token.'}

well I got progress but I'm confused at what token I managed to mess up

gritty wind
#

I'm trying to update the test server config now to work with the changes

#

What do you have in your .env file

#

Just for BOT_API_KEY

full fractal
#
BOT_TOKEN=$insert-bot-token
#

wrong name?

gritty wind
#

Right, so there is another token for the site, but luckily that's static for dev environments

#

BOT_API_KEY=badbot13m0n8f570f942013fc818f234916ca531

#

BOT_TOKEN is fine

full fractal
#

it seems to be working now

#

there's a lot questionable errors still but oh well

gritty wind
#

Could you share them? We may be able to work through some of them now

full fractal
gritty wind
#

Hm that's curious

full fractal
#
2021-10-09 23:29:40 | bot.exts.moderation.watchchannels.bigbrother | ERROR | Failed to fetch webhook with id `609535034474496063`
bot_1        | Traceback (most recent call last):
bot_1        |   File "/bot/bot/exts/moderation/watchchannels/_watchchannel.py", line 107, in start_watchchannel
bot_1        |     self.webhook = await self.bot.fetch_webhook(self.webhook_id)
bot_1        |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 1493, in fetch_webhook
bot_1        |     data = await self.http.get_webhook(webhook_id)
bot_1        |   File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 248, in request
bot_1        |     raise Forbidden(r, data)
bot_1        | discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
bot_1        | 2021-10-09 23:29:40 | bot.exts.moderation.watchchannels.bigbrother | ERROR | Failed to start the watch channel; unloading the cog.
gritty wind
#

Oh

full fractal
#

I think it's related to this part of the log

gritty wind
#

Ok so I don't have any roles on that server

#

But could you give your bot the super bot role?

#

If not, I gave it admin anyway so it should work now I hope

#

Seems you can't either, will have to wait for Mark to do that

full fractal
#

yeah I can't either as just an admin

#

I've rarely worked with an application that spits out as many log entries as this one

#

a bit of a firehose ^^

gritty wind
#

Hah that's true

#

I've gone ahead and fixed the other issue, so no one else should hit it now ๐Ÿคž

full fractal
#
Make sure to update the following if you are running the bot on docker
Site URL: `site: &DOMAIN "localhost:8000"`to `web:8000
snekbox_eval_api` URL: `"http://localhost:8060/eval"` to `"http://snekbox:8060/eval"`

What is this all about by the way?

brazen charm
#

the contributing guide will also need updating for the urls

gritty wind
#

So if you're running on docker, there's the config var on line 359 that needs the URL to be specifically set to use docker

#

That is, if the actual bot application itself is running on docker, it'll use the internal routing system, i.e the website with name web will be on http://web...

gritty wind
full fractal
#

Right, I did change the snekbox URL

gritty wind
#

!remind 12H update contributing guides for new url

stable mountainBOT
#
Okay.

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

full fractal
gritty wind
#

It could use some work for sure

#

It would probably look better if not forced onto one line as it is now

#

Thoughts on that?

full fractal
#

still broken but I have to go for the moment, thanks @gritty wind for helping ^^

gritty wind
#

If you're referring to the first part, it means the bot calculated a ping time to be negative (most likely meaning your system time is not in sync with discord's)

#

I've found that it's almost guaranteed to be the case on docker

#

Haven't found a fix

full fractal
#

There was another error in the logs but my memory sucks

gritty wind
#

I'll be here if you ever feel like debugging again

full fractal
#
web_1        | Exception occurred during processing of request from ('172.18.0.7', 56860)
web_1        | Traceback (most recent call last):
web_1        |   File "/usr/local/lib/python3.9/socketserver.py", line 683, in process_request_thread
web_1        |     self.finish_request(request, client_address)
web_1        |   File "/usr/local/lib/python3.9/socketserver.py", line 360, in finish_request
web_1        |     self.RequestHandlerClass(request, client_address, self)
web_1        |   File "/usr/local/lib/python3.9/socketserver.py", line 747, in __init__
web_1        |     self.handle()
web_1        |   File "/usr/local/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 174, in handle
web_1        |     self.handle_one_request()
web_1        |   File "/usr/local/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 182, in handle_one_request
web_1        |     self.raw_requestline = self.rfile.readline(65537)
web_1        |   File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
web_1        |     return self._sock.recv_into(b)
web_1        | ConnectionResetError: [Errno 104] Connection reset by peer

this is probably safe to ignore, yeah?

gritty wind
#

Yeah that's an error from discord

#

It just likes to disconnect with no warning

vocal prairie
#

For the redirects issues, are these for prod or only for the previews?

gritty wind
#

Just previews

vocal prairie
#

Oh ok

full fractal
#

Success! I've played around with Daylily for like 30 minutes and I haven't seen an error (other than me being stupid with commands)

clever wraith
#

Just noticed the word "scat" can be used in the .anagram command, not too sure bout that one

static canyon
#

Only meaning I'm aware of is like "scat!" when you're telling an animal/someone to go away

deep sparrow
#

it can also mean poop

#

not really 'explicit' though

static canyon
#

Yeah, just "poop" doesn't seem bad to me

stable mountainBOT
cold moon
#

!remindme 3h this again

stable mountainBOT
#
Alright.

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

stable mountainBOT
#
It has arrived!

Here's your reminder: remember this
[Jump back to when you created the reminder](#dev-contrib message)

static canyon
green oriole
#

Yeah, nah, let's not put them into one file

#

I don't mind how we organize the interface, I just don't want any file that has more than 400 lines

static canyon
#

4 of the exts/fun are over 400 lines, one of which is 675 lines

#

Yes, we want to avoid it where we can, but I'm not really sure we can avoid it here

green oriole
#

We can either split out utilities in other files, or have each command be its own file, all joined under a single cog

static canyon
green oriole
#

Just have the command defer all the work to an imported function

gritty wind
#

I don't think we should add structural complexity just to avoid having too many lines

#

It's a bit uhh

#

How do I put this

#

Superstitious

#

Fewer lines is ideal, but it isn't a big deal if we go over. Remember the goal here is to keep things understandable and approachable. More lines hurts that, but so does structural complexity

#

I've worked extensively on the silence cog, and I needed to pull out graphs just to understand what the hell it was doing

green oriole
#

I don't think it is structure complexity to split it up

gritty wind
#

It is when you start splitting functions up into more and more calls just to save a bit of space

green oriole
#

I mean, it is one very simple level of indirection

gritty wind
#

One level which will do the following:

  • Add an import
  • Make you go to a new file where you are splitting the interface and logic
#

Ultimately, it'll probably be fine with whatever you go with, but in general we shouldn't just make commands wrappers for other functions in the name of a "shorter" file

stable mountainBOT
cold moon
#

!remindme 4h again...

stable mountainBOT
#
You got it!

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

brisk brook
#

Lol

#

Stop procrastinating!

gritty wind
#

Hey @last patio you wouldn't happen to know how to specify CMD from a shell in docker build would you?

#

Or actually

#

I see the problem now

#

command is used on run lol

#

Nah that's not what I'm trying to do. I have a default CMD specified in the dockerfile, but I'm trying to override it when building the image from the command line

green oriole
#

I don't think that's feasible without adding like a second stage build to override it

last patio
#

I think docker commit is what you want: build the existing image, docker commit a layer on top of it

green oriole
#

ooh, smart

#

yeah, you just push a layer on top of the file

#

docker commit --change "CMD ['hello'] $perv_tag $new_tag"

gritty wind
#

I just ended up slapping my run in a conditional

#

The thing is, I need this to happen in the build stage not the run stage

green oriole
#

using commit you create a new image

gritty wind
#

I think you're missing my point

#

I don't actually want to modify the CMD it turns out

#

Since that is only used when running

#

I want this done during the build stage

green oriole
#

Okay, I guess the question is why you want to modify it

gritty wind
#

Well, I'm trying to combine the static build dockerfile with the normal docker file

#

When doing a static build, it runs a different command to the normal docker file

#

This'll probably be easier to understand once I push the changes

green oriole
#

probably haha

stable mountainBOT
stable mountainBOT
#

bot/exts/avatar_modification/avatar_modify.py line 291

async def spookyavatar(self, ctx: commands.Context) -> None:```
mint nebula
vale ibex
#

Ah right, then no we purposefully removed the ability to do that

mint nebula
#

Noted, ๐Ÿ‘

vale ibex
#

We no longer allow any commands that parrot back arbitrary images via the bot, or anything that allows members to run commands against other members without their permission.

mint nebula
#

i was going to make a pr on it, glad i asked first

vale ibex
#

๐Ÿ‘

#

It's always good to ask here, or raise an issue first, before investing time in making a code change

gritty wind
#

Another question for one Mr. @last patio I've left a comment on the usage of __all__. I tried now setting the all in the init to not have the helper functions, but it seems I can still import them with no problems.

I don't think they should be used from there if someone wants to use them

#

What do you think?

last patio
#

Yeah, nothing will prevent you from importing them. Same for __, but since that's a convention linters will actively warn against it. We can't fully "hide it" in Python anyways, so it's really up to you about how we deal with it

timid sentinel
#

If you just want to indicate it shouldn't be imported I think it should be a single rather than double underscore before the name.

cold moon
vale ibex
#

Checkout the readme ๐Ÿ˜„

patent pivot
#

messages from help channels

vale ibex
#

Could have sworn I put this in the readme

#

but now I realise I put it in the k8s readme

#

I'll pad it out with more

gritty wind
#

It will be consumed by AIโ„ข๏ธ to produceโ„ข๏ธ Bugdataโ„ข๏ธ to be processed by ยฉ the pydis-hiveโ„ข๏ธmind

vale ibex
#

yupyup

#

that's it

#

Alright, pushed more to the readme

stable mountainBOT
green oriole
#

well at first we were supposed to do stuff for d.py 2.0

#

but we didn't

cold moon
#

Can anyone help me with opening this issue in API repo about voice mute model changes? I'm currently busy with school stuff.

molten perch
#

Of course, I'll open the issue.

full fractal
#

When updating the bot's code, is a container rebuild for bot_bot_1 always necessary to pull in the updates?

#

I feel like I saw something about a faster way but I don't remember

vocal prairie
#

No, docker compose up without --build will work because the bot source code is stored as a volume

#

So the container itself will be cached, so it'll be faster

vale ibex
#

heh, I'm glad I pinned this, it's been asked a lot recently

#

,

full fractal
#

I've only done sudo (which docker-compose) up ... is that the wrong command?

#

(I don't have rootless docker set up ATM)

vale ibex
#

did you stop the container before doing that?

full fractal
#
^CGracefully stopping... (press Ctrl+C again to force)
Stopping bot_bot_1       ... done
Stopping bot_web_1       ... done
Stopping bot_snekbox_1   ... done
Stopping bot_redis_1     ... done
Stopping bot_postgres_1  ... done

~/programming/oss/bot on ๎‚  main [!] is ๐Ÿ“ฆ v1.0.0 via ๎˜† v3.8.5 took 3m16s792ms 
โฏ sudo docker container ls --all
CONTAINER ID   IMAGE                                     COMMAND                  CREATED        STATUS                       PORTS     NAMES
ac18a4d9500a   bot_bot                                   "python3 -m bot"         17 hours ago   Exited (0) 19 seconds ago              bot_bot_1
174aca225190   ghcr.io/python-discord/site:latest        "python manage.py ruโ€ฆ"   18 hours ago   Exited (137) 8 seconds ago             bot_web_1
5a9e384a0b37   ghcr.io/python-discord/metricity:latest   "bash entry_point.sh"    18 hours ago   Exited (0) 3 minutes ago               bot_metricity_1
323de1e0ab48   ghcr.io/python-discord/snekbox:latest     "gunicorn -c config/โ€ฆ"   18 hours ago   Exited (0) 18 seconds ago              bot_snekbox_1
4a156024b581   redis:5.0.9                               "docker-entrypoint.sโ€ฆ"   18 hours ago   Exited (0) 18 seconds ago              bot_redis_1
f38cafd4ccaf   postgres:13-alpine                        "docker-entrypoint.sโ€ฆ"   18 hours ago   Exited (0) 20 seconds ago              bot_postgres_1
#

preassumably?

vale ibex
#

yea, that should just work then

#

is it not pulling code changes in?

full fractal
#

it doesn't seem to be, I added a runtimerror within the set_command method of bot.exts.info.doc and it's not crashing :/

vale ibex
#

huh that's really odd, I don't think running it as sudo should have any affect

#

but also I run on a windows host so can't be sure

#

can you shove a error log in say the dunder init of bot and see if it appears?

full fractal
#
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.
bot_1        | 2021-10-10 16:53:07 | bot.monkey_patches | DEBUG | Patching send_typing, which should fix things breaking when discord disables typing events. Stay safe!
bot_1        | 2021-10-10 16:53:07 | discord.client | WARNING | PyNaCl is not installed, voice will NOT be supported
bot_1        | 2021-10-10 16:53:07 | bot | ERROR | please show up >.<
bot_1        | 2021-10-10 16:53:08 | deepdiff.diff | INFO | jsonpickle is not installed. The to_json_pickle and from_json_pickle functions will not work.If you dont need those functions, there is nothing to do.
web_1        | Creating a superuser.
bot_1        | 2021-10-10 16:53:08 | bot | INFO | Cog loaded: Big Brother
web_1        | Admin superuser already exists.
bot_1        | 2021-10-10 16:53:08 | bot | INFO | Cog loaded: Clean
#

yup ๐Ÿคท

#

please show up in the middle

vale ibex
#

yea

#

not sure why your exception isn't being hit then

full fractal
#

whelp then it's debugging time before I even develop a bugfix :p

vale ibex
#

Where did you add the error? when you run the command, does it just add the doc fine?

full fractal
#
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index e7710db2..c3268c32 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -396,6 +396,7 @@ class DocCog(commands.Cog):
             "inventory_url": inventory_url
         }
         await self.bot.api_client.post("bot/documentation-links", json=body)
+        raise RuntimeError("no")
 
         log.info(
             f"User @{ctx.author} ({ctx.author.id}) added a new documentation package:\n"
vale ibex
#

I did the same and it raised the error when I ran the command

full fractal
#

I moved it up and now it's crashing ๐Ÿคท

vale ibex
#

how odd

full fractal
#

I'm just going to assume PEBKAC unless I hit something similar again ๐Ÿ˜„

vale ibex
#

hah hopefully ๐Ÿ˜„

#

It's an issue I run into quite often

full fractal
#

problem exists between keyboard and chair
-> me doing a dumb-dumb somewhere

vale ibex
#

aka layer 8 issue

full fractal
#

f.ext r doc

#

f.ping

#

well there goes my latency again

vale ibex
#

wrong server kek

full fractal
#

oh lol

#

I can't be the first one to do that riggghhttt ๐Ÿ‘€

vale ibex
#

nope haha

full fractal
#

phew

full fractal
#

well, let's see how many review comments a 9 lines PR will get :D #dev-log message

#

oh fun I forgot to push my changes

full fractal
#

Hello I am here to bikeshed, please stay calm.
awesome

placid ermine
#

what does the api response json look like

timid sentinel
#

{'package': ['documentation link with this package already exists.']}

#

It would be sorta nice if the api gave error codes, checkin' in strings always feels a bit meh

vale ibex
#

{'package': 'pyth', 'base_url': '', 'inventory_url': 'https://docs.python.org/2/objects.inv'} on success

vocal wolf
#

@vale ibex is there any specific reason why we haven't merged bot#1865 (stalling for something, another thing is broken, etc)?

dusky shoreBOT
vale ibex
#

Yea, there's a typo in the message and wookie had a could do for extra handling

#

Once the typo is fixed I'd be fine with merging and Richard has the option to do wookie's suggestion

#

Hmm, wookie's suggestion might be better fixed in the site

#

so it gives a meaningful error

thorny obsidian
full fractal
vale ibex
#

๐Ÿ‘Œ

full fractal
#

what's the current api response if it's too long right now?

vale ibex
#

wookie said it's the exact same

full fractal
#

well that's not great

vale ibex
#

yea, i think we shouldn't special case it here

#

the problem is the site reports the wrong message

#

so we should fix the site api

full fractal
#

Agreed.

thorny obsidian
#

So I considered that, but it's a lot more interaction required to bulk subscribe/unsubscribe vs toggle buttons

vale ibex
#

The idea with buttons is that they can be toggle buttons, so when a user clicks them, the text updates to reflect that they now have the role, and the user cna click again to remove the role

#

it'll be 2 for now

#

can't see it going over 5

thorny obsidian
#

Off the top of my head: Announcements, PyWeek, Python Trivia Night, Code Jam, maybe even Pixels

vale ibex
#

The idea is it'll be useful for ad hoc events where we want a temp self-assignable role for announements

thorny obsidian
#

A lot of this will be blurry with if it should be in lance

vale ibex
#

So even if there are more, they won't be all the time

#

we could add it to the branding cog and have that cog validate the id

#

So in the event md you'd also specify an announcements role id

full fractal
#

shoot, I just realized I didn't escape the package name in my error handler, it's probably fine?

#

other than some fun markup presumably nothing bad could happen?

vale ibex
#

Yea, it'll be fine. The command itself is mod only, and the bot has strict allowed_mentions

#

so it won't cause issues

#

ofc nothing wrong with belt and braces though

timid sentinel
#

IIRC the package name is checked against a regex (smth like [_0-9a-z]) before the request as well so there's your braces ๐Ÿ˜›

vale ibex
#
package_name_validator = RegexValidator(
    regex=r"^[a-z0-9_]+$",
    message="Package names can only consist of lowercase a-z letters, digits, and underscores."
)
#

so it is ๐Ÿ˜„

timid sentinel
vale ibex
#

Ahhh alright

timid sentinel
#

It would be nice if the site api gave error codes for these sorts of things

#

Maybe that's something we could have in the new API

fallen patrol
#

like

#

every response with an error supplies an error code

dim pelican
#

RE: sir-lancebot#859, it should be good to go. Just pending reviews from Xith and Dennis

dusky shoreBOT
dim pelican
#

@vocal wolf what do you think about #859 and sir-lancebot#860 (only one of these are mine)

dusky shoreBOT
fallen patrol
#

small update on that poetry bug from previously, to solve it for myself I wrote a script that parses the poetry.lock file to export a requirements.txt in my ci, since it only takes a second to run rather than poetry taking around 15 seconds to run.

patent pivot
#

static deploy previews for site!

gritty wind
#

I want to hire banks PR full time please

patent pivot
#

HELL yeah

#

i'm just ultra hype around this it's so cool

#

i still don't know how it works

gritty wind
#

Joe Iโ€™m not convinced you didnโ€™t come up with this after the first admin meeting

#

Itโ€™s an html scrapper

patent pivot
#

i mean i won't not take the credit sometimes my brain waves are just that immense that i forget my idea

#

but i just pumped out buzz words you did the dirty work

gritty wind
#

Between the both of us, we make a functional person

patent pivot
#

exactly, the hivemind continues

molten perch
#

Hey! Do I need some kind of formal approval to implement api#19 and api#20? They're fairly easy changes. ๐Ÿ˜„

static canyon
#

@molten perch fyi I'm planning to do api#20 myself

dusky shoreBOT
molten perch
#

Oh sorry then.

#

I'll implement the other.

static canyon
#

No worries; I would've assigned myself but for some reason I can't on the API repo

short snow
#

Hello long time, I would start mentioning the review changes from Sunday ๐Ÿ™‚

molten perch
short snow
#

yeah

molten perch
#

Could someone take a look at sir-lancebot#857? It's close to the finish. ๐Ÿ˜„

molten perch
#

Hey! Is there a consensus about whether the API is going to use Async SQLAlchemy, or not?

fallen patrol
clever wraith
#

Hi all, sir-lancebot#699 will be delayed due to my laptop being in need of repair.

dusky shoreBOT
clever wraith
#

Or whatever the new pr number is

short snow
austere hornet
#

Anyone know why lint is failing on sir-lancebot#901?

dusky shoreBOT
dim pelican
#

What happens if you manually run flake8?

sleek steppe
austere hornet
fallen patrol
#

er

#

flake8

sleek steppe
#

Also if flake8 was not skipped then it probably would have just caught a syntaxerror

patent pivot
#

poetry run task lint

vocal prairie
austere hornet
vocal prairie
#

Oh wait, poetry run task lint is equivalent, nvm

sleek steppe
#

You can also do poetry run precommit to install the hooks so you can't commit without the lint passing

fallen patrol
#

also if you don't want to wait for them to install the first time

#

poetry run pre-commit install --install-hooks

dim pelican
#

The command that I was thinking of was flake8 madlibs.py

austere hornet
#

Also @sleek steppe I don't see any whitespace in the JSON, maybe I'm missing something?

sleek steppe
#

If you're committing locally then you can just run the lint

#

and it will fix the whitespace automatically

austere hornet
austere hornet
patent pivot
#

have you installed deps?

#

poetry install

austere hornet
#

Oh wait I don't think so hold up

short snow
#

brad helper ๐Ÿ‘€ congo

austere hornet
#

@patent pivot Now I get this:

patent pivot
#

uhh yeah you need git, so you'll need git bash or however you get git on windows

short snow
#

Found a uncaught error in xkcd command sir-lancebot

#

Will open an issue in sometime, if someone didn't

full fractal
#

brad, mina, and me in past three weeks IIRC

#

ah and etrotta too

austere hornet
#

Congrats to all of you! (ok ok, I know it's off topic)

#

So @patent pivot I installed git and poetry run task lint works now, but I'm getting this and can't figure out on what lines the errors are happening

patent pivot
#

not much I can tell you other than what it says, you should be using 4 spaces for indentation but have used tabs, so it's flagging it up as a complaint

austere hornet
#

So you're saying I have to physically type 4 spaces for each indentation instead of tab even if tab gives you exactly 4 spaces?

thorny obsidian
#

unless your editor is converting a tab to 4 spaces, a tab is not guaranteed to give you 4 spaces equivalent

#

A system can configure a tab to display as any amount of spaces

short snow
vocal prairie
short snow
#

copy madlibs code put it into black formatter online, halff the lint errors would be solved

#

also enable pre-commit, which would run the linter before commiting

green oriole
#

Hey @austere hornet, can you please set up a pre-commit hook to avoid having all of those failed lints?

#

poetry run task precommit

short snow
#

I know we don't use them, but it would remove the tabs errors and long lines -- half of them, the rest can be followed by flake8

green oriole
#

Long line wouldn't be using the right length though

#

and some of the style changes will have to be reverted

short snow
#

yeah

rapid igloo
#

I think autopep8 might be better to fix the errors since it reads config files like tox.ini, .flake8 if present

gritty wind
#

Now, I ran it on the entire codebase, and it generated a minimal diff, so I'm assuming it can follow our style guide when the code is already properly formatted, but for the people that would benefit most from this, I think it would be very confusing.

Why is linting failing, I ran the formatter?
"Well, you see, the formatter doesn't actually follow our style guide"

#

That is to say, we could consider a formatter, just not autopep8

#

But that will still require modifications to the style guide - just not as significant as autopep8

dim pelican
austere hornet
austere hornet
green oriole
#

Cool!

stable mountainBOT
#
Yeah okay.

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

austere hornet
#

Oops didn't mean to ping that time

rapid igloo
# gritty wind Now, I ran it on the entire codebase, and it generated a minimal diff, so I'm as...

I guess it would be amazing if trivial things like formatting errors could be fixed with script. I'm not sure why there are few formatters that uses flake8's errors... the advantage of black (despite not following the style guide fully) of course, is that it can be used in CI to --check whether the code is properly formatted and help you fix it automatically during development or before committing. maybe I'm missing something big here, but it isn't that hard to parse flake8 output and automatically fix (known) formatting errors[^1], so one could possibly have a scripted that accepts flake8 output as stdin so it can fix the trivial things? especially things like trailing whitespace. (Actually doesn't pre-commit automatically fix up some things?)

^1: as I understand it linting != formatter check -- so of course linter could fail after formatter is run (but yeah thanks for pointing out, autopep8 is actually worse than black. I didn't used a concrete example like you did when trying it out)

Of course one could argue this is the job for the IDE (and sure for stuff like trailing whitespace it makes total sense) but not everyone may be using a python-dedicated editor or have really good python support setup. For example, I use nvim with python LSP and it warns me unused variable, line too long etc. but it doesn't take into account config files in the project.

gritty wind
#

I hear you, but yeah for the most trivial of things, we do use extra formatters to fix them (though they don't take into account flake8). Trailing whitespace, missing newlines, wrong file endings are all fixed by pre-commit.

Having built a tool which fixes exactly one flake8 error (single to double quotes), it can get pretty complex.

Regardless, I don't see it as too much of a problem. I'm in the habit of writing okay-ish looking python code before any formatting, and any errors are pointed out to me before I commit (pre-commit), so I almost always never mess up linting. Ofc that isn't always viable, for instance, it won't help when commiting from the github UI, but I believe it's always viable where an automatic formatting script is.

#

One more tool we can add with little difficulty is some sort of import manager, possibly isort. I think Akarys was looking into that, but that's one error less

#

There is also the fact that for the case in question, it seems pre-commit wasn't set up before commiting, and linting was not run at all, and obv for those cases we can't do anything

molten perch
short snow
#

alembic setup, and its fine

molten perch
#

Oh,it has already been assigned to @clever wraith .

thorny obsidian
#

Is the Python d.py 2.0 PR planning on being merged this upcoming weekend?

green oriole
#

If it is reviewed before this weekend, hell yeah

short snow
vale ibex
#

I don't think these should be in config

thorny obsidian
#

@vale ibex you had some opinions about this. Should these roles be defined in the config or would something like constants.py make more sense? -- lol you beat me to it

vale ibex
#

we should have the role ID's in config, the ones that are used by the subscribe command should be a constant in the cog file itself

green oriole
#

Agreed

thorny obsidian
#

Yeah, that makes sense to me. I want to be explicit in the file itself which roles are being added, not by running down some yml file

vale ibex
#

yea, in the cog file I expect there to be something like ```py
ANNOUNEMENT_ROLES = (
constants.Roles.subscribe_role,
contsants.Roles.pyweek,
)