#dev-contrib

1 messages Β· Page 148 of 1

short snow
#

good luck πŸ™ƒ

#

Ok cool, sir-lancebot#930 is now ready for review, the only todo left is to add leaderboard support to all game cogs which would be done after the core functionality gets an approval

dusky shoreBOT
clever wraith
#

Hi all, regarding sir-lancebot#902, cowpy has been switched back to Apache. Does this mean I need to find another library or just do it myself?

dusky shoreBOT
clever wraith
#

I am no core dev or lawyer, but if they switched the license it should be fine to use, if there is any problem with that switch it is on them, that's my personal view on the matter

vale ibex
#

Does apache require attribution? I forget

#

should be fine as apache, just might need to add a thrid party license file

clever wraith
#

I don't think you need to attach the license since you don't vendor anything, it is a third party library compatible with MIT

clever wraith
#

Hey @vale ibex, rapidfuzzy fully released wheels for 3.10 if you want to update the issue

vale ibex
#

nice nice

#

oh, i already had πŸ˜„

#

just waiting on hiredis and psutil

static canyon
#

@reef tinsel something I noticed on your PR is that you're using logging.getLogger and not bot.log.get_logger

#

You should change that

#

I'll formally request changes on the github when I'm on my laptop later

reef tinsel
#

ok

static canyon
#

And as for requesting reviews, it's at the top-right of the main PR tab

reef tinsel
#

tbh it makes no difference to functionality currently anyway since im not using it lol

#

yh

#

i did look but i could find any thing to click

gritty wind
#

not everyone can request reviews

static canyon
#

Oh right

gritty wind
#

If you've got time, make sure to update your base branch for your PR, so you can work out any problems before people start reviewing

reef tinsel
#

wdym?

static canyon
#

!remind 3h review bot#1917

stable mountainBOT
#
You're the boss!

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

dusky shoreBOT
gritty wind
#

So, when you created a new branch, you started at a certain point in history

short snow
gritty wind
#

Since then, the main branch had new commits

#

Which your branch doesn't have

reef tinsel
#

aah πŸ‘

gritty wind
#

It's a good idea if you have time to do it, but it's not a big deal

reef tinsel
#

done the merge - will test again now

gritty wind
#

thanks πŸ‘

dim pelican
#

Is it normal for our code base to type hint the variables when they are definied?

brisk brook
#

You generally shouldn't

#
abc: str = "abc"
#

This is useless

short snow
#

90% of the time no, the rest 10% include cases like this where the reader is not aware of what it will contain or it is not explicitly clear

gritty wind
#

There are some places where it can be useful (think Optional/None)

green oriole
#

And collections

gritty wind
#

I think something in our toolchain would warn for that

#

yeah

dim pelican
#

@reef tinsel see above? This is the first thing that stands out to me

brisk brook
#

See dict() because dict[Any, Any]

gritty wind
#

I think that's what Jason is saying haha

#

Good example

green oriole
#

Yeah

short snow
#

Yes, the reader wouldn't know-how is the dict structured unless they go through the code

reef tinsel
#

πŸ‘

molten perch
#

Hey! Could someone take a look at api#23? It should be pretty straightforward by now. πŸ˜„

short snow
#

I see some cascading options patching, which wasn't discussed on the PR, any context for that?

gritty wind
#

Good idea, good idea

#

The mako script is just auto-gened, right?

short snow
#

yeah

gritty wind
#

Thx

short snow
#

Ok @molten perch the mako script doesn't agree with black and the linter

You can update it to this

"""
${message}

Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
import sqlalchemy as sa
from alembic import op
${imports if imports else ""}

# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}


def upgrade() -> None:
    ${upgrades if upgrades else "pass"}


def downgrade() -> None:
    ${downgrades if downgrades else "pass"}
thorny obsidian
gritty wind
#

That doesn't.... look right

short snow
#

We use it on api

gritty wind
#

I think we may use it on api yeah

#

Maybe we should just exclude the migrations directory

#

It's almost entirely autogenerated anyways

short snow
#

Without black, migrations look horrible

gritty wind
#

Who's looking at them

thorny obsidian
#

why do we use black on the api?

short snow
#

no they aren't autogenerated, only the initial one is

#

rest you write them on your own

gritty wind
#

They are, just run generatemigrations

#

I know, I ran a ton when debugging with Dorsan

#

Would be quite underpowered and inefficient if we still had to manually write them

molten perch
short snow
#

There is a way to generate them in Alembic by diffing the sqlalchemy models, but I haven't worked with them, they aren't very accurate and most of the time one edits them manually to make them accurate. Django autogenerate are completely next level, if alembic had that support - I would have used it.

I remember this being discussed on the pr also

#

Yeah that linked discussion

#

autogenerated models

#

compare them with the current state

gritty wind
#

I don't think Volcy's comment is accurate, at least not anymore

#

That's not correct

#

I have an auto generated migration above

#

let me get it for ya

short snow
#

πŸ‘ .

gritty wind
#

Deleted a table, dropped all dependencies

#

clean migration

static canyon
#

@gritty wind am I right in saying that guild.get_role has never had any issues with cache (aka we don't need to await guild.fetch_all_roles())?

gritty wind
#

It's also like django with generating new files for new migrations, it doesn't overwrite anything

gritty wind
#

I'm not sure, it's hard to know for sure beyond looking at where we use similar things, and see what works

#

Is this for the reminders issue?

short snow
#

They are different

gritty wind
#

Wdym?

molten perch
short snow
#

ok nvm, cascading was added alter by dorsan

static canyon
gritty wind
#

Ah, hmm

static canyon
#

I don't like this

gritty wind
#

We use get_role in a few places, doesssn't seem to be a problem I think

#

I'm not sure

#

Fetch should be fallback at least anyways

short snow
#

Also that patreon PR has lot of duplicated code, espcially get roles, knock them to a cog task

vale ibex
#

wait_until_guild_available already ensures that roles, members and channels have items

#

I don't see a need for that

static canyon
#

yeah

#

Okay, thanks

gritty wind
#

Hm, seems deleting the table still requires manual changes

#

Alright, that's fine

sour viper
#

hey so if i made a contribution do i get the "Contributor" role awarded ?

gritty wind
#

So, it depends

#

A role given by staff to people who make substantial contributions

#

The role is given on a case-by-case basis, but usually a single contribution not really

sour viper
#

ohhhh okay

gritty wind
#

Unless you like idk... sprinted an entire project or something πŸ˜›

#

We do appreciate all contributions though, and we keep our peepers peeled

sour viper
#

naaaaah not that big just a small fun command

vale ibex
#

!otn a Scale's peeled peepers

stable mountainBOT
#

:ok_hand: Added 𝖲cale’s-peeled-peepers to the names list.

gritty wind
#

I can't believe it took this long, I've been saying it for such a long time πŸ‘€

vale ibex
#

lol

static canyon
#

Submitted a preliminary review @reef tinsel πŸ‘

#

A few nitpicky things so sorry :p

reef tinsel
#

πŸ‘ will take a look

static canyon
#

This is probably my first in-depth review so let me know if you have any queries :p

reef tinsel
#

@static canyon when I fix these, should I do one big commit ssaying something about the review, or should I split it up?

static canyon
#

I think split it up for now and if we decide we want to squash it later then we can πŸ‘

reef tinsel
#

ok πŸ‘

dim pelican
#

I tend to have more commits than (probably) needed

gritty wind
#

@short snow how were you even running black to get it to error? It shouldn't pick up the mako script because it's not python

#

Hell, running black . on Dorsan's branch passes

static canyon
#

The thing is we can always squash commits, but it's had to split one commit into multiple

#

So I'll tend to do more than needed and then squash

dim pelican
#

I think it had the main branch merged twice over the course of the PR

static canyon
#

Do you have precommit configured by the way? @dim pelican @reef tinsel

dim pelican
#

Yup

static canyon
#

Good πŸ‘

reef tinsel
#

yep

molten perch
gritty wind
#

Currently, it seems fine to keep it

#

I'm not even sure if anything is not passing?

#

Also, dockerfile still needs a newline at the end of the file

#

I'm about to press the green button, just doing some final checks on the actions

#

Exciting stuff, big news for the api

molten perch
#

Indeed πŸ˜„ It seems like cascading works as well, so everything's fine πŸ˜„

gritty wind
#

Does it? It's still throwing errors for me, but I figured might as well ignore them at this point

molten perch
#

It did not throw errors for me.
When'd it throw errors for you? Can you send your code snippet that was failing?

gritty wind
#

I did the same thing agian, just removed nomination

molten perch
#

Oh, yeah. It's a migration problem, not cascading.

#

And, you just have to change the order, as alembic is not aware of them.

gritty wind
#

So what was the cascading problem?

#

Typically if the cascading is working properly, dropping the nomination table should drop all columns in nomination_entry, no?

#

Like if I manually run the SQL:

drop table api_nomination cascade;```

It'll drop the table just fine
molten perch
#

I hope so?
I only tested with single records, not whole tables. :/

reef tinsel
#

The isort pre-commit hook will stop my commit from commiting when it changes an import order, even when it is the only "failing" thing. Could this change?

static canyon
reef tinsel
#

but all i need to do is start the commit again and it will work

#

for it sorts the imports for me

static canyon
#

Ah right

#

Yeah, that's annoying I guess

gritty wind
reef tinsel
#

i do understand why the isort fails, as it does give me a notice that m imports have changed, but is their a way for this kind of thing to pass, but give me the notice?

gritty wind
#

It's designed to explicitly fail like that

molten perch
gritty wind
#

Though, you can manually run it beforehand

gritty wind
molten perch
#

It's handled on the ORM level.

gritty wind
#

Right, but it isn't working

thorny obsidian
#

@trail pilot Can you provide some more guidance / an example of what you're expecting the json loaded in to look like? It's currently unclear from the code and the PR description.

gritty wind
#

It's working for now, and it's easy enough to modify the migrations if something doesn't cascade properly, so I'll just submit an approval for now

#

Let me go check on the actions

molten perch
#

I went through the cascading the other day, it seemed to work just fine.
However, I tested it using SQLAlchemy, and not by issuing SQL commands.

static canyon
#

I meant that the top 3 should have different variable names to the bottom three

#

So like```py
tier_1_or_above_patrons = set(...)
tier_2_or_above_patrons = set(...)
tier_3_only_patrons = set(...)

tier_1_only_patrons = ...
tier_2_only_patrons = ...

reef tinsel
#

aahok

static canyon
#

edited @reef tinsel ^

#

So for the two things related to that, just hold fire

gritty wind
#

Deleted the user just fine, but the nomination entry was still there

#

I can also modify the PK on api_user so that the ID no longer exists, which should update in FKs, but it doesn't

molten perch
#

But, that's not the ORM. Let me show you.

short snow
#

also the linting tools pass as dorsan has fixed the initial migration file

gritty wind
#

regardless, I don't think it's worth the bother to try and get it compatible with the code style. There are other things which I'm pretty sure will fail, but we can't fix

#

I was debating whether or not to ask Dorsan to definitely disable black on migrations, since for the most part they shouldn't need to be reviewed by humans

#

But at the same time, they already get linted so, what's the point

short snow
#

I mostly write migrations for alembic myself, and I am sure a few others also do that... so not completely sure about that

molten perch
gritty wind
short snow
#

(torture? lol, I just didn't knew about this and now have written a lot of alembic migrations for two of my projects so I am just used to it)

#

Ok yeah, I am fine with removing black then, because the main job is done anyways

reef tinsel
#

could someone have a look at my latest comment on bot#1917 (latest message in #dev-log )

dusky shoreBOT
static canyon
#

@reef tinsel not on my laptop so can't comment on GitHub but dopy """ ...... """instead

reef tinsel
#

a little confused?

static canyon
#
"""...."""```to```py
"""
....
"""```
#

That way it's not over the 120chars

reef tinsel
#

that doesn't work

static canyon
#

Wdym?

gritty wind
#

@molten perch alright, we're getting very close now. I've asked for someone from devops to have a look at the actions so we should be ready to go soon

reef tinsel
#

pre-commit doesn't like it

static canyon
#

Add a newline? If so, add it

reef tinsel
#

open and closing quotes should be on the same line if 1 line string

#

in otherwords, that format isn't allowed

static canyon
#

I mean ig "every day" --> "daily"

molten perch
static canyon
reef tinsel
static canyon
#

Yeah, we do sometimes have to rework docstrings

molten perch
#

I'm not aware of the context. So you created a User and a NominationEntry correspondingly, right?
(Although, you'll need a Nomination for a Nomination Entry though)

gritty wind
#

I dropped nomination completely, so I didn't need nomination

#

But yeah

#

Created a user, used it to create a nom entry

#

dropped user

#

nom entry still there

molten perch
#

I'm not sure how.
It's supposed to return None like when you do type(user) (since you named the nominationentry user)

gritty wind
#

I still see the entries for the nomination in the DB for the nomination, but not the user

molten perch
#

I did the same thing, it seems to work.

gritty wind
#

I cleared my entire environment, and started from scratch to get something reproducible

#
from datetime import datetime
from sqlalchemy.orm import Session
from sqlalchemy import create_engine
import os

os.environ["database_url"] = "postgresql://pysite:pysite@localhost:7777/pysite"
os.environ["auth_token"] = "my_token"

from api.core import settings
from api.core.database.models.api.bot.user import User
from api.core.database.models.api.bot.nomination import Nomination
from api.core.database.models.api.bot.nomination_entry import Nominationentry

engine = create_engine(settings.database_url)
session = Session(engine)

session.add(User(id=1, name="test name", discriminator=8000, in_guild=True, roles=[]))
session.add(User(id=2, name="test nominee", discriminator=8000, in_guild=True, roles=[]))
session.add(Nomination(active=True, user_id=2, inserted_at=datetime.now(), id=1, end_reason="", reviewed=False))
session.add(Nominationentry(id=1, reason="Something", actor_id=1, nomination_id=1))
session.commit()

user = session.query(User).first()
session.delete(user)
session.commit()
session.query(Nomination).first()
session.query(Nominationentry).first()
cold island
#

You want nominations to disappear when dropping users?

gritty wind
#

That's what cascade should do in theory yeah

#

Otherwise you have dangling entries

cold island
#

Is that a good thing in this case?

gritty wind
#

There are very few cases where users are deleted

#

And yeah, that is intended behavior

cold island
#

Ah, I think I see

green oriole
#

I feeeeel like for safety reasons the user shouldn't ever be dropped if it is referenced by a nomination

cold island
#

If we want to drop info on a user then cascading sounds like a good thing

#

And for safety reasons we have blackbox

green oriole
#

I don't think we would notice it

gritty wind
#

Nothing does it automatically

green oriole
#

We do drop users when they leave the guild with no infraction

gritty wind
#

I'm pretty sure we'd only get to that point if someone requests data expunging

green oriole
#

I think @patent pivot does that every month during the data review thing

green oriole
#

Okay he stopped doing those

cold island
#

But if they leave the guild with a nomination that will stop them from being deleted in that case as well right?

gritty wind
#

So, looking at it

#

This is the current behavior

green oriole
#

But he used to do that

There were 216,631 records in the user table containing users from the Discord server. 12,780 of these records are users who have left the server with no infraction history, these records have been removed.

gritty wind
#

It's the same in the current API

green oriole
stable mountainBOT
#

bot/exts/backend/sync/_syncers.py lines 212 to 223

async def _sync(diff: _Diff) -> None:
    """Synchronise the database with the user cache of `​guild`​."""
    # Using asyncio.gather would still consume too many resources on the site.
    log.trace("Syncing created users...")
    if diff.created:
        for chunk in chunked(diff.created, CHUNK_SIZE):
            await bot.instance.api_client.post("bot/users", json=chunk)

    log.trace("Syncing updated users...")
    if diff.updated:
        for chunk in chunked(diff.updated, CHUNK_SIZE):
            await bot.instance.api_client.patch("bot/users/bulk_patch", json=chunk)```
gritty wind
#

Syncer doesn't delete anything either

#

Only time users are deleted is when someone goes in and explicitly, manually deletes them

molten perch
# gritty wind

So, what's the context in that case? You have Nomination, NominationEntry and a User and you delete a User and you expect both Nom and Nomentry to be deleted?

gritty wind
#

Well, if the user is gone, why do we still have the nomination entry

#

It would appear to be dangling

#

Actually I see why

#

I didn't delete the other user lol

#

Okay, seems to be working as intendedℒ️

molten perch
#

Phew πŸ˜…

#

Cool

#

Thank you for the test and all! πŸ˜„

#

In theory, I patched the actions correctly.

trail pilot
thorny obsidian
#

have you tested your feature yet with that json?

stable mountainBOT
molten perch
#

Yaay, alembic setup merged πŸŽ‰ Thank you! πŸ˜„

gritty wind
#

I wonder if caching will properly work if you try to use the published container as a source

#

Or will we have to publish the dev one too

#

Gotta eventually test that

#

!remind 18H Test that

stable mountainBOT
#
ROGER THAT

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

molten perch
#

I believe so, yeah! πŸ˜„

thorny obsidian
# trail pilot Yep

the json provided will throw a key error with your current code. explanation needs to be description

trail pilot
#

So I couldn’t give the JSON I tested it with

cold moon
#

New?

#

I think I don't have redesigned issues yet

cold moon
#

Everything looks old for me

brisk brook
cold moon
#

Actually yes, there are new icons, but design is same for me currently

dim pelican
#

Can't wait to get some long messy bars for my PRs

gritty wind
#

Just go to the git history tab

dim pelican
clever wraith
#

The heck is this

#

Does github wants to make us feel even worse about our commit higiene

trail pilot
#

Holy crap, that’s amazing

dim pelican
#

Atomic commits mean that you should try to reach Avogadro's number right?

clever wraith
#

I like this

#

It would allow making releases easier to manage

#

Gah, limited betas

#

Github will end up killing me with their betas

patent pivot
#

best way of rollouts

clever wraith
#

For sure

patent pivot
#

coming from someone who has run A/B for a user base of uhh

clever wraith
#

But it is pretty argh at some point

patent pivot
#

21 million

clever wraith
#

Pff, that's only the population of Switzerland

#

Do they do beta testing for new chocolate brands?

#

Nah I don't

gritty wind
timid sentinel
clever wraith
#

no I'm not trying to keep all the chocolate for myself

timid sentinel
#

lol

trail pilot
#

So, I'm trying to commit to sir-lancebot with isort added, but flake and isort keep causing conflicts for each other. flake8 doesn't like the additional newline between application relative and application while isort keeps fixing it

#

and causing that conflict

stable mountainBOT
#
It has arrived!

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

fallen patrol
stable mountainBOT
#
Of course!

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

fallen patrol
#

At theatre

austere hornet
austere hornet
#

Np

fallen patrol
#

Hmmmmm

stable mountainBOT
reef tinsel
#

I assume that Bot (and maybe some other bots) will require the message intent? Whatever it is, it's probably worth it to put this information on the contributing guides?

rapid igloo
#

the Bot contributing guides has a note on that

reef tinsel
#

doesn't mention the message intent at all there...

cold island
#

It's not relevant until April. We'll put it there when we actually turn on the intent

static canyon
#

@reef tinsel just had a brief look at your commits since my review and it looks pretty good πŸ‘

Will re-review later when I'm on my laptop

#

!remind 5h4M re-review bot#1917

stable mountainBOT
#
Alright.

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

dusky shoreBOT
static canyon
#

Eee

#

!reminder edit duration 3352 7h2M

stable mountainBOT
#
Alright.

That reminder has been edited successfully!

reef tinsel
#

good thing the bot can then πŸ™‚

short snow
#

deletes message what did you say, I can do maths

static canyon
reef tinsel
static canyon
#

In fact

#

!remind 34h Issue for providing exact end time instead of relative time on !remind

stable mountainBOT
#
Aye aye, cap'n!

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

static canyon
#

Also @reef tinsel I'd hold fire on wookie's reviews for now since some of them I don't agree with and would like to flesh out

reef tinsel
#

yeah

#

i'm changing things that are clearly good (i.e. api call saving and docstring updation)

static canyon
#

Yep πŸ‘

rapid igloo
short snow
#

so even you are there

#

probably

#

yeah

#

i sent a message, saw?

fallen patrol
#

hmmm, i won't be there, but im very interested in if a branch per release is before or after a release commit is made to the default branch.
eg: is the newest release part of the main branch, or the last commit goes into the release branch?

#

makes sense

#

i need to make a release workflow to generate that last commit for me to a pr lol

short snow
#

globe is the repo, and the content is an issue

#

*No, I am not *

fallen patrol
#

o

#

i'm not in any of these

#

should go to one

short snow
#

this is about github actions

fallen patrol
#

but im busy today

#

and its 5am

short snow
#

i am free today :D

fallen patrol
#

interesting....

fallen patrol
short snow
fallen patrol
#

Er, I just noticed this is drv contrib

short snow
#

lol, he messed it up

desert vessel
#

does sir lancebot run on a vps? or does it run on docker?

cold moon
stable mountainBOT
dim pelican
#

Hey all, I ran into an issue this morning during my testing. How would you raise an error from a command group subcommand? Currently for sir-lancebot#842 the subcommands all call the same "create and send embed" function. If there is an error during the conversions (specifically, the case when a name cannot be found during the fuzzy matching) how do I raise and send an error embed?

dusky shoreBOT
brisk brook
#

What do you mean?

#

Just try/except?

clever wraith
#

You want to raise InvalidArgument and it will send the proper error embed

#

I believe that's what you are asking

brisk brook
#

Isn't it BadArgument?

#

!d discord.ext.commands.BadArgument

stable mountainBOT
#

exception discord.ext.commands.BadArgument(message=None, *args)```
Exception raised when a parsing or conversion failure is encountered on an argument to pass into a command.

This inherits from [`UserInputError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.UserInputError "discord.ext.commands.UserInputError")
gritty wind
#

We raise our own execrations and handle it

#

Thanks autocorrect

#

Things like

#

!src sheygzbeksbd

#

Those use that

#

Iirc

#

!src src

#

Ah no you’re right

#

It’s bad argument

clever wraith
#

Oh right, BadArgument

dim pelican
#

Alrighty, will have to try that out. I have to take any value from the user to search for a fuzzy matched color name, but when one is not found I need to raise the BadArgument when the function is returned

clever wraith
#

Sounds about right, yeah

dim pelican
#
    @colour.command()
    async def name(self, ctx: commands.Context, user_colour: str) -> None:
        """Command to create an embed from a name input."""
        hex_colour = self.match_colour_name(user_colour)
        # add try / except with BadArgument
        hex_tuple = ImageColor.getrgb(hex_colour)
        await self.send_colour_response(ctx, list(hex_tuple))
clever wraith
#

Eh, the linode dashboard is pretty fine

patent pivot
#

unnecessary

#

the only thing we provision on our Linode dashboard is the cluster itself, volumes, load balancers, firewalls, etc are all defined inside Kubernetes

#

TF is cool, but I don't like it for infrastructure at our size and don't want to use it here

green oriole
#

@rapid igloo feel free to PR without an issue, you have my approval

#

She asked me to have a look

rapid igloo
#

:D thanks

#

!remind 12H make people not able to cheat in candies ^

stable mountainBOT
#
Affirmative!

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

stable mountainBOT
static canyon
#

!remind 1d Do this

stable mountainBOT
#
Yeah okay.

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

keen valley
#

Hey!
I am looking for the New idea for sir-lancebot
Everything is done
but before that I just need to ask that, is there already another such kind of feature?
I had created .gender command which will get a parameter and return the gender of that name
And exception and all, I had handled

gritty wind
#

How is it determining gender

dim pelican
#

Is gender defined by names? I don't think it is

vale ibex
#

I don't think a command that assumes gender based on a name is something we'd be interested in

gritty wind
#

Yup to both points

molten perch
#

Hey! Would someone mind to assign me to api#22, just for the sake of consistency? 😁

dusky shoreBOT
keen valley
clever wraith
#

Hope it is fine for me to assign

molten perch
#

Β―_(ツ)_/Β―

molten perch
brisk brook
#

Bcos they pay

#

πŸ’Έ

clever wraith
#

how do i install pip install -r requirements.txt

clever wraith
#

Hey @last patio (I believe we never met, I am akarys other's identity), I wouldn't mind having a way to bypass the worker, but how do we integrate that into the hastebin UI?

patent pivot
#

what if we did it as a confirm

#

try once, get an error and warning, try again and it goes through

clever wraith
#

How do we even code that? I guess you could set a session token

#

Yup, we do return a message to show as an error

last patio
clever wraith
#

We could actually store state in the user cookies

last patio
clever wraith
#

But honestly I don't think it is good UIs because we know most users don't know how to read

last patio
#

we could always put "uwu gazooks! our web service inklings have determined a token! oopsie" to make it more user friendly, taken from discord's example

clever wraith
#

Heh

last patio
#

what happened to your other account

clever wraith
#

I don't think too long messages display nicely though

#

My other account is fine, I'm just a plural person apparently, heh

clever wraith
#

morethanone.info and all that jazz, but I'd guess you already know what plurality is

last patio
#

fair enough

last patio
#

lets do it

last patio
#

very interesting

clever wraith
#

Well, now you know, heh

#

I'd be scared of users just pressing save twice though

#

without reading

last patio
#

maybe we could store a timestamp in there and require like 1, 2, 3 seconds before accepting a second save?

#

or just a regular ratelimiter may not be a bad shout

clever wraith
#

Hmmm

#

Do we have that many false positive on token filtering?

#

workers#13

dusky shoreBOT
clever wraith
#

Too bad, workers#14

dusky shoreBOT
austere hornet
clever wraith
#

Oh, nice

#

Mind leaving a comment pls?

#

I don't even know if I am allowed to work on that PR. I think it should be fine.

patent pivot
#

what language should proxy be written in

#

hmmmmmm

#

the thing for filtering egress traffic

#

yea

#

that's part of it

#

yes

#

basically when coredns sees a query from a pod which is marked to have it's egressing traffic filtered

#

it'll return a DNS resolution to the proxy

#

the proxy then checks if that domain is permitted

#

yeah, but having proxy do it is nicer

#

we don't want to run a whole rule evaluation on our DNS controllers

#

that's wasteful and harmful to non-filtered traffic

#

i need to check with linode how dns support is

fallen patrol
#

i wasn't supposed to send that yet

smoky adder
#

Hello everyone, does this thread have a list of projects to contribute?

stable mountainBOT
#

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

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

Where to start

  1. Read our contributing guidelines
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
stable mountainBOT
rapid igloo
#

gah okay

rapid igloo
#

done

molten perch
#

Hey, @gritty wind! As for site#618, would you mind opening an issue in the API repo as well? So that we can keep the models up-to-date! πŸ™‚ (If you're busy, I can open it as well)

dusky shoreBOT
gritty wind
#

I’ll open it once it’s approved for site

#

It probably wouldn’t make sense to open it now when it can still change

summer garden
#

Is there a quick way of reloading a cog after changes when using lancebot with docker?

dim pelican
#

From your discord server, .c r <your cog>

#

Also, good catch on the color review, totally blanked when I was writing those BadArgument calls for the color ranges

short snow
#

@dim pelican regarding your error, if you would still get it as you haven't specified trashcan emote, did you read by point 1?

#

Or by error you mean that the .colour rgb(etc) aren't being catched?

#

try adding invoke_without_command=True on the group deco

dim pelican
#

I'll have to try it when I'm back at my testing setup

dim pelican
stable mountainBOT
#
Can do!

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

short snow
#

okay πŸ‘

cold island
#

@timid sentinel @last patio changes addressed in bot#1793 πŸ‘‰πŸ‘ˆ

dusky shoreBOT
stable mountainBOT
last patio
#

oof i’ll try to review it tomorrow on my 12h shift

#

!remind 15h bot#1793

stable mountainBOT
#
You got it!

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

dusky shoreBOT
stable mountainBOT
cold island
left flume
vale ibex
#

Could you open an issue on sir-lancebot's repo with your proposed changes?

#

We can then discuss them and see if it's something we're interested in having on the bot

#

preferably this is done before you actually write any code, since then you don't waste your time if it ends up getting rejected

summer garden
#

@dim pelican let me know if you're testing sir-lancebot#842 and things don't seem to be adding up. I think there is some confusion on the pr

dusky shoreBOT
summer garden
# dim pelican omg...I see what you mean

Have you noticed that embed descriptions seems to be unhelpful at best? HSB information for 20. Random information for Pigeon Post. I'm wondering if we could throw some other info in it's place

#

"random information" doesn't sound like you're giving a random color

#

I had an idea that if you use the random subcommand, a reaction pops up πŸ”„ so you can get a new color without retyping the command. It's probably best left for another time, once this is pushed

stable mountainBOT
trail pilot
#

@thorny obsidian
So, the unicode trickery is working, would we want to have syntax highlighting? I think I'd likely have to avoid keywords so we can still keep syntax highlighting, here's how it looks

trail pilot
#

Also experimenting a feature where it shows the amount of people that have answered so far

#

The only problem with this would be ratelimits

clever wraith
#

Yes, just rename it like you'd rename any repo

#

Hopefully\β„’

fallen patrol
#

eheheehehe this reminds me of when i accidently made a repo after renaming

#

so uh the gist here is that yknow how github does the auto redirects

#

well what happened is i made one of those redirect repos by mistake because i made a fork of a repo with the same name ;-;

#

turns out if you delete it fast enough or something github keeps those redirects

trail pilot
#

Hm, would you all think a .joke command would be cool, just like a simple Python joke pulled from a text file (maybe a YAML if it’s different for different chats) like "What is a backend developer’s favorite kids game?", answer is "Jenga"

summer garden
#

that would be quite fun

trail pilot
#

or "What did the coroutine say to the event loop?", answer is "await! I’m almost done"

#

actually that one doesn’t make much sense

#

"What is a Python programmer’s favorite song?", answer "Blank Space by Taylor Swift", these are just a few examples

rapid igloo
#

your fork is yours and it has nothing much to do with the main repo. you can even create a fresh new repo named something ridiculous but pull main repo's commits locally, make your changes, then PR to upstream. it'd work afaik as long as the repo histories match

#

4 lines PR for reviews, anyone? sir-lancebot#931

gritty wind
left flume
#

any opinions on sir-lancebot#932 ?

stable mountainBOT
fallen patrol
#

left a review on the colour command πŸ˜…

last patio
#

good bot

fallen patrol
timid sentinel
#

@cold island @cold island @cold island clean is heeeeere!!!

cold island
#

oh yeeeee

#

I was actually just looking at it and noticed kwzrd's comment about time.time()

#

So many I should've changed that

#

but it seems to work blobshrug

clever wraith
#

Clean rework is merged?

short snow
#

yep

clever wraith
#

Woooooo

cold island
#

!help clean

stable mountainBOT
#
Command Help

!clean [users] [traverse] [first_limit] [second_limit] [use_cache] [bots_only=False] [regex] [channels]
Can also use: clear, purge

*Commands for cleaning messages in channels.

If arguments are provided, will act as a master command from which all subcommands can be derived.

β€’ users: A series of user mentions, ID's, or names.
 ‒ traverse: The number of messages to look at in each channel. If using the cache, will look at the first traverse messages in the cache.
 ‒ first_limit and second_limit: A message, a duration delta, or an ISO datetime. If a message is provided, cleaning will happen in that channel, and channels cannot be provided. If a limit is provided, multiple channels cannot be provided. If only one of them is provided, acts as clean until. If both are provided, acts as clean between.
 ‒ use_cache: Whether to use the message cache. If not provided, will default to False unless an asterisk is used for the channels.
 ‒ bots_only: Whether to delete only bots. If specified, users cannot be specified.
 ‒ regex: A regex pattern the message must contain to be deleted. The pattern must be provided enclosed in backticks. If the pattern contains spaces, it still needs to be enclosed in double quotes on top of that.
 ‒ channels: A series of channels to delete in, or an asterisk to delete from all channels.*

Subcommands:

!clean all [traverse=10] [use_cache=True] [channels]
Delete all messages, regardless of poster, stop cleaning after traversing traverse messages.
!clean between <first_limit> <second_limit> [channel]
Delete all messages within range.
!clean bots [traverse=10] [use_cache=True] [channels]
Delete all messages posted by a bot, stop cleaning after traversing traverse messages.
!clean regex <regex> [traverse=10] [use_cache=True] [channels]
Delete all messages that match a certain regex, stop cleaning after traversing traverse messages.
!clean stop
If there is an ongoing cleaning process, attempt to immediately cancel it.
!clean until <until> [channel]
Delete all messages until a certain limit.
!clean user <user> [traverse=10] [use_cache=True] [channels]
Delete messages posted by the provided user, stop cleaning after traversing traverse messages.

cold island
#

Look at that big boy

short snow
#

welp

clever wraith
#

Two full screens on mobile, heh

short snow
#

One more review :lemon_plead: bot#1446

dusky shoreBOT
vocal wolf
dim pelican
#

sir-lancebot#842 needs reviews / testing. Will let the reviews come in before adding more commits.

dusky shoreBOT
dim pelican
stable mountainBOT
#
Aye aye, cap'n!

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

rapid igloo
#

1\ngoodbye\n? :P

fervent sage
#

yes

dim pelican
#

Anyone else getting an error when running sir-lancebot's main branch on docker?

#

Right now it is saying it cannot find the duck game's all_cards.png. Seems like it thinks the current directory is in bot instead of sir-lancebot.

#
sir-lancebot    | FileNotFoundError: [Errno 2] No such file or directory: '/bot/bot/resources/evergreen/all_cards.png'
sir-lancebot    |
sir-lancebot    | The above exception was the direct cause of the following exception:
sir-lancebot    | discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.fun.duck_game' raised an error: FileNotFoundError: [Errno 2] No such file or directory: '/bot/bot/resources/evergreen/all_cards.png'
clever wraith
#

The directory is actually correct, we place our code in /bot

#

Although I'm not sure why the file isn't present

dim pelican
#

So I should rename my local fork folder to bot instead of sir-lancebot?

#

It is definitely present: sir-lancebot\bot\resources\fun\all_cards.png

clever wraith
#

I don't see that error in prod

#

No no, it should be correct

#

Can you try to rebuild the image?

dim pelican
#

Yeah I've built down and up but let me try again

clever wraith
#

Oh wait, the path is indeed wrong

#

evergreen isn't a thing anymore

#

But the code on main is correct

#

Did you pulled everything and all?

dim pelican
#

Yeah I did pull, it didn't remove the folder locally though

#

Interesting

clever wraith
#

What's the full traceback?

dim pelican
#

My folders are still present locally even after the restructure

clever wraith
#

How weird

#

Does git status give you untracked files?

dim pelican
#

nope

clever wraith
#

Does git log -1 give you ba4b0e4?

dim pelican
#

No, since I'm on my fork and merged from upstream

clever wraith
#

Aaah

#

Fork link?

dim pelican
#

Mine?

clever wraith
#

Whichever you are using, yes

dim pelican
clever wraith
#

Okay, seems like your history is heavily messed up

dim pelican
#

lol

clever wraith
#

I can tell you how to fix it, but honestly I'd recommend you to just be working on the upstream

#
git fetch upstream
git checkout upstream/main
git push --force origin main
```to fix your main branch
dim pelican
#

Had a gnarly rebase but should be good now

clever wraith
#

Looks about right

dim pelican
#

Thanks btw!

trail pilot
molten perch
#

Hey! Just a quick question. I'm not very familiar with django tests. Does it set up an empty database for each test? Also, is that something that we want to include in the new API?

gritty wind
#

It restores it for each case

#

Assuming we're using django's testing utilities

#

let me check actually

#

Nah it should restore it to empty

molten perch
#

Cool, so I guess it should do the same thing in case of the new API as well, right?

gritty wind
#

For the new API, I think it's probably better if we don't have a test database, and just have pure unittests

#

Like I can't think of much we'd gain over a purely functional approach (and maybe mocking out DB calls if we have to?)

Django does a lot of heavy lifting to get the unittests to work properly when you're dealing with mock DBs

#

And it limits our expansion potential for things like parallelization

molten perch
#

Okay then, but if we don't have an actual test database how are we gonna test out if it actually works? (Mocking DB calls does not seem to be a good solution for me, many things could go wrong with DB relationships and such things.)

short snow
gritty wind
gritty wind
#

It's still up to us to configure the creation of the DB, make sure it gets migrated, and handle cleaning

#

That's the part django handles

#

We'd also have to inject parts of this into the test cleaners so it can clean the DB between each test

molten perch
gritty wind
#

It's a lot of work, and I'm not convinced integration tests will be all that useful yet

#

I'm looking through the test suite now

molten perch
#

Actually, since the new API has to be totally compatible with the codebase of bot, I had to make a few adjustments. (like when filtering reminders you use "author__id")
So, I would be more comfortable if I had integration tests, but it's your call to be honest πŸ˜„
I'm not yet done with the reminder endpoints (Still haven't implemented the DELETE and PATCH ops.) so it's still far away.

gritty wind
#

And I'm not seeing anything actually utilizing the integration rn

#

Mostly just mocking

molten perch
stable mountainBOT
#

bot/exts/utils/reminders.py line 266

'author__id': str(ctx.author.id)```
gritty wind
#

Well, if it's a pydantic alias, that'd still fall under the unit testing portion, not something we need to mock out

#

On the DB side, it'd be the exact same

molten perch
#

Okay then. I'll open a PR sooner or later. πŸ˜„

stable mountainBOT
#

.github/workflows/lint-test.yml lines 29 to 41

# Via https://github.com/actions/example-services/blob/main/.github/workflows/postgres-service.yml
# services:
#   postgres:
#     image: postgres:13
#     env:
#       POSTGRES_USER: postgres
#       POSTGRES_PASSWORD: postgres
#       POSTGRES_DB: postgres
#     ports:
#     # Assign a random TCP port
#     - 5432/tcp
#     # needed because the postgres container does not provide a healthcheck
#     options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5```
gritty wind
#

PostgreSQL is already set up and configured for later, and simply needs to be commented out to start.
I don't think there was anything planned for it yet, just migrated from site just in case

molten perch
#

I see, I haven't done Mocking before, so I'll have to hit up the documentation, but it's gonna be fine. πŸ˜„

trail pilot
#

( Bit off-topic but congrats @molten perch on helper! )

molten perch
#

Thank you! πŸ˜„

austere hornet
#

Congrats @molten perch !

fallen patrol
molten perch
# gritty wind > PostgreSQL is already set up and configured for later, and simply needs to be ...

Alright, I finished the implementation of the reminder endpoints and the first batch of tests. (The ones that test the Token Auth)
But now I'm in a bit of a confusion, what and how to test next.
So, like how would I do the Mocking if I have to create a test user and a bunch of Reminders? Or Do I even have to test those?
(like: https://github.com/python-discord/site/blob/main/pydis_site/apps/api/tests/test_reminders.py#L49)

stable mountainBOT
#

pydis_site/apps/api/tests/test_reminders.py line 49

class ReminderCreationTests(AuthenticatedAPITestCase):```
gritty wind
#

That's highly dependent on the code being tested. For the most part, I imagine you have the code that performs all the logic (get the request, find the appropriate action, parse arguments, etc, etc -> return some other data), and somewhere in the middle of that, you want to access database objects?

#

The simplest method to do that would be to mock the return of the database request and return your own User, reminder model, etc

#

It's basically what the current site does, it just defines the model, adds it to the DB, fetches it from the DB, and then uses that model

#

If you notice there, adding to the DB and fetching from the DB doesn't actually accomplish anything

molten perch
#

Yeah, actually (at least for me) by just defining a fixture that creates a test database and returns a session then when the test ends it tears down everything seems like an easier solution, since the database queries are not tied to the database models, you just pass them as arguments when you query something using sqlalchemy, that makes it harder to mock this chain of method calling (I'm referring to requests such as session.query(Reminder).filter_by(content="test").all())

gritty wind
#

I don't think so, at least in that case, why would you add anything to your test DB besides reminders that have that content

#

You don't need to verify that filter_by(content="test") will work correctly, that's a reasonable thing to take as fact

#

Also, one of the reasons I'm so hard against having a test DB is because it adds an extra layer of complexity, which we'll then have to maintain, and will make it difficult for us to do certain things (I have test parallelization mind right now, just going off the test times in site), and can lead to non-reproducible tests

#

Look at it this way, you'll either put the effort into mocking the db, or creating it, cleaning it, and maintaining it

#

It's more effort to do that latter, and imo has much less ROI

molten perch
#

Okay, it makes sense. I think I can mock the fastapi dependency that creates db sessions this way it'll be much easier πŸ€”

brisk brook
#

The dependency injection system was designed so that you could easily just pass arguments that would override the Depends

molten perch
#

Yeah, I didn't realise it right until now. πŸ˜„

#

Thank you! πŸ˜„

gritty wind
#

If you're still creating DB sessions, will that alleviate the aforementioned problems?

molten perch
#

I believe so, yes!

clever wraith
#

congrats on helper @molten perch

gritty wind
#

More activity on metricity in the past 10 minutes than the past 10 months

#

At least we get to experience github's real time message fetching lemon_clown

#

How long does discord cache external images

#

I'd like to see my new PFP one of these days

vale ibex
#

@patent pivot question...should I strip tzinfo, or migrate to aware dts in db for metricity

#

since 2.0 is aware now 🀑

patent pivot
#

I think either is fine

#

are there any scenarios where one is better than the other

vale ibex
#

Not really, psql stores in utc anyway, so I should just be able to set it on connection that I was aware dts

#

Just need to look around gino/sqlalch when I'm back later

#

I'll go with aware then, since it should just be a connection change, rather than shoving to strip tzinfo everywhere

green oriole
gritty wind
#

How 2 do that

green oriole
gritty wind
#

What

#

Web 🀑

#

I hard reset my own cache if thats what you mean

green oriole
#

I mean what client are you using

#

Yeah, if you use web just yeet your browser cache on the cdn domain

gritty wind
#

Discord windows, but even following that link anywhere it’s still the old image. Are you seeing the new one?

green oriole
#

That's weird, I do

#

Can you delete %appdata%/discord/cache

gritty wind
#

I could try another hard reload now

#

Everything is gonna take ages to load now, brb :P

#

Pfffft it's still the old one lmao

#

I guess it's not meant to be

green oriole
#

How weird

scenic moth
#

how to get !d help for list.insert ?

brazen charm
#

the docs don't define a symbol for it so you can't directly

scenic moth
#

._.

vale ibex
#

As far as I can see, since d.py changed how they store user's avatars, there isn't an easy way to generate a backwards-compatible hash

#

My d.py 2.0 hash:```py
In [2]: hash(ctx.author.display_avatar)
Out[2]: 1811796705115642717

My d.py 1.7 hash: `a_2970a2477a6b8a040f740abc068b4d26`
#

Ahhhh nevermind. It's now referred to as the Asset's "key"

#

IE ctx.author.display_avatar.key

green oriole
#

I was about to say, heh

vale ibex
#

Alright, since I'm here, opinions on whether we should store both guild and user avatars hash's in metricity?

#

CC @patent pivot

#

atm we only store the user's hash, so I could add a new column to store the guild specific hash too

brisk brook
#

!e print(hash(object()))

stable mountainBOT
#

@brisk brook :white_check_mark: Your eval job has completed with return code 0.

8792879756307
vale ibex
brisk brook
vale ibex
#

(which led to the confusion)

#

Since I had assumed the dunder hash of an avatar would return the same value as what used to be called the avatar_hash

brisk brook
#

I think they hash the hash though

#

!e print(hash('a_2970a2477a6b8a040f740abc068b4d26'))

stable mountainBOT
#

@brisk brook :white_check_mark: Your eval job has completed with return code 0.

2074662032031832231
brisk brook
#

I guess not..

vale ibex
#

It's a hash of the cdn url now

brisk brook
#

Ooh, I guess that makes sense

vale ibex
#

aaaaall right, I think that's d.py 2.0 and threads working in metricity

#

nvm lol, the message event triggers before the thread create event

static canyon
#

Why isn't the lint-test showing under checks for bot#1901?

dusky shoreBOT
green oriole
static canyon
#

Ah right

#

Now I need to remember how to resolve conflicts when it's "too complex" for doing in the website

green oriole
static canyon
#

Thanks

#

I think I broke my bot

#

It just mutes me for every message I send saying "burst"

#

I don't even know how

green oriole
#

LOL

#

what is your config thresold?

#

if you set it to one that'd be the issue

static canyon
#

It looks like the value isn't resetting

static canyon
# green oriole what is your config thresold?
anti_spam:
    # Clean messages that violate a rule.
    clean_offending: true
    ping_everyone: true

    punishment:
        remove_after: 600
        role_id: *MUTED_ROLE

    rules:
        attachments:
            interval: 10
            max: 6

        burst:
            interval: 10
            max: 7```do you mean this?
green oriole
#

yes

static canyon
#

I haven't touched anything to do with antispam so I'm really confused as to why this is happening

green oriole
#

how weird

#

is daylight saving doing some funky stuff haha

static canyon
#

I mean maybe?

#

My laptop time is set an hour behind

#

Maybe that's why?

green oriole
#

to me it seems like some timestamp isn't calculated correctly

#

that could be why

static canyon
#

Thanks windows

#

It's 5pm not 4pm

#

It's even set to London timezone

#

Wtf is going on lol

green oriole
static canyon
#

The messages I'm sending are freaking out too

#

It initially shows sent time as 16:32 (laptop time) then discord corrects it

green oriole
#

the UK is switching during the Saturday to Sunday night, right?

static canyon
#

Yeah

green oriole
#

how weird

static canyon
#

I think my laptop went back an hour twice?

green oriole
#

doesn't seem like it applied daylight saving

static canyon
#

The thing is I was just in greece (2 hrs ahead of england) so maybe that screwed with it

#

I have no clue

green oriole
#

have you restarted since?

static canyon
#

yeah

#

Several times

green oriole
#

are you dual booting?

static canyon
#

yes

#

Win & Linux

green oriole
#

please tell me not with ubuntu

static canyon
#

Linux Mint

green oriole
#

Okay, I don't know if this screws with the BIOS time or not

static canyon
#

I mean I just manually set the time to 17:35 (correct) and I'm still getting auto-muted

green oriole
#

even after a bot restart?

static canyon
#

let's try

#

I restarted before realising my laptop time was fucked

green oriole
#

my bot is starting if you wanna check

static canyon
#

Okay, it seems to be fixed

hoary anvil
#

@static canyon linux and windows don't play nice with bios time

#

windows sets local time and displays it, linux sets utc, stores offset, and displays calculated local

#

or vice versa

#

so they set it differently unless you live in utc all year

#

I've always had the same issue

static canyon
#

And yes, it's still very much broken

hoary anvil
#

interesting

static canyon
#

As long as I manually set time on windows it's fine

#

But as soon as I go back to automatic, although my laptop stays the same time, the bot starts muting me

gritty wind
#

It doesn’t like time travelers

static canyon
#

Whhhyyyyy isn't this working

#

Okay so even setting time manually doesn't work

#

I am completely and utterly fucked

#

@hoary anvil @green oriole Do either of you know how to get around this?

green oriole
#

pain and suffering

static canyon
#
>>> datetime.datetime.now().hour
17```
#

Datetime still gives the right time

green oriole
#

timedatectl set-local-rtc 1 --adjust-system-clock on Linux could help

static canyon
#

So I honestly don't know what's happening

green oriole
#

huh, how weird

cold island
#

Why isn't what working

static canyon
#

It keeps saying I'm breaking burst rules

cold island
#

uuh where are you running the bot?

#

Windows?

static canyon
#

Windows

cold island
#

In Docker?

static canyon
#

Yea

cold island
#

Restart WSL?

static canyon
#

WSL?

#

I'm not using WSL

#

I'm dual booting

#

I have a physical installation of both Windows 10 and Linx Mint on my drive

cold island
#

Ok but you're saying you're running the bot in Windows through Docker. I'm not sure how the Linux installation is related

green oriole
cold island
#

But I mean

#

Isn't the bot getting the same amount of events?

static canyon
#

It could be something other than the dual booting

#

But I don't know what because I didn't touch any antispam code

green oriole
#

yes, except it is trying to count messages in the past 1h10s instead of 10s

cold island
#

Wait

static canyon
hoary anvil
#

but I barely use windows on my main pc so idrc

cold island
#

But what does the Linux install have to do with where the bot is running

static canyon
#

Nothing

cold island
#

So you're running it in Docker. Is Docker using WSL or Hyper-V?

static canyon
cold island
#

If you installed it recently it's probably WSL

green oriole
#

do you have a win pro edition

static canyon
green oriole
#

then WSL

cold island
#

Ok, so as a first step I suggest restarting WSL

#

If it doesn't work we can think of something else

static canyon
#

How do I restart WSL?

cold island
#

Don't remember the command, I'll check

green oriole
#

wsl.exe --shutdown

cold island
#

or that

green oriole
#

I have speed_module_3

static canyon
#

I guess restart?

cold island
#

yeah

static canyon
#

I just realised the logs in the terminal have time as 16: instead of 17:

#

erm```py
Traceback (most recent call last):
File "docker\api\client.py", line 214, in _retrieve_server_version
File "docker\api\daemon.py", line 181, in version
File "docker\utils\decorators.py", line 46, in inner
File "docker\api\client.py", line 237, in _get
File "requests\sessions.py", line 543, in get
File "requests\sessions.py", line 530, in request
File "requests\sessions.py", line 643, in send
File "requests\adapters.py", line 439, in send
File "urllib3\connectionpool.py", line 670, in urlopen
File "urllib3\connectionpool.py", line 392, in _make_request
File "http\client.py", line 1255, in request
File "http\client.py", line 1301, in _send_request
File "http\client.py", line 1250, in endheaders
File "http\client.py", line 1010, in _send_output
File "http\client.py", line 950, in send
File "docker\transport\npipeconn.py", line 32, in connect
File "docker\transport\npipesocket.py", line 23, in wrapped
File "docker\transport\npipesocket.py", line 72, in connect
File "docker\transport\npipesocket.py", line 52, in connect
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 81, in main
File "compose\cli\main.py", line 200, in perform_command
File "compose\cli\command.py", line 60, in project_from_options
File "compose\cli\command.py", line 152, in get_project
File "compose\cli\docker_client.py", line 41, in get_client
File "compose\cli\docker_client.py", line 170, in docker_client
File "docker\api\client.py", line 197, in init
File "docker\api\client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
[16568] Failed to execute script docker-compose
PS C:\Users\tizzy\bot>```

#

That happens when I docker-compose run bot

cold island
#

Is Docker up yet?

green oriole
#

Start docker desktop

#

It should yell at you for not being up

static canyon
#

It is started

#

I've got it open

#

I guess I'll try to restart

#

Okay, it's running

#

And the time in the console is correct πŸŽ‰

#

That's a good sign lol

#

My mute has been auto-ended

green oriole
#

Niice

static canyon
#

Yeah, it all works now

#

Thanks πŸ‘

cold island
#

I'm guessing it was caused by the hour shift and WSL stayed in the old time or something

static canyon
#

Yeah, maybe

gritty wind
#

weird, wsl should've restarted when you restarted windows

static canyon
#

@patent pivot Does the bot's API for infractions support some form of an oldest_first kwarg? If not, how would I go about implementing it? I've never touched api/database stuff before so got no clue where to look/start

patent pivot
#

hmmm honestly not sure, never worked with DRF

static canyon
#

eee

#

Not what I wanted to hear lol

cold island
static canyon
#

I don't know anything that has it lol

#

Or not at the api-level

cold island
#

I mentioned nominations earlier

static canyon
#

One case has reversed(...) but that won't work here because it'll be reversed of the 100 most recent -- not the actual 100 oldest

#

Yeah, everything seems to be either reversed(...) or xxx.reverse() @cold island

#

There's no comments or anything saying what it does, but 'ordering': '-inserted_at' might just do it

cold island
#

oh yeah that

#

I knew there was something of that sort

static canyon
cold island
#

Didn't work as in it didn't accept the arg?

static canyon
#

I don't know

#

The resulting embed isn't oldest first

#

Ah, it shouldn't have the -

#

So 'ordering': 'inserted_at'

cold island
#

Looking at the viewset it should be able to accept the arg

fallen patrol
#

@static canyon why is the bot migrating to ogblurple?

#

It's role colour is the new blurple

vocal prairie
static canyon
#

Our entire branding is the old blurple

#

We made the decision not to change

fallen patrol
#

In that case, maybe just patch the blurple method to return og?

static canyon
#

I'm confused with what's so bad about my approach

fallen patrol
#

Future use

static canyon
#

We don't want to be patching just for the sake of it

#

og_blurple is going to stay og_blurple 🀷

fallen patrol
#

I don't think that ppl are always gonna remember to not use discord.Colour.blurple() and that it's going to make it past reviews

patent pivot
#

and if it becomes problematic then we write lints for it

fallen patrol
#

Ahhh ok

#

Seems like more work πŸ€·β€β™€οΈ

patent pivot
#

we aren't going to be monkeypatching anything discord.py, if we need to make substantial changes in the future we'll fork, patching for things like this is bad practice

fallen patrol
#

Ah

cold island
#

Question

#

Why on the bot are we using the allowed_strings converter instead of Literal?

brazen charm
#

because it predates the Literal converter and wasn't migrated

green oriole
#

What do we gain by migrating?

#

lol

#

Alright, the diff will be small enough, have fun @clever wraith

#

Yup

#

Go crazy

static canyon
#

@clever wraith if you can, wait for bot#1926 so you can do that one too

dusky shoreBOT
static canyon
#

Thanks

static canyon
#

I open the file and there's no conflict showing

#

Oh wait, I think it's because the entire file was deleted

#
CONFLICT (modify/delete): bot/exts/utils/clean.py deleted in origin/main and modified in HEAD. Version HEAD of bot/exts/utils/clean.py left in tree.
green oriole
#

Oh yep

static canyon
#

So I just delete the file?

green oriole
#

Yeah, and port the changes made in your PR to the new file

static canyon
#

right

#

I have just realised that @cold island's PR uses the old logging.getLogger instead of bot.log.get_logger

#

I suppose I should do a new PR for that

#

@green oriole how do I now push the resolve without pushing all the commits fetched from origin?

brazen charm
#

you push the commits from origin, because they're already on the target branch they won't show up and only the merge commit is visible

static canyon
#

right

#

okay

#

Except I can't do that

#

Because origin is already updated? @brazen charm

static canyon
#

What do I add?

clever wraith
#

The two files that had conflicts

static canyon
#

And when I push it pushes a whole load of commits (all the ones that were fetched)

clever wraith
#

That's normal, you are pulling main

#

That's the goal of this operation

static canyon
#

Right okay

#

Yeah that worked

#

I was thinking it'd add each individual commit to my PR's commits but it didn't

clever wraith
#

Nah, github does detect you pulled main

#

It has a wrinkly brain

static canyon
clever wraith
#

lol, you did push 94 commits onto the branch

#

It isn't lying

#

Github is just deceting which one are from the PR when rendering the page

static canyon
#

Right, yeah

cursive relic
#

there seems to be a bug at .wiki command. I was able to remove the message by pressing trashcan when eivl made the command.

#

is that supposed to happen?

gritty wind
#

Seems intentional

#

Or at least, the call to the paginator doesn't try to limit who can modify it

gritty wind
#

I'm not sure, it's not a bug, probably just an oversight. I wouldn't mind seeing it limited though. Would you like to open an issue or PR for that?

cursive relic
#

I could try opening one

#

thx πŸ˜„

cursive relic
#

Opened a issue for it

static canyon
#
PS C:\Users\tizzy\sir-lancebot> docker-compose run sir-lancebot
Starting sir-lancebot_redis_1 ... error

ERROR: for sir-lancebot_redis_1  Cannot start service redis: driver failed programming external connectivity on endpoint sir-lancebot_redis_1 (760f41add314f5f1951a61cc7269c28aa72164d1c193aedb75d3606b489c9838): Bind for 127.0.0.1:6379 failed: port is already allocated

ERROR: for redis  Cannot start service redis: driver failed programming external connectivity on endpoint sir-lancebot_redis_1 (760f41add314f5f1951a61cc7269c28aa72164d1c193aedb75d3606b489c9838): Bind for 127.0.0.1:6379 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
```how do I fix this?
#

It's saying it's already allocated but I'm not sure why

gritty wind
#

Do you have other docker projects running?

#

docker container ls

static canyon
#

Errr

#

I've got bot running apparently

#

How do I stop a project? @gritty wind

gritty wind
#

docker container stop <name>

#

if you're on windows, you can just use the UI

static canyon
#

I guess you have to do bot_site etc.

gritty wind
#

what name did you try

#

yeah

static canyon
#

right

gritty wind
#

if you want to take the entire compose down, you need the compose file

clever wraith
#

It is bot_web_1 fwiw

cold island
brisk brook
#

How do I change the logging level of the bot?

dim pelican
#

Should be:

logger.setLevel("DEBUG")

Or something like that right?

brazen charm
#

trace logging can be configured through the env var, otherwise I believe you just have to change it in the source or at runtime

clever wraith
#

You have a LOG_LEVEL env var in most projects, otherwise just turning on debug mode should be lowering to trace

brisk brook
#

I was hoping on changing it during runtime but yeah I see

brazen charm
#

you can change the root logger's level with internal eval

brisk brook
#

Yeah that's what I was trying to mess around with but couldn't figure out

brazen charm
#

should just be getLogger().setLevel(...) and it'll propagate to every logger (if they aren't set through the trace loggers env var)

brisk brook
#

I can't for the life of me get the bot to fetch the incidents webhook πŸ€”

#

Oh wait smh πŸ€¦β€β™‚οΈ

cold island
#

@brisk brook maybe we can settle on a nice color for incidents that isn't transparent?

#

Transparent is meh

brisk brook
#

Haha yeah

#

I was gonna suggest literally "copying" the message. So the webhook author would be the message link's author and you would remove it from the embed

#

So that it "kind of" looks like the message right there

cold island
#

hmm

#

It adds some extra info, and I think it helps that it doesn't look like one of the reports

#

Also the purpose of the webhook author being the person reporting is that it's easier to associate the report with the embed

short snow
#

bluenix reviewed all my 3 prs lemon_hyperpleased

cold island
#

The embed currently shows a mention of the message author

#

Some embed fields don't support mentions

#

!u

stable mountainBOT
#
Zig (mbaruh#0278)
User information

Created: <t:1542225348:R>
Profile: @cold island
ID: 512354988157173763

Member information

Joined: <t:1582826109:R>
Roles: <@&267628507062992896>, <@&807415650778742785>, <@&267629731250176001>, <@&831776746206265384>, <@&587606783669829632>, <@&778376272509141023>, <@&267630620367257601>, <@&825337057181696020>, <@&295488872404484098>, <@&585529568383860737>, <@&764802720779337729>, <@&463658397560995840>, <@&518565788744024082>, <@&542431903886606399>

Infractions

Total: 31
Active: 0

cold island
#

I'm guessing that title is what you were referring to? @brisk brook

cold island
#

Ah that's interesting

#

But yeah I don't think that supports mentions either

clever wraith
#

I think it does support a few things

#

Can you run user on a bot Zig

short snow
#

Yeah the author name doesn't support mentions, that's why i didn't use it

clever wraith
#

I think Ak added an emoji there