#dev-contrib

1 messages · Page 163 of 1

vale ibex
#

this could be solved by just adding display_name to MockMember by default

static canyon
#

Fixed, thanks

vale ibex
#

Doing that may break another test

static canyon
#

I went for```py
mock_member = MockMember(display_name="Bobby Johnson", roles=[MockRole(id=1)])

    with patch("bot.exts.moderation.incidents.Incidents.make_confirmation_task", mock_task):
        await self.cog_instance.process_event(
            reaction=incidents.Signal.ACTIONED.value,
            incident=MockMessage(author=mock_member, id=123),
            member=mock_member
        )```instead
#

That way it won't break anything else

vale ibex
#

Yea, that would work

static canyon
#

Looks like all the tests are gonna pass this time 😄

#

Yep

#

Thanks for the help 👍

vale ibex
#

👌

static canyon
#

bot#2031 is now up; would appreciate some reviews.

dusky shoreBOT
clever wraith
#

@gritty wind wheres the mention of the revised URL filter 😡 \j

gritty wind
#

lol I ran out of letters

#

What PR is that

clever wraith
#

bot#1889

dusky shoreBOT
gritty wind
#

Why do there have to be so many reviewers 🥲

green oriole
#

No changelog for the hastebin filter either, sadge

#

/j

gritty wind
#

I literally couldn't fit anything else

#

But wasn't that announced by joe

green oriole
#

Nooot that I know of

hoary haven
#

chris i think - oop nvm

clever wraith
tawdry vapor
#

I keep having trouble with Poetry on Linux where it's not using wheels even though they're available.

#

Yesterday it built numpy from source. Today, it's trying (but failing) to build psycopg2-binary

#

And yet I can successfully install the wheel from PyPI if I just do it manually

#

help 😦

#

Actually, it installs fine outside of the venv Poetry creates, but if I try to install it inside the venv, it says that wheel is unsupported on my platform

austere hornet
#

Hmm, maybe just don't use Linux, if possible? Idk

vale ibex
#

lol that's hardly a fix

#

I've been fine with wsl, but haven't tried on native linux

tawdry vapor
#

I can also manually create a venv with python -m venv and then successfully install the wheel

#

Poetry is just creating some borked venv

vale ibex
#

what version of poetry are you on?

tawdry vapor
#

Latest

vale ibex
#

Not even sure if I'm on latest

#

I'm on 1.1.12

tawdry vapor
#

Yes that is the latest

vale ibex
#

alr

#

Are wheel and setuptools installed on the venv?

#

Is poetry just missing those out?

green oriole
#

And are you in the wheel group

vale ibex
#

poetry config experimental.new-installer false

#

and upgrading pip, but that doesn't sound like it would help

tawdry vapor
#

Yes, wheel and setuptools are present in the venv it creates

#

That config didn't help

#

Maybe I need to recreate the venv

vale ibex
#

possibly

#

would also mean numpy won't be in there, now that we removed it

#

the other suggested fix was to poetry run pip install -U pip

tawdry vapor
#

I'm trying to install site deps now

vale ibex
#

ah

tawdry vapor
#

hence psycopg2

vale ibex
#

of course

tawdry vapor
#

It might also be related to me relying on pyenv for Python 3.9, since my system's Python is on 3.10

#

Even though I have done pyenv local 3.9.9, weirdly Poetry still says

The currently activated Python version 3.10.1 is not supported by the project (3.9.*).
Trying to find and use a compatible version.
Using python3 (3.9.9)

#

3.10 is definitely not the currently activated Python

vale ibex
#

I have that problem occasionally, I do poetry use env /path/to/python.exe to create the base venv

#

then do poetry install

#

Since 3.10 is the default poetry uses on my system

#

so I do that for 3.9 projects

tawdry vapor
#

Wait I think that fixed it

#

Gonna try a full install

vale ibex
#

Nice

#

poetry usees it's own config for python paths afaik

#

not sure how it intacts with pyenv

#

but I know it doesn't respect windows PATH priority

tawdry vapor
#

Well it bugged out cause it detected 3.10 was active, but then claimed it managed to find and use 3.9. And when the venv was active showed 3.9 as the version

#

I guess I cannot rely on autodetection

#

Yeah everything installed now. Thanks for the tip

vale ibex
#

Nice, was a hard one to figure out a while ago

gritty wind
#

Yeah the auto detection bull shit was a known downside when migrating

#

We’re usually compatible with latest, and latest is usually the default

#

So we usually don’t run into problems

cold island
#

hmmmm I have a circular import and not sure how to get rid of it

#

I guess I can annotate with a string

tawdry vapor
#

Move the shared thing to another module

#

Oh it's for type annotations?

#

use if typing.TYPE_CHECKING: and put your import in that. I don't remember the exact name of that.

cold island
#

ah right that's a thing

#

thanks

#

hmm gives me a name error

brazen charm
#

import annotations from future

cold island
#

that did it 👍

fallen patrol
cold island
#

yeah quotes was what I did originally

stable mountainBOT
#

docker-compose.yaml line 28

- .:/app:ro```
gritty wind
#

It’s a volume on most of our projects so your code changes are loaded into the docker container without needing a full rebuild

cursive relic
gritty wind
#

It’s supposed to just work with fastapi or starlette

#

Though there are currently only handlers for Postgres and redis

#

If you want a different bucket type, you’d have to implement it yourself

cursive relic
#
clean_up_tasks: list[typing.Callable]
web_1    | TypeError: 'type' object is not subscriptable
``` I did try running it but it ended up with this
vale ibex
#

Are you running on python 3.9?

cursive relic
#

3.9.6, ye

fallen patrol
#

could you double check that?

cursive relic
fallen patrol
#

how are you running it?

cursive relic
#

docker-compose up --build

vale ibex
#

What version of Python is in the dockerfile?

fallen patrol
#

^ that version down at the bottom of vscode is independent of the dockerfile

cursive relic
#

3.9 is for docker

vale ibex
#

Is this code on github?

stable mountainBOT
#

Dockerfile line 1

FROM python:3.9.5-slim```
fallen patrol
#

something like this?

gritty wind
#

You can hack it by changing that type hint to typing.List, but you’d have to modify like half the type hints, and other stuff might break

cursive relic
#
version: "3.9"
services:
  web:
    build: .
    ports:
      - "5001:5001"
  redis:
    image: "redis:alpine"
vale ibex
#

That's the docker-compose file.

gritty wind
#

That docker version

fallen patrol
#

and what's in the Dockerfile

fallen patrol
cursive relic
#
FROM python:3.9-alpine
WORKDIR /chatapp
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
EXPOSE 5001
COPY . .
CMD ["python3", "-m", "chatapp"]
gritty wind
#

That’s how you get banned from a python server

#

(Arl)

fallen patrol
#

that's fine, I have typescript now

gritty wind
#

Could you change the cmd to list version

cursive relic
#

hm?

vale ibex
#

CMD ["python3", "-V"]

cursive relic
#

sure

gritty wind
#

afaik the python image installs as python not python3, but I can’t imagine it’ll be different

fallen patrol
#

yeah what chris and scale said before me

cursive relic
#

Python 3.9.9

vale ibex
#

Can you do docker-compose up --build

cursive relic
#

That's what I did

vale ibex
#

just to make sure you're actually using that version

vale ibex
cursive relic
#

Ye it is, but it's not updated

vale ibex
#

The dockerfile there says 3.8

cursive relic
#

That's one of the changes I had made

vale ibex
#

So I imagine it's still using that image.

#

Can you stop the container

#

do docker-compose down

cursive relic
#

it's stopped

vale ibex
#

then docker-compose up --build

cursive relic
#

do I change the command back to normal?

vale ibex
#

Yea

cursive relic
#

interesting, it started up

#

let me try the endpoint

#

this is redis stuff, right? ```
web_1 | return await dependant.call(**values)
web_1 | File "/chatapp/chatapp/backend/ratelimits/limiter.py", line 191, in caller
web_1 | request: fastapi.Request = _kwargs['request']
web_1 | KeyError: 'request'

gritty wind
#

Nah this is still fastapi

#

How are you using it

cursive relic
#

wdym?

gritty wind
#

How are you calling the rate limit stuff

#

In your own code

cursive relic
#
@router.get("/testing")
@UserRedis(
    requests=5,
    time_unit=10,
    cooldown=60,
)
async def _test():
    return {
        "message": "working"
    }
gritty wind
#

Uhh

#

Try adding request to the arguments of that function

cursive relic
#

now it seems like the endpoint is not being reached (keeps loading)

gritty wind
#

You might need to add some debug stuff

#

I’d add some logging in the redis function

cursive relic
#

I'll debug it a bit and will come back after 👍 . Thx alot for helping 😄

gritty wind
#

My guess is it might be redis connection, good luck

obsidian patio
#

Thanks for the review on sir-lancebot#988 @brisk brook. You had some great feedback

dusky shoreBOT
obsidian patio
#

I've resolved your comments now

cursive relic
stable mountainBOT
#

pixels/pixels.py lines 86 to 90

app.state.redis_pool = await aioredis.create_redis_pool(Connections.REDIS_URL)
Connections.REDIS_FUTURE.set_result(app.state.redis_pool)

app.state.canvas = Canvas(app.state.redis_pool)
await app.state.canvas.sync_cache(await Connections.DB_POOL.acquire())```
cursive relic
stable mountainBOT
#

pixels/utils/ratelimits.py line 258

user_id: int```
cursive relic
vale ibex
#

Thats from the auth

#

where we decode the authorization token given in the header, check who it belongs to via the database, and then add the user_id to the state

#

Since we ratelimit based on the user requesting

cursive relic
#

hm

#

So I have to make a token check..

cold island
#

So uh... I'm loading the filtered regex patterns from the DB, and it's reading "\b" as the single character, not literally slash and b

#

Trying to figure out why it's working in prod

clever wraith
#

That's.... interesting haha

#

Straight of main?

cold island
#

wdym

clever wraith
#

Are you running the main branch?

cold island
#

I'm running the new schema branch

clever wraith
#

So there is probably a bug somewhere in the new code

#

What's the branch name

cold island
#

new-filter-schema

clever wraith
#

Oh that's from our old PR isn't it

cold island
#

yeah

#

gone through some changes since

clever wraith
#

I saw the emails haha

cold island
#

lol

clever wraith
#

So have you checked it is correctly stored in the db using psql or something

cold island
#

nope, my knowledge of psql is nill

clever wraith
#

lol, alright

#

Running in compose?

cold island
#

yeah

clever wraith
#

docker-compose exec -it postgres psql -U pysite should open a shell

#

If my memory is right

vale ibex
#

site->pysite

#

but yea 😄

clever wraith
#

Right

cold island
#

didn't work with docker-compose, did with docker

clever wraith
#

Alright, well

#

What's the name of the model we want, hmm

#

SELECT * FROM sitefilter I believe?

#

I'm really not sure about the table name

#

It should be pretty obvious to guess if you press tab after typing the from

cold island
#

api_filterlist

#

or I guess we need filter

clever wraith
#

Don't you want api_filter

cold island
#

yeah

#

so I can just run SQL queries?

clever wraith
#

Yup

cold island
#

cool I try that

clever wraith
#

You have some commands starting with some slashes too, but you shouldn't need any here

cold island
#

Well I used \dt to see the table names 😄

clever wraith
#

Haha

#

You are now a certified psql user, congratulation

#

So, what's inside the db?

cold island
#

uuuh a lot of things... it's not letting me use the like operator

clever wraith
#

lol are the default filters that big

brisk brook
cold island
#

yeah ok the DB content is wrong

#

\x08 instead of \\b

clever wraith
#

Okay sorry I have to handle some problematic irl stuff

#

Good luck on the troubleshooting

#

I'd check the serializer first

cold island
#

yeah no worries, thanks for the help

#

huh. The DB on the main branch contains the same thing

#

how is it even working in prod then?

molten perch
#

Maybe, it's because they're stored like:
("\bgoo+ks*\b", None, False)
instead of:
(r"\bgoo+ks*\b", None, False),?

cold island
#

Well

#

\b

#

!int e await ctx.send((await ctx.guild.get_channel(635950537262759947).fetch_message(926214981496766544)).content[0])

stable mountainBOT
#

\

#
In [6]: await ctx.send((await ctx.guild.get_channel(635950537262759947).fetch_message(926214981496766544)).content[0])
Out[6]: <Message id=926215255418339398 channel=<TextChannel id=635950537262759947 name='dev-contrib' position=71 nsfw=False news=False category_id=411199786025484308> type=<MessageType.default: 0> author=<Member id=409107086526644234 name='Python' discriminator='4329' bot=True nick=None guild=<Guild id=267624335836053506 name='Python' shard_id=0 chunked=True member_count=292562>> flags=<MessageFlags value=0>>```
cold island
#

so it's literally a slash here

#

so not sure where it would go wrong

molten perch
#

Yeah, but aren't you trying to load the regexes from the DB?
If we were to use this: (r"\bgoo+ks*\b", None, False)
It would store them like that: \\b

cold island
#

Right I'm saying it's already escaped though. Also you can't put an r on a variable, it needs to be dynamic

molten perch
cold island
#

The DB contains patterns. The bot code in the main branch manages to match them, but the new code doesn't, I'm trying to understand why

#

Because as far as matching goes I just copied the logic from the existing code

vale ibex
#

I notice we're using a CharField now for the filter content

#

Rather than a TextField

#

in the model that is

#

Not sure if that's causing the encoding that's breaking this

vale ibex
#

@cold island not sure if this will help, or if you already saw it

cold island
#

yeah I'm just about to run the bot to try it

#

rebuilt the DB

#

Didn't seem to do the trick

#

I'll try running the main branch and see how things look like there

gritty wind
#

If it’s in the sample filters inserted into the DB

#

Those aren’t in prod in the first place

cold island
#

oh right

#

oh.

#

Ok

#

Sorry @molten perch you were probably right

#

I'll try changing migration 59 now

#

I was just convinced that it was working in the old code, but it actually doesn't

molten perch
#

Oh, alright! 😅

cold island
#

Alright thanks for the help everyone

#

Should I create a new migration for dev purposes to fix 59, or do I edit the existing one?

vale ibex
#

I'd just fix the existing one

cold island
#

Also, good news: there's a functioning regex filter in the new system. Bad news: it's alerting me for the same message indefinitely 🙂 baby steps

vale ibex
#

lol

vale ibex
#

and the people that do keep a long lasting database, they can just add a new filter

#

I don't think it's worth adding an extra step in the migration process

cold island
#

hmmm I don't see how the migration didn't run in prod though

#

did we just replace those filters?

green oriole
#

It ran once like ages ago

#

Yeah they probably got replaced since

#

iirc that migration was added when the table got lost for some reason

#

Like two years ago or something

vale ibex
#

Yea, it was added over a year ago

cold island
vale ibex
#

🚤

molten perch
#

Haha, managed to approve it in the end 😄

vale ibex
#

lol

green oriole
#

🐛
🧨🦓

#

Poor bugs

austere hornet
#

Lmao

cursive relic
#

So pixels need OAuth2 URL, and is that URL the bots OAuth2 URL?

vale ibex
#

Yes, we used Discord OAuth as part of the access token creation flow

#

so that we could get the user's userID

cursive relic
#

I think I'm now getting how that system works, slowly but surely

vale ibex
#

You can find it under the OAuth2 section of the Discord API portal for your application

cursive relic
#

Aha and then I just do what the readme.md says

vale ibex
#

yup

cursive relic
#

Great! I'll try that tomorrow because it's nearly 1am. Thx alot 😄

vale ibex
#

No problem!

green oriole
#

Is something brewing with pixels?

vale ibex
#

mostly just wanted to deal with the PRs and issues

#

I'm thinking of making a private fork, so our plans for next year aren't spoiled

green oriole
austere hornet
gritty wind
#

“Private fork” :(

#

Not a thing, but we can push the code to another repo, and push it back to pixels afterwards

green oriole
#

Inb4 he just opens a security advisory for that

gritty wind
#

We could make pixels private again if we aren’t planning on doing it for too long

vale ibex
#

I didn't want to do that since a few people reference the code there

#

such as the ratelimiting and auth

green oriole
#

Making a private copy is probably the easiest

vale ibex
#

Yea

#

probably just make an empty private repo and maybe even set the upstream to the public one

gritty wind
#

Hence short time

#

You can’t set the upstream on a repo can you

vale ibex
#

Nah, just locally to pull changes

gritty wind
#

Not sure what that implies

#

Ah ok

#

What changes lmfao

vale ibex
#

oi!

#

I merged 2 prs today

gritty wind
#

Haha true

vale ibex
#

Just ignore that there won't be more for like a year

thorny obsidian
#

Speaking of, we do need to sit down and start scoping out pixels v2. I did put it later in the events calendar, but that was only to ensure we had enough dev time for it

vale ibex
#

Yea, we should try and figure out how we're gonna mix it up

#

there's a bunch of good ideas in that notion page

magic arch
#

Can confirm the Notion page has awesome ideas

clever wraith
#

@vale ibex could you add pixels to #dev-log?

vale ibex
#

Was one of the first things I did when making the project public

clever wraith
#

Hah, I'm just blind

fallen patrol
#

oh it was added 10 days ago

cursive relic
stable mountainBOT
#

pixels/utils/auth.py line 8

from jose import JWTError, jwt```
cursive relic
#

!pypi jose

stable mountainBOT
vale ibex
stable mountainBOT
#

pyproject.toml line 21

python-jose = {extras = ["cryptography"], version = "^3.3.0"}```
vale ibex
#

That file includes the other deps that pixels uses.

cursive relic
#

ooh I see

cursive relic
gritty wind
#

You set it in the discord dashboard

#

For dev purposes it might be something like localhost:port/callback

cursive relic
#

I have this set up from there

gritty wind
#

Could you print out what the app got from discord when you called callback

cursive relic
#

wdym?

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied mute to @clever wraith until <t:1640953409:f> (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).

gritty wind
#

Try printing out the content of the request from that function

cursive relic
#

which values? There are 5 variables

#

oh request 🤦

gritty wind
#

The body to be more specific

#

Actually discord puts it in the query params

#

So

#

Request.query_params

cursive relic
#

sec

vale ibex
#

I am going to guess the OAuth2 url you are using doesn't have the identify scope

cursive relic
#

I did not specify any scopes

#

I did not touch this

vale ibex
#

That's your issue then 🙂

cursive relic
#

oh

vale ibex
#

The easiest thing to do is to go into the URL generator section and do it from there

cursive relic
#

and not use any of them?

cursive relic
#

oh

#

and do I use that long url it generated in somewhere?

vale ibex
#

Yea, for the AUTH_URL env var

#

like it says in the readme.

cursive relic
#

I had the local host url in there 🤦

vale ibex
#

I'd suggest reading the readme

cursive relic
#

I did but I misunderstood which url it meant

#

I think it worked

#

It gave me code=CPj3FXbLGHmkun521pa5ZO0vAHo5D5

gritty wind
#

I… don’t think you should share that code lol

#

Technically you can’t do anything without your backend auth but

#

No reason to share it lol

#

Anyways it looks right

cursive relic
#

but after it redirected me to /callback?code=<the_token> it threw me a error

gritty wind
#

What’s the error

cursive relic
stable mountainBOT
#

pixels/endpoints/authorization.py line 66

token, _ = await auth.reset_user_token(request.state.db_conn, user["id"])```
vale ibex
#

this line creates a new user token

#

which does so by connecting to the database

stable mountainBOT
#

pixels/pixels.py lines 100 to 110

@app.middleware("http")
async def setup_data(request: Request, callnext: t.Callable) -> Response:
    """Get a connection from the pool and a canvas reference for this request."""
    async with Connections.DB_POOL.acquire() as connection:
        request.state.db_conn = connection
        request.state.canvas = app.state.canvas
        request.state.redis_pool = app.state.redis_pool
        response = await callnext(request)
    request.state.db_conn = None
    request.state.canvas = None
    return response```
vale ibex
#

This is where our state vars are set

cursive relic
#

hm

#

so when ever ```py
request.state.db_conn

patent pivot
cursive relic
#

then I can re create it with my own db connection without needing to mess up with more pixels code.

#

uh and where is the database tables created in at? I think I have to set them up as well

vale ibex
#

Pixels currently doesn't have ORM

#

so those were created manually by Joe lol

cursive relic
#

that will be a bit painful but I think I can manage

#

if I just find a few SQL statements

vale ibex
#

that way the connection is freed up after the request is done

cursive relic
#

I could use this ```py
async def create_db_pool():
"""
creates a database pool
---
Arguments -> None
"""
bot.db = await asyncpg.create_pool(dsn=URL)

bot.loop.run_until_complete(create_db_pool())

vale ibex
#

That will create the pool sure.

#

I was referring to actually getting a connection from that pool in the middleware

cursive relic
#

oh

vale ibex
#

Otherwise you'll use up all the connections

cursive relic
#

what does that mean?

vale ibex
#

postgres by default only has 100 available connections

#

asyncpg.create_pool() creates a connection to the database, and grabs 10 connections

#

if you don't use the context manager, or manually close connections when you're done, then the pool will run out of connections

#

since they'll be dangling

cursive relic
#

and middleware is used to resets the those connections?

vale ibex
#

You can see we have the async with Connections.DB_POOL.acquire() as connection: line

#

this means that all of the code within that context manager has a connection

#

once code leaves the context manager, the connection is freed

cursive relic
#

now I got it, thx again 😄

vale ibex
#

response = await callnext(request) is how you actually call the request from within the middleware

patent pivot
cursive relic
#

@patent pivot sorry for the ping but if you made the db tables, do you happen to have the data types for them because I can't figure them out.

patent pivot
#

pretty sure we had the SQL in a file in the pixels repo

vale ibex
#

Yea, we do

#

postgres/init.sql

cursive relic
#

oh

green oriole
#

Out of curiosity, did it ever happen that the bot creates the same thread twice in the nomination voting channel?

#

And yeah, pixels has its init SQL in its repo, with my fancy database trigger linkerguns

green oriole
#

Hmm, we're having this problem at Quilt, and it just happened to some user accounts, so I am wondering if it is an API bug

cursive relic
#

I have not set up full pixels setup so how could I run those sql statements in init.sql. I tried to run .execute(<sql here>) but it did not like that syntax

#

At least this caused some error (currently can't access that traceback) ```sql
user_id int8 NOT NULL,

vale ibex
#

I have been updating the purgeban command, so it uses our clean tool, rather than discord's native purge, to retain context, however I've ran into some very odd behaviour.

I have updated purgeban to include this code ```py
infraction = await self.apply_ban(ctx, user, reason, expires_at=duration)
log.info(f"From apply_ban return: {infraction}")

`self.apply_ban()` then has this code at the end ```py
        log.info(f"Inside apply_ban: {infraction}")
        return infraction

So even though I'm returning directly after the log, and then logging the return value, this is what the log appears like:

bot_1  | 2021-12-31 17:02:15 | bot.exts.moderation.infraction.infractions | INFO | Inside apply_ban: {'id': 6, 'inserted_at': '2021-12-31T17:02:14.694643Z', 'expires_at': None, 'active': True, 'user': 825398857218129920, 'actor': 126811506632294400, 'type': 'ban', 'reason': None, 'hidden': False, 'dm_sent': False, 'purge': ''}
bot_1  | 2021-12-31 17:02:15 | bot.exts.moderation.infraction.infractions | INFO | From apply_ban return: None
#

So somehow it's getting set to None

vale ibex
vale ibex
cold island
vale ibex
#

Yea, it's the respect_role_hierarchy deco

#

ah lol

#

await func(*args, **kwargs)

#

need to return this

cold island
vale ibex
#

How strange, we have the mods channel in the config yml, but not in constants.py

#

guess it's one less line diff for this PR 😛

gritty wind
#

This is why we don’t hardcode a ton of nonsense into two separate files

vale ibex
#

🤡

gritty wind
#

Oh you know what

#

We just use it in the group don’t we

vale ibex
#

Ah, possibly

#

I need it properly now, so am gonna add it

vale ibex
#

@fallen patrol i don't quite follow your comment.

#

I'm only importing for type checking, so surely that doesn't apply?

fallen patrol
#

oh, that was in the next one

fallen patrol
vale ibex
#

Which I am.

fallen patrol
#

yeah i didn't look at the code

gritty wind
#

I forgot to add it to the announcement lol

#

Oh wait no, I did

#

At least half of what I was gonna add

clever wraith
#

21 PR opened on the bot repo in the whole 2021 year sounds very wrong

fallen patrol
#

its not total opened in the whole year, its total open rn

#

@gritty wind you are a very misleading person

#

even more so than I had just presumed

clever wraith
#

What

gritty wind
#

I hoped that’d be implied since the closed is bigger than the open

clever wraith
#

This page is so confusing haha

gritty wind
#

It was made in like 10 mins during a staff meeting ¯_(ツ)_/¯

fallen patrol
#

also closed is actually pulls merged or pulls closed with unmerged commits

gritty wind
#

We don’t have many closed PRs that aren’t merged, so I just did it lazily and ignored them

#

Except on forms

clever wraith
#

What

gritty wind
#

That’s really fucked lol

fallen patrol
#

298

#

meh

clever wraith
#

Can we have a proper stats page haha

fallen patrol
#

forms-frontend#298

dusky shoreBOT
fallen patrol
#

bruh

clever wraith
#

I volunteer for making one tomorrow

gritty wind
#

Tbh idrc, go for it lol

fallen patrol
#

we should write a python client that will request and get all of this info

#

and output it as an csv

gritty wind
#

It was a planned project for this year

fallen patrol
#

which is what I thought scale was doing but no, he was just searching every repo smh mh smh

gritty wind
#

But we didn’t have the bandwidth for it

thorny obsidian
#

lol rip ledger

gritty wind
#

Maybe next year

fallen patrol
gritty wind
#

10 minutes searching vs 1 hour figuring out the stupid API

#

Yeah

#

clever wraith
#

I'll proooooobably make a simple script for it

thorny obsidian
#

But you can also write some smart queries in github to search across multiple repos. I have one for pulling recently closed things for the weekly staff meeting agenda

fallen patrol
#

haven't worked with the graphql client yet

#

which would prooobably be better for this

clever wraith
#

I'd use GraphQL for this for sure

gritty wind
#

I wanted the stats per project

clever wraith
#

We made some auto-generated graphql queries for the code jam management stuff last year, that was pretty cool

#

It is really cool how you can query a ton of data at once

#

And not require a stupid amount of requests to do so

#

Could you share said query @gritty wind?

fallen patrol
#

^

#

!paste

stable mountainBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

gritty wind
#

It’s more relevant to getting PRs from contribs, but you can strip out that part

#

Contributor statistics

query ($user: String!) {
  user(login: $user) {
    login
    contributionsCollection(organizationID: "MDEyOk9yZ2FuaXphdGlvbjM2MTAxNDkz") {
      pullRequestReviewContributions(first: 1) {
        totalCount
      }
      
      pullRequestContributions(first: 1) {
        totalCount
      }
      
      totalCommitContributions
    }
  }
}

Paste this into https://docs.github.com/en/graphql/overview/explorer and then enter an object into the variables like:

{
  "user": "courtesy of jb3"
}
clever wraith
#

Oh, that's the contrib stats one

#

I think we have that one saved somewhere

patent pivot
thorny obsidian
patent pivot
#

I think if we spec it out ledger could be a good idea

#

It’s just it was fairly loosely defined

#

Let’s defined the questions rather than the data, what do we want ledger to answer, etc. instead of just “let’s download arbitrary attributes of all pull requests ever in a table”

#

devops is migrating from Kubernetes in the new year though so for my involvement it may be pushed a month or two down the line

vale ibex
#

Some early 🚰 there

patent pivot
vale ibex
#

Early leaking taps

#

Lol

patent pivot
#

lmfao

#

I think I already mentioned it

#

and we’re fairly sure

thorny obsidian
#

I can definitely define some questions if that's what you're after

patent pivot
#

for sure that’d be dope

#

and we can refocus and maybe simplify goals

clever wraith
#

Is it planned on throwing data into the stats infra?

patent pivot
clever wraith
#

But still go through the normal staff infra?

fallen patrol
#

hey @thorny obsidian, given that the aoc role goes until the end of the month, can we update the aoc commands to be supported until the end of the month?

#

the channels still exist, including #aoc-bot-commands.

patent pivot
#

Ansibling

patent pivot
#

I'll have a paper on it soon

#

most stuff remains the same

#

still containers, running in podman instead of docker, still Debian based, but obviously embracing that more

clever wraith
#

What's up with lance?

patent pivot
fallen patrol
#

...

mint nebula
#

issue:

#

!src ot

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'

mint nebula
#

!src paste

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'

mint nebula
#

!src command for tag doesnt work but it used to. is it an expected behavior?

fallen patrol
#

there's an issue for that which I've suggested a fix but its not approved yet

#

still waiting

mint nebula
#

eee

fallen patrol
dusky shoreBOT
clever wraith
#

Oh that's us

#

Yeah, we are part of the same system

#

The commit is on main but it isn't released yet

vale ibex
#

The task itself links to the correct PR.

fallen patrol
#

@vale ibex aoc stats needs in_month decorator

#

otherwise sentry issue in feburary

vale ibex
#

Alright

#

What would cause the sentry issue you speak of?

#

@fallen patrol do you have a traceback from that test?

#

I'm intrigued what would raise the error.

fallen patrol
#

yes

#

the command literally isn't protected

vale ibex
#

What is the traceback

fallen patrol
#

2022-01-01 10:00:48 | bot.exts.events.advent_of_code._helpers | ERROR | Unexpected response 404 while fetching leaderboard 968271

#

no traceback

vale ibex
#

What is AOC_YEAR set to?

fallen patrol
#

not set

#

so it would default to whatever the code gets it as

vale ibex
#

that's likely the issue then

#

it defaults to current year

fallen patrol
#

so its expected to update that every year?

vale ibex
#

Since we have it set to 2021, it would still pull last year's

fallen patrol
#

;-;

#

well then

#

will fix in pull as soon as my other aoc pulls are merged

#

will make it default to the last one until november and then use the current year.

vale ibex
#

Sure, could you open an issue for it to describe your plans

fallen patrol
#

i'll do it after my other aoc pulls are reviewed/merged

#

I was kind of expecting to see them in prod before aoc ended.

#

sir-lancebot#969
sir-lancebot#966
sir-lancebot#967

clever wraith
#
if (
            current_date.month not in (Month.NOVEMBER, Month.DECEMBER) and current_date.year != AocConfig.year or
            current_date.month != Month.JANUARY and current_date.year != AocConfig.year + 1
        ): ```that's such a big if haha
vale ibex
#

lol yup

#

I was going to do a not all, but then it was a large negative all, which can be hard to read

#

so this was better

#

Dates are fun 🤡

static canyon
#

I'm trying to run the bot project via docker-compose run bot and I keep getting a crash error saying the auth credentials weren't provided for the api?py Traceback (most recent call last): File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/bot/bot/__main__.py", line 13, in <module> bot.instance.run(constants.Bot.token) File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 663, in run return future.result() File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 642, in runner await self.start(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 605, in start await self.login(token) File "/bot/bot/bot.py", line 256, in login await self.cache_filter_list_data() File "/bot/bot/bot.py", line 87, in cache_filter_list_data full_cache = await self.api_client.get('bot/filter-lists') File "/bot/bot/api.py", line 81, in get return await self.request("GET", endpoint, raise_for_status=raise_for_status, **kwargs) File "/bot/bot/api.py", line 76, in request await self.maybe_raise_for_status(resp, raise_for_status) File "/bot/bot/api.py", line 68, in maybe_raise_for_status raise ResponseCodeError(response=response, response_json=response_json) bot.api.ResponseCodeError: Status: 401 Response: {'detail': 'Authentication credentials were not provided.'}

vale ibex
#

Are you on main, or do you have changes?

static canyon
#

(bot#2034)

static canyon
#

I think it's because I changed all of my env settings etc. to use my own local instance of site whilst I was implementing bot#1951

vale ibex
#

Ah, then you'll likely need to change them back.

#

Have you changed the docker-compose?

#

or do you have an override present?

static canyon
#

I honestly can't remember

#

I don't need any changes in them so I can just "reset to defaults" and presumably things will work

vale ibex
#

take a look at your project file

#

is there is docker-compose.override.yml?

static canyon
#

There isn't

#

I had changed the docker-compose.yml but I think I've reverted those changes now

#

I'd made all sorts of changes to make #1951 work and now I need to revert them all but I don't know what it was before lemon_sweat

vale ibex
#

Just reset to main

static canyon
#

It doesn't change files in the .gitignore though

vale ibex
#

docker-compose.yml isn't in the gitignore

static canyon
#

Okay, my docker-compose.yml is the default now

#

The one that's on main

vale ibex
#

cool

#

do a docker-compose pull

#

then docker-compose up --build

static canyon
#

Okay

#

It's building

#

Running...

#

It's failing to connect to the site

static canyon
# vale ibex then docker-compose up --build
bot_1        | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
bot_1        | 2022-01-01 17:04:59 | bot | CRITICAL | Could not connect to site API. Is it running?```
vale ibex
#

localhost:8000 is the issue

#

Follow the steps at the top of this to switch to docker

static canyon
#

👍

#

Should fakeredis be true or false by the way? @vale ibex

vale ibex
#

false

#

fakeredis makes it so that asyncrediscache only uses memory, rather than call out to actual redis

static canyon
#

Wait, it literally says that on the page lol 🤦

static canyon
vale ibex
#

Shouldn't need a rebuild

#

just docker-compose up

static canyon
#

Yeah

#

building is only when dependencies change, right?

vale ibex
#

or when dockerfile changes

static canyon
#

👌

#

Seems to be running

vale ibex
#

Nice

static canyon
#

Yep, it's running

#

Thank you 👍

static canyon
#

@fallen patrol out of interest, have you made any progress with bot#1924 / bot#2020?

dusky shoreBOT
summer garden
#

Can I claim sir-lancebot#995?

dusky shoreBOT
summer garden
#

I see this is just adding the missing enums right?

static canyon
#

I was gonna do it tomorrow if no one had gotten around to it

#

It's adding the missing enums for both AgeRatingCategories and AgeRatings If I remember correctly

summer garden
#

I assume sentry is some sort of app for logging errors?

static canyon
#

Yeah, basically

static canyon
# summer garden I see this is just adding the missing enums right?

Turning```py
class AgeRatingCategories(IntEnum):
"""IGDB API Age Rating categories IDs."""

ESRB = 1
PEGI = 2   

intopy
class AgeRatingCategories(IntEnum):
"""IGDB API Age Rating categories IDs."""

ESRB = 1
PEGI = 2
CERO = 3
USK = 4
GRAC = 5
CLASS_IND = 6
ACB = 7```and then doing the same for the `AgeRatings` class
#

And I guess looking for any other missing enums

summer garden
#

got it

static canyon
#

I need your GitHub so I can assign you @summer garden

vale ibex
#

Staff can also assign themselves

#

Anyone in the org can

static canyon
#

Right yeah, true

summer garden
#

👍 I did just there

static canyon
#

Feel free to @ me here and request a review when it's done @summer garden

vale ibex
#

The sentry integration isn't smart enough yet to follow the chain

summer garden
#

Just the text? Not the link in the issue?

vale ibex
#

Yea, just that text will be enough

static canyon
#

Has been merged

dusky shoreBOT
fallen patrol
#

sir-lancebot#778 really needs reviews

dusky shoreBOT
austere hornet
#

And sir-lancebot#901 (core-dev)!

dusky shoreBOT
summer garden
vale ibex
#

@austere hornet when you get a chance to implement my feedback, could you also update the branch to main? GitHub UI doesn't have the option for me.

#

Did you allow edits from maintainers?

austere hornet
vale ibex
#

Cool, I can update the branch now

#

I'll wait until after your change though, so I can test it after merging main

austere hornet
#

@vale ibex I have implemented your feedback on sir-lancebot#901

dusky shoreBOT
placid ermine
stable mountainBOT
#

pydis_site/urls.py line 7

path('admin/', admin.site.urls),```
placid ermine
#

uses django.contrib.admin

clever wraith
#

@placid ermine admin is a special built-in app

#

If you navigate to /admin you'll see it

placid ermine
#

yeah but that's django.contrib.admin, right? not pydis_site.apps.admin

clever wraith
#

Basically those are auto generated html views for models

#

Oh

#

iirc that's how you configure admin

#

Although that's pretty pointless, yeah
CC @last patio

gritty wind
#

It is served correctly

#

But we don’t use it

#

I don’t think anyone besides Joe understands the log in mechanism

clever wraith
#

It used to be tied to github OAuth

#

Could someone tell me how many autobans have been issued so far please?

#

A metabase question with infractions starting with Your account has been used to send links to a phishing website. over time would be chiefkiss pithink

gritty wind
clever wraith
#

Yep

#

I mean, there isn't any credentials by default even

#

Someone has to manually insert them

static canyon
clever wraith
#

I didn't exactly remember the difference between the two messages

#

I remember there is one

static canyon
#

Hmm

clever wraith
#

Ahh, Your account has been used to send links to a phishing website. You have been automatically banned.

#

The start is different isn't it

static canyon
#

"...You have been banned..." vs "...You have been automatically banned..."

clever wraith
#

You know what would even better, use the first criteria and do a filter on actor__bot

gritty wind
#

Do you want the autobans or the manual one

static canyon
#

So as long as you include the "automatically" it'd be fine

clever wraith
#

I mean so you have two curves

#

But I mainly just want the number of automatic one please good sir

gritty wind
#

Best I can do is a simple graph

#

The meta base mobile website is already a nightmare

clever wraith
#

lol it sure is interesting

#

To be fair it is much better than mobile grafana

#

At least metabase tried

gritty wind
#

Grafana is actually pretty nice

#

What’s the bot actor Id

#

!u 409107086526644234

stable mountainBOT
#
Python#4329 <:bot:812712599464443914>
User information

Created: <t:1517609130:R>
Profile: @stable mountain
ID: 409107086526644234

Member information

Joined: <t:1517609268:R>
Roles: <@&270988689419665409>, <@&277546923144249364>

Activity

Messages: 0
Activity blocks: 0

Infractions

Total: 5
Active: 0

clever wraith
#

409107086526644234

gritty wind
#

What

#

It comes up with 0 results if I filter on it hm

clever wraith
#

Huh

static canyon
clever wraith
#

It is also putting automutes so that doesn't make any sense

gritty wind
clever wraith
#

Grafana does store them anyway

static canyon
gritty wind
#

The results and the ID are there if I don’t filter for them

static canyon
gritty wind
#

But then

clever wraith
#

Are you using a numerical check or something

#

There is a quite bad bug in metabase if you try to represent the ID by a number because JS will truncate it

gritty wind
#

No it’s just pasting the ID incorrectly

#

Because of the truncation

#

But you can’t make it a string on mobile

clever wraith
#

Well that's really sad

#

Joining is probably the only solution then

gritty wind
#

Okay I figured it out

#

I can just select filter by clicking on the value

clever wraith
#

Really, that's cool

gritty wind
#

Bot bans by week since end of October

#

Or by day

#

384 total

clever wraith
#

oh that's much less than I thought

#

thanks

static canyon
#

@fallen patrol fyi have left another review & two comments which should've been part of the review on bot#2017

dusky shoreBOT
clever wraith
#

The timestamp change on aoc countdown should be reverted

#

.aoc countdown

dusky shoreBOT
#

:x: Please use #aoc-bot-commands for aoc commands instead.

clever wraith
#

Well I'm not liked by the bot but it will say "in one year" for at least a whole month if I understand I it correctly

static canyon
#

Or is this something on a PR?

static canyon
clever wraith
#

the fuck

#

I also see 1 Dec 2022 on mobile

#

!raw 897932607545823342-927158962997059674

stable mountainBOT
#

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

static canyon
#

I guess Discord™️ 🤷

clever wraith
#

<t:1669870800:R>, that shouldn't cause any problem

#

<t:1669870800:R>

solemn kayak
#

So this thing ^^ never got solved in the discussion here a few weeks ago. Should I create an issue on lance?

gritty wind
#

There might not be much that’ll come out of an issue

#

If you can get down a solid reproduction, go for it

solemn kayak
#

Ok cool. What do you mean by a "solid reproduction"?

clever wraith
#

a set of steps allowing you to reproduce the bug

#

.wa 1-(tanh(x))^2

#

I mean, there should just be more logging in that command

#

the answer should be logged if it didn't 200

gritty wind
#

Feel free to PR some non-spammy logs directly

clever wraith
#

why would you migrate from notion to the site? the notion page is public

thorny obsidian
#

That would make it available for anyone to update, not just staff

clever wraith
#

guess it is pretty much a copy paste anyway

thorny obsidian
#

It's also for better consistency. It would be odd if all our projects except Forms was on site. There's also no strong reason to keep it on Notion if we're opening it up to outside contributors

vale ibex
#

I have a question with unittest.
I have this test: ```py
@patch("bot.converters.Age")
async def test_foo(self, mocked_age_converter):

within the test I do ```py
mocked_age_converter.return_value.convert = AsyncMock(return_value="foo")
await self.cog.some_func_that_calls_age_converter()

Where the func I'm awaiting calls the age convertor with await Age().convert(ctx, "1h")

I was under the impression that my patch, an subsequent update of the return value would cause the age convert within the cog function to return foo.

However, my assert_awaited_once_with a little further down shows it's still using the default return values, rather than my patched ones. Am I doing something wrong?

clever wraith
#

@gritty wind there, fixed

gritty wind
#

I’m not sure what you’ve done

#

It looks a lot like the notion table with “closed PRs vs merged PRs” stuff, just without the totals lol

clever wraith
#

but the counts aren't wrong/misleading :P

#

I still don't know how you ended up with 21 open PRs on bot

gritty wind
#

It’s off by like a fraction even on the biggest projects lmao

clever wraith
#

wait

#

why do I also have 21

gritty wind
#

Because they are 21

clever wraith
#

peepoLeave

gritty wind
#

This is exactly my data that’s what I’m saying

clever wraith
#

okay I get it now

#

the PRs opened in 2021 that are still opened

#

I'll fix it 🤡

gritty wind
exotic ember
clever wraith
#

also you used the since parameter to generate the notion page, right?

#

Because if so your count isn't right but mine is

#

Because since is created or updated since

vale ibex
#

but clearly I'm missing something 😅

#

fwiw mocked_age_converter.convert = AsyncMock(return_value="foo") doesn't work either

#

Where line 48 is where the converter class from line 76 down is instantiated

#

The reason I need to mock this is because I need to specify an arg for first_limit when calling assert_awaited_once_with, which is made hard by the converter basing it from datetime.now()

exotic ember
vale ibex
#

Ahhhhhhhh

#

Changing to @patch("bot.exts.moderation.infraction.infractions.Age") and mocked_age_converter.return_value.convert = AsyncMock(return_value="foo") works now

#

that's where I was going wrong 😅

#

Thanks 😄

clever wraith
#

I should filter out bots so forms-frontend doesn't get like 300 PRs haha

#

Maybe add commits too while I'm at it

austere hornet
gritty wind
#

Btw, I’ve gotta say before you put any more effort in

#

Don’t do it unless you enjoy doing it

#

Besides a few nit pickers most people don’t care

clever wraith
#

I'm doing that for Quilt at the same time

vale ibex
#

Cool, tests are done for bot#2033

dusky shoreBOT
clever wraith
#

I find the mean commits per PR and mean diff size stats quite interesting

#

do you think it would be worth adding to the announcement?

#

also fyi Xav reviewed madlib, not ak

static canyon
#

Can we change the emojis on @dusky shore's issue regex thing to match GitHub's recent change to closed issues?

#

I.e. issues that were closed by a merged PR should show a purple tick, not the red

#

bot#2034 as an example

static canyon
#

In fact, it looks like all closed issues have the purple tick currently

#

bot#1801 was closed without a PR but still shows as purple on GH

static canyon
#

Would we be able to add that logic ourselves?

vale ibex
#

Looks like github have just replaced the red icon with the purple one, we can do the same

static canyon
#

Yeah

#

Would be nice to add the logic ourselves though in my opinion

#

If possible

vale ibex
#

What logic?

static canyon
#

Purple if it has a linked PR, otherwise red

vale ibex
#

Ah

#

Yea we could do that

#

lets make the parity change first though

static canyon
#

So two separate issues? Or one issue with two PRs?

vale ibex
#

Do you happen to have the purple version? I can upload that to the emoji server

#

Adding that custom logic should be an issue, so we can discuss whether we want it or not.

#

We can just change the icon now though

static canyon
vale ibex
#

Ahh, no worries, I left a comment in the repo last time I did it

#

# These icons are from Github's repo https://github.com/primer/octicons/

#

I'll grab it now

static canyon
#

The raw thing doesn't seem to have the colour

vale ibex
#

Nah, they don't

#

that's added by a svg class on github

static canyon
#

this is the image then (uploaded as a .png)

#

@vale ibex would the PR just be```diff

bot/constants.py, within the Emojis class

  • issue_closed = ":IssueClosed:"
    
  • issue_closed = "<:IssueClosed:NEW_ID>"```?
    
vale ibex
#

That's not what it currently is

#

It's currently issue_closed = "![IssueClosed](https://cdn.discordapp.com/emojis/852596024739758081.webp?size=128 "IssueClosed")"

#

you'll just need to update the id

#

when I upload the new emoji

static canyon
#

Rather than uploading a new one?

#

Then no PR is needed?

vale ibex
#

not sure you can do that

static canyon
#

Eh, you can't

#

Ignore lol

gritty wind
#

Smh Chris couldn’t you see me typing

#

It took way too long to find an example lol

vale ibex
vale ibex
gritty wind
#

T’was a joke, you can’t actually see me typing

#

Unless

#

Hm, no cameras here

vale ibex
#

ahhhh lol

#

sir-lancebot#998

dusky shoreBOT
vale ibex
#

@vocal wolf ticking things in my PR eyes_sus

vale ibex
#

oh lol

#

I saw Xith putting labels so thought it was him

static canyon
#

Approved by the way

green oriole
#

I don't know if it has been mentioned already but Xavier reviewed the madlib PR, not me

vocal wolf
fallen patrol
#

!remind 6H pitch BOT_ENABLED_EXTENSIONS for Lance. Won't have to load all 58+ cogs every time as a developer when writing a new cog.

stable mountainBOT
#
Absolutely!

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

gritty wind
#

Why

#

It takes like a fractional second to load the cogs

fallen patrol
#

!remind 6H answer scale

stable mountainBOT
#
Yep.

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

gritty wind
#

I saw your other message lol

#

If it’s slash commands, that’s the wrong way to go about it

#

The interactions between various components is still important, it’s wiser to write your registration system to compare the required commands vs the changed commands and only send off the ones that have changed

#

I actually wrote basically that when I wrote a small interactions client

static canyon
#

sir-lancebot#999 is up; would appreciate feedback on the issue

dusky shoreBOT
stable mountainBOT
hoary haven
#

i got @stable mountain working party

#

props to @tawdry vapor (i think?) or whoever wrote the contributing guides. made it painless for even a noob like me

patent pivot
tawdry vapor
fallen patrol
patent pivot
#

i mean like

#

why are we not loading cogs

#

is there a harm in loading cogs

fallen patrol
#

oh

#

87+ cogs, on lance, and on each message there's 6 or 7 debug logs that a listener was blocked from firing in the wrong month

#

additionally, some of them make initial requests to apis (github cog), and even others error because xxx config variable was not set up, so there's one or two tracebacks every load

thorny obsidian
#

The debug logs I've seen have really only been the Candy Collection and Spooky React. It's very specific logs

brazen charm
#

I don't think there are that many of them for it to be an issue

thorny obsidian
#

If it's an issue we could just reduce the logging on those cogs

vale ibex
#

What are the tracebacks you are referring to? I've see some warning/error logs if a cog isn't loaded, but I've never encountered a traceback

#

those should be fixed.

thorny obsidian
#

for instance, for one command this is the debug log:
But it's clear it's only 1 cog producing those debug messages.

thorny obsidian
vale ibex
#

Yea, that's not really linked to loading specific cogs though

#

that's just if the paginator is ever called

#

We could change the default emoji though, and have prod override with an env var

thorny obsidian
vale ibex
#

We should do similar in the AoC cog as we do for other cogs then, check if required env vars are set, if not don't load the cog

#

fixing the cause, rather than symptoms

thorny obsidian
#

tbh I'm okay with an occasional traceback because I didn't fully set stuff up.

fallen patrol
thorny obsidian
#

like, during my PR review sprint I only got 2 tracebacks and that was me not setting up the AoC notifier role id and being too lazy to change the trashcan emoji

vale ibex
#

I don't have anything against your idea, I just feel like it'll be something barely anyone uses

thorny obsidian
#

The biggest improvement that could be made is decreasing the logging done in the CandyCollection and SpookyReacts cog

vale ibex
#

which isn't to say we shouldn't do it, but if it's trying to fix a problem, then there are other options that hiding the issue by not loading the cog

fallen patrol
#

yeahh

vale ibex
#

in_month guards could easily be trace logs imo

gritty wind
#

I do think the idea does introduce some fundamental problems for integration

#

Buttttt if no one is arguing for it anymore /shrug

fallen patrol
thorny obsidian
stable mountainBOT
#

bot/utils/decorators.py line 83

log.debug(f"Guarded {listener.__qualname__} from invoking in {current_month!s}")```
vale ibex
#

rather than having to do things in each cog

gritty wind
#

While unloading cogs doesn’t directly cause it, it doesn’t really hurt to have all cogs loaded

fallen patrol
vale ibex
#

Yea those are the two other things I mentioned

thorny obsidian
#

tbh I'd rather not block loading of the AoC cog because the notifier role isn't set up. The traceback occurs once and would allow faster testing of AoC features for me

summer garden
gritty wind
#

I don’t know the ins and outs of the aoc system, but shouldn’t you set the role either way

thorny obsidian
thorny obsidian
summer garden
#

i'll write up an issue sometime

clever wraith
#

Hey @vale ibex and @fervent sage regarding sir-lancebot#710, could I take it? I've noticed it's been inactive for a while

dusky shoreBOT
fervent sage
#

Sorry was gonna reply earlier but then we drove out of 4g signal, you're welcome to take that over

clever wraith
#

On a road trip?

clever wraith
#

@vale ibex I'll push soon I'm just gonna go for a walk

clever wraith
#

alright, pushed

green oriole
#

oh hey, I see cool stats on that computer

#

sir lance PRs are much more chonky on average than I thought

wide elm
#

Hi :D

#

Would it be a good idea to add a tag which explains why when someone uses pycharm, and runs into problem when they try to install packages outside of the Pychamr's venv, and its not found when they run their script

clever wraith
#

That would be good, but maybe just explain how the venv thing works in general

wide elm
#

theres already a tag for that

#

!venv

stable mountainBOT
#

Virtual Environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using Windows PowerShell, you may need to change the execution policy first. This is only required once:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

clever wraith
#

Maybe a tag like !venv-packages

wide elm
#

maybe

#

hm

hoary haven
#

is this problem only present for pycharm users? i guess more prevalent bc of the way pycharm automatically creates a venv?

i'm guessing you want a tag that you can use to assist someone that's installed packages outside the intended location. how does a help session like this typically go, and what kind of information or instructions do you envision this tag having?

gritty wind
#

It’s been suggested before, but explaining this concept to the people who’ll benefit the most of it is difficult in such a limited format

hoary haven
#

i imagine there's a bit of troubleshooting that always has to be done before you can be sure of the problem & help. dunno if it would work well in a tag

wide elm
#

Theres a lot of people who end up getting confused by it

timid sentinel
#

bot#1828 is a sort of relevant issue

timid sentinel
#

Well, not that relevant, although it all links together

#

There's so many different setups and ways of doing things and gotchas that im not really sure what the right setup if tags/guides would be

hoary haven
#

i'd suggest that as you help & troubleshoot these issues note them and see how a tag could help you and in what scenarios. that will help solidify a possible idea/proposal

#

or like wookie said it might be too much variance to put all in one tag

thorny obsidian
#

I think it may be worth having a short tag explaining to use the command prompt in PyCharm itself or the Settings ->Project->Project Name->Interpreter menu method. I've helped debug this so many times I've memorized the steps in PyCharm even though I don't use PyCharm.

It's a problem that really only heavily affects PyCharm because of its automatic venv creation

timid sentinel
#

Yeah that seems fair

wide elm
#

A lot of people flock to it as their first editor, since its sort of the poster python IDE

cursive relic
#

I'm confused, how do I make a request to endpoints that need authentication, it's telling me to make post request to endpoint which did not work

#

I passed the headers etc as in the example

gritty wind
#

I think we disabled pixels didn’t we

timid sentinel
#

Yeah

#

Unless you're trying to set it up yourself?

last patio
#

good evening

#

anyone looking for reviews?

#

feel free to request from me

cursive relic
gritty wind
#

It seems like the auth system has caused you more trouble than it’s worth for you

thorny obsidian
dusky shoreBOT
gritty wind
#

Can you show your request

cursive relic
#

Sure when I get back to laptop ~ 5mins

thorny obsidian
cursive relic
# gritty wind Can you show your request
token = SECRET
headers = {"Authorization": f"Bearer {token}"}
r = requests.post("http://127.0.0.1:5001/authenticate", headers=headers)
data = r.content
print(data)
gritty wind
#

Please have a look at that function

#

That route takes the token in the body

cursive relic
#

I did try http://127.0.0.1:5001/authenticate?body=token as well

gritty wind
#

I’m not familiar with passing the body like that, afaik that’s just a url parameter