#dev-contrib

1 messages Β· Page 137 of 1

brazen charm
#

I think exposing beginners to the type hinting system through seasonalbot is great, if there are wrong typehint they can (and should) be caught in reviews and the users can learn from there. And typing for the user or a more lenient checker is much simpler than for mypy

#

I think most of the wrong hints were from when the project started and the code quality was significantly lower because there weren't many people to review things

brisk brook
#

Beginners are also the ones who benefit the most from typehints

#

It shouldn't be something that errors in the pre-commit

#

But I think it could be added as CI that will show up errors and then someone can give the user a human-readable version of what needs changing

vale ibex
#

!ext r help_channels

stable mountainBOT
#

:ok_hand: Extension successfully reloaded: bot.exts.help_channels.

vale ibex
#

there was only 2 available for some reason

thorny obsidian
vale ibex
#

yea seems like it, saw some 504s from the help channel cog in sentry

trail pilot
#

Sounds good

#

There should be a review guide though because I have to say it's much nicer to get reviews in the beginning about the logic and how it works rather than nitpicks

#

(Not talking about these reviews specifically, jsut in gneeral)

brazen charm
#

nitpicks are important too if they influence code quality

trail pilot
#

Ahh, that exists

trail pilot
brazen charm
#

you can put it off for a bit if you're not feeling motivated, the PRs aren't critical to need immediate attention

brisk brook
trail pilot
#

Ah alright

dim pelican
#

In batch means make multiple commits, but one push right?

#

I'm really bad about pushing singular small commits

trail pilot
#

Yep, that's batch i think

#

it squashes it right?

brisk brook
#

No, I am saying that you wait it off until all comments have gathered and then commit all fixes one time instead of opening your editor to make a small typo fix.

trail pilot
#

Ah

dim pelican
#

Ohhh gotcha. Let the PR marinate a little bit and build up suggestions, then make all the changes at once with one commit

trail pilot
#

I have a question - should I implement a change if it virtually does the same thing but it just takes a bit more time out of working on my other PRs?

#

Like changing from a link system to a local file system

brisk brook
trail pilot
#

yep

#

Because I also have my challenges PR where I have to add the threadpool

brisk brook
#

I think it is fine there, we have imgur links at other parts of the bot. I realize now that I probably should've commented that to make it clear

trail pilot
#

alr

brisk brook
trail pilot
#

Ohh

#

I just do await asyncio.to_thread(function)

#

Lol I'm such a noob sorry

brisk brook
#

You used to do the executor stuff which was annoying

trail pilot
#

@vale ibex Your changes are implemented

vale ibex
trail pilot
#

There we go

#

it's psuhed

#

sorry lol merge conflict

vale ibex
#

Ah cool, I'll look

#

Just one of my comments to be looked at now πŸ˜„

#

oh wait, it was in a commit with the wrong name

trail pilot
#

Oops, m

#

mb

#

I'm gonna add some python related words now

vale ibex
#

pithink Getting a 422 error from github trying to resolve this convo

#

how odd

trail pilot
#

How do these sound for python related words
snake
python
github
cpython?
programming
antigravity

austere hornet
#

Hmm, antigravity?

trail pilot
#

easter egg

#

not sure many people would know what antigravity is

#

ooh, how about
bytecode

fiery kayak
#

Snake isn't technically related to python

trail pilot
#

Fair

austere hornet
#

Yeah was gonna say that

trail pilot
#

I'll take out snake

austere hornet
#

Don't really like cpython

#

Too specific

#

And Github is not really Python related

vale ibex
#

cool, maybe these too πŸ˜„ ```py
lambda
class
print
function
Guido
Python Discord
dictionary
True
False
import
return
yield

#

no problem with more words

brisk brook
#

No capitalization though

trail pilot
#

Yeah

#

also what aobut spaces?

vale ibex
#

πŸ‘Œ

trail pilot
#

spaces might be weird

#

they would work but like

brisk brook
#

'hashmap' maybe?

trail pilot
#

no wait theyw ouldn't

austere hornet
#

How about PyDis?

vale ibex
#

ahhh only support single words atm?

#

that's fine

trail pilot
#

pydis sounds good

austere hornet
#

Actually that's an abbreviation technically not sure if that will work

trail pilot
#

Do you think I should keep it in alphabetical order or just so I don't have to look through the entire list for each word, add it to the ned

austere hornet
#

Yeah

trail pilot
#

or `hexadecimal

#

binary, hexadecimal, octal

austere hornet
trail pilot
#

nvm lol

#

it's osmehting else

austere hornet
brisk brook
#

Use Python to sort it

austere hornet
#

Great idea!

vale ibex
#

cat file.txt | sort -u > output.txt shrugR

brisk brook
#

Add them to the end then have some script that does like ```py
with open('hangman_words.txt', 'rw') as f:
lines = f.readlines().sort()
f.seek(0)
f.write(lines)

brisk brook
trail pilot
#

I didn't see this till now, I already sorted them by hand lol

#

just used regex search

brisk brook
#

Ah lol

trail pilot
#

@brisk brook You mentioned to_thread, I have that setup, but is there a blocking HTTP session?

brisk brook
#

Where would there be a blocking HTTP session?

trail pilot
#

so i can take it in a thread

#

since its' blocking

#

I use the async with self.bot.http_session

brisk brook
#

Aren't you using HTTPx or Aiohttp?

#

Yeah, notice the async with?

#

That is not blocking

trail pilot
#

Yeah ik

#

So do i just not convert it to a thread?

#

If it isn't blocking

#

the blocking time really isn't that much though

#

@brisk brook ^^
sorry for the ping, just that i'm using aiohttp yet people want it to be in the executor?

brisk brook
#

No that does not need to be in a thread, sorry for the delay.

trail pilot
#

No worries! and alright, sounds good

#

so mostly little grammatical rrors to fix

#

Also - should I use RGB or pure hex for the KYU colors?

brisk brook
trail pilot
#

alright

#

Is there just a rgb to hexadecimal converter

gritty wind
#

You can just format the number as hex. The format specifier would be 02x (the 0 for padding).

For instance, (18, 98, 227) is 1262e3:
!e

print(f"{18:02x}{98:02x}{227:02x}")```
#

Eval wanna work?

brisk brook
#

It has to be first yeah?

gritty wind
#

!e

print(f"{18:02x}{98:02x}{227:02x}")```
stable mountainBOT
#

@gritty wind :white_check_mark: Your eval job has completed with return code 0.

1262e3
gritty wind
#

In case you're curious, that's some shade of blue

trail pilot
#

and does discord.py want it as 0x1262e3 or just 1262e3?

gritty wind
#

Umm, which function?

trail pilot
#

th color.from_hex i think

#

doesn't exist

#

ohh i'ts just normal

#

it' sthe color argument

#

discord.Color(color=...)

gritty wind
#

Both seem to work

brisk brook
#

0x1262e3 is preferred

gritty wind
#

But it also seems discord has a builtin converter

brisk brook
#

!e ```py
print(0x1262e3)

stable mountainBOT
#

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

1204963
brisk brook
#

Yeah see, that's just special Python syntax. It becomes the number it represents

gritty wind
#

Does discord.Colour actually take in a hex? It seems to expect an rgb tuple

#

Ah, nvm

#

It's just the bad docs

#

Righto, so you'd probably want to actually convert it first

brisk brook
#

It takes in an int, string of hex characters, and a color tuple yeah

gritty wind
#

To go from what I had to a valid value, wrap it in int(<formated string>, 16)

#

That'll just convert it to an int from a base 16 string

#

Or just... use the discord builtin method and avoid the trouble 🀑

dim pelican
#

Yeah....the color command I'm working on expects some wild stuff for embed color

trail pilot
#

much less complicated lol

gritty wind
#

What are you working on?

trail pilot
#

sir-lancebot#860

dusky shoreBOT
trail pilot
#

I take a rgb tuple for the color of the embed to represent KYU colors

gritty wind
#

If you still want to set your own colors, you can do that, just saying to use the discord method for it so you don’t have to implement it yourself

trail pilot
#

what's the discord method?

dim pelican
dusky shoreBOT
static canyon
#

@trail pilot I think you ended up committing the opposite of this lemon_sweat. It's not a big deal though eitherway

fallen patrol
#

@clever wraith have you tried the pr on gitpod.io?

clever wraith
#

yes

fallen patrol
#

how do you get pre-commit to work?

clever wraith
#

i had to remove the vscode section, it breaks the .gitpod.yml for some reason

fallen patrol
#
(sir-lancebot-7VoPu34x-py3.9) gitpod /workspace/sir-lancebot $ pre-commit install-hooks 
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/gitpod/.cache/pre-commit/repo3u60y7x8/py_env-python3.9/bin/python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
    
Check the log at /home/gitpod/.cache/pre-commit/pre-commit.log
(sir-lancebot-7VoPu34x-py3.9) gitpod /workspace/sir-lancebot $ poetry run precommit

  FileNotFoundError

  [Errno 2] No such file or directory: b'/home/gitpod/.nvm/versions/node/v14.17.5/bin/precommit'

  at ~/.pyenv/versions/3.9.6/lib/python3.9/os.py:607 in _execvpe
       603β”‚         path_list = map(fsencode, path_list)
       604β”‚     for dir in path_list:
       605β”‚         fullname = path.join(dir, file)
       606β”‚         try:
    β†’  607β”‚             exec_func(fullname, *argrest)
       608β”‚         except (FileNotFoundError, NotADirectoryError) as e:
       609β”‚             last_exc = e
       610β”‚         except OSError as e:
       611β”‚             last_exc = e
(sir-lancebot-7VoPu34x-py3.9) gitpod /workspace/sir-lancebot $ 
fallen patrol
#

yes

#

how else do I make a commit lol

clever wraith
#

you need to set PIP_USER to false

fallen patrol
#

the hooks themselves have to install to be able to use pre-commit

clever wraith
#
tasks:
  - name: "Python Environment"
    before: "pyenv install 3.9.6 && pyenv global 3.9.6"
    init: "pip install poetry && export PIP_USER=false"
    command: "poetry install && poetry run pre-commit install"
fallen patrol
#

interesting

#

i'm using that terminal

clever wraith
#

gitpod doesnt allow user site packages

#

pre-commit has installed

#

ill see if i can get vscode extensions to work, but no promises unfortunately

fallen patrol
#

aight

fallen patrol
# clever wraith pre-commit has installed

here's a minor change:

tasks:
  - name: "Python Environment"
    before: "pyenv install 3.9.6 && pyenv global 3.9.6"
    init: "pip install poetry && export PIP_USER=false"
    command: "poetry install && export PIP_USER=false && poetry run pre-commit install --install-hooks"
#

for some reason

clever wraith
#

you only need to export once

fallen patrol
#

even in the same terminal

#

PIP_USER was set to yes

clever wraith
#

oh

#

shit

fallen patrol
#

and removing that second PIP_USER export breaks the whole thing πŸ˜‚

#

also in that same thing, I've added the --install-hooks flag which means when it installs the hook it also installs the environments so rather than having to wait for them to install on the first commit they install with everything else

clever wraith
#

i dont like how long that line gets

fallen patrol
#

i mean

#

its yaml

fallen patrol
#

#dev-contrib message
@celest charm@tawdry vapor someone just pointed out something extremely important concerning this.

pipx.

Rather than installing poetry to the same env, install pipx and then install poetry with pipx. lemon_exploding_head

#

discord-modmail/modmail#74

dusky shoreBOT
patent pivot
#

lol

fallen patrol
tawdry vapor
fallen patrol
#

Well yes, but also no

#

A good portion of poetry installs were installed with pipx. Imo it's a reliable tool which has less problems than poetry.
Using pipx to install poetry puts poetry in the venv and allows the project to be installed to site packages.

tawdry vapor
#

So poetry can be in a venv and our dependencies can be global, OR poetry can be global and our dependencies in a venv. I don't see a practical difference, except for the former requiring an extra tool (in fact, the venv could just as easily be created manually I suppose).

#

Keep in mind poetry is the only thing that needs to get installed besides what's in the lock file (and the usual setuptools).

fallen patrol
#

I believe that poetry actually just installs by invoking the current pip on the path, so even just resetting that to the system pip in the dockerfile would work

celest charm
#

@fallen patrol I think we came to the conclusion that the proper way to resolve the conflict was to create a requirements.txt using poetry and then use it instead of poetry in docker

fallen patrol
patent pivot
#

yeah i've seen that done before

brazen charm
#

Why would it not be a feasible solution?

patent pivot
#

yeah it's generally pretty alright to do, poetry has a command https://python-poetry.org/docs/cli/#export

fallen patrol
stable mountainBOT
#

New in version 3.8.

Changed in version 3.10: importlib.metadata is no longer provisional.

Source code: Lib/importlib/metadata.py

importlib.metadata is a library that provides for access to installed package metadata. Built in part on Python’s import system, this library intends to replace similar functionality in the entry point API and metadata API of pkg_resources. Along with importlib.resources in Python 3.7 and newer (backported as importlib_resources for older versions of Python), this can eliminate the need to use the older and less efficient pkg_resources package.

fallen patrol
#

I have to have my package installed, so I can get its version from site packages

#

I mean I could use read the toml key from pyproject.toml but I would rather not do that even in the docker containers

stable mountainBOT
#
It has arrived!

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

fallen patrol
#

But in docker, I would like it to work the same way as pypi, which will be importlib.metadata.
This is why it has to be installed in docker πŸ˜›

molten perch
#

Hey could some take a look at sir-lancebot#857 ? πŸ™‚

trail pilot
#

@vale ibex What do you think of this?

vale ibex
#

Yea, looks good πŸ˜„

cold island
#

Oh, that's cute πŸ˜„

remote wigeon
remote wigeon
#

yeah

vocal prairie
#

That would be nice, you can tell the number of letters more easily.

remote wigeon
#

if need help implementing that feel free to ping me

trail pilot
#

Alright, it's working now!

#

@vale ibex I added all your changes, feel free to review anything more if you want

remote wigeon
#

ok i was bored

#

heres a helper class:```py
import string

class AlreadyGuessedError(Exception):
pass

class WrongGuessError(Exception):
pass

class InvalidGuessError(Exception):
pass

class Word:

def __init__(self, word: str):
    self._word = word
    self._letters = set(word.lower())
    self._guessed_letters = set()
    
def guess(self, guess: str):
    if len(guess) != 1:
        raise InvalidGuessError()
    
    normalised_guess = guess.lower()
    
    if normalised_guess not in string.ascii_lowercase:
        raise InvalidGuessError()
    
    if normalised_guess in self._guessed_letters:
        raise AlreadyGuessedError()

    if normalised_guess not in self._letters:
        raise WrongGuessError()

    self._guessed_letters.add(normalised_guess)

@property
def guessed(self):
    return self._letters == self._guessed_letters

def __repr__(self):
    return " ".join(character if character in self._guessed_letters else "_" for character in self._word)

def __str__(self):
    return self.__repr__()```
trail pilot
trail pilot
remote wigeon
#

Β―_(ツ)_/Β―

#

it doesnt really matter either way

trail pilot
remote wigeon
#
    def __str__(self):
        return " ".join(character if character in self._guessed_letters else "_" for character in self._word)

    def __repr__(self):
        sclass = self.__class__
        return f"<class '{sclass.__name__}'>: {self.__str__()}"```
#

maybe thats cleaner

#

ab_c_ _fg a b _ c _ _ f g

vale ibex
#

rather than showing how many tries I had left

trail pilot
#

and keep the gameboard?

vale ibex
#

Yea, wasn't it doing that before?

trail pilot
#

It was only doing that for winning

vale ibex
#

Ah right, yea I think it would make sense to send it separately

#

so that users can see how they did

trail pilot
#

alright, ti works

#

Pushed it!

#

Thanks for the approval! @vale ibex

vale ibex
#

πŸ‘Œ

trail pilot
#

@remote wigeon I added your changes

#

changed to delete_after

#

and I also changed to a variable instead of editing the varibale directly

trail pilot
#

Oh oops, mb

#

I just did find and replace

trail pilot
vale ibex
#

πŸ‘

vocal wolf
#

@static canyon Good PR, thank you for creating it.

dim pelican
vocal wolf
vale ibex
#

yupyup

vocal wolf
#

ty

vale ibex
#

That should have been a seperate commit

#

didn't realise that made it in

vocal wolf
#

looks good to me, wanna squash or nay

#

wait

vale ibex
#

Yea, I'll sort out the commits

vocal wolf
#

can't merge because we're waiting on another PR, yeah?

vale ibex
#

yea, the site one

vocal wolf
#

oh they're both approved once

vocal wolf
#

might wanna pull

vale ibex
#

I just force pushed it anyway

#

I try to avoid updating branches if I intend to squash

#

since that brings public commits into the branch

#

I just rebased and squashed instead

#

rebased both, gonna merge

vocal wolf
#

dew it

vale ibex
#

once site ci finishes πŸ˜›

vocal wolf
#

once the workflow passes on site

#

yeah lmao

#

and there it goes

#

nice

#

both done

vale ibex
#

Nice

dim pelican
#

Chris and Xith = ducky_wizard & πŸ§™

sour viper
#

Is there a process for assigning an issue from github to yourself ? I think i asked this once but the response was to just comment it there

exotic ember
#

Is there a process for assigning an issue from github to yourself?
There isn't, you're correct in that you should comment that you'd like to work on an issue and we'll assign it to you

sour viper
#

Okay then, thanks !

brisk brook
clever wraith
#

sir-lancebot#849

dusky shoreBOT
clever wraith
#

Please

brisk brook
#

Yes I am gonna have some fun with that today and hopefully leave my last comments!

molten perch
# clever wraith Please

Could you please move the error_embed creation under the if condition, as discussed before? I believe you might've forgotten.

brisk brook
#

That- and some hangman playing :3

dim pelican
clever wraith
celest charm
trail pilot
celest charm
#

πŸ‘hail satan

trail pilot
#

Hangman is a weird game regardless lol

#

I felt weird when writing Out the comments

celest charm
#

petition to rename it to hangperson, we don't want to single out males in execution

trail pilot
#

β€œThis represents the hung man” sounds like I’m a murderer lmao

trail pilot
celest charm
remote wigeon
#

i mean its still mankind Β―_(ツ)_/Β―

dim pelican
austere hornet
patent pivot
#

as in what does it do?

#

it manages nominations - we don't actually have a pool anymore

thorny obsidian
#

How we do recruitment and nominations for helpers

vale ibex
#

Yea

#

!tp forceadd 212644551926611969 Seems decent

stable mountainBOT
#

:x: Nominating staff members, eh? Here's a cookie :cookie:

thorny obsidian
#

It's a little bit depressing that I recognize my own ID now -_-

vale ibex
#

lol

cold island
static canyon
#
Submitting coverage to coveralls.io...
Could not submit coverage: 405 Client Error: Not Allowed for url: https://coveralls.io/api/v1/jobs
Traceback (most recent call last):
  File "/home/runner/work/bot/bot/.cache/py-user-base/lib/python3.9/site-packages/coveralls/api.py", line 237, in wear
    response.raise_for_status()
  File "/home/runner/work/bot/bot/.cache/py-user-base/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Not Allowed for url: https://coveralls.io/api/v1/jobs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/bot/bot/.cache/py-user-base/lib/python3.9/site-packages/coveralls/cli.py", line 85, in main
    result = coverallz.wear()
  File "/home/runner/work/bot/bot/.cache/py-user-base/lib/python3.9/site-packages/coveralls/api.py", line 240, in wear
    raise CoverallsException('Could not submit coverage: {}'.format(e))
coveralls.exception.CoverallsException: Could not submit coverage: 405 Client Error: Not Allowed for url: https://coveralls.io/api/v1/jobs
Error: Process completed with exit code 1.```Err I think something's wrong with the bot checks? <https://github.com/python-discord/bot/pull/1831/checks?check_run_id=3639273246>
#

That seems like an issue in the check code rather than from my PR

fallen patrol
#

They can be reran later

#

Preferably to rerun them when the api is back

static canyon
#

Ah, I see

#

Do you know how I can force-rerun the check once the maintenance has finished? @fallen patrol

fallen patrol
#

Button on the checks, probably

static canyon
timid sentinel
#

Is anyone else getting 404s whenever they click on commits in a PR on github?

obsidian patio
#

I assume @dusky shore doesn’t have access to some dedicated GPU?

patent pivot
obsidian patio
patent pivot
#

hmmm no GPU compute as of now - will have to see if we could fit it into our budget

obsidian patio
#

But it’s not an issue without it. Just would’ve been a bit fun to use if we already had it

patent pivot
#

lol, minimum for a GPU instance is $1,000/month, and our yearly budget is $2,000

obsidian patio
#

LOL

#

Sounds like a perfect fit

cold island
#

Why does it require a GPU?

#

I don't think the speed difference is noticable for an image this size with that amount of operations. GPUs are good for very particular operations.

#

You'll also need certain frameworks to communicate with it that would probably be too heavy for a project like lancebot

patent pivot
#

If we use SIMD instructions with that Pillow fork we can basically do it on CPU and do it fast

cold moon
#

Why GPU instance is so expensive?

cold island
#

Because everyone wants them

#

But people don't actually hold a GPU instance for an entire month like that

#

It's worth getting it because they only need it for relatively short periods of time

#

If you want a GPU instance for a long time you'll get a spot instance which is considerably cheaper

#

There are entire enterprises revolving around managing spot instances with GPUs for training machine learning models

dim pelican
#

Hey all, can we get some general feedback on sir-lancebot#842 if you get a chance? Still working through some implementation decisions

dusky shoreBOT
cold island
dim pelican
#

The user input is an open point for me

cold island
#

What about the user input are you not sure about?

obsidian patio
#

I was just thinking if we already had a GPU, it would be fun to try it out with that command

cold island
#

Yeah no worries, I'm just saying that working with a GPU requires a whole other setup

obsidian patio
#

Yep

cold island
#

Also @dim pelican would you like feedback about the code itself, or do you want to wait until the PR is ready?

dim pelican
sleek steppe
#

I think all of those cases are fine and doable with a bit of regex

cold island
#

Replied in the PR

#

Basically what toxic said

#

Ugh, I made it in single comments instead of starting a review

timid sentinel
#

works fine for me

humble isle
#

def wookie(x, y):

austere hornet
#

@cold island Could you please review sir-lancebot#843 when you have a moment? Thanks!

dusky shoreBOT
austere hornet
#

Thanks @sleek steppe for your review on Hangman!

trail pilot
#

@sleek steppe Implemented your suggestions for sir-lancebot#843

dusky shoreBOT
trail pilot
#

oops lol

austere hornet
#

Haha

static canyon
#

!tags

stable mountainBOT
#
**Current tags**

Β» args-kwargs
Β» async-await
Β» blocking
Β» botvar
Β» class
Β» classmethod
Β» codeblock
Β» comparison
Β» customchecks
Β» customcooldown
Β» customhelp
Β» decorators
Β» defaultdict
Β» dict-get
Β» dictcomps

static canyon
#

!args-kwargs

stable mountainBOT
#

*args and **kwargs

These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.

Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.

Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.

Use cases
β€’ Decorators (see !tags decorators)
β€’ Inheritance (overriding methods)
β€’ Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
β€’ Flexibility (writing functions that behave like dict() or print())

See !tags positional-keyword for information about positional and keyword arguments

static canyon
#

just realised this isn't #bot-commands

austere hornet
clever wraith
#

which issues can i start working on? most issues don't have up-for-grabs so if the author has not said that they are working on it can i work on it? i want to start contributing but dont know which issues i can start filtering out

clever wraith
#

bot

cold island
#

It doesn't need to say up for grabs. If it's open and approved you can request working on it.

#

If it's not clear if it's approved but it interests you, request anyway and we'll tell you if it can be worked on

#

Given it's not assigned already of course

#

If you're looking at sir-lancebot after all, then it should say approved and that the author doesn't mind others working on it (the checkmark at the end of the issue description)

austere hornet
#

Kind of a random question, but why does #dev-voice have a 99 member limit? I just don't understand the point of that

fervent sage
austere hornet
brisk brook
#

It's also pretty healthy to have a limit, even if it isn't used

#

Sometimes #voice-chat-text-0's limit is close to being hit, and that's when you start to go "Ah, let's separate"

#

@clever wraith I left some suggestions, you should just be able to commit those without dealing with your editor.

#

Other than that, it works nicely

cold island
brisk brook
#

That will make it obvious from a contributors perspective thanks to their editor what needs changing

cold island
#

Yeah that's possible

brisk brook
#

On the other hand, this means the bot won't run until you have setup everything, so use that sparingly (maybe not for channels for example)

vale ibex
#

Maybe a bunch of β–‘ in places that need to be changed

cold island
#

The issue is that for example Pycharm won't really complain about yaml errors

#

The only thing I found that makes it mark a line with red is an invalid anchor reference

brisk brook
#

Would <> even be invalid yaml?

cold island
#

I don't think so, but it doesn't make pycharm complain

brisk brook
#

Like if I did voice-verification: &DEV_VOICE_VER <replace with channel id> then yaml wouldn't error, it would make it a string

cold island
#

yeah

#

If you add for example *lskjaghlksaj instead

#

it will error

#

Because there is no anchor with that name

vale ibex
#

I feel like it would be easier to pre-fill all the places that need changing with a defined char

#

So we can just say, change all places with this char

#

And say you can ctrl+f to find places you missed

cold island
#

Any funky char you have in mind?

cold island
#

πŸ€”

vale ibex
#

Yup

#

!charinfo β–‘

stable mountainBOT
cold island
#

Maybe οΏ½

vale ibex
#

That would be better

cold island
#

!charinfo οΏ½

stable mountainBOT
cold island
#

name checks out

vale ibex
#

Lol yea

brisk brook
#

That's good

vale ibex
#

We could even add a check in dunder init for those chars

#

And give a nice warning

cold island
#

I'm more hoping for this to be a temp measure

brisk brook
#

Is there an issue for having the bot auto-detecting the channels at least?

vale ibex
cold island
#

Until we get the auto config stuff going

vale ibex
brisk brook
#

I feel like since we know the bot template, we an have the bot match channels by name?

vale ibex
#

This is a stop gap

cold island
#

yeah

brisk brook
#

It should be pretty easy to iterate through the channels when an incomplete config is found

cold island
#

It should, but at that point I'd rather whoever does it work on the app we want to make

brisk brook
#

Yeah true

brisk brook
#

I would maybe use multiple, because an ID is multiple characters (could become too much though). But that is a big improvement

fallen patrol
#

@cold island I have one concern: trashcan: ":trashcan:

#

the trashcan specific emoji is pretty important and can result in unexplainable bugs since there's decorators, methods, paginator, etc that all use it

#

the paginator ceases to work with out it, and other commands will throw errors, or not throw them and silently fail-- it seems important enough to me that it should be documented that that emoji should be filled out

cold island
#

It is

#

There's a comment above that section

fallen patrol
#

inversely, the config.py file could have a check for if the emoji there is in a server the bot is in and default to πŸ—‘οΈ if it doesn't πŸ˜›

cold island
#

Added οΏ½ to the emojis too

brisk brook
#

I don't understand though, why does one need to change the trashcan emoji?

#

It's a Discord emoji

green oriole
#

Because the default emoji looks more like a basketball hoop than a trashcan

vale ibex
#

πŸ—‘οΈ

green oriole
#

πŸ€
πŸ—‘οΈ

#

Now tell me it doesn't work

vale ibex
#

Lol

#

πŸ€
panicBasket

austere hornet
#

Lmao

fallen patrol
#

!charinfo \u200b

stable mountainBOT
#

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

fallen patrol
austere hornet
#

@trail pilot Did you disable DMs by any chance? I can't DM you anymore for some reason

trail pilot
#

Oh shoot let me friend you

#

I did because people kept DMing me for help

austere hornet
#

Ah

trail pilot
#

Can you friend me?

#

I can't friend you

austere hornet
#

Says you're not accepting frs

trail pilot
#

Oh lol, we're both not accepting it

#

I'll just enable DMs again

austere hornet
#

Thx

trail pilot
#

What does everyone think of a bytecode command?

#

Gets information from the bytecode name

#

like
.bytecode LOAD_NAME

brazen charm
#

the docs should already handle that

trail pilot
brazen charm
#

!d LOAD_NAME

stable mountainBOT
#

LOAD_NAME(namei)```
Pushes the value associated with `co_names[namei]` onto the stack.
trail pilot
#

OH

#

I thought you had to do !d dis.LOAD_NAME

#

!d LOAD_FAST

stable mountainBOT
#

LOAD_FAST(var_num)```
Pushes a reference to the local `co_varnames[var_num]` onto the stack.
brisk brook
#

I can't get sir-lancebot#860 to work, even after running docker-compose down to delete the containers

dusky shoreBOT
brisk brook
#

bs4 doesn't get installed

thorny obsidian
#

@patent pivot site#590 is open

dusky shoreBOT
thorny obsidian
#

... what?

exotic ember
#

coveralls api is under maintenance

thorny obsidian
#

@brisk brook lmao, you'd think I'd get the theme right facepalm

trail pilot
#

Actually idek if that’ll fix it lol

#

Yay! After a week or two sir-lancebot#843 is about to be merged! (All checks have passed) Thank you to everyone who reviewed it!

dusky shoreBOT
austere hornet
trail pilot
#

Haha

fallen patrol
#

nice

#

uh

#

LMAO

fallen patrol
trail pilot
fallen patrol
#

basically if i have an active game

#

it will still count messages in another channel

#

which seems not intentional

trail pilot
#

Ah crap

#

Should I open an issue for that?

fallen patrol
#

i mean

trail pilot
#

it's kind of harmless ig

#

so

fallen patrol
trail pilot
#

it's cause I do the on_message event for the user itself, not checking the hcannel too

fallen patrol
#

yeah

#

the solution would be easy enough but meh

brisk brook
brisk brook
vale ibex
#

So that it rebuilds the image

brisk brook
#

Ah, alright

vale ibex
#

We have a volume setup so that code changes don't need a rebuild

#

But any changes to the dockerfile, or the deps need a rebuild

cold island
#

Anyone with some HTML/JS knowledge wants to help me for like 10 minutes?

cold island
#

and django templates

brisk brook
#

I don't know too much about it, but may be able to do something πŸ˜… . What issue/PR is this about?

cold island
#

Actually have to go for a while, will come back later

sour viper
#

Hey everyone, so I have coded one of the issues for Sirlancebot an anagram command, and when i tried running flake8 it showed a lot of errors for lot of files which i hadnt worked on, i made sure that my file is in accordance with the guidelines

#

Other files having issues shouldn't be a problem right ?

brisk brook
sour viper
#

issue is already present

brisk brook
sour viper
brisk brook
sour viper
brisk brook
# sour viper

Ah, Isort. Python Discord has a bit different style guide than Isort follows.

I can help you setup flake8 in your editor so that you get red squiggly lines, that way it's easier to ignore those Isort errors.

#

Press Ctrl + Shift + P (that will open the command pallette). Then type "Select linter".

That should give you "Python: Select Linter". After selecting that you'll get a menu with different linters, there you can select "flake8" and it should be set up.

sour viper
#

Oh, was doing "flake8 anagrams.py" the wrong way to do that

brisk brook
sour viper
#

i did that i can see the squiggly lines now

brisk brook
#

You can hover over those and get the error flake8 says, as well as there being a Problems tab where console it where you can read them.

sour viper
#

all flake8 errors are resolved, but isort is complaining about some issues

brazen charm
#

I don't think lancebot uses isort, make sure to run with the right flake8

sour viper
#

im not sure what im supposed to do here, it just says in wrong order ? any ideas i tried running isort anagram.py it spit out some error

dim pelican
#

I think Colours comes before negative replies from bot.constants

sour viper
#

Huh, it popped up 2 more issues, 2 for wrong position and one unexpected missing import, it would be really helpful if it said what position would be correct and what was missing

static canyon
#

Your imports are in the wrong order

#

The order should be```
builtin libraries

external libraries

project modules```

#

You currently have an external library under the project modules

#

And then it's alphabetical within those sections (capital coming before lowercase) so Colours and NEGATIVE_REPLIES need to be switched

#

If you were using PyCharm it has a button which sorts all the imports for you (don't know if VSC has this)

sour viper
sour viper
static canyon
#

Builtin = in stdlib (comes with Python)
External = installed with pip
Project = any file made in the project that you import (e.g. the from bot.bot import Bot)

sour viper
#

That did it, its resolved

static canyon
brisk brook
#

Any objections to sir-lancebot#871? I would like to get hangman loaded back into the bot

dusky shoreBOT
brisk brook
#

Do I need some form of approval for this?

green oriole
#

You can go for it @brisk brook

brisk brook
#

Alright!

sour viper
#

Guys, so I just committed my code to my repo which I forked and I had configured precommit so I think its all good, how does one go about creating a PR ?

gritty wind
#

Check out the main page of your fork on GitHub, it should show you a button to create a PR from that branch

#

GitHub has a picture guide on this

sour viper
#

Does someone need to assign the issue to me to proceed with this ?

gritty wind
#

We require that you have the issue assigned to you to avoid confusion, and two people doing the same work. You technically don't need that to open the PR, but it's part of our contributing rules

sour viper
gritty wind
#

I see that you requested an assignment already

#

let me just

sour viper
#

I commented a week ago on this issue, it was unassigned from the last person, I don't think anyone was working on it

gritty wind
#

Usually, we get around to assignments quicker than that, if it happens again, feel free to bump the issue πŸ˜…

sour viper
#

Nah no problem ! I thought there would be more important things going on than game commands so it was on hold

#
Added 2 files
anagram.py - Has the code for anagram command
anagram.json - Contains all the words for anagram command

## Relevant Issues
<!--
It is mandatory to link to an issue that has been approved by a Core Developer, indicated by an "approved" label.
Issues can be skipped with explicit core dev approval, but you have to link the discussion.
-->

<!-- Link the issue by typing: "Closes #<number>" (Closes #0 to close issue 0 for example). -->


## Description
<!-- Describe what changes you made, and how you've implemented them. -->

## Did you:
<!-- These are required when contributing. -->
<!-- Replace [ ] with [x] to mark items as done. -->

- [x] Join the [**Python Discord Community**](https://discord.gg/python)?
- [x] Read all the comments in this template?
- [x] Ensure there is an issue open, or link relevant discord discussions?
- [x] Read and agree to the [contributing guidelines](https://pythondiscord.com/pages/contributing/contributing-guidelines/)?
#

So this block, can someone guide me through this I had some questions about this

gritty wind
#

Anything in particular?

sour viper
#

Do i need to remove all the <!-- from the block > ?

gritty wind
#

They're comments, so they won't show up in the end product

#

So it's up to you

#

(You can also see what the end product will look like in the preview tab)

sour viper
#

Oh didnt notice that before, that will cover all my doubts !

#

I just created the PR sir-lancebot#874 , do I need to notify anyone for review or its automated workflow

dusky shoreBOT
gritty wind
#

If you have anyone in particular you think should be reviewing this (for instance they said they will, or it's related to other work they are doing), you can ping them on the issue

#

Otherwise

#

People look through all the open PRs for things that need reviewing

#

So now, your next step is to kick back and relax while the reviews come in

sour viper
#

yay my first PR to an actual open source project ! I originally wanted to work on Hangman but when I started to work on that and looked at issue it was assigned and someone already had coded that

cold island
#

Where can I find on the site repo the code for the top bar with all the buttons?

#

Ah found it

#

Ok, looking for help with CSS and/or JS in django templates

#

I must be missing something simple

#

Basically I want to have an element that can be collapsed.

Bulma has a bulma-collapsible extension that should make it painless https://bulma-collapsible.netlify.app/usage/#collapsible-card
But if I dump this code into one of the pages on the site, it appears collapsed but the action of expanding it doesn't work (made sure that the extension is loaded).

So I tried to tinker with more "self-reliant" code. So I tried to add parts of this to see what would happen https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_collapsible_animate
It works when I place it in its own file, but when I place it into one of our pages the page is blank. It appears again when I remove the styling

#

If I try to only take the JS from the second link, basically the same thing happens as in the first instance

gritty wind
#

I've found that with django templates, it's never simple

cold island
#

Appears collapsed, because that's the styling, but the button doesn't work

#

Yeah, unfortunately every single page is loaded via templates for the navbar at the top

gritty wind
#

Can you also share the template you're editing?

cold island
#

I'm not editing a template

#

It's inserted into a template automatically

#

This makes the content of your HTML/MD under the site navbar

gritty wind
#

My best guess is the styles are being applied in a larger scope than you're intending

#

If you can share the page or the product html, I may be able to give more helpful advice

cold island
#

The style works, the JS doesn't

#

This is the same JS from the w3 link which I confirmed to be working in a standalone page

#

Alternatively making the bulma-collapsible snippet linked work will be even better

trail pilot
#

@brisk brook Should I make a new PR to fix the messages in all channels thing

#

And only lock it to a channel

#

and remove multiplayer?

#

Ah wait, I just saw your issue

#

sir-lancebot#873
^^ important issue that reintroduces hangman but removes not checking the channel only

thorny obsidian
#

coveralls is still down?

static canyon
#

Under maintenance apparently

gritty wind
#

Maybe it’s gone forever and we never have to worry about coverage again

thorny obsidian
#

I can only hope

cold island
#

@patent pivot is it possible to disable coveralls for now? just makes tests fail atm

patent pivot
#

I can probably make the check unenforced, yeah, I'm in the canteen right now though, so will be a bit

cold island
#

no rush

brisk brook
#

(Sorry for not catching these bugs earlier)

Also to be clear @trail pilot, this is not your fault. Don't worry about it. Your PR received so many reviews and during the whole window of it being opened nobody noticed, the blame can't be put on you

trail pilot
#

I suppose, I'll be more cautious in the future with bugs nevertheless

#

I'll trya nd test out some edge cases for .challengse

#

challenges

fallen granite
#

hey guys, I wanted to contribute to some open source projects. Do you guys have any projects that would be suitable for me to tackle? I have a pretty basic / intermediate level of understanding. I know recursion, some basic coding principles like OOP, etc. I also coded several full stack projects.

vale ibex
fallen granite
#

Someone referred me to here from the general thread

vale ibex
#

A few of us here have, including myself

#

.src

dusky shoreBOT
vale ibex
#

I can't even remember how I did it

#

Just the fallout πŸ˜…

#

I'm sure if you go searching enough in this channel you'll find it lol

brisk brook
molten perch
#

Hey! Could someone take a look at sir-lancebot#857 ? πŸ™‚

brisk brook
brisk brook
fallen granite
#

Do you guys do pair programming on prs?

dim pelican
#

Sure, depends on the person and if they are willing to work with each other

fallen patrol
#

Partially.

#

It shouldn't show legitimately deleted channels cc @gritty wind

cold island
#

I think this is a copy paste from a sir lancebot decorator

fallen patrol
#

]e

fading flickerBOT
cold island
#

Yeah I agree, this shouldn't show hidden channels

gritty wind
#

It’s just a hard coded string

cold island
#

They're not deleted yet fwiw

fallen patrol
#

Ah

gritty wind
#

I mean, someone wanna PR it?

#

If they aren’t deleted, idk what to tell you

#

It’s just ID mentions

fallen patrol
gritty wind
#

It isn’t

fallen patrol
#

Ah, cool

#

But the snekbox is since it was just one change...?

gritty wind
#

It isn’t

#

Also definitely not a one line change

#

I basically rewrote half the docker file

fallen patrol
#

Welp time to raid your github

#

πŸ˜” only 11 repos

gritty wind
#

It should be fairly simple, update a couple constants, but now that I think about it, it may be an environment variable

fervent sage
#

you missed the perfect opportunity for snekbot

gritty wind
#

I've updated the variable now

glacial pagoda
#

]e

fading flickerBOT
patent pivot
#

we'll bump snekbox to 3.10 on release, as soon as there is a docker image

gritty wind
#

Why… would we do that

vale ibex
#

@gritty wind @cold island since we talked about it earlier bot#1834

gritty wind
#

πŸ‘Œ πŸ‘Œ

vale ibex
# dusky shore

FWIW @clever wraith I think this is what's causing issues with @slow bone too

fallen patrol
#

Yknow, issues with modmail will never be fixed if they aren't reported upstream

vale ibex
#

this be why I'm making a PR πŸ˜›

fallen patrol
#

lol

vale ibex
#

IG this is useful for you to know for your bot too, if you're not already doing this

fallen patrol
#

You can also dm the modmail bot @hollow dagger to report a bug

#

I'm staff on kyb3r's modmail

#

conflict of interest eh?

vale ibex
#

We had to fork kyb3r's modmail

#

since they don't push to dockerhub anymore

#

😦

fallen patrol
#

where's the fork

#

0.o

vale ibex
fallen patrol
vale ibex
#

yea, that's the way to do it

fallen patrol
#

also will have support for pypi installation soon

vale ibex
#

as long as you're tagging with a commit hash too, so people can pin

fervent sage
#

forbiddenfruit :)

gritty wind
#

That seems like a very niche scenario that’s not worth the infra hit

fallen patrol
fervent sage
#

ours does iirc

fallen patrol
#

yes

fervent sage
#

!e import forbiddenfruit

stable mountainBOT
#

@fervent sage :warning: Your eval job has completed with return code 0.

[No output]
fervent sage
#

just modify the dict object with your own bitwise ops KEKW

fallen patrol
#

@vale ibex so right now I'm not waiting for the guild to be ready before loading anything, because for the most part, I've been skipping the cache when possible. Could you give some tracebacks from @stable mountain not having the member cache so I can try to plan for something which I can't particulary test for given I'm not on a huge guild? πŸ˜›

vale ibex
#

it's mostly just when doing get_member we assume if it's None, then that user isn't in the guild

#

when actually it could be that they're just not in the cache

fallen patrol
#

ah

#

smh

#

so

#

tldr not something that affects me

#

since I've been fetching the user if it is none

vale ibex
#

Sure, that works

fallen patrol
#

hmmm

vale ibex
#

or you can do guild.chunk() on boot

#

and then always rely on the cache

fallen patrol
#

how long does a guild.chunk() take?

vale ibex
fallen patrol
#

if you were to int e it right now

#

i'm curious if that is worth the time that it takes to chunk the whole guild

#

!d discord.Guild.chunk

stable mountainBOT
#

await chunk(*, cache=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Requests all members that belong to this guild. In order to use this, [`Intents.members()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.members "discord.Intents.members") must be enabled.

This is a websocket operation and can be slow.

New in version 1.5.
vale ibex
#
import time
start = time.perf_counter()
await guild.chunk()
print(f"Took {time.perf_counter()-start} seconds")
fallen patrol
#

!int e...

cold island
#

shhh let him figure it out

fallen patrol
#

lol

cold island
#

oh he just did that elsewhere

vale ibex
#

yup, it's running lol

fallen patrol
#

for pydis it may be useful but it does not seem particularly useful for a bot which mainly replies to users who just sent a message and are therefore mostly in the cache

vale ibex
#

This is a websocket operation and can be slow.
It's not wrong

fallen patrol
#

for modmail it does not seem super useful to cache the entire server

#

when like

cold island
#

still running lol

fallen patrol
#

50 people or so dm it a day

#

idk how many actually use the modmail here...

#

how many use modmail? πŸ˜›

vale ibex
#

!ping

stable mountainBOT
#
Pong!
Command processing time

69.226 ms

Python Discord website status

Healthy

Discord API latency

100.671 ms

vale ibex
#

ok it's not killed the bot, it's doing it in the background

fallen patrol
#

lol

vale ibex
cold island
#

async ^ tm

fallen patrol
vale ibex
#

yea, but an await could be blocking within the actual coro

#

if it doesn't yield

fallen patrol
#

true

#

i think its actually a subprocess or a thread in this case

#

idk

#

oh

#

what's the server member count

#

!guild

stable mountainBOT
#
Server Information

Created: <t:1483877013:R>
Voice region: europe
Features: THREE_DAY_THREAD_ARCHIVE, WELCOME_SCREEN_ENABLED, INVITE_SPLASH, ANIMATED_ICON, PARTNERED, NEW_THREAD_PERMISSIONS, VIP_REGIONS, PREVIEW_ENABLED, THREADS_ENABLED, SEVEN_DAY_THREAD_ARCHIVE, MEMBER_VERIFICATION_GATE_ENABLED, NEWS, ROLE_ICONS, RELAY_ENABLED, COMMUNITY, DISCOVERABLE, VANITY_URL, PRIVATE_THREADS, BANNER
Roles: 88
Member status: status_online 48,649 status_offline 206,738

Members: 255,387

Helpers: 43
Moderation Team: 19
Admins: 12
Owners: 3
Contributors: 18
Leads: 11

Channels: 234

Category: 30
News: 8
Staff: 63
Stage_Voice: 2
Text: 122
Voice: 9

gritty wind
#

A lot

fallen patrol
#

255,387

#

well uh

#

please ping me when its done πŸ‘€

#

!remind 15m chunking done yet?

stable mountainBOT
#
Alright.

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

fallen patrol
#

related

#

bot#1834 -- don't merge yet. Because of how long it takes, it could have problems with where that event is waited for. In addition, that event is called every time this guild comes up after an outage. This could be problematic because it would be calling await guild.chunk() multiple times while the other ones are still running. I think this pr could be a major source of problems and should be investigated further

gritty wind
#

Time to create a long lasting cache

#

Redis to the rescue

vale ibex
#

but yea, I think depending on how long it takes, this might not be the way to go

#

we might need to do a get_or_fetch approach

fallen patrol
#

there's a few other things that should exist

stable mountainBOT
#

discord/guild.py lines 884 to 886

@property
def chunked(self) -> bool:
    """:class:`​bool`​: Returns a boolean indicating if the guild is "chunked".```
fallen patrol
#

await guild.chunk() doesn't actually check this property i believe

#

yeah, doesn't seem to be checking that variable

vale ibex
#

it does within state.chunk_guild

#

it checks if there's a request in progress

stable mountainBOT
#

discord/state.py lines 1051 to 1060

async def chunk_guild(self, guild, *, wait=True, cache=None):
    cache = cache or self.member_cache_flags.joined
    request = self._chunk_requests.get(guild.id)
    if request is None:
        self._chunk_requests[guild.id] = request = ChunkRequest(guild.id, self.loop, self._get_guild, cache=cache)
        await self.chunker(guild.id, nonce=request.nonce)

    if wait:
        return await request.wait()
    return request.get_future()```
vale ibex
#

yea

fallen patrol
#

that will run if there is not a request.

vale ibex
#

yea, so it won't duplicate chunk requests

fallen patrol
#

however there's guild.chunked which checks if the list is the same

vale ibex
#

if there is already one for that guild id

fallen patrol
#

i thiiink you're missing the other part I'm checking

#

or I'm missing your part

vale ibex
#

I was referring to your point of

This could be problematic because it would be calling await guild.chunk() multiple times while the other ones are still running

fallen patrol
#

ah, I moved past that πŸ˜…

#

if the guild is already chunked, I do not see code in state that checks if the guild is already chunked

#

which would be as simple as if not guild.chunked:

vale ibex
#

Ah right, we do that within our on guild available

#

since we set a _guild_available flag

fallen patrol
#

is the chunker still running?

vale ibex
#

no, so the idea is once the chunker finishes, we would set that flag

#

so if the event fires again while the bot is still running, we won't re-chunk

fallen patrol
vale ibex
#

but since the fact that this chunk still hasn't finished, I don't think we're gonna go with this approach anyway

fallen patrol
#

@fervent sage ^

vale ibex
#

Yea, I've been running ```py
import time
start = time.perf_counter()
await guild.chunk()
print(f"Took {time.perf_counter()-start} seconds")

in another channel
#

Since

#

!sf 889254608852094996

stable mountainBOT
#
Snowflake

889254608852094996
Created at 2021-09-19 21:00:20.302000 (<t:1632085220:R>).

fallen patrol
#

lmao

vale ibex
#

unless I'm doing something stupid

fallen patrol
#

hmm

#

could you check guild.chunked?

vale ibex
#

!int e print(guild.chunked)

stable mountainBOT
#
In [9]: print(guild.chunked)
False```
fallen patrol
#

smh

#

that code is kinda useless but ig accurate

stable mountainBOT
#

discord/guild.py lines 894 to 897

count = getattr(self, '_member_count', None)
if count is None:
    return False
return count == len(self._members)```
fallen patrol
#

curious how off they are

#

since that is likely to always be false on a guild this big

vale ibex
#

!server

stable mountainBOT
#
Server Information

Created: <t:1483877013:R>
Voice region: europe
Features: THREE_DAY_THREAD_ARCHIVE, WELCOME_SCREEN_ENABLED, INVITE_SPLASH, ANIMATED_ICON, PARTNERED, NEW_THREAD_PERMISSIONS, VIP_REGIONS, PREVIEW_ENABLED, THREADS_ENABLED, SEVEN_DAY_THREAD_ARCHIVE, MEMBER_VERIFICATION_GATE_ENABLED, NEWS, ROLE_ICONS, RELAY_ENABLED, COMMUNITY, DISCOVERABLE, VANITY_URL, PRIVATE_THREADS, BANNER
Roles: 88
Member status: status_online 46,840 status_offline 208,553

Members: 255,393

Helpers: 43
Moderation Team: 19
Admins: 12
Owners: 3
Contributors: 18
Leads: 11

Channels: 234

Category: 30
News: 8
Staff: 63
Stage_Voice: 2
Text: 122
Voice: 9

fallen patrol
#

πŸ₯Ί

vale ibex
#

!int e ```py
print(len(guild._members))
print(getattr(guild, '_member_count', None))

stable mountainBOT
#
In [10]: print(len(guild._members))
    ...: print(getattr(guild, '_member_count', None))
    ...: 
8241
255392```
vale ibex
#

lol

fervent sage
#

hang on jesus christ i've just looked at the chunking code for discord.py

#

its uh

#

a mess

vale ibex
#

dude the chunk request code is something

fervent sage
#

but it doesnt look efficient

fallen patrol
#

this is probably entirely not feasible

fervent sage
#

do we have a bot in here that can be quickly tested with something

fallen patrol
#

@brisk belfry?

vale ibex
#

depends on the test lol

fallen patrol
#

^

fervent sage
#

I want to try explicitly enabling the chunk_guilds_at_startup=True in the bot's constructor

#

i think its called that

fallen patrol
#

hmmmm

#

chunk_guilds_at_startup (bool)

indicates if on_ready() should be delayed to chunk all guilds at start-up if necessary. This operation is incredibly slow for large amounts of guilds. The default is True if Intents.members is True.

#

!d discord.Client

stable mountainBOT
#

class discord.Client(*, loop=None, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client").
fervent sage
#

I have chunk_guilds_at_startup enabled for GTA Online's bots, and they are online within about ~5 seconds of running the file

vale ibex
#
        try:
            chunk_guilds = options['fetch_offline_members']
        except KeyError:
            chunk_guilds = options.get('chunk_guilds_at_startup', intents.members)
#

this is in state.ConnectionState

fervent sage
#

they renamed it and wanted backwards compat iirc

fallen patrol
#

yeah

#

because discord renamed it

vale ibex
#

yea, so if it's not explicitly set, it'll use the member intent anyway

fervent sage
#

hmmm

cold island
fallen patrol
fervent sage
#

frankly what I'd say at this point is just accept that state is not something that can be handled at this scale with the discord api and make resilient commands

fallen patrol
#

or better yet don't rely on the member cache-- if a user isn't in the member cache ^^ then fetch them

#

they get added to the cache anyhow if using bot.fetch_member/user

vale ibex
fervent sage
#

though, again, i find it really really strange we're having this issue here, since on a server with 100K more members all works fine

vale ibex
fallen patrol
#

I wonder

vale ibex
#

!raw 563594791770914816-889254608852094996

stable mountainBOT
#
== Raw message ==

!int e `​`​`​py
import time
start = time.perf_counter()
await guild.chunk()
print(f"Took {time.perf_counter()-start} seconds")
`​`​`​
vale ibex
#

this isn't broken right?

fallen patrol
#

i wonder if its actually caching the entire server

fervent sage
#

the only thing i can imagine affecting it is stuff like RELAY_ENABLED stuff in guild features, but relay is a message and event distribution thing, it should affect members

fallen patrol
#

and discord even said that they don't use that anymore shrug

gritty wind
#

If you want to toss it into a bot here, could try 3.10

#

Not critical and will auto deploy

#

But like to do that you’d have to do it now cuz I need to approve before I sleep

fervent sage
fallen patrol
#

is that bot's source public?

fervent sage
#

sadly not

#

I wanted it to be but got told no lol

vale ibex
#

That command is just jishaku tho right?

fervent sage
#

jishaku shouldnt modify anything that would affect the output of that

vale ibex
#

lol

fallen patrol
#

smh

vale ibex
#

arthur jsk py ```py
(len(_guild._members),
getattr(_guild, "_member_count", None))

radiant merlinBOT
#

(7, 255040)

fervent sage
#

i copied the message from here then modified it until it was jishaku compatible KEKW

fallen patrol
vale ibex
#

no member intent lol

fallen patrol
#

ah..... okay.

vale ibex
#

@stable mountain is the only one with member intent afaik

#

don't think @radiant merlin has it yet

#

may be wrong

fallen patrol
#

so the 7 users are the 7 users who interacted with the bot

fervent sage
#

wouldnt @viscid badge have it too

fallen patrol
#

yah

vale ibex
#

this is true

fallen patrol
#

and @slow bone

fervent sage
#

arthur

vale ibex
#

arthur doesn't lol

fallen patrol
#

arthur help

fervent sage
#

that should have cached me lol

fallen patrol
#

yeah same here

fervent sage
#

even just saying arthur

vale ibex
#

ok, out of the bots I care about, only Python has it

#

sorry Dave

fallen patrol
#

ah

#

makes more sense

fervent sage
#

if you need me to look at things on gtao and see if they line up please ping me, its fun to solve scaling issues KEKW

vale ibex
#

or does it?

fallen patrol
#

if it does, then this is a discord problem probably lmao

vale ibex
#

Since it's still running in Python

fervent sage
#

no it makes the bot cry and stop responding to gateway heartbeats

vale ibex
#

lol

fallen patrol
# vale ibex sorry Dave

did I mention I'm building a whole api to my modmail bot so ppl can add stuff to all features? πŸ‘€ eg you could add a stats counter to modmail and get all of the info for metricity

#

offtopic flex

vale ibex
#

nice

#

So ooi, what do you do to ensure the member cache is populated?

#

or is gtao not in d.py?

fallen patrol
fervent sage
#

It's running dpy2.0

fallen patrol
#

hmmm

vale ibex
#

does that change things?

fervent sage
#

hm actually

fallen patrol
#

yes

#

that would have been nice to know

fervent sage
#

lester may still be on 1.7.3

fallen patrol
#

please

fervent sage
#

yeah its still on 1.7.3

fallen patrol
#

damn

#

Big Changes

  • Performance of the library has improved significantly (all times with 1 process and 1 AutoShardedBot):
    • 735 guilds boot up time (with chunking): 57s/1.7 GiB RAM -> 42s/1.4 GiB RAM
    • 27k guilds boot up time (with chunking): 477s/8 GiB RAM -> 303s/7.2 GiB RAM
    • 48k guilds boot up time (without chunking): 109s -> 67s
    • 106k guilds boot up time (without chunking): 3300s -> 3090s
fervent sage
#

thats guilds not members per guild btw

vale ibex
#

I mean we're way beyond those times already, for 1 guild

fervent sage
#

so not representative of our issue

fallen patrol
#

still useful

fervent sage
#

hang on

#

what I can do is boot up a test bot on gtao using dpy2.0

#

see how that changes things

sharp timber
#

There's a decent chance there's a bug in there

#

Especially since dpy2.0 was never officially released

fallen patrol
#

...

vale ibex
#

@stable mountain is still on 1.7.3

fallen patrol
#

why is this needed

#

all bots on gateway v9 get events for all threads

vale ibex
#

Mostly so it appears in the member list

fallen patrol
#

πŸ˜”

#

not necessary but w/e

#

hell, for a while, bots on gateway v7 and so forth were getting thread events when they weren't supposed to

sharp timber
#

I have a feeling all bots + all threads events is not likely to remain the case in the future

vale ibex
#

!int e print(bot.is_ws_ratelimited())

stable mountainBOT
#
In [11]: print(bot.is_ws_ratelimited())
False```
vale ibex
#

πŸ€”

fallen patrol
#

because of the changes to get us off the gateways?

sharp timber
#

Discord will limit thread events so bots not in the thread won't see them for one reason or another, perhaps behind another intents change

#

Pure speculation but it's a very low hanging performance fruit for them

fallen patrol
#

true

fallen patrol
#

er, 30 minutes, I don't think its stopped yet

fervent sage
#

dpy 1.7.3 on top, 2.0 on bottom

fallen patrol
#

!snf 889254608852094996

stable mountainBOT
#

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

vale ibex
#

!snf 889254608852094996

stable mountainBOT
#
Snowflake

889254608852094996
Created at 2021-09-19 21:00:20.302000 (<t:1632085220:R>).

vale ibex
#

lol

#

still going

fallen patrol
#

47 minutes ago sheesh

#

lmao I just realised, I only asked you to run that for information which is useful towards modmail πŸ˜‚

vale ibex
fervent sage
#

at this point im just gonna attribute it to "discord randomly hates pydis" since other things have broken just here too

stable mountainBOT
#

bot/bot.py line 203

_intents = discord.Intents.default()  # Default is all intents except for privileged ones (Members, Presences, ...)```
sharp timber
#

bot._get_state()._chunk_requests

#

Mind printing this chris?

vale ibex
#

I wonder if it's because the MemberCacheFlags are inferred from intents

fallen patrol
stable mountainBOT
#

bot/bot.py lines 47 to 48

self._connector = None
self._resolver = None```
thorny obsidian
#

Is it typing events 2: electric bugaloo type of scenario?

vale ibex
#

and we disable some intents

fallen patrol
#

the fact that the bot is making its own connector... i wonder if that has any cause

vale ibex
#

!int e print(bot._get_state()._chunk_requests)

stable mountainBOT
#
In [12]: print(bot._get_state()._chunk_requests)
{}```
vale ibex
#

πŸ€”

sharp timber
#

er

#

Then

#

it's not chunking anymore

#

and it's just broken

fallen patrol
#

i think its worth trying to test those since they're different from the one's that alec is using

vale ibex
#

There's no logs

#

or anything in sentry

fallen patrol
#

this may be an eval bug

#

partially*

sharp timber
#

It's possible that we sent a chunk request and discord simply hasn't responded to it

fallen patrol
#

that too

#

but i wonder...

fervent sage
#

we're on 1.7.3 still?