#dev-contrib

1 messages Β· Page 170 of 1

vale ibex
#

just waiting on bot-core to be merged so I can bump that

fallen patrol
#

lmao: #dev-announcements

In the coming weeks, the core dev team will be migrating our current bots
chris does it right then, in true disnake speed

vale ibex
#

lol

#

I've had bot and bot-core locally for a day or two now

fallen patrol
#

2.5 will require message_content intent btw

vale ibex
#

we're ready

fallen patrol
#

i mean when connecting to discord

#

but there's some very nice and very fun bugs on discord's end mmlol so we haven't bumped master to v10 yet

vale ibex
#

Is the intent itself part of 2.4?

fallen patrol
#

no

vale ibex
#

ahh alr

fallen patrol
#

since the intent isn't needed to be declared on v9 or lower

vale ibex
#

ah oki nice

fallen patrol
#

it'd be nice if it wasn't glitched on discord's end tho

vale ibex
#

lol

fallen patrol
#

my test bot on v10 with the intent disabled still got message content over the HTTP api but not the gateway

#

however if i turned on the intent, then i would not receive it over HTTP

#

but would over the gateway

vale ibex
#

works the same for members

fallen patrol
#

nope, its supposed to be both

vale ibex
#

the other two parts, not so much lol

#

oh wait, yea i get what you mean now

fallen patrol
#

it seems to only affect bots that had the toggle on for a while, from what I tested

vale ibex
#

You need member/message intent enabled in api portal to get via HTTP

fallen patrol
#

ye

vale ibex
#

you need that + declare on connection to get from gateway

fallen patrol
#

yeah

fallen patrol
#

in which case you're in a better position to have discord fix the issue than i am

#

on a new bot account they worked properly, and were both restricted

vale ibex
#

strange

fallen patrol
#

very

vale ibex
#

lol

#

probably because I was capitialising all instances of Discord

#

and didn't set my regex to have a negative lookahead

clever wraith
#

I assume you used 2.4?

vale ibex
#

^2

#

will set to 2.4 in the bots

clever wraith
#

wait, bot core is a thing now?

vale ibex
#

slowly becoming a thing, yea

#

using sir-robin as a catalyst for it

#

just to make sure boiler plate stuff is in there

clever wraith
#

yikes the docs are very white

brisk brook
#

I am sorry my nitpicks just keeps coming

#
## 1.4.0 23rd February 2022
- Feature: Migrate to disnake over discord.py 2.0a0
- Feature: Add common monkey patches
- Support: Added intersphinx to docs.
vale ibex
brisk brook
#

Why is there a dot at the end of the last one πŸ˜…

clever wraith
#

oh wonderful

brisk brook
#

lol

clever wraith
#

there should be a dot at the end of every line!

vale ibex
clever wraith
#

the tense isn't even the same lmao

fallen patrol
clever wraith
#

we could go for a quite a bit like that

brisk brook
clever wraith
#

did I ever have the contrib role, I don't even remember

vale ibex
#

alright updated the changelog with some better wording and grammar

clever wraith
#

okay but those commas at the end of each bullet item is a bit cursed

vale ibex
#

that's for the sub list

clever wraith
#

I think bot-core is using something later than 2.0

#

younger?

#

well a bigger semver

vale ibex
#

it's set to ^2

clever wraith
#

it shouldn't be ^2

vale ibex
#

so that's >=2, <3

clever wraith
#

like I don't even think message intents are in 2.0

vale ibex
#

message content intent isn't released yet

clever wraith
#

wow that heart wasn't for me, okay lemon_pensive

#

:P

vale ibex
#

lol

clever wraith
#

I still think you should at least pin to 2.1, iirc 2.0 was quite broken

vale ibex
#

I was gonna just do *

#

since the bots should set the version they want

#

didn't think it was worth bothering specifying a version

clever wraith
#

I think it could be nice to avoid problems further down the line

#

will you support third party usages?

fallen patrol
#

2.1 is the broken version IIRC

clever wraith
#

oh really

fallen patrol
#

by 2.2.2 its pretty stable afaik

#

and stability is just going up from there

fallen patrol
#

pr is disnakedev/disnake#353

dusky shoreBOT
clever wraith
#

I see

fallen patrol
tawdry vapor
#

@hoary haven I think you can push your changes to your PR. No need to wait for the other reviewer.

hoary haven
#

ah yes, forgot. will do

fallen patrol
vale ibex
#

Ah, haven't really touched that yet

#

there's a bunch of other places that do that too

fallen patrol
#

ah

#

I learned that the hard way, so I wanted to share it with you

vale ibex
#

Hah yea, thanks

thorny spade
#

is there any reason to move to disnake

#

rather than other forks

green oriole
#

Google docstring style, I approve, I approve

sleek steppe
#

Quick PR to avoid an attribute error when the help channel cache is empty, bot#2101

dusky shoreBOT
gritty wind
green oriole
#

wait did we vote on that haha

#

oh riiiight

#

that rings a bell

#

feels like it was ages ago

gritty wind
#

I did a sprint on it, then it went dormant, so yeah probably

#

12/2

#

Which uhh

#

I think that’s December why discord

green oriole
#

sounds about right

green oriole
#

oh I think I remember someone talking about stopping the bot from auto-joining threads

#

yeah that was changed

#

the logging system was relying on that, how did you work around it?

stable mountainBOT
#

bot/exts/moderation/modlog.py lines 838 to 844

@Cog.listener()
async def on_thread_join(self, thread: Thread) -> None:
    """Log thread creation."""
    # If we are in the thread already we can most probably assume we already logged it?
    # We don't really have a better way of doing this since the API doesn't make any difference between the two
    if thread.me:
        return```
green oriole
#

uhh.. did you even work around it? πŸ˜…

#

or is it logging the thread every time someone joins until the bot also joins?

vale ibex
#

on_thread_join is only triggered on create, when the bot joins, or when a cached archived thread is unarchived

#

on_thread_member_join is when other members join

vale ibex
#

(once we migrate to disnake)

#

since I don't think that data is available in discord.py

green oriole
#

does it log the thread twice or not, then

#

I feel like it shouldn't

vale ibex
#

right now I imagine it will log on create and when the bot joins

#

which isn't ideal

#

we should update the modlog event to look at the created time, to try and distinguish

#

once we migrate to disnake and have access to that data

green oriole
vale ibex
#

True, but I wonder if it is done so before or after the join event is triggered

#

if it's done before, then we're probably fine as-is

green oriole
#

yeah

#

I mean, could always try it out haha

vale ibex
#

yup

#

don't have access to my personal machine atm though, so can't myself

sleek steppe
#

yeah I think dpy does the event handling before dispatching the event

cold island
#

Is there no thread creation event?

vale ibex
#

on_thread_join is the only event

#

and it triggers for a few reasons

#

it logs thread creations to mod log

proper flax
#

May I ask why disnake over pycord or nextcord?

vale ibex
#

Right now from what we can tell, disnake is more stable currently, the features are generally well implemented, implemented consistently with existing features, and are implemented in good time

#

nextcord are working on a v3 api, which we are watching closely and may migrate over to when it's ready for general consumption

hoary haven
#

oh did i misunderstand too? @last patio

#

what is "removing the admin app"?

last patio
#

i am removing admins from python discord

hoary haven
#

lol gg

last patio
#

no, basically that app looks ... like it was supposed to be a space where we build custom functionality on the django admin

#

but all it does right now is include the django admin urls in its url config

#

and the joke is, we don't even include that application

#

it's completely dead code

placid ermine
#

yoo is that the one i pointed out

tawdry vapor
#

If it is, good job

hoary haven
#

14 hours later confirming yes this works. cool!

placid ermine
hoary haven
dim pelican
placid ermine
#

Wow this mina user seems like a menace

hoary haven
#

so it's running site locally on my machine

#

and logging into the django admin portal

#

so these are infractions on my test bot/test server

dim pelican
#

Cool cool cool

hoary haven
#

me testing antispam

last patio
#

aaaaaaaaaaaaaaaaaaaaaaaaaaa

hoary haven
#

this is fine to "leak" btw right? @patent pivot ? Thinking_chief

#

pretty sure Thinking_chief

patent pivot
#

yeah anyone can see it

#

if they clone site

hoary haven
#

ye ye

patent pivot
#

if it had our data maybe not lol but otherwise you're good

hoary haven
#

once they have SITE_ID=1 lol

green oriole
#

Is there even any credentials for the prod admin panel

#

It was previously tied to discord OAuth, that was pretty sick

patent pivot
patent pivot
green oriole
#

I mean we had that for free with the wiki OAuth so why not

patent pivot
#

so then we had a whole role oauth2 system for an admin panel which 12 people could access

green oriole
#

Yeah yeah I remember that

last patio
trim cradle
#

right, I've been meaning to respond to that

trim cradle
# last patio hi <@!253696366952316929> ! did you find some time to find some time to look int...

I suppose the current pipeline is fine. It might be nice if admins ask new helpers to add themselves to the registry. As it stands, it's not clear which person or combination of people have final say.

We also haven't discussed the criteria all that much. I mentioned before that I wanted to remove one of the resources, "neural networks from scratch" because it's expensive and print-on-demand, which means that we're asking our users to take on a hefty financial risk in case the resource turns out to not be useful for them. I'd rather curate resources that are easily accessible, even among those that are paid.

Should we curate pairs of interchangeable resources? My inclination is to say that if two resources are very similar, we should only keep one. We don't want to give our users option paralysis or curate so many resources that we don't help our users refine their search any better than google would.

crude gyro
#

I don't have the answers for those questions.

#

I'm sure we can iterate on whether the pipeline is fine or not, but the more important thing is to document what the pipeline is

#

because right now I don't think we've actually written it down anywhere.

#

or am I wrong about that? @trim cradle

trim cradle
crude gyro
#

probably, there are helper onboarding docs on notion

#

maybe it could be added to those?

#

but I think how to contribute a resource should be documented in the repository itself, though.

trim cradle
#

Good point

#

I need to focus on some work stuff, but I'll see about writing something this weekend.

crude gyro
#

that'd be good. me and @last patio are working on an epic which involves improving the overall documentation and reducing the complexity of the site repo, so this would fit neatly in there

trim cradle
#

are Volcyy and Joe's new identities part of a thing?

crude gyro
#

no, they're just weirdos

trim cradle
#

but they're interrelated phenomena?

#

in either case, I'm going to have nightmares.

wild prism
trim cradle
#

but I see your point.

boreal nacelle
#

Far enough away IMO that I don't bring it up when people ask why they should use Nextcord

vale ibex
boreal nacelle
#

alright, wasn't sure

vale ibex
#

No worries πŸ˜€

sleek steppe
#

@hoary haven @spare plaza bot#2071 was merged. thank you for that cool PR lemon_fingerguns

dusky shoreBOT
hoary haven
#

time to test it in prod LaserKeypora

magic arch
#

brb with my alts /s

green oriole
#

Oh god the emojis in commits

severe tangle
#

Lmao

spare plaza
#

I was expecting it to be squashed to remove the emojis

#

oofers

green oriole
spare plaza
#

I even do it for my work projs

#

although, the MyPy thing should have been πŸ“’

green oriole
#

oh god

#

oh hey what will mister @last patio lead?

static canyon
green oriole
#

cool

fallen patrol
#

3rd commit down, no emoji?

spare plaza
#

that was a colleague

hoary haven
#

i do love the πŸ™ˆ for gitignore

#

um this reminds me, should the bot contributing guide be updated to match some changes we made?

#

in config-default

sleek steppe
#

Yes

#

Feel free to make a PR for that πŸ‘

hoary haven
#

yeah and possibly update to staff notion as well.. i'll try to do that today

cold island
#

Most of the configs on that page are mandatory

vale ibex
#

Yea, a lot of overrides can be removed from the staff config too tbh

#

since we're not actually overriding, just setting it to the same value again

sleek steppe
cold island
#

yeah I just made a template for the configs you had to define to run the bot on your server

hoary haven
#

i think we changed some though

#

like the names.. i think there was one that overlapped but i'll check

cold island
#

oh, it does include the filters and help channels configs

#

I guess we can update it, but we can also just remove those

hoary haven
#

i'm not looking at it right now but it would be good to include those i think. who really wants like 40 test help channels

thorny obsidian
#

@static canyon how is reminders stalled by the mod pings PR? Also which mod pings PR?

static canyon
#

Lemme find the #

#

bot#2001

dusky shoreBOT
static canyon
#

That PR adds the DayDuration converter which I use in my PR

#

Although actually I think I might've since redesigned it, I'm not sure nvm, it will still use this

thorny obsidian
#

Wouldn't it make more sense to use arrow since we're shifting towards more arrow usage anyway? It'll add support for human readable stuff too

static canyon
#

I'm just using regex because that's what the modpings pr does

#

Plus arrow doesn't have one method that would solve this

thorny obsidian
#

I'll let core devs weigh in on this, but I really enjoy the way the epoch command does it. Since we use arrow anyway, it makes more sense to me to rely on it since it's more robust in the date times it can detect

static canyon
static canyon
vale ibex
#

arrow.get() and arrow.dehumanize()

thorny obsidian
vale ibex
#

Yea, regex seems bad for this.

#

at face value at least

#

if there's something this regex does that the two arrow functions don't, I'm open to hear it

hoary haven
#

one thing i would like support for, in both !remind and .epoch, is "in 1 hour"
iirc you have to do "in 1 hours"

thorny obsidian
#

Because for mod pings I do think it would be really helpful for people to turn it off for like 2 hours and just do !mogpings off for 2 hours or whatever the syntax needs to be

static canyon
vale ibex
#

so, using arrow would support everything there, and would support an offset

#

with 2 function calls

#

arrow.get() to try and interpret it as a datetime stamp (Which supports many different formats), arrow.utcnow().dehumanize() to try and interpret it as an "in 1 hour" style offset

static canyon
#

I mean I just tried one of the things work in my regex and it doesn't work with arrow

vale ibex
#

which is?

static canyon
#
arrow.get("2021-11-22 12:00:30pm")
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    arrow.get("2021-11-22 12:00:30pm")
  File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\api.py", line 91, in get
    return _factory.get(*args, **kwargs)
  File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\factory.py", line 254, in get
    dt = parser.DateTimeParser(locale).parse_iso(arg, normalize_whitespace)
  File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\parser.py", line 250, in parse_iso
    raise ParserError(
arrow.parser.ParserError: Invalid time component provided. Please specify a format or provide a valid time component in the basic or extended ISO 8601 time format.```
hoary haven
#

is this a general util that can be implemented in bot-core? so that all our bots can use it?

static canyon
#

So we wouldn't have 12/24hr support I guess when including a date

vale ibex
#

yea, that would work if you removed the pm

#

since it infers 24 hour clock if given a date too

static canyon
#

It apparently doesn't work with . instead of : either

#

So like 12.30pm

#

So another fix needed if we're gonna use arrow

thorny obsidian
#

Why would you need 12.30pm?

static canyon
#

It's just something that was asked, to have support for extra formats

static canyon
thorny obsidian
#

I just really don't like the idea of creating our own behemoth regex which we then have to maintain. That adds a lot of complexity and will make it more difficult to add to or adjust in the future.

static canyon
#

But could probably be made true relatively easily

static canyon
vale ibex
#

I'd rather say it doesn't work for those esoteric formats, rather than have a large maintenance burden on a complex regex

thorny obsidian
static canyon
#

Why would you need to change it if it works?

vale ibex
#

I've never heard of a place that uses 12.30 as a time format

thorny obsidian
#

Ideally it's true, but realisitically it's not.

#

Because you can't guarantee that it'll just work flawlessly. There will be edge cases we don't catch, especially with more esoteric formats.

static canyon
#

🀷

thorny obsidian
#

It has better support for humanized timestamps and 8601 compliant timestamps...

static canyon
#

It's not better support, it's the same support (for iso) 🀷

vale ibex
#

Yea, I don't think either me nor kat would have imagined saying better support also means unused formats

#

since 12,30 isn't supported either

#

neither is 12;30

#

So, since we want to have support for well known formats, arrow is the best choice for that, since it's one less thing we need to maintain, and can rely on the maintainers of arrow to do that for us

static canyon
#

I'm fine with moving to arrow, mainly because it makes the humanize part of the issue easier, I just don't get why you both feel the need to shit on my code with reasons which aren't even correct

vale ibex
#

We aren't shitting on your code, I'm sure it works for what you intended it to do, what I'm saying is that I don't think having it in the code base would be the best option, if one of our dependencies does what we wanted already, with minimal code changes

thorny obsidian
#

I don't think I ever "shit" on your code. All I've been saying is that I think arrow is the better choice because it reduces maintenance burden and is robust with the timeformats it supports, including humanized time formats.

vale ibex
#

the best code is no code, second to that is minimal code

static canyon
static canyon
thorny obsidian
static canyon
#

Hmm

#

I don't really see how

#

Either way you've still got to test it

#

I guess it's just the understanding of the regex

tawdry vapor
#

Arrow has a test suite for what it's worth.

static canyon
tawdry vapor
#

Yes technically if we want to be strictly black box we still need our own tests but I don't that we want to be so strict necessarily

static canyon
#

Yeah

#

So in terms of the edge cases @vale ibex (like not supporting am/pm) how would I fix those? Just not allow am/pm input and assume 24hr?

tawdry vapor
#

If you already wrote tests they could possibly be used still

static canyon
#

And apparently we want to be using arrow instead

#

Another thing arrow doesn't support (not having padded times)```py

arrow.get("2021-11-22 9:30:00")
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
arrow.get("2021-11-22 9:30:00")
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\api.py", line 91, in get
return _factory.get(*args, **kwargs)
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\factory.py", line 254, in get
dt = parser.DateTimeParser(locale).parse_iso(arg, normalize_whitespace)
File "C:\Users\tizzy\AppData\Local\Programs\Python\Python39\lib\site-packages\arrow\parser.py", line 250, in parse_iso
raise ParserError(
arrow.parser.ParserError: Invalid time component provided. Please specify a format or provide a valid time component in the basic or extended ISO 8601 time format.```

#

Honestly when I'm seeing the things that arrow doesn't support, it makes me want to just use the regex because that does support it

thorny obsidian
#

You can add formats for arrow to parse.

tawdry vapor
#

Well if the goal is the same then the test cases should be the same and ideally your tests aren't written such that they're tightly coupled to the implementation.so I assumed they can be reused

static canyon
static canyon
tawdry vapor
#

For the most part they are. A few attributes behave differently

static canyon
#

I'll mess around with it and see

#

Should hopefully be fine

#

If I really need to I can account for the differences

tawdry vapor
#

You can directly compare with datetime

static canyon
#

mhm

tawdry vapor
#

Or use .datetime to convert it if you must

static canyon
#
>>> arrow.get("2021-11-22 00:00:00") == datetime.datetime.fromisoformat("2021-11-22 00:00:00")
False```oof
tawdry vapor
#

That's probably tz diff

static canyon
#

Right, yeah

tawdry vapor
#

Latter is naive

static canyon
#

So I'll just have to account for naivety

#

Which I don't think will actually be an issue since my test datetimes are all set to UTC

#
>>> london_time = datetime.datetime.fromisoformat("2021-11-22-00:00:00").replace(tzinfo=pytz.timezone("Europe/London"))
>>> paris_time = datetime.datetime.fromisoformat("2021-11-22 00:01:00").replace(tzinfo=pytz.timezone("Europe/Paris"))
>>> london_time == paris_time
```how can I get this to work? Comparing different timezones (Paris is one hour ahead of London so this should be true)
tawdry vapor
#

Not sure. I would have expected that to work.

static canyon
#

Rip

#

Guess I'll look it up

tawdry vapor
#

Oh well you changed the minutes instead of hours

#

It does compare correctly if you fix that and covert them to arrow objects

#

But still False with just datetime

static canyon
static canyon
tawdry vapor
#

arrow.get(dt_object)

#

No idea why datetime fails I thought it would work

cold island
vale ibex
#

arrow.get does that by default iirc

cold island
#

I have commit 91621bc7 from the bot. How can I open it on github?

clever wraith
#

git show locally

cold island
static canyon
#

If I'm working on a site PR, how can I make my bot repo interact with my local site again?

#

I namely need the clean logs part of site

hoary haven
#

those somehow just workedℒ️ for me

#

but i run locally, and only use docker for site
idk if that has smth to do with it?

static canyon
#

🀷

#

I'm running bot with docker compose run bot and trying to access the clean logs

clever wraith
#

Your url settings are wrong, it changed recently

#

Look at the staff server notion page, it is updated

hoary haven
static canyon
#

Thanks

#

Now I just need to update the config file to reflect that

hoary haven
#

this is what i have

urls:
    # PyDis site vars
    site:        &DOMAIN       "localhost:8000"
    site_api:    &API    !JOIN [*DOMAIN, "/api"]
    site_api_schema:           "http://"
    site_paste:  &PASTE  !JOIN ["paste.", "pythondiscord.com"]
    site_schema: &SCHEMA       "http://"
    site_staff:  &STAFF  !JOIN [*DOMAIN, "/staff"]

    paste_service:                      !JOIN ["https://", *PASTE, "/{key}"]
    site_logs_view:                     !JOIN [*SCHEMA, *STAFF, "/bot/logs"]```
static canyon
#

This is what I just changed it to```yml
site: &DOMAIN "localhost:8000"
site_api: &API !JOIN [*DOMAIN, "/api"]
site_paste: &PASTE !JOIN ["paste.", "pythondiscord.com"]
site_schema: &SCHEMA "http://"
site_staff: &STAFF !JOIN [*DOMAIN, "/staff"]

paste_service:                      !JOIN ["https://", *PASTE, "/{key}"]
site_logs_view:                     !JOIN [*SCHEMA, *STAFF, "/bot/logs"]```
#

That seems to be the same

#

So should be good

#

Thanks

#

Now if I make changes to my local site repo, how do I make it so that bot will run that changed site repo?

#

Or is that just done by default?

#

Guess not lolpy aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)] 2022-02-24 21:19:35 | bot | CRITICAL | Could not connect to site API. Is it running? ERROR: 69

sleek steppe
#

Is the site running on localhost:8000?

static canyon
#

I'm trying stuff right now

#

If I do docker-compose up in the site repo, it starts up

#

But then when I do docker-compose run bot in the bot repo, it says the port is already taken (it basically tries to start site even though I've already got it running)

#
PS C:\Users\tizzy\bot> docker-compose run bot
Creating network "bot_default" with the default driver
Creating bot_snekbox_1  ... done
Creating bot_postgres_1 ... done
Creating bot_redis_1    ... done
Creating bot_metricity_1 ... done
Creating bot_web_1       ...
Creating bot_web_1       ... error

ERROR: for bot_web_1  Cannot start service web: driver failed programming external connectivity on endpoint bot_web_1 (14f14a45c4ea9f680f6f3e681b9804c24b04273e679148eccf3923b9a7d427d5): Bind for 127.0.0.1:8000 failed: port is already allocated

ERROR: for web  Cannot start service web: driver failed programming external connectivity on endpoint bot_web_1 (14f14a45c4ea9f680f6f3e681b9804c24b04273e679148eccf3923b9a7d427d5): Bind for 127.0.0.1:8000 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.```
#

And same thing for docker-compose up in the bot repo

hoary haven
static canyon
#

You can run additional services on the host, but this guide won't go over how to install and start them in this way. If possible, prefer to start the services through Docker to replicate the production environment as much as possible.

The site, however, is a mandatory service for the bot. Refer to the previous section and the site contributing guide to learn how to start it on the host, in which case you will need to change urls.site in config.yml to wherever the site is being hosted.

#

That second paragraph says I need to update the env var to point to where I'm running site locally

#

But I do that and then it just tries to restart it

#

Might have fixed it

#

nvm

#

I've got no clue what I'm doing now

#

If I have site running separately, it gives an error because it tries to start it up itself.

If I don't have site running separately, then site starts when I run bot, but bot fails to connect to it

#

I think I've made some progress, but am coming across an error:py postgres_1 | 2022-02-24 21:35:41.071 UTC [118] ERROR: relation "channels" already exists postgres_1 | 2022-02-24 21:35:41.071 UTC [118] STATEMENT: postgres_1 | CREATE TABLE channels ( postgres_1 | id BIGSERIAL NOT NULL, postgres_1 | name VARCHAR NOT NULL, postgres_1 | is_staff BOOLEAN NOT NULL, postgres_1 | PRIMARY KEY (id) postgres_1 | ) postgres_1 | postgres_1 | pydis-testing_metricity_1 exited with code 1

brazen charm
#

you can use a compose override file to prevent site from starting with bot

hoary haven
#

from "With the Bot Running Locally"

brazen charm
# static canyon What do you mean?

a docker-compose.override.yml file that changes the web service to not start if you're already running it youself. e.g. I use this to stop the bot from starting

version: "3.7"

services:

  bot:
    profiles:
      - ignore

static canyon
#

Hmm

#

Which repo do I put that in?

#

bot I guess?

brazen charm
#

yes, as that's where you want to prevent the site to start in

#

don't know what the relation error is though as I usually also skip metricity

static canyon
#

So I guess I'd ignore web and postgres?

#

Currently getting thispy PS C:\Users\tizzy\bot> docker-compose up ERROR: The Compose file is invalid because: Service site has neither an image nor a build context specified. At least one must be provided. @brazen charm

brazen charm
#

I think it's web in the bot's compose

static canyon
#

Right, yea

#
ERROR: Service "web" was pulled in as a dependency of service "bot" but is not enabled by the active profiles. You may fix this by adding a common profile to "web" and "bot".```
#

Now this

brazen charm
#

I guess you'll also need to override bot to not depend on web

static canyon
brazen charm
#

You'll need to specify the depends_on key without the web service (and only that)

static canyon
#

Hmm

brazen charm
#

the override is merged into the normal compose iirc

brazen charm
#
  bot:
    depends_on:
      - the_items_that_are_not_web
static canyon
#

I've got that

#

Still not working

#
      depends_on:
        - snekbox
        - redis```
#

Same with just snekbox / just redis

#

Just removed from the main docker-compose for now

brazen charm
#

Not sure if it's also merging that, maybe assigning it some normal value but that may break things

#

yeah that'll also wokr

static canyon
#

It's still failing to connect to site

#
2022-02-24 21:54:36 | bot | CRITICAL |
...
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
2022-02-24 21:54:36 | bot | CRITICAL | Could not connect to site API. Is it running?```
#

And I did do docker-compose up in site

brazen charm
#

can you access it from the browser?

static canyon
#

It loads the pydis.com homepage (but on localhost)

brazen charm
#

try 127.0.0.1 instead of localhost

static canyon
#

Okay

static canyon
brazen charm
#

not sure then if http is set. I'd go through the hosts file aliases as those solved a similar issue before

static canyon
#

what do you mean?

brazen charm
#

and then using pythondiscord.local

static canyon
#

Apparently my host file already has something for 127.0.0.1

#
127.0.0.1 kubernetes.docker.internal```
brazen charm
#

shouldn't matter

static canyon
#

Okay, added

#

It works in the browser

#

Time to see whether bot likes it

#

Nope, it doesn't

#

Still fails to connect @brazen charm

#
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host pythondiscord.local:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
2022-02-24 22:10:41 | bot | CRITICAL | Could not connect to site API. Is it running?```
brazen charm
#

what does the config look like?

static canyon
#
site:        &DOMAIN       "pythondiscord.local:8000"
site_staff:  &STAFF  !JOIN [*DOMAIN, "/staff"]

site_logs_view:                     !JOIN [*SCHEMA, *STAFF, "/bot/logs"]```
#

Those are the three relevant bits

brazen charm
#

is the schema set?

static canyon
#

Right, yeah

#
site_schema: &SCHEMA       "http://"```
clever wraith
#

I don't think it will go through the host hosts file

#

you should use web:8000

brazen charm
#

oh it's in docker

#

glossed over that

static canyon
#

I had that earlier and it didn't work

#

But I'll try I guess

brazen charm
#

it may need site_web or something like that

clever wraith
#

are you not using the COMPOSE_PROJECT_NAME env var?

static canyon
#

I am

clever wraith
#

it should be using the same network then

#

you can try to take stuff down (explicitely with the command) and try again

static canyon
#

Got a massive error

#

Basicallypy web_1 | connection = Database.connect(**conn_params) web_1 | File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect web_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync) web_1 | psycopg2.OperationalError: FATAL: the database system is shutting down

#

Hmm that seems to have just been bad timing

#

Think it's fine

clever wraith
#

yeah the bot started too fast

static canyon
#
Starting pydis-testing_snekbox_1 ...
Starting pydis-testing_snekbox_1    ... error
Starting pydis-testing_redis_1      ...
WARNING: Host is already in use by another container

ERROR: for pydis-testing_snekbox_1  Cannot start service snekbox: driver failed programming external connectivity on endpoint pydis-testing_snekbox_1 (f31d95944ea3f5946d079361174a933e28803b9e4174742dfa4d9d56b30f67ab): Bind for 127.0.0.1:8060 failed: port is already allocated
Starting pydis-testing_redis_1      ... error

ERROR: for pydis-testing_redis_1  Cannot start service redis: driver failed programming external connectivity on endpoinRecreating pydis-testing_postgres_1 ... done
ed: port is already allocated
pydis-testing_metricity_1 is up-to-date

ERROR: for snekbox  Cannot start service snekbox: driver failed programming external connectivity on endpoint pydis-testing_snekbox_1 (f31d95944ea3f5946d079361174a933e28803b9e4174742dfa4d9d56b30f67ab): Bind for 127.0.0.1:8060 failed: port is already allocated

ERROR: for redis  Cannot start service redis: driver failed programming external connectivity on endpoint pydis-testing_redis_1 (b66684f7324dedefa34457a3afc0f567571f29fb0f2e1ca33acaa696ebacdd3a): Bind for 127.0.0.1:6379 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.```
clever wraith
#

can you docker ps?

static canyon
#

And then site is spammingpy postgres_1 | 2022-02-24 22:20:25.287 UTC [258] ERROR: relation "channels" already exists postgres_1 | 2022-02-24 22:20:25.287 UTC [258] STATEMENT: postgres_1 | CREATE TABLE channels ( postgres_1 | id BIGSERIAL NOT NULL, postgres_1 | name VARCHAR NOT NULL, postgres_1 | is_staff BOOLEAN NOT NULL, postgres_1 | PRIMARY KEY (id) postgres_1 | ) postgres_1 | postgres_1 |

static canyon
# clever wraith can you `docker ps`?
dc781ee168b5   ghcr.io/python-discord/metricity:latest   "bash entry_point.sh"    3 minutes ago    Restarting (1) 15 seconds ago                              pydis-testing_metricity_1
15ef75f5489a   redis:5.0.9                               "docker-entrypoint.s…"   15 minutes ago   Up 14 minutes                   127.0.0.1:6379->6379/tcp   bot_redis_1
7a9fe5630e4f   ghcr.io/python-discord/snekbox:latest     "gunicorn -c config/…"   15 minutes ago   Up 14 minutes                   127.0.0.1:8060->8060/tcp   bot_snekbox_1```
clever wraith
#

you have something that is still up

#

you gotta take it down first

static canyon
#

How?

clever wraith
#

docker-compose down

static canyon
#

I have

#

On both terminals

#

But there's still something running

clever wraith
#

yes

#

hmm

static canyon
#

Closed it from Docker Desktop

#

Now, let's try this again

clever wraith
#

ah it is from before the rename

static canyon
#

As soon as I start bot, the terminal where I started site gets spammed with errors

#

And then the bot terminal gets spammed too

clever wraith
#

this is fresh instance, right?

static canyon
#

Site error:py postgres_1 | 2022-02-24 22:24:39.609 UTC [111] ERROR: relation "channels" already exists postgres_1 | 2022-02-24 22:24:39.609 UTC [111] STATEMENT: postgres_1 | CREATE TABLE channels ( postgres_1 | id BIGSERIAL NOT NULL, postgres_1 | name VARCHAR NOT NULL, postgres_1 | is_staff BOOLEAN NOT NULL, postgres_1 | PRIMARY KEY (id) postgres_1 | ) postgres_1 | postgres_1 |

#

The bot thing seems to just be that error

clever wraith
#

can you docker-compose down --volumes and try again?

static canyon
#

There was definnitely nothing running

#

I did docker ps and it was empty

clever wraith
#

yeah but volumes

static canyon
#

Apparently there's volumes in use

#

I can't seem to shut them down though

clever wraith
#

hmmm

static canyon
clever wraith
#

I guess you can down first without volumes and then with

static canyon
#

I guess they're from before the rename

#

Yeah, I removed the COMPOSE env var thing and now they're gone

#

So now I try starting site, and then bot? @clever wraith

clever wraith
#

yep

static canyon
#

No errors now

#

But it's stuck on bot_1 | 2022-02-24 22:30:34 | bot | INFO | Attempting site connection: 1/3

clever wraith
#

what is your site url set to

#

and also do you get any error

static canyon
static canyon
clever wraith
#

it should timeout after a bit

#

hmm

static canyon
#

Ah, it's on try 2/3 now

#

Just took a long time to timeout

#

As in, 60 seconds

#

So looks like it's still not working

#
bot_1        | 2022-02-24 22:30:34 | aioredis | DEBUG | Creating tcp connection to ('redis', 6379)
bot_1        | 2022-02-24 22:30:34 | bot | INFO | Attempting site connection: 1/3
bot_1        | 2022-02-24 22:31:54 | bot | INFO | Attempting site connection: 2/3
bot_1        | 2022-02-24 22:33:14 | bot | INFO | Attempting site connection: 3/3
bot_1        | ...
bot_1        | 2022-02-24 22:34:29 | bot | CRITICAL |
bot_1        | ....
bot_1        | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host web:8000 ssl:default [None]
bot_1        | 2022-02-24 22:34:30 | bot | CRITICAL | Could not connect to site API. Is it running?``` @clever wraith
clever wraith
#

hmm

#

schema is http?

static canyon
#

Yeah

clever wraith
#

can you resend your url?

static canyon
#
urls:
    # PyDis site vars
    site:        &DOMAIN       "web:8000"
    site_api:    &API    !JOIN [*DOMAIN, "/api"]
    site_paste:  &PASTE  !JOIN ["paste.", "pythondiscord.com"]
    site_schema: &SCHEMA       "http://"
    site_staff:  &STAFF  !JOIN [*DOMAIN, "/staff"]

    paste_service:                      !JOIN ["https://", *PASTE, "/{key}"]
    site_logs_view:                     !JOIN [*SCHEMA, *STAFF, "/bot/logs"]```
#

Ah wait, I'm not using the COMPOSE env var

clever wraith
#

what is your ALLOWED_HOSTS set to?

#

ah well, that'll do it haha

static canyon
#

Had to remove it to get rid of the volumes

#

Forgot to add it back

#

Let's try again 🀞

#

I think it's working

#

Had a few issues but fixed them

#

Seems to be up

#

Perfect, it's up

#

Thank you very much @clever wraith! ducky_party

clever wraith
#

cool, you're welcome

thorny spade
hoary haven
#

all the front-end peeps, now's your chance to weigh in EYES site#682
is it fine to have a br inside a span? is it worth avoiding if it Still Worksℒ️?

dusky shoreBOT
green oriole
#

I think it is fine as it is, it would avoid messing with margins and stuff

thorny spade
#

can i be assigned to this

hoary haven
#

the commit title is wrong though
I think it's worth fixing but will defer to core devs

molten perch
thorny obsidian
#

!source superstarify

stable mountainBOT
#
Command: superstarify

Temporarily force a random superstar name (like Taylor Swift) to be the user's nickname.

Source Code
thorny obsidian
#

I know, I wanted to look at the source code myself. That was the fastest way to do so

stable mountainBOT
#

bot/exts/moderation/infraction/superstarify.py line 36

async def on_member_update(self, before: Member, after: Member) -> None:```
thorny obsidian
#

It listens for everytime a member is trying to change their nickname. If they do and they have an active superstarify infraction, it reverts it

static canyon
#

It is, if you're using listeners

#

@bot.event can only have one
@bot.listen() or @commands.Cog.listener() can have multiple

fallen patrol
#

@clever wraith its not possible to remove the nickname permission from a user without having a whitelist role that gives it to everyone else unfortunately

#

hence python listens for every member update and changes the nickname back if its changed during that period

fallen patrol
#

zig lmao

#

πŸ₯² discord/discord-api-docs#4571

dusky shoreBOT
stable mountainBOT
#

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

sleek steppe
#

I’m pretty sure there are some badges that are inaccessible from the API

fallen patrol
#

^^

#

nitro isn't visible from the api, and i'm not sure about boosting

patent pivot
#

boosting is iirc

#

!int e author.premium_since

stable mountainBOT
#
In [49]: author.premium_since
Out[49]: 
datetime.datetime(2019, 6, 10, 19, 7, 12, 423000, tzinfo=datetime.timezone.utc)```
patent pivot
#

slightlyℒ️

fallen patrol
patent pivot
#

yea

#

!user

stable mountainBOT
#
Haz-Mat (joe#6000)

partner hypesquad_balance early_supporter verified_bot_dev

User information

Created: <t:1459415175:R>
Profile: @patent pivot
ID: 165023948638126080

Member information

Joined: <t:1484070095:R>
Roles: <@&267627879762755584>, <@&267628507062992896>, <@&807415650778742785>, <@&587606783669829632>, <@&409416496733880320>, <@&797752289771126784>, <@&491583790448246785>, <@&721459198839357490>, <@&267630620367257601>, <@&585529568383860737>, <@&323426753857191936>, <@&295488872404484098>, <@&764802720779337729>, <@&463658397560995840>

Activity

Messages: 119,638
Activity blocks: 19,432

Infractions

Total: 0
Active: 0

patent pivot
#

good command

cold island
fallen patrol
#

no, that means that the field may not exist

cold island
#

ah

fallen patrol
#

the second ? which that pr adds means that the field may be nullable

cold island
#

But yeah, my issue is as edge as an edge case might be πŸ˜…

fallen patrol
#

well uh

#

it led me to find another bug in the library, and so far 2-3 discord api bugs catsip

cold island
#

lolol

#

I thought this might happen

fallen patrol
#

some of these bugs existing for 5+ years

fallen patrol
cold island
#

nothing profound, I just figured it might not be the only place where something like that happens, and not surprised the lib has old bugs

fallen patrol
#

true

fallen patrol
cold island
placid ermine
#

hi could i get a review on bot#2039 πŸ₯Ί

dusky shoreBOT
thorny spade
#

can i got a review on sir-lancebot#1034

dusky shoreBOT
thorny spade
#

wait

#

not this

#

sir-lancebot#1041

dusky shoreBOT
thorny spade
#

this one i suppose

trim cradle
#

@last patio I'm offloading responsibility for the resource contribution guide.

last patio
#

alright πŸ‘

austere hornet
#

Do you mean the !user command? If so, the "activity blocks" means how many 10-minute blocks you were active for on the server I think

crude gyro
green oriole
#

It could be interesting to look at some Django resources in there, I think

#

RP has a whole series on the lib I believe

thorny obsidian
crude gyro
#

sounds good, kat. lemon_hyperpleased

#

it'll keep for a few days

last patio
#

lemon I have an ew pr

#

it fixes all the useless output from python manage.py test

#

so it just displays dots now as it should

crude gyro
#

very nice

#

'I can review it, link me

last patio
#

if you pass the wrong datetime kind django will now throw up with an exact stacktrace at test run time

#

and the infraction viewset was updated as well, to query aware to aware instances

crude gyro
#

reviewed but I don't get it @last patio

last patio
#

fixed

#

@crude gyro@crude gyro@crude gyro@crude gyro@crude gyro

crude gyro
#

okay @last patiothis was a success.

last patio
#

thanks

trim cradle
#

why is there no #dev-make-site-good

#

or #dev-site-engooden

cold island
stable mountainBOT
#

discord/ext/commands/core.py line 885

async def invoke(self, ctx: Context) -> None:```
cold island
brisk brook
#

You cannot, no. You need to modify ctx and change the args πŸ˜΅β€πŸ’«

sleek steppe
#

Is there a reason why !d discord links nextcord?

cold island
#

!help d

stable mountainBOT
#
Command Help

!docs [symbol_name]
Can also use: d, doc

Look up documentation for Python symbols.

Subcommands:

!docs cleardoccache <package_name>
Clear the persistent redis cache for package.
!docs deletedoc <package_name>
Removes the specified package from the database.
!docs getdoc [symbol_name]
Return a documentation embed for a given symbol.
!docs refreshdoc
Refresh inventories and show the difference.
!docs setdoc <package_name> <inventory> [base_url]
Adds a new documentation metadata object to the site's database.

cold island
#

!docs getdoc

fervent sage
#

Why can i use those buttons lol

stable mountainBOT
cold island
#

!d discord

stable mountainBOT
#

To work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

cold island
#

interesting

#

It might be because nextcord was the last to be added?

#

or because it's the last on the list out of the wrappers

#

!src docs

stable mountainBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
sleek steppe
stable mountainBOT
#

discord/ext/commands/converter.py line 1097

async def run_converters(ctx: Context, converter, argument: str, param: inspect.Parameter):```
cold island
#

oh that's a thing

vale ibex
#

Yea, but you need to pass it the converter still, and call each param

cold island
#

But it looks a bit awkward

vale ibex
#

so it's not much better

cold island
#

I'm only dealing with one param at a time so it's not the end of the world, but creating that Parameter object seems annoying

#

I have a thing that works, so I'll stick with it for now

vale ibex
#

πŸ‘Œ

austere hornet
#

Does anyone know something similar to wait_for() for buttons in dpy? When I try to use wait_for() it doesn't work and I also tried using this and it isn't working either:

@commands.Cog.listener()
async def on_interaction(interaction: discord.Interaction):
    await interaction.respond("houston we got an interaction")

Would appreciate some help with this. Thanks!

fallen patrol
#

respond isn't an attribute on any interaction object in dpy

#

its send

austere hornet
hoary haven
#

reviews welcome on bot#2069

hoary haven
#

That Title Case pain

sleek steppe
#

that's a very long PR title lemon_eyes

hoary haven
#

(also i'm gonna try reviewing your PR @placid ermine)

sleek steppe
#

hmm, what's the reason we should check usernames when joining/switching voice channels?

hoary haven
#

we've had a couple times users in vc reported users joining with Bad Usernames
getting an alert will allow us to address these users even if they're not reported

#

i think griff originally implemented it to only be initial voice join, but looks like along the way it was changed? not too sure on this one

fallen patrol
#
  • join vc with clean name
  • change nickname
    no ping, and bypassed the system
#

ooh but i did look at the code and the solution to the above should be pretty easy to implement (hopefully)

#
    @Cog.listener()
    async def on_member_update(self, before: Member, after: Member) -> None:
        if before.display_name == after.display_name:
          return
        if after.voice is None:
          return
        await self.check_bad_words_in_name(after)
#

although hm, is pydis caching voice states

#

yeah it caches the entire server

cold island
fallen patrol
#

ah, makes sense

fallen patrol
#

although the above code paired with the existing would prevent all bypasses

clever wraith
hoary haven
#

if i want to review someone's PR and it's on a branch of their own fork, what do i do
git remote add upstream their_repo.git ?

tawdry vapor
#

Good enough for looking at and running the code, but not if you want to make changes and push them

#

In your ~/.gitconfig you can create an alias ```
[alias]
cpr = "!cd ${GIT_PREFIX:-.} && git fetch origin refs/pull/${1}/head && git checkout FETCH_HEAD #"

hoary haven
#

my origin is my own fork though. i suppose i should use 'upstream' ?

tawdry vapor
#

Yeah

hoary haven
#

sigh i think i'm on old pwsh and && doesn't work lol

clever wraith
#

To be honest I recommend the gh CLI client

tawdry vapor
#

Just make it separate commands

clever wraith
#

With it you can just do gh pr checkout 12345

#

Also I don't know if y'all are still on Linode, but they are being acquired by Akamai

hoary haven
#

gh cli sounds good

#

but thanks mark i'm now in a detached HEAD state but that's to be expected, i think

placid ermine
#

french noblemen in 1789:

hoary haven
#

@clever wraith preferred protocal for git operations: https vs ssh
does it matter?

brazen charm
#

shouldn't really matter for unauthenticated

clever wraith
#

Depends on what you use

#

If you use ssh, use ssh

#

If you use http, use http

tawdry vapor
hoary haven
#
GraphQL: Could not resolve to a PullRequest with the number of 2032. (repository.pullRequest)```

![shrug](https://cdn.discordapp.com/emojis/332268181517238272.webp?size=128 "shrug")
tawdry vapor
#

No idea I don't use gh cli

hoary haven
#

oh wait i'm using wrong number

#

no one saw that

clever wraith
#

Haha

last patio
#

mark that cpr thing is super smart

tawdry vapor
outer oasis
#

Where do the "GitHub Actions" embeds in #dev-log come from?

#

Selecting "Send me everything" with a webhook on GitHub only creates embeds from "GitHub"

torpid grotto
sleek steppe
#

Hello, I'm looking at bot#2107, it looks good to me, but would it be better include moderators in the interaction check since we do this for pagination and deletion emojis, or leave it as-is?

dusky shoreBOT
hoary haven
#

(WAHHH the gh cli tool is so cool)

hoary haven
#

i think that'd be nice. on occasion i've pushed other mods' buttons on a help embed they've invoked

#

i think we might expect the same behavior across all

sleek steppe
#

cool cool. cc @torpid grotto

hoary haven
#

it might even be necessary, if there are users for whatever reason spamming large embeds in python-general.. unless the trash can emoji still checks

torpid grotto
stable mountainBOT
#

bot/constants.py line 711

STAFF_ROLES = Guild.staff_roles```
hoary haven
#

i think the one above it is the moderation role

torpid grotto
#

Alright I'll do the moderation roles one

hoary haven
#

(if that's what the current behavior is for other things @sleek steppe?)

sleek steppe
#

yeah πŸ‘

hoary haven
#

@placid ermine can you test smth like this

#

this is the resulting log

#

is that right though? it appears to tell me that the mute has failed bc the time is in the past, nothing appears in the modlog, the user doesn't get the muted role. but i still have to unmute them to remute them correctly

#

this is bot#2039

dusky shoreBOT
hoary haven
#

the infraction ID also still gets incremented

placid ermine
#

interesting

#

oh.

#

so
i put my check inside the apply_infraction function
but the bot posts the infraction to the db before that function is called

#

hmm although

#

@hoary haven i think this doesnt happen for infraction edits, could you confirm that

hoary haven
#

like will it let me edit a "failed" mute to end in the future?

#

probably?

#

before this the most recent infrac was 34

placid ermine
#

mm good catch btw

hoary haven
#

thank you :D not that we ever use iso lmao

#

i tried editing a valid existing mute to a date in the past, and it failed (as it should), and the original mute duration seems to hold (as it should)

placid ermine
#

okay i think ill need to put the checks for mute, ban and voice_mute individually

#

because all the commands seem to post the infraction to the api before calling apply_infraction

#

wait

hoary haven
#

or maybe revert the PR to just disallowing infraction edits into the past?

placid ermine
#

huhhh

#

ohhh

#

fuck

#

i see whats wrong

#

so the flow goes something like

  1. post infraction to site api
  2. try to apply infraction by adding role/kicking/banning etc
  3. if this fails, delete infraction from api
    my mistake was returning immediately upon finding the duration is in the past, and thus not executing step 3
hoary haven
#

that sounds right to me..

#

yeah, bc i can use !ban with dates in the past and it shows up in the infraction search despite the user not actually being banned

placid ermine
#

okay so trying to apply the check between (1) and (2), skipping (2) and doing (3) is going to become pretty messy

hoary haven
#

maybe check with a core dev.. bc the portion of the code change that actually disallows editing infractions into the past works fine right?

placid ermine
#

yeah edits work fine

hoary haven
#

the part of disallowing past-date expirations to start with might be better in a separate issue < is what i'm unsure about

placid ermine
#

applying doesnt

#

okay

#

ill revert that commit

#

(maybe)

fallen patrol
#

thonk this seems new

#

NVM DO NOT USE THAT

#

github why

#

they don't use their key to sign those commits when you rebase on github πŸ₯²

tawdry vapor
#

This is a problem with rebasing through the site in general.

#

Including merging a PR via a rebase.

fallen patrol
#

I was all ready to not actually start my editor and use that.... indeed, its not possible

tawdry vapor
#

The other problem with online rebases is that it changes the committer date to the current time, so all commits appear to have happened at the same time (cause the web UI uses the committer date rather than the author date).

fallen patrol
#

;-;

#

I mean, given this particular project the screenshot is from uses squash only, its probably fine

obsidian patio
dusky shoreBOT
cold island
placid ermine
#

interesting

cold island
#

If you don't want to apply it to all ISOs, you can inherit from the ISO converter and add the check after the super call

#

like FutureISODatetime or something

placid ermine
cold island
#

And Expiry naturally needs to use it instead

stable mountainBOT
#

bot/converters.py line 349

async def convert(self, ctx: Context, duration: str) -> datetime:```
placid ermine
#

wait wrong line

stable mountainBOT
#

bot/converters.py line 351

Converts a `​duration`​ string to a datetime object that's `​duration`​ in the future.```
cold island
#

Of Duration yes

#

Not ISODateTime

#

Expiry is a Union of the two

placid ermine
#

hmm

vale ibex
#

Does the bot use the convertor on startup when pulling infractions to schedule?

#

or does it just use the raw json from site?

placid ermine
#

we dont need a check there do we? a bad duration shouldnt make it to the db

vale ibex
#

It's a valid use case that on start up an infraction would be in the past

#

if it expired while the bot was down

placid ermine
#

hmm πŸ€”

cold island
#

I don't think it uses the converter

vale ibex
cold island
#

At least from what I recall when converting everything to TZ aware

vale ibex
#

I can't imagine it would, since we'd need to call convert manually

cold island
#

yeah I think I just made it use arrow.get

vale ibex
#

πŸ‘Œ

placid ermine
#

so i inherit ISODateTime, call super().convert in this convert, and raise an exception if its in the past?

placid ermine
#

πŸ‘

cold island
#

And change Expiry to use it instead

placid ermine
#

right

#

and do i need to add anything in the error handler or smthn

cold island
#

Nope, it handles BadArgument already

placid ermine
#

cool cool

green oriole
#

Make sure you raise BadArgument and not any built-in exception

placid ermine
#

yeah noted

#

uhh

#

instead of sending an error message

#

if the conversion to datetime raises the exception it changes the reason to be the string

green oriole
#

Oh that's interesting

#

It is because of the function signature

cold island
#

yeah the next arg is a str

green oriole
#

Yeah then you probably want to check it inside the command itself

#

There is probablyyyyy a way around it

#

But I personally don't think that's a good idea, although we shall ask mister zebra right there

cold island
#

well what's the workaround

placid ermine
#

does it do this for all exceptions or just BadArgument

cold island
#

I think for all Discord errors?

#

not sure

#

hmm

#

Ok so

#

The issue is that the date arg is optional

#

So it does fix it for warns, mutes, etc.

#

It doesn't fix it for bans, edits, appends, instead causing unexpected behavior

placid ermine
#

ig i could make a decorator which checks that the date arg is not in the past?

cold island
#

That could work yeah

green oriole
placid ermine
#

decorator works

placid ermine
#

@hoary haven should be fixed now btw

hoary haven
#

cool
one thing i noticed yesterday is that sometimes running !infr search would work and other times it wouldn't
2022-03-01 09:37:22 | bot.exts.backend.error_handler | DEBUG | Command infraction search invoked by mina✯✩✯#0001 with error CheckFailure: The check functions for command infraction search failed.
any idea why?

vale ibex
#

Did you run it in a non-mod channel?

hoary haven
#

yes. yes i did lol

#

time to add 🟠 emoji to category names

torpid grotto
#

Is anyone able to review bot#2107

dusky shoreBOT
brisk brook
#

I was planning to do so later today when I get home (in an hour) πŸ’―

#

The code looks good, just needs testing

torpid grotto
#

So far I've tested with roles, without and with other people who aren't the author of the message

gaunt cypress
#

Hi I was just wondering why don't we separate frontend from backend into different repository

thorny obsidian
gaunt cypress
#

Yep

thorny obsidian
#

Because there's no need for that with django and how we do our markdown rendering

gaunt cypress
#

Imo it will separate the jobs better

#

But ok I guess thanks

thorny obsidian
gritty wind
#

Site backend is mostly already separated anyway

#

It’s almost entirely in the API folder

#

I say almost entirely because of a couple other apps which are technically backend, but nothing backend beside the api has been worked on in years

#

That’s just admin and mod logs

sleek steppe
#

@torpid grotto bot#2104 has been merged. Thanks for the PR!

dusky shoreBOT
sleek steppe
#

bot#2107 *

dusky shoreBOT
torpid grotto
cold island
#

Why are we running actions on drafts πŸ€”

brazen charm
#

why not?

cold island
#

Well, they're drafts. I'm pushing commits without expecting them to succeed

brazen charm
#

test can be useful for others, along with the previews

#

and it's free

cold island
#

true, I guess I'm a little annoyed by the emails πŸ˜…

tawdry vapor
#

It's possible to disable notifications for actions

#

I don't see why one would want notifications for that generally

#

Maybe if the actions take hours

gritty wind
#

I don’t remember if there’s a setting for it or not (there almost definitely is), but you can filter your incoming emails for a CC to ci_activity@noreply.github.com and never see another ever again

dusky shoreBOT
molten perch
#

I believe so, yes.

dim pelican
#

@surreal veldt , @austere hornet when the command is called without a sub-command, it attempts to directly convert the string using PIL's ImageColor.getrgb(). It then sets the name based on converting the rgb value to hex, and then looking up the hex value from the referenced color list. This could be a case where the fuzzy matching has a score of at least 80, and "matches" the hex value #008000 to Black. Using .color name green works as intended

surreal veldt
#

so what's needed would be adjusting the fuzzy matching?

dim pelican
#

Yes, but that would run the risk of then not matching other inputs that are correct

austere hornet
last patio
#

site will no longer produce any warnings while running tests! Thanks to @tawdry vapor and @crude gyro for reviews. If everything is green, running tests locally will now look like this:

crude gyro
#

nice work @last patio, that's much cleaner

hoary haven
#

what did it look like before?

crude gyro
#

a deluge of irrelevant warnings and logging

tawdry vapor
#

that's a nice word lemon

#

can I save it?

crude gyro
#

you save what you need, Mark my good friend

tawdry vapor
#

thanks!

crude gyro
#

(also I don't know what that means, how do you save someone's word)

tawdry vapor
#

haha

dim pelican
#

Delugeℒ️ copyrighted by: lemon

vale ibex
tawdry vapor
#

@last patio what did you think of my proposals in the Poetry commands issue? I am keen on the last one, which makes manage.py a Poetry script and removes the taskipy stuff

last patio
#

no problem

last patio
#

so no way around collectstatic

tawdry vapor
#

Do you not see the value our custom one provides to new contributors?

#

Setting up an admin account, API key, etc

#

In any case that seems orthogonal to this issue

last patio
tawdry vapor
#

This revelation does not bode well for your project lead position

last patio
#

Thanks Mark

#

I think manage.py tasks are a nice idea though. Removing dependencies is always good

austere hornet
#

I like the DevOps role icon!

clever wraith
#

Pydis is moving to Amazon lambda

austere hornet
#

Ic

tawdry vapor
clever wraith
austere hornet
#

Ah haha

#

Yeah ik

last patio
#

I know Mark, you too!!

#

I think site is on a really good path right now. It's getting really good to contribute

#

@tawdry vapor do you want to take a look at that issue then?

tawdry vapor
#

It does seem like a quick issue but I don't feel comfortable making a commitment right now cause I have a busy week.

last patio
#

no worries!

thorny spade
#

@dim pelican i want a re-review for python-discord/sir-lancebot#1041

dusky shoreBOT
dim pelican
#

Its all good, was just asking the question lol
Would having the default set in the function eliminate the need for a constant?

#

Ah I see the diff now

#

Looks good to me

thorny spade
#

wait

#

@dim pelican

#

WE CANT DO THAT

dim pelican
#

Hmmm?

#

How so

stable mountainBOT
#

bot/exts/core/internal_eval/_internal_eval.py line 113

output = self.shorten_output(output)```
thorny spade
#

this use shorten_output

#

if 99980 is the default

#

then shorten_output will be truncated to 99980 character

#

but the limit of sending message on discord is 1980 character

#

oh no

#

should i revert them

#

@dim pelican still here?

dim pelican
#

Yeah just reading

thorny spade
#

for example

#

!e

for x in range(20000):
  print("a")
#

yeah

#

it say truncated

dim pelican
#

If the output is over 1980, it calls _upload_output, and the output is shortened according to the max_length. The upload would then save all of the characters up to 99980

#

And have that as a link

thorny spade
#

ah ic

#

ok~

dim pelican
#

But now I want to test it again lol

thorny spade
#

lol

dim pelican
#

Yeah.....

#

About that suggestion I made....

#

It was a bad one

#

Your original implementation works the way it should

#

I'm sorry about that

dim pelican
thorny spade
#

np

dim pelican
#

Oh it hurts so good

thorny spade
dim pelican
#

Just that I made a bad suggestion, no worries

thorny spade
#

@dim pelican i want a re-review

dim pelican
thorny spade
clever wraith
#

@vale ibex being popular

#

I have no idea why you are showing there, there is nothing else pydis related underneath that

#

why make a simple markdown when you can have a pdf

clever wraith
#

oh new toy btw

vale ibex
cold island
gritty wind
#

If I had to pick a face for devops, we could certainly do a lot worse than chris lemon_hyperpleased

cold island
#

I don't know about that, that's a pretty ugly face

gritty wind
#

This is just what he looks like before shaving in the morning

#

His face smoothens out significantly

patent pivot
#

just better lol

clever wraith
#

Not latex

#

Very sadge

patent pivot
#

org compiles to tex

clever wraith
#

That sounds like cheating

#

But that's decent cheating

#

:P

exotic ember
#

anyone run into

Installing dependencies from lock file

  RuntimeError

  [BUG]  bot-core (1.2.0) is not satisfied.

  at /usr/lib/python3.10/site-packages/poetry/mixology/partial_solution.py:200 in satisfier
      196β”‚             # As soon as we have enough assignments to satisfy term, return them.
      197β”‚             if assigned_term.satisfies(term):
      198β”‚                 return assignment
      199β”‚
    β†’ 200β”‚         raise RuntimeError("[BUG] {} is not satisfied.".format(term))
      201β”‚
      202β”‚     def satisfies(self, term):  # type: (Term) -> bool
      203β”‚         return self.relation(term) == SetRelation.SUBSET
      204β”‚

this when running poetry install in the bot repo?

patent pivot
clever wraith
#

fair

dim pelican
exotic ember
hoary haven
#

i just did a fresh new pull of the bot and was able to poetry install everything fine

exotic ember
#

:thonk:

vale ibex
#

Are you on an old version of poetry?

#

One that might not support installing from url?

#

No idea when that was added

exotic ember
#

Poetry version 1.1.13 should be the latest version

#

anyways I only needed local dependencies for LSP to work so I removed bot-core from poetry, did poetry install then pipped bot-core again

vale ibex
#

How odd though

vale ibex
#

what branch are you working on?

exotic ember
exotic ember