#dev-contrib

1 messages ยท Page 140 of 1

static canyon
#

@steady junco ^

brisk brook
#

Isn't that useless unless you have server to follow messages into?

static canyon
#

I guess

#

I use it in a number of servers just to get the announcements I'm interested in without notifications of other messages

steady junco
#

Ya bro Ik about following announcement channel Thanks a lot ๐Ÿ˜„

gritty wind
#

For notifications you can also enable all messages in announcement channels, but I canโ€™t remember how it works for mobile push notifs

#

Iโ€™ve been on DnD for months

#

If someone has an android, can they confirm whether this link works

static canyon
#

The above one's don't, but that does

#

So I guess adding a / fixes it

cold moon
static canyon
#

Wait nvm it doesn't work lol

steady junco
#

Should I try to confirm

static canyon
# cold moon

Formats correctly on discord but gives this page when you open it

steady junco
#

I can easily open it

clever wraith
steady junco
#

But I can open it huh

#

I can open it then what's the problem

#

I am on Android

gritty wind
#

Now, thatโ€™s extremely stupid :)

#

Alright thanks yโ€™all

clever wraith
#

@gritty wind remove the slash and it works

gritty wind
#

It breaks without it, see above

clever wraith
#

The fuck

gritty wind
#

Thatโ€™s discord android for ya

#

Tbf the one with the slash is broken on iOS too

clever wraith
#

Wait, just read dev announcements, does this mean @viscid badge is getting the boot?

brisk brook
thorny obsidian
clever wraith
#

Ah

gritty wind
#

Ah

thorny obsidian
#

So you can actually use metricity for features if you do

vale ibex
#

Yea ๐Ÿ˜„ and also means you don't need to manually run some SQL to work with anything related to metricity in dev

#

EG voice verification would error previously, since metricity relations just didn't exist

steady junco
#

Can I add rock paper scissors to @dusky shore

dim pelican
#

I think it is already there

steady junco
#

And also a new tag to @stable mountain

stable mountainBOT
#
Bad argument

Unable to convert 'rps' to valid command, tag, or Cog.

steady junco
#

A new tag?

#

And Can you also tell me what the new tag should be related to

dim pelican
#

Yeah you can create an issue for the tag you have in mind, and if it gets approved you can work on making a PR for it

steady junco
#

What's PR

dim pelican
#

A Pull Request. It is for adding things to a GitHub repo that allows people to review the code you want to add

#

Ahh I used ! instead of . for the rock paper scissors

#

.src rps

dusky shoreBOT
#
Command: rps

Play the classic game of Rock Paper Scissors with your own sir-lancebot!

Source Code
steady junco
#

So it's already there

#

A guessing game ๐Ÿค”

#

There can be more games

dim pelican
#

There are quite a few games on sir-lancebot, do you want to check them out?

steady junco
#

Ya I want to but maybe later ๐Ÿ˜„

#

Let's see

dim pelican
#

Head over to #sir-lancebot-playground and type in .help . That will give you a list with a few of the things that sir-lancebot can do

steady junco
#

Okie

#

I got one idea for @dusky shore

#

Np if it's not a game idea but it's cool ๐Ÿ˜„

gritty wind
#

Feel free to share the idea, though you donโ€™t have to come up with your own idea to contribute.

You can check out our issue tracker which has a lot of issues you can take.

https://github.com/python-discord/sir-lancebot/issues

GitHub

A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development. - Issues ยท pytho...

steady junco
#

I mean something more

#

Like a good command on my own

dim pelican
#

You absolutely can, just have to fill out the issue form template with the relevant information

steady junco
gritty wind
#

Ok, so yeah you can make both. If you want to make a command for sir lance bot, you can share your idea here, or pick one of the existing ideas.

For tags, you can suggest them in #community-meta

steady junco
gritty wind
#

Thatโ€™s fine, share your idea here

steady junco
#

So my idea is that

#

I want to create a Coin flip command that will just give a random input as Head or tails

#

Ik it's simple ๐Ÿคท but still interesting or something like a role dice command

dim pelican
#

Would you believe that it exists already?

#

.src coinflip

dusky shoreBOT
#
Command: coinflip

Flips a coin.

Source Code
steady junco
#

Hmm

#

A role dice

#

.src roledice

#

Or A command that will give a joke

gritty wind
# steady junco A role dice

Sure, thatโ€™s not a bad idea. Could you create an โ€œissueโ€ on tracker?

That way we can assign you, and know whoโ€™s working on what.

steady junco
#

Ya I will do it

#

Ok I will don't have time rn ๐Ÿ˜„

#

Tomorrow maybe

#

Thanks ๐Ÿ˜Š

thorny obsidian
#

We already have a dice roll command

#

.roll 4

dusky shoreBOT
clever wraith
#

site#594 could use reviews! I've got some changes to make so make sure you look at bluenixes review first please

dusky shoreBOT
thorny obsidian
clever wraith
#

Ready for review but I haven't done what bluenix has asked in his review yet

molten perch
#

Hey, api#17 could also use some reviews. The models were generated based on the current schema, so it needs a lot of thorough reviews to spot possible mistakes. ๐Ÿ˜„
(It's quite an easy PR to review, regardless ๐Ÿ˜ )

clever wraith
#

Man whoever made .reverse messed up, can't even reverse aibohphobia \s

static canyon
#

Okay ๐Ÿ‘

static canyon
#

!remind 15h ^

stable mountainBOT
#
Affirmative!

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

fallen patrol
#

WOW

#

@celest charm @tawdry vapor apparently, pip install . will install the bot just fine

#

so poetry isn't even needed for the dockerfile

#

nor is a requirements.txt file needed

#

the only problem that there is with that situation that its not easily possible to install the dependencies before copying over the source code

#

which can be extremely annoying for any developer

#

the way I am attempting to get around that, is to copy the minimally required dependencies into the container

#

installing it, copying the rest, and installing it again

#

although what I will probably do is the requirements.txt thing lol

static canyon
#

@thorny obsidian RE sir-lancebot#861 would it be better to just remove the hacktoberfest cog completely if we're no longer going to participate in it?

thorny obsidian
#

No, people did put work into the cog and there's no reason to remove it. It's still useful outside of this server's participation in hacktoberfest

static canyon
#
@commands.group()
async def hacktoberfest(self, ctx: Context):
    """Group which contains the `timeleft` subcommand."""
    pass

@hacktoberfest.command()
async def timeleft(self, ctx: Context):
    ...```is the kind of thing you were envisioning? @thorny obsidian
#

Or did we want to change this around and have everything under hacktoberfest like so?```py
@commands.group()
async def hacktoberfest(self, ctx: Context):
...

@hacktoberfest.command()
async def timeleft(...):
...

@hacktoberfest.group(...)
async def stats(...):
...

@stats.command()
async def link_user(...):
...

...

@hacktoberfest.group(...)
async def issues(...):
...```

#

If you can even have nested subcommands like that in dpy (I believe you can)

#

That's gonna be rather big for one file but I guess it could still be organised into multiple files if we import stuff (perhaps that's bad though)

tawdry vapor
fallen patrol
#

!pep 517

stable mountainBOT
#
**PEP 517 - A build-system independent format for source trees**
Status

Final

Created

30-Sep-2015

Type

Standards Track

fallen patrol
#

๐Ÿ˜›

#

I think so

#

what happens is pip installs poetry-core as a build dependency before installing the project

#

!pypi poetry-core

stable mountainBOT
fallen patrol
#

that's what this is

#
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
#

In order to improve the above situation, poetry-core was created. Shared functionality pertaining to PEP 517 build backends, including reading lock file, pyproject.toml and building wheel/sdist, were implemented in this package. This makes PEP 517 builds extremely fast for Poetry managed packages.

austere hornet
#

That's not a bad idea, imo! You should open an issue about it on Sir Lancebot!

fallen patrol
#

now, the problem is this:

# Copy the source code in
COPY . .

# install the full package
RUN pip install . 
#

it is not possible to install the package without the source files already being copied

#

trying to install with just poetry.lock and pyproject.toml results in some issues

#

lemme uh

#

oof

#

that's going to be a bit harder to add , given that support for all user provided images was removed

#

I would still make an issue, but given that, it may be rejected, since it repeats a user's content

fallen patrol
# fallen patrol lemme uh

this is the issue I get when using the below in my dockerfile:
ValueError: /modmail/modmail does not contain any element
file:

# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./

# Install dependencies and project
RUN pip install . --use-feature=in-tree-build

# Copy the source code in last to optimize rebuilding the image
COPY . .
austere hornet
fallen patrol
#

That's because the build system expects a library at modmail/modmail, but the source code wasn't copied yet

brisk brook
fallen patrol
#

they only work on the user themselves

#

chris wrote that refactoring

brisk brook
#

Yeah and .rotate <image/message/attachment> would make someone quite clearly aware of it no?

fallen patrol
#

like i said, i would still make the issue

brisk brook
#

Oh yeah for sure, that goes for anything added.

fallen patrol
#

and then we can discuss it there where its on the record

green oriole
#

Only profile pictures please, no attachments

#

We don't trust users enough to process and random images

brisk brook
#

May I ask the difference? Someone could still easily upload rule-breaking images as their profile pictures

thorny obsidian
#

Having the bot parrot back an arbitrary image is quite different from setting it as your profile picture

#

Profile picture changes are also heavily ratelimited

fallen patrol
#

and spam prevention

green oriole
#

beside, other communities and Discord T&S are also moderating profile pictures

fallen patrol
#

!remind 11M continue pep 517 discussion

stable mountainBOT
#
I got you.

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

brisk brook
thorny obsidian
#

We don't have any good way to moderate arbitrary images posted and we don't really want the bot to parrot back something offensive when it could be missed by the mod team

fallen patrol
#

however, i do agree that the command itself is useful

brisk brook
#

Can't we force some guidelines on it though?

fallen patrol
#

like, its a nice concept

#

but maybe its not useful here, and would be easier to rotate an image manually

thorny obsidian
brisk brook
#

Like only being involved in the same channel and some X messages?

thorny obsidian
#

Or just... have the person you're trying to help not post a screenshot of the code?

brisk brook
#

That way, if another user uploads some rule-breaking content and it is found by the moderation team that means that the bot's parrot will also easily be seen.

green oriole
#

I mean at this point you may as well be clicking the rotate button on your device gallery

fallen patrol
thorny obsidian
thorny obsidian
green oriole
#

My biggest worry would be CSAM because we would download the image

fallen patrol
#

@thorny obsidian this is the proposed use, I don't see anything about code screenshots?

#

that is also not code, so I'm not sure where you got that idea from, kutiekatj9

thorny obsidian
brisk brook
fallen patrol
#

wut

#

argh no my clipboard got cleared

green oriole
#

Do you just want to use pydis as a service to rotate random icons then? lemon_raised_eyebrow

#

The use case seems to be exactly what @thorny obsidian just mentioned

stable mountainBOT
green oriole
#

Either way, yeah, we won't be implementing it. Sorry, but it is without user input or nothing.

fallen patrol
# fallen patrol this is the issue I get when using the below in my dockerfile: ```ValueError: /m...

a solution I've come across for this is to copy the modmail/__init__.py and required README.md file since they're required for build here: https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L8
https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L13

I would like to point out that while I am not actually referencing a pydis project in these code snippets, the function is exactly the same.

stable mountainBOT
#

pyproject.toml line 8

readme = "README.md"```
`pyproject.toml` line 13
```toml
packages = [{ include = "modmail" }]```
fallen patrol
#

that ends up looking something like this:

# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./

COPY modmail/__init__.py ./modmail/
COPY README.md .

# Install dependencies and project
RUN pip install . --use-feature=in-tree-build

# Copy the source code in last to optimize rebuilding the image
COPY . .

# install the full package
RUN pip install . --no-deps --force
#

while its not best, this means that it will install all of the dependencies, then install the code

brisk brook
#

What is this important?

fallen patrol
vocal prairie
#

If the current implementation is such a problem, why not just use Poetry's custom installer? Or one of the other alternative installation methods?

#

Or just add poetry as a dependency

fallen patrol
#

So...
there's several different solutions here. One way is to use requirements.txt

  • export deps # as ci or in docker

this means either maintaining a generated requirements.txt file or creating it every docker container

then we can just pip install -r requirements.txt and then copy the source files over.

the other way is to just do pip install .
However, this comes with a major drawback, the dependencies will be installed every time the docker container is created since the source code has to be copied before running pip install .

vocal prairie
#

Don't both of those methods ignore the concept of a lockfile?

fallen patrol
trail pilot
#

@brisk brook what do you think of this for disabling insteadof just editing it out?

brisk brook
#

I think that is what I am talking about yeah

trail pilot
#

alright, it's pushed

brisk brook
#

This is when you disable them correct?

trail pilot
#

Yep

fallen patrol
#

Tbh should the kata button be disabled?

#

It's a link, I don't see a reason to turn off a link

trail pilot
#

Don't we need to disable the whole view after 3 minutes though?

fallen patrol
#

Links are different :P

trail pilot
#

ah wait a link button is not aninteraction

fallen patrol
#

Links are never sent to the bot

#

Ye

brisk brook
fallen patrol
#

Ah, ok

brisk brook
#

I would maybe look weird if some buttons were disabled but not others

fallen patrol
#

IMO removing any way to click a link is worse than the wonkiness of one button enabled and the rest disabled

#

Buuut it's in the title so

static canyon
#

@brisk brook RE running sir-lancebot on v2.0, I get open C:\Users\tizzy\sir-lancebot\.env: The system cannot find the file specified. each time I try to rebuild

#

Same error for running, although I did find a way around that but then get an error because the dpy version used is 1.7.x and so Thread stuff stops execution

#

I suppose thinking about it, I should try with just an empty .env

green oriole
#

yes, you need one

brisk brook
#

Yeah I've heard about that

static canyon
#
C:\Users\tizzy\sir-lancebot>docker-compose run sir-lancebot
[+] Running 7/7
...                                                                              
Error response from daemon: driver failed programming external connectivity on endpoint sir-lancebot_redis_1 (20d06b00d3db2f0d3c3b95ee8d4d75b9af7270b248cb8fbe3dc8cb9bc9839320): Bind for 127.0.0.1:6379 failed: port is already allocated```new one now
#

Same for docker-compose up

#

@brisk brook @green oriole ^

brisk brook
#

๐Ÿค”

green oriole
#

you have redis already running

#

maybe another project

static canyon
#

How though?

#

Literally nothing is running python wise

#

Only thing is docker

green oriole
#

docker ps?

static canyon
green oriole
#

well you have the bot running

#

for like 10 days

static canyon
#

wtf how ๐Ÿค”

#

My discord bot is very much offline

green oriole
#

you never docker-compose down

static canyon
#

huh

green oriole
#

actually the bot isn't running

#

just the other sidecar services

static canyon
#

Right, let's try again

#

How do I configure my bot token again?

#

Hopefully the same as with bot

stable mountainBOT
#
Alright.

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

static canyon
fallen patrol
#

since it all got split up I'm reposting this so all of the information is together

#

14:05] arl: @ fix error#1642 @ Mark#3118 โ™ฆ๏ธ apparently, pip install . will install the bot just fine
[14:05] arl: so poetry isn't even needed for the dockerfile
[14:05] arl: nor is a requirements.txt file needed
[14:07] arl: the only problem that there is with that situation that its not easily possible to install the dependencies before copying over the source code
[14:11] arl: which can be extremely annoying for any developer
[14:11] arl: the way I am attempting to get around that, is to copy the minimally required dependencies into the container
[14:12] arl: installing it, copying the rest, and installing it again
[14:12] arl: although what I will probably do is the requirements.txt thing lol
[16:16] Mark โ™ฆ๏ธ: I doubt pip supports Poetry's custom lockfile format. And the lockfile is the main point of using Poetry. Do you really mean that it can install all locked dependencies?
16:18] arl: what happens is pip installs poetry-core as a build dependency before installing the project

#

!pypi poetry-core

stable mountainBOT
fallen patrol
#

This snippet from pyproject.toml is the pep517 backend which is supported by the above.

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

As mentioned in the above package's readme:

In order to improve the above situation, poetry-core was created. Shared functionality pertaining to PEP 517 build backends, including reading lock file, pyproject.toml and building wheel/sdist, were implemented in this package. This makes PEP 517 builds extremely fast for Poetry managed packages.

now, the problem is the best way to install

This is not possible:

# Copy requirements so they can be installed
COPY pyproject.toml poetry.lock ./

# Install dependencies and project
RUN pip install . --use-feature=in-tree-build

# Copy the source code in last to optimize rebuilding the image
COPY . .

it is not possible to install the package without the source files already being copied

Running the above in a dockerfile results in this error:
ValueError: /modmail/modmail does not contain any element

This dockerfile is intentional to not have to reinstall all dependencies when any code is edited. If so, docker development would not be too feasible.

However, there's a few solutions I've discovered for how to not have to reinstall all packages.
Solution A: double install
A solution I've come across for this is to copy the modmail/__init__.py and required README.md file since they're required for build here: https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L8
https://github.com/discord-modmail/modmail/blob/b5ab21fd373fa19405811e17f11951234b775e97/pyproject.toml#L13
Then installing the library, copying the source code, and then installing the code again with pip, but with the --no-deps flag since we've already installed the dependencies.

Solution B: requirements.txt
Either by maintaining an autogenerated requirements.txt file checked in to the repo by poetry export or by generating a requirements.txt file by copying the necessary files of poetry.lock and pyproject.toml in the container and then running pip install -r requirements.txt

Either way, we have a requirements.txt file in the docker container, and it gets installed before the source code is copied.

Note, I know these examples are from my bot, but the same concepts and snippets apply to pydis and the dockerfiles for pydis

stable mountainBOT
#

pyproject.toml line 8

readme = "README.md"```
`pyproject.toml` line 13
```toml
packages = [{ include = "modmail" }]```
fallen patrol
#

This is an entire summary of everything I brought up earlier, but there is some additional information which is the two possible solutions

fallen patrol
#

subjective opinion:
Update: For my own project, I've opted to go with an autogenerated requirements.txt file checked in to the repository with a manual pre-commit hook ran by default on github actions only, manual locally but with a taskipy shortcut task. This ensures that the requirements.txt file will always be up to date, but won't run on every commit with an edited pyproject.toml file since locking can take some time, and isn't super fast. If pydis chooses to go this same route, I can share the hook code that I'll be writing to check if the requirements.txt file is changed ๐Ÿ˜›

#

However, I am choosing solution b for my own project since I require a requirements.txt file for a different purpose

#

I actually favour solution A

dim pelican
#

Hey all, in regards to sir-lancebot#859 I am trying to use asyncio to create a scheduled task. For debug and testing I have it set to 1 minute, but I keep getting this error:

sir-lancebot  | 09/28/21 03:34:31 - bot.exts.utilities.wtf_python DEBUG: self.last_fetched = datetime.datetime(2021, 9, 28, 3, 34, 31, 572890)
sir-lancebot  | Traceback (most recent call last):
sir-lancebot  |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 672, in _load_from_module_spec
sir-lancebot  |     setup(self)
sir-lancebot  |   File "/bot/bot/exts/utilities/wtf_python.py", line 121, in setup
sir-lancebot  |     bot.add_cog(WTFPython(bot))
sir-lancebot  |   File "/bot/bot/exts/utilities/wtf_python.py", line 46, in __init__
sir-lancebot  |     asyncio.create_task(self.fetch_readme())
sir-lancebot  |   File "/usr/local/lib/python3.9/asyncio/tasks.py", line 360, in create_task
sir-lancebot  |     loop = events.get_running_loop()
sir-lancebot  | RuntimeError: no running event loop
dusky shoreBOT
dim pelican
#
sir-lancebot  | The above exception was the direct cause of the following exception:
sir-lancebot  |
sir-lancebot  | Traceback (most recent call last):
sir-lancebot  |   File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
sir-lancebot  |     return _run_code(code, main_globals, None,
sir-lancebot  |   File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
sir-lancebot  |     exec(code, run_globals)
sir-lancebot  |   File "/bot/bot/__main__.py", line 31, in <module>
sir-lancebot  |     bot.load_extension(ext)
sir-lancebot  |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 732, in load_extension
sir-lancebot  |     self._load_from_module_spec(spec, name)
sir-lancebot  |   File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 677, in _load_from_module_spec
sir-lancebot  |     raise errors.ExtensionFailed(key, e) from e
sir-lancebot  | discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.utilities.wtf_python' raised an error: RuntimeError: no running event loop
sir-lancebot  | sys:1: RuntimeWarning: coroutine 'WTFPython.fetch_readme' was never awaited
#

The code in question is this code block:

...
class WTFPython(commands.Cog):
    """Cog that allows getting WTF Python entries from the WTF Python repository."""

    def __init__(self, bot: Bot):
        self.bot = bot
        self.headers: dict[str, str] = dict()
        self.last_fetched = datetime.datetime.now()
        log.debug(f"{self.last_fetched = }")

        asyncio.create_task(self.fetch_readme())

    async def fetch_readme(self) -> None:
        """Gets the content of README.md from the WTF Python Repository."""
        refresh = self.last_fetched + datetime.timedelta(minutes=README_REFRESH)

        if refresh > datetime.datetime.now() and self.headers:
            return  # cache should be up-to-date

        async with self.bot.http_session.get(f"{WTF_PYTHON_RAW_URL}README.md") as resp:
            log.trace("Fetching the latest WTF Python README.md")
            if resp.status == 200:
                raw = await resp.text()
                self.parse_readme(raw)
...
fallen patrol
#

!d discord.ext.tasks @dim pelican

#

Oh because it's greedy

#

Uh

#

Well tldr you need to use it in the cog creation

#

One minute

dim pelican
#

Down here?

def setup(bot: Bot) -> None:
    """Load the WTFPython Cog."""
    bot.add_cog(WTFPython(bot))

fallen patrol
#

I'm on mobile but uh

#

Tldr you don't use asyncio to create a task, you use the bot method

#

Or use the method decorator

dim pelican
#

Added the tasks import and the decorator:

from discord.ext import commands, tasks
...
    @tasks.loop(minutes=README_REFRESH)
    async def fetch_readme(self) -> None:
#

Now get this:

sir-lancebot  | sys:1: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
fervent sage
#

you need self.fetch_readme.start() in the __init__ function

fallen patrol
#

Aaaaand

#

In the cog_unload meth, self.... Stop()

dim pelican
#

Alright, removed the decorator and added the .start(), now getting this:

#

AttributeError: 'function' object has no attribute 'start'

#

Added the decorator back, and have this:

#
sir-lancebot  | sys:1: RuntimeWarning: coroutine 'Loop.__call__' was never awaited
fallen patrol
#

you need both

dim pelican
#
class WTFPython(commands.Cog):
    """Cog that allows getting WTF Python entries from the WTF Python repository."""

    def __init__(self, bot: Bot):
        self.bot = bot
        self.headers: dict[str, str] = dict()
        self.last_fetched = datetime.datetime.now()
        log.debug(f"{self.last_fetched = }")
        
        asyncio.create_task(self.fetch_readme())
        self.fetch_readme.start()
        
    @tasks.loop(minutes=README_REFRESH)
    async def fetch_readme(self) -> None:
fallen patrol
#
-       asyncio.create_task(self.fetch_readme())
dim pelican
#

Get rid of that?

fallen patrol
#

ye

dim pelican
#

wild shit man

fallen patrol
#

minimal example:

import asyncpg
from discord.ext import tasks, commands

class MyCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.data = []
        self.batch_update.add_exception_type(asyncpg.PostgresConnectionError)
        self.batch_update.start()

    def cog_unload(self):
        self.batch_update.cancel()

    @tasks.loop(minutes=5.0)
    async def batch_update(self):
        async with self.bot.pool.acquire() as con:
            # batch update here...
            pass
#

also yes

fallen patrol
dim pelican
fallen patrol
#

ah, lol

#

but yeah

#

you uh

dim pelican
#

I uhh, don't unload the cog anywhere lol

fallen patrol
#
    def cog_unload(self):
        self.fetch_readme.cancel()
#

you add that anyways

#

even if you don't unload it

#

that means that someone unloading the cog from the bot will not actually remove that fetch request

#

and it will forever continue until the bot is kilt

dim pelican
#

๐Ÿ‘ I have a lot to learn about this async magic

fallen patrol
dim pelican
#

Also, thanks a bunch!

fallen patrol
#

np

static canyon
green oriole
#

yeah, sure

stable mountainBOT
static canyon
# green oriole yeah, sure

Okay, that then raises the question of which method do we want to use -- difflib.get_close_matches, or rapidfuzz.process.extract?

#

Using rapidfuzz seems to need less code

green oriole
#

most probably rapidfuzzy

static canyon
green oriole
#

sounds like a good idea

static canyon
#

๐Ÿ‘Œ

#

And lastly, same PR or a different one? (currently doing sir-lancebot#884)

dusky shoreBOT
static canyon
#

I suppose a different PR since it's not related to .help anymore

green oriole
#

It's fine, I won't sue you for this

static canyon
#

๐Ÿ‘Œ

#

I'll keep it the same then

slim widget
#

What permissions would I be granting to policy bot by accepting this? I'm not 100% certain what it does or is for.

#

I just mean "act on your behalf" seems a bit broad.

green oriole
#

Well bunch of stuff but it doesn't actually use any of that

#

Act on your behalf is a catch all iirc, it will show up if one of many perm flags are set

slim widget
#

Alright ยฏ_(ใƒ„)_/ยฏ

gritty wind
#

If this is for pydis projects, I donโ€™t think you need to accept this

#

(Maybe to see the actual website, but thats just it iirc)

green oriole
#

You need it to see the website for whatever reason

sour viper
#

Hey how long before I can nag someone for re reviewing my PR ?

dim pelican
#

Depends on the someone ๐Ÿ˜‰ which one do you want a look at?

sour viper
#

Would you be interested in being the someone good sir

#

sir-lancebot#874

dim pelican
#

Sure, you can easily send a link by typing sir-lancebot#874

dusky shoreBOT
sour viper
#

I nagged Blue a couple of times, but he must be busy I guess. Last change blue requested was the anagram file was around 130k lines big with words which werent common, now the file is reduced to around 17k lines with common words, which should be easy for users to guess

#

@dim pelican Done with suggestions, glad all of them were minor nothing major

#

Apparently it fixed the end of line error which we just introduced

dim pelican
#

lol, really?

#

Just curious, do you have the pre-commit hooks installed? It should run on your commit in the command line before a push

sour viper
#

yeah i have, if i have any errors github stops me from committing

dim pelican
#

Ahh you commited from my comments

sour viper
#

Yeaaaah

#

i remember for eof errors, it would fix it by itself when pushed to github

#

is that not the case when we commit suggestions inline ?

cold island
#

The precommit is a hook installed on your computer

sour viper
#

Ah should i fix it by pulling and pushing again ?

#

brad already approved my PR, is that allowed after approval changing files ?

cold island
dim pelican
#

Oh yeah, mine is a small approval. Blue needs to approve and I think 1 or more Core Devs have to approve as well

green oriole
#

Nah, just a core dev now

cold island
#

Blue requested changes, so he does need to approve

green oriole
#

it is one contrib or helper + one core dev

#

Oh, right

#

Blue's review can be dismissed though

#

he doesn't have to approve

sour viper
#

the linting error is now resolved, im just gonna let the grownups now sort it out

clever wraith
#

site#594 is good for reviews! @brisk brook I've resolved your review

dusky shoreBOT
brisk brook
dim pelican
dusky shoreBOT
brisk brook
#

Ah

dim pelican
#

However, if you are feeling in a reviewing mood, sir-lancebot#859 should be ready-ish now

dusky shoreBOT
brisk brook
#

Yes it is! It's on my "Lab rat testy" list

#

I don't understand one thing though, you went back to the looping?

#

It's probably not the worst thing in the world to pull data like that so if tyou feel that's better then that's fine with me

dim pelican
#

I kept getting an issue with the asyncio.create_task

brisk brook
#

I thought all cogs were loaded specially exactly for this reason?

dim pelican
#

ยฏ_(ใƒ„)_/ยฏ

brazen charm
#

there's no running loop when it's in the init, you can get the loop through bot.loop and create the task on it

green oriole
#

Perfect mister @molten perch thank you very much

molten perch
#

lemon_fingerguns_shades I also updated the API(I mean the FastAPI) models ๐Ÿ˜„

static canyon
#

@green oriole how can I get print statements to work in @dusky shore whilst I'm debugging stuff?

green oriole
#

iirc you don't

#

you can use logging though

static canyon
#

Ah right

#

Fair enough

#
    raw_commands = []
    for cmd in ctx.bot.walk_commands():
        if not cmd.hidden:
            raw_commands += (cmd.name, *cmd.aliases)```why does this code lead to duplicates? (duplicates shown below)```py
{'avatareasterify': 2, 'easterify': 2, 'quiz': 2, 'leaderboard': 3, 'stop': 2, '8bitify': 2, 'reverse': 2, 'fact': 2, 'prideavatar': 2, 'avatarpride': 2, 'pridepfp': 2, 'prideprofile': 2, 'flags': 2, 'count': 2, 'c': 5, 'info': 3, 'spookyavatar': 2, 'savatar': 2, 'spookify': 2, 'about': 2, 'sub': 2, 'unsub': 2, 'lb': 2, 'reload': 2, 'r': 3, 'list': 2, 'all': 2, 'movie': 2, 'mosaic': 2, 'name': 2, 'show': 2, 's': 2, 'help': 2}```
#

This is code that's already in @dusky shore but I don't understand why there's duplicates

vale ibex
#

I'm guessing sub commands count more than once

#

and root aliases IG

static canyon
#

Hmm

#

I guess raw_commands needs to be a set then

#

So apparently the real issue is just that it doesn't consider subcommands at all

#

So in the instance of .foo bar with the alias .foo baz, foo, bar, foo and baz would get added to raw_commands (note that foo gets added for each of its subcommands)

#

When what we actually want is foo bar and foo baz to be added

#

Rewriting this now to fix the issue

#

root_aliases are the bane of my existance right now lol

fallen patrol
#

TBH @radiant merlin doesn't have that problem since it'll just load every single file in the exts folder

static canyon
fallen patrol
#

lmao

#

so

#

there may be a solution in the custom help command

static canyon
#

I'm working on the custom help command right now

#

Rewriting it because it's broken as hell

#

Not even just in the obvious way of raising a TypeError on every invocation for an invalid command, but there's a shit tonne of stuff which doesn't do what it's supposed to do (getting duplicates etc.)

fallen patrol
#

which bot?

static canyon
#

@dusky shore

#

.help asd

dusky shoreBOT
#
Query "asd" not found.
fallen patrol
#

Both help commands are completely different

static canyon
#

.help asdfd

dusky shoreBOT
#
Query "asdfd" not found.
fallen patrol
#

yeah, I made one of those issues

#

.help quote

static canyon
#

.help u

fallen patrol
#

but both help commands are so so so different

static canyon
#

that's an example where it raises an error that doesn't get handled, because it's doing dict() with 3 arguments

fallen patrol
#

the one for @stable mountain does not inherit the default help command, and the sir-lancebot one does

fallen patrol
static canyon
#

lol

#

I'm just so out of right now

#

This shit is so fking broken

fallen patrol
static canyon
#

!src help

stable mountainBOT
#
Help Command

An interactive instance for the bot help command.

Source Code
fallen patrol
#

If you are truly replacing the sir-lancebot I recommend just copying Bot if that one is good enough, and removing the tag stuff

static canyon
#

Well great, @stable mountain literally has the same fking problem

stable mountainBOT
#

bot/exts/info/help.py line 104

for command in await self.filter_commands(self.context.bot.walk_commands()):```
static canyon
#

It uses .walk_commands() as well

fallen patrol
#

except I've never seen it have the same bug

static canyon
#

It'll have duplicates, trust me

fallen patrol
#

do !help adf, pls

static canyon
fallen patrol
#

ah, but there's still another one?

static canyon
#

It's not an error, it's an issue

#

bot.walk_commands() gives the command twice when the command has root_aliases

#

Idfk why but it does

fallen patrol
#

because root_aliases are hacked in

static canyon
#

Yeah

#

But like why does that make it show as a command twice

static canyon
#

As in forpy @extensions_group.command(name="reload", aliases=("r",), root_aliases=("reload",)) async def reload_command(self, ctx: Context, *extensions: Extension) -> None:doing list(lambda x: x.qualified_name, bot.walk_commands())) will give ['reload', 'extensions reload', 'extensions reload']

#

The extensions reload comes twice

#

And idfk why

#

I got to go eat dinner now, and honestly I need the break :p

static canyon
#

Hmm

#

Idk actually

#

I'll have to look more closely into the root_aliases implementation

#

It depends on how the new commands.Command is made

#
        for alias in getattr(command, "root_aliases", ()):
            if alias in self.all_commands:
                raise commands.CommandRegistrationError(alias, alias_conflict=True)

            self.all_commands[alias] = command```called it. We need to change the `command`'s `parent` before adding to `all_commands`
#

eh, that breaks shit so nvm rofl

#

It's right, but also wrong

#

Dpy doesn't let have you a sharing alias and command, even if it means .x vs .something x

#

It thinks the two are the same command

dim pelican
#

Oh no, my suggestion broke the anagram

brisk brook
#

Don't worry about it, that's why we test

sour viper
#

@brisk brook I fixed the seconds causing issue, shouldve tested it on my end first then committed

clever wraith
#

@brisk brook resolved

clever wraith
#

please review sir-lancebot#849

dusky shoreBOT
dim pelican
clever wraith
#

Excuse me?

#

It doesn't explain why you out of context sent the message "grub hub butt" here

#

Stop spamming here please

#

This channel is just for conversation of python discord projects

#

So please stop

#

<@&831776746206265384> not sure about this one

obtuse arrow
#

!pban 892453482815193139 Seems like you're just here to spam nonsense. We don't need that in this community.

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied purge ban to @daring tide permanently.

clever wraith
#

Sorry about the ping

dim pelican
#

That was a good ping Kron

austere hornet
static canyon
#

We get like 50+ daily pings anyway

clever wraith
#

Lol

#

Ty

static canyon
#

Including 5 within 2mins at times lol

#

Our filters also produce loads

#

So yeah, no need to worry about pinging us. If you're not sure, ping us and we can let you know whether it was appropriate for future reference ๐Ÿ‘Œ

molten perch
#

Hey! Could someone take a look at sir-lancebot#857 and api#17 ? I'd appreciate it! ๐Ÿ˜„

fallen patrol
#

That seems a little low...

static canyon
vale ibex
#

Any chance someone could give modmail-plugins#6 a once over, would like to get this merged, so I can rebase my other feature branches onto it without having PR dependancies

dusky shoreBOT
brisk brook
#

There seems to be line ending changes?

vale ibex
#

Yea, since I added the lint it fixed them all

#

there was also a bunch of whitespace too

dim pelican
#

That's pretty neat

mellow hare
#

Wait, hold on

stable mountainBOT
#

bot/utils/scheduling.py line 47

assert inspect.getcoroutinestate(coroutine) == "CORO_CREATED", msg```
mellow hare
#

It's the only instance in the bot production code that we have it

#

Everywhere else is in test

brazen charm
#

check the blame? I'd assume it's something to catch the coro already beaing awaited during development and shouldn't be reachable in prod

mellow hare
#

Still bizarre to see it in prod. I've always assumed that assert isn't suitable for it

#

@tawdry vapor why

green oriole
#

I'd say that's a decent use of assert right there

#

Should do more of those

mellow hare
#

Fair enough

green oriole
#

@mellow hare oh also I just saw the issue, we will need a site issue too to add the new voicemute type and add a custom migration to change all the current voice bans to voice mutes. Feel like writing it? I can do it before the end of the week otherwiiiise

slim widget
#

The idea is to make the code fail closer to where the problem occurred.

#

But an assert should never be used to implement an interface, and it shouldn't have any side-effects (aside from unavoidable ones like CPU usage).

slim widget
fallen patrol
#

approving reviews are @vale ibex and @vocal wolf

gritty wind
#

Branch is outta date

brisk brook
#

The worst of bugs would be solved with asserts.

fervent sage
#

asserts are for when I know that something is impossible but i need to convince the type checker KEKW

#

such as things in bot subclasses potentially being None because the thing that sets them to something runs in an override of async def start()

mellow hare
#

Well neat, I'm glad I learned about the assert thing

trail pilot
#

sir-lancebot#860 would anyone want to test this PR out? if so, thanks!

dusky shoreBOT
fallen patrol
# mellow hare <@!137073073168973824> why

Because the O compiler flag (optimization) removes assert statements.
Its better to use an if statement which raises an assertionerror if the assertion is needed in prod

#

Yes ik I'm not Mark but it's still the answer ๐Ÿ‘€

#

iirc S100 complains about them

#

S101

tawdry vapor
#

I think I used an assertion because it's more of a programming error than a runtime error. Not sure if I totally agree with that still but assertions vs. exceptions kinda has a blurry line.

fallen patrol
#

else, its fine to use an assert

thorn ibex
#

It is AMAZINGLY detailed for a free book (PDF)

#

(I didn't write it, so I'm not really self-advertising)

#

From their website:

dim pelican
#

Looks pretty cool to me! Would the target audience be any one and everyone or could it be broken down to beginner/intermediate/advanced?

With 200 chapters I can see this being a bit tricky to find what you need

#

Especially if you don't know what you don't know

thorn ibex
#

Ah yes

#

It's a PDF

#

with Bookmarked contents

dim pelican
#

Very cool ๐Ÿ˜Ž

thorn ibex
#

And this is an extract, detailing what kind of language it uses

steel isle
#

this is amazing!

#

again, my shift key is broken -_-

#

yes

thorn ibex
#

I mean, I would definitely recommend checking it out yourself first

#

before publishing it on the resources page

steel isle
#

looks cool, imma dig in

thorn ibex
#

As of now, the book's latest Python version (the version listed in the book) is Python 3.8

dim pelican
steel isle
#

all you really need to do is to make an issue

dim pelican
#

Sweet, if you hit any blocks there are usually people here to help out! And if you don't want to deal with it I'm sure someone can pick it up as well

thorn ibex
#

This one, right?

steel isle
#

yes

#

that one

#

create a new issue

thorn ibex
#

Ah, I see it now

#

Resource Suggestion

steel isle
#

yup

thorn ibex
#

Thanks!

steel isle
#

yw

brisk brook
dim pelican
#

Oh really? My bad Alt!

thorn ibex
#

Yup

#

Saw that message in the nick of time

#

Thanks!

brisk brook
brisk brook
thorn ibex
#

Done!!!

#

Thanks for the help, folks!

#

Also, y'all might just wanna tone down @dusky shore's sass level. This got me good

#

I can't tell if it's bugged or just roasting me

austere hornet
#

Lol

#

I'm not sure

thorn ibex
#

Nah it's not bugged

#

It was just roasting me

#

When you get burned by a bot ๐Ÿ˜ญ

dim pelican
#

That was from the .spookify command right? It supposed to act scared lol. I think there is one with bats that gets applied on a black background that you can't see every time

vale ibex
#

Yea, we should add a white border to the bat png

dim pelican
static canyon
#

Can't really view the gh page on mobile

dim pelican
static canyon
#

The logo seems a bit out of place to me

#

So I'd go for without

dim pelican
#

I burned my eyes for the sake of testing on light mode:

static canyon
#

Actually that doesn't look bad (with the logo)

#

I think the dark mode might just look bad because of my phone contrast (I'm outside atm)

dim pelican
#

You really can't see it on dark mode since it is a .png, so the background is transparent

static canyon
#

I'll have to look when I get back home

#

So a few hours

dim pelican
#

right, so if I made a .jpg image with a background color to give contrast it might look ok-ish then

static canyon
#

!remind 3h this ^

stable mountainBOT
#
ROGER THAT

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

static canyon
#

But then that might make it look weird on light mode

dim pelican
#

If I do a light grey? Just enough to stick out on both

static canyon
brisk brook
#

You can't really make out the logo

#

I thought the .jpg work-around was a nice solution

dim pelican
#

๐Ÿ˜… definitely didn't try and fail to get a local .jpg to attach to an embed and then make the suggestion to not have an image

brisk brook
#

Just send it to Discord (like in here maybe?) and use that

dim pelican
#

Oh as the url? I was thinking of including it in the resources folder, but kept getting a path error when testing locally

#

*Using the relative path of the project structure to create a discord.File object and then attaching that to embed

green oriole
#

are you running in docker ?

dim pelican
#

Yup!

green oriole
#

The cwd should be the project root

dim pelican
#

right so

LOGO_PATH = "/bot/resources/utilities/logo.jpg"

Should work when I pass to

image = discord.File(LOGO_PATH)

But it usually gets a file not found error

#

Holy shit, I had exts in the path....๐Ÿคฆ

#

!remindme 6 hours

stable mountainBOT
#
Bad argument

6 is not a valid duration string.

#
Bad argument

6 is not a valid duration string.

dim pelican
#

f

#

!remindme 6h Fix Logo Path

stable mountainBOT
#
ROGER THAT

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

green oriole
#

You want ./bot/...

dim pelican
#

Indeed, thanks Akarys!

clever wraith
#

hey guys, whats the deal with some links when editing locally redirecting to pythondiscord.local?

#

i looked at the guide and there isnt any mention of it anywhere

stable mountainBOT
static canyon
# dim pelican

This does look a lot better on my laptop than my phone, but I do think trying out the light grey should be done

clever wraith
#

@brisk brook update!

#

anyways, please review site#594

dusky shoreBOT
trail pilot
#

@brisk brook So I saw your comment on sir-lancebot#860, I'm not sure why that's happening though

dusky shoreBOT
trail pilot
#

If I had to guess, maybe the name is too long?

#

Because I'm not getting that error

brisk brook
#

This is after waiting for the components to edit

trail pilot
#

Hmm

green oriole
#

Oooh juicy components, I like this

trail pilot
#

Interesting

trail pilot
#

It works for me with just one

#

I might add a cooldown then

#

or just edit out the view entirely

brisk brook
#

I had a lot of them open

clever wraith
#

@brisk brook leftover merge conflicts removed

#

Sorry for bothering you so much lemon_sweat

trail pilot
#

I should just add a cool down for a minute

#

Or better yet would you be fine with just editing out the view entirely?

brisk brook
#

I don't understand the problem, why does a lot of views cause this issue?

trail pilot
#

it might be some internal jumbo for dpy

trail pilot
elder belfry
#

Hey @dim pelican , I found out something...
So apparently PIL.ImageColor.getrgb can handle the following patterns and return a tuple of RGB,

'rgb(255, 0, 0)' # spaces after or before `,` doesn't matter
'hsl(0, 100%, 50%)' #same as rgb for spaces, and `%` is required
'hsv(0, 100%, 100%)' #same as hsl
'#FF0000' # case insensitive

So in python, it would be:

>>> from PIL import ImageColor
>>> ImageColor.getrgb('rgb(255, 0, 0)')
(255, 0, 0)
>>> ImageColor.getrgb('hsl(0, 100%, 50%)')
(255, 0, 0)
>>> ImageColor.getrgb('hsv(0, 100%, 100%)')
(255, 0, 0)
>>> ImageColor.getrgb('#FF0000')
(255, 0, 0)

I think we should use this, and for the regex for these patterns,
you can refer the source file for ImageColor, https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageColor.py,
and besides it also contains some 140 standard HTML color names, but I don't think we can use this, but anyway, it also returns a RGB tuple:

>>> ImageColor.getrgb('limegreen')
(50, 205, 50)
molten perch
#

Is it an intended behaviour that when I call wait on a View the bot keeps typing, until the View either times out or gets stopped?
(I was implementing sir-lancebot#857 when I encountered this "side effect")

dim pelican
#

That....will make things so much easier for us lol

elder belfry
molten perch
#

It seems to do so. It might be a glitch with dpy I'm not sure.

vale ibex
#

Depends, are you using a context manager?

#

Or calling wait directly as a func

#

If it's the former, then move the ctx.send outside of the context manager

elder belfry
# dim pelican That....will make things so much easier for us lol

And from the source code, to handle CMYK mode, ig this will work

import re

color = 'cmyk(0, 99, 100, 0)'
match = re.match(r"cmyk\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
if match:
    c = int(match.group(1))
    m = int(match.group(2))
    y = int(match.group(3))
    k = int(match.group(4))
    r = int(255 * (1.0 - c / float(100)) * (1.0 - k / float(100)))
    g = int(255 * (1.0 - m / float(100)) * (1.0 - k / float(100)))
    b = int(255 * (1.0 - y / float(100)) * (1.0 - k / float(100)))
    print(r, g, b)
vale ibex
#

Or, just await the send typing func directly, rather than use the contact manager, since it stays for 5s anyway

molten perch
#

I did the same thing as in the examples, provided in the dpy repo.

brisk brook
#

Just move it out once

molten perch
#

๐Ÿฅถ Missed it, sorry. Thanks for pointing out, didn't realise it. :/

trail pilot
#

I might just remove the view altogether after the view expires for the challenges command

#

Adding a cool down would be obnoxious

#

Unless itโ€™s a short one

#

Iโ€™ll test it out with a 15 second cool down

brisk brook
#

Do you know why it fails when you have a lot of views open?

molten perch
#

Since, it's been patched sir-lancebot#857 could use some reviews, I'd appreciate it! ๐Ÿ˜„

stable mountainBOT
trail pilot
#

I'm going to edit the view to None and see what happens

#

Even after the cooldown it still raises it, weird..
I'm just going to remove the view altogether

#

Hm... it still edits the view properly and disables it after the error? I'm wondreing if I should just ignore the exception

#

Alright, editing the view out entirely works

#

it doesn't provide any usage if it's disabled

#

or if it's just out entirely

#

so I'm just gonna remove the view

dim pelican
#

Oh boy, just got the image to work!

#

Dark mode:

#

Light mode:

austere hornet
dim pelican
#

Thanks! The problem that I was having is that I was using the absolute path, and also not attaching the image file to the embed

#

sir-lancebot#859 should be ready to test / review now

dusky shoreBOT
clever wraith
#

site#594 and sir-lancebot#849 both need reviews! We are getting close to merges on both

dim pelican
#

I think 594 needs a core dev approval

#

And 849 needs wookie and xith, don't know their timezones so I'm not sure if I should ping them or not

thorny obsidian
dim pelican
#

Sweet, then maybe a ping nice and early tomorrow Kron?

trail pilot
#

Likewise for sir-lancebot#860 if anyone wants to review it!

dusky shoreBOT
molten perch
#

Same applies to api#17 , it might seem like a lot, but on the contrary, itโ€™s relatively easy. ๐Ÿ™‚

static canyon
vocal wolf
#

@clever wraith .quack has been merged.

#

.quack

dusky shoreBOT
clever wraith
#

Yayy

#

Now we just need a changelog

obsidian patio
#

Sir Lancebot currently reacts with spooky emojis to user messages, but also bots. Fine with you if I PR to ignore bots?

clever wraith
#

That sounds like a good idea

static canyon
#

I'd open an issue first though

obsidian patio
#

Itโ€™s such a tiny change that I think itโ€™s redundant in this case

static canyon
#

Eh, probably

#

I'm just used to always creating an issue

green oriole
clever wraith
green oriole
#

Quite indeed

clever wraith
#

When y'all have time please look at site#594

dusky shoreBOT
obsidian patio
vocal prairie
#

danger is another one

dim pelican
#

I'll eventually get them all
spooky danger skeleton halloween doot jack-o-lantern

vocal prairie
#

pumpkin is the only one you missed

gritty wind
#

lol does it use the same reaction as jack-no-lantern

dim pelican
#

And halloween

austere hornet
#

Are the reactions a new feature on Lance?

#

spooky

#

Nice

#

halloween

#

Nice

#

This is cool

#

Thanks to whoever did this!

thorny obsidian
#

Not new, just locked to October

austere hornet
clever wraith
#

halloween pumpkin

austere hornet
stable mountainBOT
#
Affirmative!

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

trail pilot
#

Sorry for asking again and again - but when anyone is free, could anyone who is fine with doing so test out sir-lancebot#860, I havenโ€™t run into any errors so far but Iโ€™m wondering if anyone else does

dusky shoreBOT
clever wraith
#

Apologies for asking so much, but could people look at site#594?

cold island
vocal wolf
#

iirc it reacts to random messages

cold island
#

random?

#

I thought it only reacted to specific triggers

#

.src

dusky shoreBOT
stable mountainBOT
#

bot/exts/holidays/halloween/spookyreact.py line 32

async def on_message(self, message: discord.Message) -> None:```
vocal wolf
#

yeah it does

#

so that's a weird one lol

trail pilot
austere hornet
#

??? This makes no sense

#

On one message there is no reaction but on the second there is

#

And the reaction itself makes no sense

#

Clearly there is a bug somewhere

#

Does anyone know where?

dim pelican
#

Apparently it's a thing, I asked Akarys about it earlier

patent pivot
#

itโ€™s a candy collecting game

stable mountainBOT
thorn ibex
#

Dark mode?

brazen charm
molten perch
#

Hey! Yesterday I pushed a few changes to api#17 , that should make it way more convenient to review the pr. Thus, I would really appreciate if someone took a look at it. ๐Ÿ™‚

gritty wind
#

I believe that's Volcy

fervent sage
#

ye

vocal prairie
stable mountainBOT
#

postgres/init.sql lines 1 to 3

CREATE DATABASE metricity;

\c metricity;```
brisk brook
#

It seems like it, there you create the metricity database then connect (that's the \c metricity;) to it.

vocal prairie
#

Oh ok, I was wondering if that was the same file for both and didn't know that \c syntax

brisk brook
#

Oh wait, isn't site also the API?

gritty wind
#

it is

#

metricity doesn't have an init, on account of not having a database. Sqlalchemy iirc does the migrations

#

Can't remember if it's sqlalchemy or something else

vocal prairie
#

alembic iirc

gritty wind
#

Correction, yup ^

brisk brook
#

Here it is, just found it

clever wraith
#

Hey everyone! I have two small requests to make this morning. Thanks for putting up with me lemon_sweat

#

First, when you guys have time, could you changelog .quack?

#

Also, site#594 needs reviews! It's just a documentation change, nothing big

clever wraith
#

Have a nice day everyone

patent pivot
#

workflow as a whole

#

I think, at least

#

maybe not thinking about it, I can't remember

molten perch
#

Hey! Could someone take a look at sir-lancebot#857?

slim widget
#

Oh, does it react randomly in that channel?

#

Nvm.

wind ruin
#

!rule 9 and That's not on topic for this channel nor server

stable mountainBOT
#

9. Do not offer or ask for paid work of any kind.

wind ruin
#

wait wrong rule

#

Rule 6
Do not post unapproved advertising.

obsidian patio
#

Do we have a default config file for @dusky shore?

#

For the testing server

patent pivot
#

it has few enough env vars that just following the setup guide should be a quick process

obsidian patio
#

True

vocal prairie
clever wraith
#

ty @vale ibex

austere hornet
#

Wait @vale ibex I don't remember reviewing .quack

#

I was pinged

vale ibex
#

uhhhhhh

#

who's shom770

austere hornet
#

@trail pilot

vale ibex
#

I'm bad at remembering people who use different names in discord ๐Ÿ˜‚

austere hornet
#

Ah

#

No worries

vale ibex
#

updated it ๐Ÿ˜„

green oriole
#

Ping me when the PR is opened @obsidian patio

obsidian patio
#

Sure, thanks

patent pivot
#

@fervent sage did you get anywhere with quackstack S3? otherwise I'm going to add it today

obsidian patio
dusky shoreBOT
patent pivot
#

yeah, instead of on fs which gets reset

solemn kayak
#

My server nickname just went purple and got a duck emoji next to it for <1s. Is that due to one of you guys' duck bots?

patent pivot
#

check if it's in S3 and return that link if it is

gritty wind
#

Just a random display bug

solemn kayak
#

Ah ok thanks

patent pivot
#

we oly need to check if it is there and return the URL

#

we're not serving images from quackstack, you'll get a link back to an S3 bucket

#

the bucket is uhhhh

#

thank you it's me enjoying a tuna mayo sandwich

#

yea

#

we haven't used the bucket yet

#

but i wanted the name lol

trail pilot
vale ibex
#

hah no worries

timid sentinel
#

That is, # use logging.getLogger (not bot.utils.logging.get_logger) to prevent circular import

#

Would moving the CustomLogger into a different file fix it?

#

wait no

#

actually maybe yes, idk

brisk brook
#

I'd say just move it into the functions that need it?

#

In general they're just gonna be used once

#

There's 4 uses I can see

#
GitHub

The community bot for the Python Discord community - bot/constants.py at 00af16266c65462bc0cfedde729e01d6d97363b7 ยท python-discord/bot

#

The first is just from loading the config, which could be troublesome

#

The third* is accessing an attribute that doesn't exist. Which should never happen. If it does then something's bad and the potential performance cost is okay

tough imp
#

don't think those logs show up anywhere since the file is loaded before logging init ๐Ÿ˜„

brisk brook
#

The second was actually when checking the required values. Which is also a function and can be delayed

stable mountainBOT
#

bot/log.py line 12

from bot import constants```
tough imp
#

logging init depends on config

timid sentinel
#

Ah lol, that's fun. Is there a way of making it work? Just using a default logger config before setting up our own one that relies on constants? Or should we just not bother logging anything in constants.py?

#

that is, services.py, not sure if that link jumps to it

#

i'm not sure why that one has a problem

patent pivot
#

okay i ditched the quackstack s3 bucket

#

yea am debugging it

#

oh, cloudflare is caching

#

which is good, but not for dev lol

#

wait

#

hm

#

hmmm yeah

#

not sure why

#

bucket definitely exists

#

lol

#

hm

tough imp
#

should have named it ddn for duck delivery network ๐Ÿ˜”

patent pivot
#

for me it's cutting between working and not working

patent pivot
#

even with v1 i get mixed results

#

maybe we use b2

#

well, eventually we'll cut over to cloudflare r2

#

lmfao

green oriole
#

Why did you yeet quackstack lmao

patent pivot
#

ddn was too good not to use

tough imp
# timid sentinel Ah lol, that's fun. Is there a way of making it work? Just using a default logge...

I personally think the info log on L107 doesnt need to be there (it already doesnt reach stdout, if I'm not mistaken), or it could just be a print, L126 will kill the bot via an exception anyway (so the message could go in the exception instead), and L190... I'm upset because I never realized the annotated attrs aren't fetched from the yaml until a lookup is made, I always assumed the attrs get set on the classes to fail immediately if not found ๐Ÿ˜ฌ

timid sentinel
#

Makes sense, I guess we could just not log in that file then. Not sure on the best way to solve it in services.py though, it's imported in the util folder's __init__.py https://github.com/python-discord/bot/blob/main/bot/utils/__init__.py while the utils/logging.py file is being imported. Things I can think of are

  1. Don't have the __init__.py imports and just use the full paths elsewhere
  2. Move the logging import to inside the function send_paste_to_services function, probably the easiest option but feels a little more fragile.
vale ibex
#

could we import get_logger in the __init__ of the bot package and then import the function from bot directly?

#

IE in __init.py__ do from bot.utils.logging import get_logger and then anywhere we want to log we from bot import get_logger [...] get_logger(__name__)

molten perch
#

Hey! If someone happens to have some time, I would really appreciate if they could take a look at api#17 .

molten perch
#

Nothing special, porting Django models to SQLAlchemy models basically.

#

I believe so, yes.

patent pivot
#

this is just the db models

#

ah, not as of yet no

molten perch
#

However, if the model pr gets merged, it'll be fairly easy to port the endpoints. I believe.

#

lemon_fingerguns_shades It's not as bad as it seems.

#

Actually, the hardest parts are the checks(validations) and not the models itself.

#

๐Ÿ˜‚ You're welcome

brisk brook
#

JSON Binary pretty sure

patent pivot
late wolf
#

Hey, I added the package to pyproject.toml but it didn't pick it up. Why did this happen, and how can I fix it

brisk brook
#

Yeah it has to do with PostgreSQL

late wolf
#

For sir lancebot

patent pivot
#

difference is described in that docs

late wolf
vocal prairie
#

Did you run poetry install after you added it? You'll need to if you manually added the entry.

patent pivot
#

sort of

molten perch
#

Well.. there was a "helper_text" attribute on the Django models, I thought since there is no such thing in SQLAlchemy(or at least it wouldn't make sense to add them), I'll add them so that new contributors will understand what each field represents. Actually.. not just new contributors ๐Ÿ˜„

green oriole
#

I think this is a very good thing

#

there is no reason to remove documentation, unless it is redundant

#

and some of those names really aren't self documenting

molten perch
stable mountainBOT
#

pydis_site/apps/api/models/bot/off_topic_channel_name.py line 14

RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-วƒ๏ผŸโ€™'๏ผœ๏ผž]+$"),```
stable mountainBOT
#

pydis_site/apps/api/models/bot/role.py lines 62 to 64

def __le__(self, other: Role) -> bool:
    """Compares the roles based on their position in the role hierarchy of the guild."""
    return self.position <= other.position```
molten perch
dusky shoreBOT
molten perch
#

I believe we should merge the models pr first.

vale ibex
#

It's a way to manage database versions

patent pivot
#

getting a fresh database to the state it is in today

#

so assume you start with an empty database, like a fresh install

#

then you want to add an app that handles todos, so you add a model that defines a table of todos

#

then to actually get that schema to the databsae you add a migration that does the actual sql ops

#

then say you add users later down the line, you add the models and then add the migrations to match the database up to thta

#

so you have basically a changelog of all modifications to the database

#

and since that gets replayed you can go backwards and forwards at will

#

it's sort of that, yeah

#

django auto-generates most messages

#

that's the naming of migrations, we picked most of those though

#

yeah, similar to metricity

patent pivot
#

yes - but keep in touch here so it is integrated correctly and configured right

vale ibex
#

wdym by partial UUID approach?

#

the migration tool needs to know what order to run the migrations in, they're very much order dependant

patent pivot
#

alembic default

vale ibex
#

huh

#

how does it deal with order?

#

is it just a linked list?

patent pivot
vale ibex
#

That's pretty cool

trail pilot
#

Would anyone want to test/review sir-lancebot#860 when they're free? I'm wondering if anyone else is getting errors because on my end I haven't gotten any but I might be missing a few edge cases

dusky shoreBOT
cold island
#

Hey Mark, can you repost the code you sent here? I recently tried to do something similar but it didn't quite work for me

tawdry vapor
#

I'll try to find it

#

Don't remember what branch it's on

#

I'm not able to find it. I might have to go through local branches 1 by 1 but there are lots of them.

cold island
#

ok, not important then, thanks

tawdry vapor
#

Yeah sorry. I really have no idea where that code is

#

I found it

cold island
#

Thanks!

#

Right, so the solution was using init_subclass. I tried doing something similar with a metaclass, but got a metaclass conflict because of ABCMeta

dim pelican
#

General question: when should a PR have the commits squashed? Is this possible to do from the PR itself or should I do the rebase locally then push it prior to merging?

brisk brook
#

If the PR should squashed it will be done during the merging

#

You squashing and force pushing messes with the reviews.

vale ibex
#

eh, there are valid use cases for squashing outside of merge time

#

since squash merging always squashes to 1 commit

dim pelican
#

Got it! Just looking at the sir-lancebot#859 and thinking to myself "These 40 commits could just be 4" lol

dusky shoreBOT
vale ibex
#

Yea, the main issue with squash merging like this, is that there's no easy way for reviewers to tell if something got messed up with the rebase

#

without reviewing all over again

dim pelican
#

In that case I will just keep going with atomic commits and let them build up ๐Ÿ‘ thanks for the quick responses fellas

vale ibex
#

๐Ÿ‘Œ

dim pelican
#

!remindme 10h Test sir-lancebot#860

stable mountainBOT
#
I'll allow it.

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

dusky shoreBOT
brisk brook
gritty wind
#

You should be able to clean up the history without changing files

#

Back when I was working on the MVP for forms, I'd usually write a feature, use 300 commits, and once it was more or less done, I'd git reset --soft, then make commits of the final product, without changing any code from before I reset

vale ibex
#

Yea, the point I was making is that to a reviewer, the PR just shows as force pushed

#

there's no way to tell if the author actually changed the code, or if the commits were just squashed

brisk brook
#

Yeah so you need to look through it again and Approve (if that's what you did previously)

#

And all of them get dismissed afaik

clever wraith
#

If anybody needs PR reviews lemme know

molten perch
#

You asked, I delivered. ๐Ÿ˜‚
api#17 needs as many reviews as possible.

dim pelican
#

Maybe sir-lancebot#859, but it should be pretty close already. Could try to test it out and see what breaks

dusky shoreBOT
sour viper
#

Hey is there any need to follow up for merging a approved PR ?

#

sir-lancebot#874

dusky shoreBOT
sour viper
#

I meant sir-lancebot#874

dusky shoreBOT
austere hornet
cold island
#

You still need core dev approval

#

Otherwise nothing is required from you atm

sour viper
#

Do I have to contact any core dev or its all handled

cold island
#

Someone might get around to it if they have the time. If it sits for too long feel free to bump

#

We don't want PRs to sit for too long, but sometimes people are busy or don't notice

sour viper
#

I'm going to wait another week then follow up maybe, I got approval around a week or more before so I thought I'd check in

gritty wind
#

@cold island @vale ibex not to distract y'all from other things right now, but I got somewhere with static builds:
https://615b32be1025c010fb532b0e--pydis-static.netlify.app/

This is zig's PR, though do note that not the entire site is working yet. I know resources barely work, though please do tell me if you notice something not acting as expected

vale ibex
#

ah nice nice

#

I shall take a look after the stream ๐Ÿ˜„

fallen patrol