#dev-contrib

1 messages · Page 111 of 1

gritty wind
#

env var

#

you don't actually need to set it

vocal prairie
#

Why don't you use 🗑️ instead? Wouldn't it be simpler?

gritty wind
#

it's optional

gritty wind
vocal prairie
#

Oh

#

Got it

merry ember
#

Ok, I can honestly not see that in the instructions so unless I'm completely lost it should maybe be added?

gritty wind
#

It wasn't even an env var until recently

#

Because you don't need it

#

We are currently in a wiki freeze

#

so the guide can not be updated

thorny obsidian
#

It's not in the instructions >_>
(I struggled with this like 2 weeks ago too)

gritty wind
merry ember
#

I get an emoji error or something like that, and I get no default emoji, it's just not there at all.

gritty wind
#

If you try to paginate, you'll get a warning, but pagination will still work

#

basically unused everywhere else

merry ember
#

Ok

vocal prairie
#

Can I request a quick review on site#476 from someone? It just add the timeline to the navbar the same way we discussed here a month or so ago

dusky shoreBOT
patent pivot
#

approved

gritty wind
#

Hmm I can't checkout the branch

#

got it

#

policy bot is having the same issues as me

#

It can't check out

#

Was the branch deleted?

#

entire fork was deleted

#

@patent pivot can you force merge

patent pivot
#

oh that's what caused that error

#

hmm, yeah

#

I think I can

#

merged

gritty wind
#

This seems unrelated, but the test runner gave:

Unable to parse the GitHub repository metadata from response!

vocal prairie
#

Thank you both!

#

So for the website search, it'll have to by implemented it manually I guess.

gritty wind
#

I'd think someone made a django search plugin at some point in time

#

If not, we could make one, but that should probably be standalone

vocal prairie
#

We moved away from Django though, right? Or does that include html/md

gritty wind
#

Well, we are moving away from django for the backend

#

But isn't this for the frontend?

#

backend being API, frontend being site

vocal prairie
fervent sage
#

oh speaking of that stuff, is the backend stuff gonna be in a separate repo or just a different folder?

gritty wind
#

separate repo

fervent sage
#

right, that should make my brain explode less kek

#

fastapi is one of my favourite toys frameworks so i look forward to being able to help on that

gritty wind
#

~~Anyone who says fastapi is good, has never tried starlette. Fastapi is starlette ~~ - QoL

#

not a topic for this channel

#

For the search, the MD files are just static content

#

Isn't there a plugin to search static content?

#

Timeline is live now, thanks @vocal prairie

vocal prairie
dry folio
#

guys if i resolve a review on a pr will the reviewer receive a notification?

gritty wind
#

No, but they may if you pushed commits

#

You can leave a comment telling them you resolved it, or you can re request review once all changes are done

dry folio
gritty wind
#

Yeah that's fine

#

Also, they do get a notification on the comment

dry folio
gritty wind
#

Opened a fix for the ping problems

#

It's a small PR if someone would like to review

gritty wind
#

interesting

#

how are you running?

fervent sage
#

pipenv

gritty wind
#

what do you have in your config?

#

for site mainly

fervent sage
#

localhost:8000

gritty wind
#

what about schema?

fervent sage
#

1 sec

gritty wind
#

oh I know

fervent sage
#

http

gritty wind
#

you can't do ping on localhost

#

you have to use pythondiscord.local

#

it's in the guide for hosts

fervent sage
#

switched to using etc/hosts and those entries, still getting the same issue

patent pivot
#

hmmm

#

are you on windows

#

oh, no, root

fervent sage
#

etc/hosts :P

patent pivot
#

huh

sleek steppe
#

Works fine for me

patent pivot
#

oh yeah

sleek steppe
#

don't mind the pfp

patent pivot
#

that's super weird lol

#

I've had similar things on macOS

gritty wind
#

did you update your config?

fervent sage
#

yup

patent pivot
#

but not with bot

fervent sage
#

there's a debug log that shows pythondiscord.local resolving to 127.0.0.1 so i assume it gets resolved and then the socket is like "hang on thats localhost nop"

gritty wind
#

Not really sure what's up then

#

Could you

#

print the value of url on line

#

45

#

print(url)

fervent sage
#

wil do

#

pythondiscord.local

gritty wind
#

that shooould be correct I think

#

I'll spin up a linux machine to test this on

#

what os are you on?

fervent sage
#

Mint 20

#

ubuntu 20 should be a good enough similar one that's available on things like linode

gritty wind
#

yup yup

#

I have one with docker ready to go, should be easy enough to test

fervent sage
#

Stackoverflow:

You cannot create an ICMP packet without root privileges as it needs a raw socket which is only allowed to be created by root user. This is not a limitation of module but system.

gritty wind
#

hm

fervent sage
#

it might just be one of those things™️ that just needs to be lived with

gritty wind
#

worst case scenario, I'll add a try/except

#

with another error

fervent sage
#

I was today years old when i learned:

BTW, You may argue that "Oh I have ran ping with normal user millions of times". Try ls -l /bin/ping, you will see -rwsr-xr-x 1 root root, that means ping has SetUID. More information about SetUID, you can google it. In short, SetUID gives normal user root privileges when executing ping.

patent pivot
#

setuid is a magical devil

merry ember
gritty wind
#

You can ask around here, and if someone wants to work on it, you can both get assigned

#

You can also say as much on the issue

fervent sage
#

give me a few minutes to google how it might be done, if its not too difficult i may volunteer to help :P

merry ember
#

I don’t know which API would be used, I’ve worked with Spotify but that may be overkill?

#

Anyway, it would feel good to work together with someone more experienced. :)

fervent sage
#

probably lastfm, it has a decent api which is fairly easy

merry ember
#

Ooh, that’s sweet.

#

I generally only listen to Irish folk music, can be nice to broaden one’s views. 🙃☘️

fervent sage
#

oki ive taken a look and it looks fun, im happy to help out :P

gritty wind
#

you can both leave comments and I'll assign you

#

I think alec may actually be able to assign you both

fervent sage
#

yup

#

i'll wait for magic's comment so i know their gh kek

midnight nest
#

!ping

stable mountainBOT
#

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

merry ember
#

@fervent sage Done!

#

Yay, so exciting! Now what? :P

fervent sage
#

easiest thing will probably be for you to fork the repo and grant me push perms since you arent able to push to the main repo

#

then we can branch and begin!

merry ember
#

Excellent! I’ll grant you right away but need to sleep soon. I see you are one hour behind so that’s nice with not a too huge TZ difference.

fervent sage
#

yeah i also have some stuff to do, so maybe we start tomorrow kek

green oriole
#

Oooh that'd be it, thanks a lot!

sleek steppe
#

When sir-lancebot is sending for commands, when they don't have a signature, it has a space at the end that loks weird. Can that be changed?

gritty wind
#

@fervent sage hmmmm couldn't repro on ubuntu 20

#

Can you give me the exact exception?

fervent sage
#

cause docker runs as root

gritty wind
#

no

#

Ah

#

I am running as root

fervent sage
gritty wind
#

now I have to make a user :P

gritty wind
#

@fervent sage fix pushed

fervent sage
celest charm
#

.eggdecorate nonexistent-color @celest charm

dusky shoreBOT
#

Sorry, I don't know these colours: nonexistent-color @celest charm

celest charm
#

is this bad?

#

as in, the bot can ping like that

thorny obsidian
#

.eggdecorate asdkfasd @celest charm

dusky shoreBOT
#

Sorry, I don't know these colours: asdkfasd @celest charm

thorny obsidian
#

huh... yeah/

#

We should escape mentions

celest charm
#

I will add to the spring cleanup PR perhaps?

gritty wind
#

It's in another PR

celest charm
#

I spotted that it's just doing an f-string formatting

#

oof

gritty wind
#

I just can't remember which one

celest charm
#

is there a 4d map for PRs?

vocal prairie
#

That was supposed to be in catify

#

Idk if it was elsewhere

gritty wind
#

Ah I was thinking of another bug

fervent sage
#

we should use allowed mentions how they're designed to be used and only allow the command author to be mentioned

celest charm
#

Maybe we should treat this like SQL injection (because it hit us hard once or more), and just provide a safe method for formatting strings?

brazen charm
celest charm
#

in this case, it shouldn't ping anyone

brazen charm
#

Does discordpy's default allow every ping?

sleek steppe
#

Yes

fervent sage
#

i cant remember exactly how discord.py handles it but just using allowed_mentions=AllowedMentions(users=False, roles=False, everyone=False) in the bot's constructor and explicitly allowing it where pings are needed is the correct way

celest charm
#

oh, so it does some post-processing?

#

ok

sleek steppe
#

AllowedMentions.none()

brazen charm
#

Having it disabled by default sounds the best if it's supported by the lib

fervent sage
#

no allowed mentions are a discord feature that means the mention still appears as a mention but no ping is actually sent

celest charm
#

Should I proceed with the spring cleanup PR review?

#

or is it obsoltete/overridden/something else?

vocal wolf
#

@eternal owl reddit migration will be happening soon

eternal owl
#

I will be asleep 😅😬

#

Will fix any issues tmw after my classes

celest charm
#

How can I add a comment about something which is not a change?

#

I only seem to be able to do that with changes

vocal prairie
#

On a GitHub review?

celest charm
#

ye

vale ibex
#

you can only comment 2 lines either side of changes

eternal owl
#

Did you test the Reddit webhook@vocal wolf

vocal wolf
#

I thought @sleek steppe did

sleek steppe
#

Yeah I did

eternal owl
#

Alright

#

Cuz it's been a while I have tested

vocal wolf
#

@patent pivot you're going to need to shove secrets into @dusky shore once the reddit migration thing is done

patent pivot
#

same as the python ones?

vocal wolf
#

yes

eternal owl
#

Not config.yaml tho, env vars this time

vocal wolf
#

OK THEY'RE BOTH GREEN I'M MERGING

patent pivot
#

so REDDIT_CLIENT_ID and REDDIT_SECRET?

#

hol up

#

lo

#

i haven't

#

doe it yet

vocal wolf
#

holding

sleek steppe
patent pivot
#

is it those vars

vocal wolf
#

yes

celest charm
eternal owl
#

See the Reddit class in constants for the cars

#

Vars*

sleek steppe
#

REDDIT_CLIENT_ID REDDIT_CLIENT_ID and REDDIT_WEBHOOK but the last one is optional

patent pivot
#

uhhh

vocal prairie
patent pivot
#

do i need to specify it

vale ibex
#

REDDIT_WEBHOOK has a default for prod

patent pivot
#

oh right, optioal as in it defaults to server

#

got it

fervent sage
vocal wolf
patent pivot
#

and I can remove them from Python now

vocal wolf
#

obliterate them from python yes

patent pivot
#

alright, done for both

vocal wolf
#

turn it into yeethon or whatever the fuck it was called

patent pivot
vocal wolf
#

ok

#

merge?

#

merge.

fervent sage
#

merge!

sleek steppe
fervent sage
#

HANG ON

celest charm
#

the pain

#

in the docstring

dry turret
#

3.11 for that new patch

fervent sage
#

there's non transparent pixels in the corners of shipit

vocal wolf
#

oh

fervent sage
#

sorry kek

vocal wolf
#

lmfao

eternal owl
fervent sage
eternal owl
#

Are the bots up

sleek steppe
fervent sage
#

lance is alive

eternal owl
#

.reddit python

dusky shoreBOT
#
Command Help

.reddit
View the top posts from various subreddits.

Subcommands:
daily [subreddit=r/Python]
Send the top posts of today from a given subreddit.
subreddits
Send a paginated embed of all the subreddits we're relaying.
top [subreddit=r/Python]
Send the top posts of all time from a given subreddit.
weekly [subreddit=r/Python]
Send the top posts of this week from a given subreddit.

sleek steppe
#

!reddit

eternal owl
#

.reddit daily python

dusky shoreBOT
#

Here are today's top r/python posts!

eternal owl
#

Worked 👍

vocal prairie
eternal owl
#

Oof emojis glitches on Android

sleek steppe
vocal prairie
#

Yes it is

#

Wait, I think so

eternal owl
#

Ty @vocal wolf

vocal wolf
#

np

fervent sage
vocal wolf
#

it's finally done

fervent sage
#

yes

celest charm
#

misread as shitpit

vocal wolf
#

pybot good

eternal owl
#

Now I can sleep in peace

vocal prairie
vocal wolf
#

I mean obviously, we just obliterated stuff from it

eternal owl
#

Nd hopefully wake up early for my online class

vocal wolf
#

very nice work @eternal owl

eternal owl
#

👍

#

Also

#

There is a pagination issue

#

I think we should close that

#

I implemented a fix for it in the PR

#

Oh nvm, you closed it

vocal prairie
#

Is bot#1236 still relevant?

dusky shoreBOT
dry folio
#

@sleek steppe i have done all the changes you asked and linted it all, would you mind re-reviewing? thank you in advance!

vocal prairie
#

Same thing with bot#1120

dusky shoreBOT
eternal owl
#

I will take a look tmw @vocal prairie

eternal owl
#

!remind 8h bot#1120 bot#1236

stable mountainBOT
#
Yeah okay.

Your reminder will arrive in 8 hours!

sleek steppe
dry folio
fervent sage
#

will review now

dry folio
sleek steppe
#

Does the github webhook delete messages automatically when a comment is deleted?

fervent sage
#

nop

vocal prairie
#

Nope

#

At least, I don't think so

fervent sage
#

bear in mind github doesnt have any knowledge of how discord works or that it supports deleting wh messages, it just sends its standard thing which discord formats

sleek steppe
#

Thought so, I guess it was deleted manually 👀

fervent sage
stable mountainBOT
#

bot/exts/evergreen/trivia_quiz.py lines 245 to 246

"Game is already running..."
f"do `​{self.bot.command_prefix}quiz stop`​"```
sleek steppe
#

Also I can see black was ran lemon_eyes

fervent sage
#

actually i will add a comment just to make sure it gets resolved

dry folio
gritty wind
#

black lints with it's own style

#

we have a different style

#

linting with black will just make your life harder

dry folio
sleek steppe
#

flake8, which isn't automatic

gritty wind
#

we don't have an automatic linter

#

You can use flake8 to look for error

dry folio
#

pip install flake8?

gritty wind
#

It's already installed

#

We ship it, along with our config of it

dry folio
sleek steppe
#

you can just do pipenv run lint iirc

gritty wind
#

(a bunch of plugins)

dry folio
gritty wind
#

yeah it'll give you most errors

#

some aren't managed by flake8

dry folio
gritty wind
#

You can find the full style guide here

#

Flake8 will get you most of the way

#

but some things you'll have to check manually

#

it's isn't particularly difficult though

#

it's a very lenient style

sleek steppe
#

pipenv run lint would give 100% of the errors on lancebot since it's pre-commit

gritty wind
#

That's simply not true

#
def xyz(x: int,
        y: int,
        z: int) -> int:
    return 1

Something like this does not meet the style guide, but flake8 won't flag it, since there is no check for it

sleek steppe
#

Ah I thought you meant for the lint action

gritty wind
#

Yeah the lint action

#

nothing flags this in automatic checks

#

If this makes it into a PR, it has to be flagged manually by reviewers

#

Otherwise it will sneak in

celest charm
#

giant review

sleek steppe
#

Discord injection lol

celest charm
#

.eggdecorate yep @sleek steppe

dusky shoreBOT
#

Sorry, I don't know these colours: yep @sleek steppe

dry folio
#

@fervent sage there are so many issues about black, i'll resolve them all in one commit instead of multiple

celest charm
#

that phrase sounds... a bit grim out of context lemon_cut

celest charm
#

nvm

fervent sage
#

side note could i get reviews on sir-lancebot#722 please :P

dusky shoreBOT
celest charm
#

will do

sleek steppe
celest charm
#

do you want a comment or a proper review?

celest charm
fervent sage
#

proper review is fine, but there isnt that much really, its just 2 cogs -> 1 cog

sleek steppe
fervent sage
#

@gritty wind mind if i make the issue about the help command finding command?

gritty wind
#

Go for it

celest charm
#

hey, I suck at writing code but at least I can criticize others' code

fervent sage
#

my problem with reviewing code is that i feel bad cause i feel like im insulting them

thorny obsidian
#

Naaaah, take it like it's a teamwork exercise! The goal isn't to "fix" the code, but to see where the code can be improved as a team.

celest charm
fervent sage
celest charm
#

well, if you consider it

#

most of the codebase is written in a procedural style

#

not as a composition of objects

#

like in C, in juggles with structs (and also plain dicts)

fervent sage
celest charm
#

Are there any other PRs anywhere in dire need of review?

gritty wind
#

fature

#

lol

fervent sage
#

god damnit

gritty wind
#

close enough

sleek steppe
sleek steppe
#

Well, I guess not

celest charm
#

well, I guess I will DESTROY the pr with FACTS and APPEAL TO AUTHORITY

#

anything on bot/?

dry folio
#

@fervent sage this one is quite long, do you still want me to revert it to the long f-string?

fervent sage
#

er can you screenshot the current code

fervent sage
#

yeah, it still feels overly long

dry folio
#

i would say to keep it like this

tawdry vapor
fervent sage
#

its not awful either way

dry folio
fervent sage
#

if you like it that way keep it

gritty wind
#

sir-lancebot#727

dusky shoreBOT
gritty wind
#

mini PR if someone is looking for something to do

#

thanks

fervent sage
#

i love tiny prs kek

vale ibex
sleek steppe
#

Yes it is

dry folio
#

@fervent sage what does this mean?

fervent sage
#

is there any more context?

dry folio
dry folio
gritty wind
#
def xyz():
  """ Something.
      This is wrong.
  """
fervent sage
#

i assume its a docstring like

"""
stuff
morestuff
"""
```where it should be
```py
"""
stuff

morestuff
"""
dry folio
fervent sage
#

you know youve spent too much time staring at linting errors when you can fabricate code from them kek

fervent sage
#

i see 443 and all i think is https

#

lol

patent pivot
#

what were the assigns for bot#1567 and bot#1575

patent pivot
#

didn't you want to do one of them vco

fervent sage
#

yeah top

patent pivot
#

alr, assigning

fervent sage
#

ty

brazen charm
vale ibex
#

I did not, I'll take a look tomorrow since im in bed noa

#

!remind 19h this

stable mountainBOT
#
Yep.

Your reminder will arrive in 19 hours!

dry folio
#

@fervent sage @sleek steppe would y'all mind re-reviewing? all changes have been applied and lint passed. thanks a lot! :D

fervent sage
#

sir-lancebot#726

dry folio
fervent sage
#

:P

dry folio
sleek steppe
#

nice I got lancebot to error

dry folio
dry folio
# fervent sage done

thank you, although i have to go for now, i'll come back in about 40 mins and do the changes

fervent sage
#

oh is there no way with async rediscache to use keys() short of just using .items() and iterating?

celest charm
#

I added... quite a bit of changes

#

hopefully not too much

celest charm
patent pivot
#

yeah no keys/values rn

#

just items iirc

brazen charm
#

sounds like it could be useful, redis does provide an interface to not fetch both at the same time

patent pivot
#

yeah

fervent sage
#

well i cant imagine that namespace will ever have a huge amount of keys so items should be fine

#

this is gonna be easier than i expected

vocal prairie
#

That looks nice

sleek steppe
patent pivot
#

hmmm

fervent sage
#

I have a dilemma: since the bot dms you anyway should i bother checking if the command is in the bots channel (since it will take up even more room in chat if I send an error there), or just react with ✉️ and be done with it

patent pivot
#

hmm, didn't we say lock it to #bot-commands or DMs

fervent sage
#

im fine with locking to dms and bot-command but i cant figure out how to stop it saying i cant use it in dms kek

patent pivot
#

command specific error handler right?

#

oh wait is that handled by decorator

#

ya

#

oh wait

#

hm

#

do we just not allow any commands in DMs maybe

fervent sage
#

i think so

patent pivot
#

.help works

dusky shoreBOT
#
Query "works" not found.
patent pivot
#

so does .ping

fervent sage
#

huh

sleek steppe
#

Isn't it supposed to be @stable mountain though

fervent sage
#

^

patent pivot
#

oh

#

ya

#

hmm

#

yeah it rejects any

#

eugh

fervent sage
#

i'll just lock to bot-commands for now

patent pivot
#

also, re some of the things on the issue:

  • we should retain past channels for 1 hour, imo, it's got to be longer than the timeout duration
  • rediscache does not support key expiry, you cannot set a TTL for a child key of a HSET
  • we should sort them by order of last activity from the command invoker, "last message from you 1m25s ago"
#

we should wildly simplify the TTL difficulties by only supporting in use channels

fervent sage
#
  1. sure
  2. hmm, sounds like making a loop to flush expired keys
  3. sure, i'll store a dict of channel.id and timestamp
patent pivot
#

yeah, a loop could work, how do you plan to handle persistence of the expiry times though?

fervent sage
#

wdym?

patent pivot
#

well, how do you know when a key is stale

fervent sage
#

if i store the timestamp and i know how long the expiry time is (i.e. 3600s) i can work out whether it was last set over an hour ago

patent pivot
#

hmmm yeah I guess

fervent sage
#

this feels like it would be simpler by just making a pr to async rediscache and adding TTLs

#

lol

patent pivot
#

you can't

#

redis doesn't support that

fervent sage
#

wat

patent pivot
#

async rediscache is built around HSETs

fervent sage
#

oh

patent pivot
#

so it's effectively KKV

#

only the top K supports TTL, child keys do not

fervent sage
#

thats annoying

#

would be easier to just use raw redis lol, rediscache here just adds more complexity kek

vocal prairie
#

Can I suggest a !noeval command or something like that that explains why eval() is not a good idea if other people can use it?

#

tag*, not command

fervent sage
gritty wind
#

We don't have any commands in DMs

#

for a few reasons

#

moderation, but that's not applicable here

dry folio
#

could someone tell me how i would do that? thanks!

gritty wind
#

and debugging

dry folio
#

the read_text method

gritty wind
#

data = p.read_text()

#

is the same as

fervent sage
gritty wind
#
with p.open() as json_data:
  data = json_data.read()
fervent sage
#

i was now years old when i learned that and im gutted i didnt know about it before

gritty wind
#

you can set the encoding in read_text as well

dry folio
dry folio
fervent sage
#

yup

gritty wind
#

yes

#

is this method called on startup or during runtime?

dry folio
dry folio
fervent sage
#

ikr

gritty wind
#

If it's during runtime, use aiofiles please

remote wigeon
#

used to be bae

#

no offence to anyone who uses it

dry folio
#

also...

#

it doesn't give me a dict?

#

so it doesn't work with json?

fervent sage
#

no, you still need to load the json

gritty wind
#

aiofiles is a completely independent thing from read_text

dry folio
gritty wind
#

Don't do sync io in discord bots, because you'll block the bot while the file is read

fervent sage
#

you can use json.loads, rather than json.load, but thats irrelevant anyway since you need to use aiofiles

#

actually lemme take a look at the code rq

#

if that staticmethod is called in the cog init its fine

sleek steppe
gritty wind
#

Then you do not need to use aiofiles

fervent sage
#

oh in that case dw about aiofiles, but you will need to json.loads() the text

dry folio
remote wigeon
#
with open("path/to/file", "r") as read_file:
    data = json.load(read_file)```
dry folio
remote wigeon
dry folio
gritty wind
#

return json.loads(p.read_text())

dry folio
fervent sage
#

thats the easiest way

dry folio
#

thanks a lot!!

fervent sage
#

loads btw is short for load string - load from a string of data not a file

sleek steppe
#

I can add read_text to spring cleanup as well

fervent sage
#

such a badly named method lol

dry folio
#

alright, finished with all of decorator-factory's changes, now moving on to vcokfire's

sleek steppe
#

json.load is literally json.loads(f.read())

fervent sage
#

yup

dry folio
fervent sage
remote wigeon
#

lol

fervent sage
#

@sleek steppe question about github, how do you do the thing where you suggest changes and actually edit it so the Commit Suggestion button comes up, i've looked how for ages and never figured it out

dry folio
#

commiting the new changes now

gritty wind
#

```suggestion
new_content
```

#

the github editor does have a shortcut button for that

fervent sage
sleek steppe
gritty wind
fervent sage
#

huh that button doesnt appear for me

gritty wind
#

Where are you looking?

fervent sage
#

if i click the + button at the side and this menu comes up

gritty wind
#

Hmm that should be it

fervent sage
#

github hates me pensivewobble

gritty wind
#

and go into preview

fervent sage
#

huh, that works just no button, weird

gritty wind
#

try control+g

fervent sage
#

that just seems to open the ctrl f menu

gritty wind
#

hm

#

Interesting

fervent sage
#

well its not the end of the world if i have to type a bit, just strange

dry folio
#

@fervent sage regarding gold colour... it's not in the class

fervent sage
#

looks like gold needs adding mmLol

dry folio
#

but i was already consistent in the code by using pydis colours like you said, so should i open a new pr and add it?

fervent sage
#

do it in the same pr, since its a thing which is being added for your pr

remote wigeon
dry folio
gritty wind
#

accessing class properties is much better than accessing random keys

#

a static type checker can pick up on class props

#

which means your IDE can see it and help you

remote wigeon
#

fair enough

thorny obsidian
#

huh... TIL

dry folio
#

i think this is perfect gold lol

sleek steppe
gritty wind
#

That doesn't help the same way class props do

#

When it's a class, a static type checker can check the key names and values

#

For example:
typing Colours.bl will autocomplete to blue, and display it's value

#

it also allows you to navigate to the definition, and edit it

sleek steppe
#

True

gritty wind
#

When using a dict, your IDE may be able to figure out the types of the keys and values, but not what they are

fervent sage
#
  • it gives you dot access which is nice
fervent sage
#

review time #3 mmLol

dry folio
#

:^) i want that

fervent sage
#

i went through twice and couldnt find any other issues than the ones i pointed out, so hopefully no more changes after this set kek

dry folio
fervent sage
#

haha, well i cant find any more changes to make just by glancing over, so i'll get to testing it locally

fervent sage
dry folio
dry folio
vocal prairie
fervent sage
#

btw @dry folio if you push changes before marking as resolved then i know im able to pull & test :P

dry folio
dry folio
fervent sage
#

oh also Remaining questions: never seems to have any content

dry folio
dry folio
#

that was from the original code

fervent sage
#

ping me when thats resolved, im gonna go get some food

dry folio
fervent sage
#

lol i cant kill lance because python never has a chance to handle the keyboard interrupt kek

dry folio
fervent sage
#

looks good, the exit case works, however the remaining questions is the wrong way round, it counts up not down

#

on the plus side im now really good at the retro trivia questions kek

dry folio
dry folio
fervent sage
gritty wind
#

You should setup your IDE and pre-commit properly

#

It'll help you spend less time formatting your code

#

and will stop errors in remote linting

#

What do you use?

dry folio
gritty wind
#

what IDE do you use

dry folio
dry folio
fervent sage
#

time for me to speedrun the retro quiz again

dry folio
vocal prairie
#

There's a retro section?

dry folio
gritty wind
dry folio
#

there's only 7 questions in it tho

gritty wind
#

including line length

gritty wind
#

You should also run pipenv run precommit which will stop you from committing failing code

fervent sage
dry folio
#

now i have to commit saying "missed + 1" lmfao

fervent sage
#

fix: off by one error kek

#

me a few hours ago: sure i'll review it how long can it take?
haha hahaha boy did i underestimate that! fun though

dry folio
dry folio
#

review time #float('inf')

#

code please work, my brain can't stand it anymore...

vocal prairie
#

I can review

#

I think I have time

dry folio
vocal prairie
#

It won't officially count, but…

#

I'm terrible at actually reviewing code, but testing? Sure

dry folio
#

uh oh

#

is typing...

#

is this a bug

#

or an approval

#

im nervous

#

nervoussssss

fervent sage
#

that remind me of something a friend told me a while ago: "Can I look at your code and tell you what's wrong? Lol, no. Can i break it regardless? Hell yeah!"

fervent sage
fervent sage
#

but we are nearing the end

gritty wind
#

precommit runs pre-commit install

fallen patrol
#

Oh

gritty wind
#

It's in the guide and the Pipfile

dry folio
fervent sage
#

always remember that pydis is never worth your brain exploding and it comes after being healthy and taking breaks

dry folio
#

i got the first bug fixed

vocal prairie
#

No image for some reason

#

The bot has admin perms

dry folio
vocal prairie
#

hmm

dry folio
dry folio
#

this is the image

#

and it's supported by discord

vocal prairie
#

But why wouldn't it work now?

#

Maybe it's just my client

dry folio
vocal prairie
#

I'll try again

fervent sage
#

:)

dry folio
#

lol

vocal prairie
#

Is it alexcat or alecat?

fervent sage
#

alecat

vocal prairie
#

Like alec?

fervent sage
#

its alec not alex :P

#

ok im gonna go have breakfast kek

dry folio
vocal prairie
#

I don't like this.

#

You can just spam to get it

dry folio
dry folio
#

because or else the question's too open-answered

fervent sage
#

my counterpoint about mitigating that is that it's against the spirit of the rules, and if someone keeps abusing it to ruin other people's games they're gonna get told not to by mods

#

its just not worth the (huge amount of) effort to mitigate spam attempts

vocal prairie
#

Got it

dry folio
#

searches "What is the process by which green plants and certain other organisms transform light energy into chemical energy?" on google

#

ah, it's photosynthesis!

fervent sage
#

yeah like, in the end its for fun, and if someone cheats or spams then they:
a) are just wasting their own time
b) are wasting other people's time and will be warned for doing so

dry folio
dry folio
fervent sage
#

lmao

dry folio
#

please let da code work.......................

#

i'm praying to a programming deity, if one exists

fervent sage
#

i have

#

approved

#

(after successfully speedrunning the retro quiz for the 7th time mmLol )

vocal prairie
#

This is the pr with the most activity that I've seen so quickly

#

Two days, yet so much reviewing

fervent sage
#

I don;t think ive ever spent this long just sitting down reviewing code before lol

dry folio
# fervent sage approved

WAIT. SO I WAS ON OTN, GOT APPROVED, AND REVIEWED BY 4 PEOPLE IN ONE DAY

BEST. DAY. EVER. (in 2021)

fervent sage
#

and in light of that im gonna stand up, so bye for the next few mins

dry folio
dry folio
vocal prairie
#

See ya vco

dry folio
dry folio
fervent sage
short snow
#

800 msgs in 7 hrs 👀 , this has been the most active day

dry folio
short snow
#

if anyone needs PR to review 🙃

short snow
#

Variables should folllow snakecase right?

vocal wolf
#

yes

#

unless they're constants, in that case it's SCREAMING_SNAKE_CASE

stable mountainBOT
#

bot/exts/evergreen/trivia_quiz.py line 19

QAndA = Tuple[str, str]```
short snow
#

should i comment?

#

Q_AND_A

vocal wolf
#

ye

clever wraith
#

I’m going to make a anagrams.
The way this work;

  1. Randomly scramble words and select letters
  2. While loop, 60 second timer
  3. Await user inputs
    To make sure it’s valid, it first checks if the letters of the input include the scrambled letters.
    The way I do this is,
    I make a list with the scrambled letters
    I for loop user inputs, check if the letter is in the list. If it is, use .remove to remove the letter. If the letter is not in the list, ignore.
    If it passes the letters check, we need to see if it’s a valid word. My method is a api call to a dictionaryAPI, trying to search up the given word. If nothing is returned, that means it is invalid and doesn’t exist.
    If it is valid, I add a reaction to the message. Then, depending on the length of the word, I add points to the user via a dictionary.
    After that, I add the word to a list. If people send the same word, it’ll know by checking if the word is in the list
  4. After the timer is up, it sends the winners
#

any revisions of this thought process?

#

this gonna be m first time contributing

dry folio
#

Because it's a class

#

Which follows PascalCase

#

So..

short snow
#

it isn't a class

#

looking at other places of code in the bot, we follow snake case.

dry folio
#

PascalCase

short snow
#

umm, we would need to change this at the others places of code, i will put this on spring cleanup, thanks

#

also, there is a 🐛

#

if questions is set to 0, it will become false

#

so it won't go inside the check for question's value

#

where you have the check for less than 1

#

i will leave a comment

dry folio
dry folio
#

Also, this is from official pydocs

short snow
#

yeah i get that

short snow
#

one of your error embeds, say "You must choose to complete at least one question."

dry folio
#

Because 0 setting it to the default value is kinda natural? I've seen it in other apps, although this is my person opinion. Give me a counterargument on why this isn't ideal

dry folio
#

There's no need arguing about this

#

It does no harm whatsoever, and i like it

short snow
#

then your error embeds are conveying false information

#

and this should be documented in the code

dry folio
dry folio
short snow
#

when user says 0, it means he doesn't want to play any questions

#

and you are making them play 7 questions

#

most apps, when said 0, show a invalid option

dry folio
#

That is your opinion.

short snow
#

i dunno which apps you saw

fallen patrol
#

heads up: bot restarted, .ext unload latex 👀

short snow
fallen patrol
#

oh dope

dry folio
short snow
fallen patrol
#

sorry wrong channel

short snow
dry folio
dry folio
#

Gtg, cya

short snow
fallen patrol
#

I just crashed the bot so uh

short snow
#

ok it did now

fallen patrol
short snow
#

pong xithrus

fallen patrol
#

he's offline

#

wait no he's admin lol

#

@vocal wolf

#

.ext unload latex

vocal wolf
#

omg fine

#

.ext unload latex

dusky shoreBOT
#

:ok_hand: Extension successfully unloaded: bot.exts.evergreen.latex.

vocal wolf
#

.ext load latex

dusky shoreBOT
#

:ok_hand: Extension successfully loaded: bot.exts.evergreen.latex.

fallen patrol
short snow
#

huh, just unload

fallen patrol
#

what good did that do lol

#

it still is loaded and can quickly crash the bot

vocal wolf
#

oh

#

so you didn't want me to reload?

#

.ext unload latex

dusky shoreBOT
#

:ok_hand: Extension successfully unloaded: bot.exts.evergreen.latex.

placid ermine
#

yeah

vocal wolf
#

ah

fallen patrol
short snow
fallen patrol
#

sorry i should've made that clear

balmy sparrow
sleek steppe
short snow
#

that reminds, i need to complete my review on it

balmy sparrow
gritty wind
#

@short snow @dry folio that was a very strange argument you two had. When it gets to a point where you are attacking the person to prove a point, you should seriously start reconsidering your actions, and that goes for the both of you. Having these projects be open source is an effort to create an environment conducive to learning and growth, something that petty arguments like this does not achieve.

#

If you want a second opinion on the matter, you can have default arguments for commands in case a user doesn't pass in an input

#

For example

#

!dmrelay

stable mountainBOT
#
Command Help

!dmrelay <user> [limit=100]
Can also use: dr, relay

Relays the direct message history between the bot and given user.

gritty wind
#

If you want the command to default to 7, make 7 a default argument instead of trying to parse a random one such as 0

short snow
gritty wind
#

Ok

#

Lets try to keep things more friendly here moving forward

stable mountainBOT
#

@eternal owl

It has arrived!

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

short snow
#

@gritty wind What should i store with the unloaded cog in the unloaded_cache for sir-lancebot#705

Like a cache needs a key and a value. I couldn't think of anything useful for value, the key would be ext name.

dusky shoreBOT
short snow
#

the author id? or unload time?

gritty wind
#

Why not have one key with all the values

short snow
#

yeah i was thinking about that, where the key would be unloaded

eternal owl
#

is it recommended to use async redis cache for dicts?
Storing them by stringifying them (json.dumps)

short snow
#

No need to stringify them, you can just update the cache dict

stable mountainBOT
#

bot/exts/christmas/advent_of_code/_helpers.py lines 286 to 296

cached_leaderboard = {
    "full_leaderboard": formatted_leaderboard,
    "top_leaderboard": _get_top_leaderboard(formatted_leaderboard),
    "full_leaderboard_url": full_leaderboard_url,
    "leaderboard_fetched_at": leaderboard_fetched_at,
    "number_of_participants": number_of_participants,
    "daily_stats": json.dumps(parsed_leaderboard_data["daily_stats"]),
}

# Store the new values in Redis
await _caches.leaderboard_cache.update(cached_leaderboard)```
eternal owl
#

I did not mean bulk updating values

#

I want to store a dict as a value

short snow
#

yeah, then you would have to striingify them lemon_sweat

eternal owl
#

alright

green oriole
#

.... I forgot to push yesterday

keen valley
#

What does happened while using thing :

-> "HelpSession":

After defining a function,

Just like :

@classmethod
    async def start(cls, ctx: Context, *command, **options) -> "HelpSession":
#

What does : do here
as

ctx:Context

What does this means

subtle kraken
#

its typehinting
It doesn't really do much other than help IDE with autocompletion and suggestions
It is also form of documentation of code

#

: in that context is used to typehint a variable to specific type
while -> in this context is typehinting that the start method will return object of HelpSession type

short snow
green oriole
#

Do you? pithink

short snow
#

how did i get the link pithink

green oriole
#

The container I guess

short snow
#

iceman's rich presence lol

#

he was editing it on vs code

green oriole
#

Oh lol

short snow
#

i missed clicked on him, and then saw view git repo, clicked and boom, new project 🙃

#

what is it about

green oriole
#

It isn’t fully secret anymore though, so that’s fine

green oriole
short snow
#

man, why did i tell, i thought it was there, so i thought u will get it anyhow lemon_angrysad

green oriole
#

Oh yeah, it is internal

eternal owl
#

why are we initializing the redis cache as a class attribute and not as an instance attribute? whats the reason behind this?

eternal owl
green oriole
green oriole
#

It is bound to a specific class, not instance

eternal owl
#

ah

short snow
brazen charm
#

It uses __set_name__ to use the class var's name as its namespace, no other reason afaik but there'd be no functional difference

vale ibex
patent pivot
#

lol

short snow
#

lemon_grumpy ok, I am really curious what the project is about

patent pivot
#

time will tell

short snow
eternal owl
#

Patience, my boi

short snow
#

toxic smh, you can already see the project

fervent sage
#

👁️

deft patrol
#

oink 👀

dry folio
# gritty wind <@!736234578745884682> <@!769221607888912487> that was a very strange argument y...

lol we didn't attack each other, and regarding the default values... i'll think about that. also, the default's already at 7 when you don't pass in a questions parameter and thus i believe it is logical for 0 to work like that as well. these are simply personal opinions, like how i used blue for my "quiz game starting embed", but someone else might like green and suggest me to change it to green. i don't understand why this would do any harm

#

it is essentially the same thing: we simply have different preferences, i like 0 = default and @short snow doesn't. it's like saying i like putting bold on "Quiz game starting" and someone else doesn't. i don't think i should do all these subtle changes just because someone else likes something else, unless there's a problem with efficiency or smth

sleek steppe
green oriole
#

That’s interesting

#

Are you adding a new constant category?

sleek steppe
green oriole
#

Aah well, it isn’t private so you have ti typehint it

sleek steppe
#

the constants are private?

green oriole
#

Nah, but the file is ignored

sleek steppe
#

ah

stable mountainBOT
#

tox.ini line 17

exclude=```
green oriole
#

Is the two dots syntax really not working

sleek steppe
#

Yeah I guess it doesn't check for that

green oriole
#

Ah, I was looking at the wrong bot

#

I don’t get why this feature isn’t on sir lance, it would make much more sense there

sleek steppe
#

agreed

deft patrol
#

@sleek steppe Oh you are a helper tada

sleek steppe
#

I hope this is the last time I have to resolve merge conflicts 😔

deft patrol
#

awww

short snow
sleek steppe
#

Yeah akarys told me

short snow
#

Ah yes, just read that

celest charm
#

Is there a way to get all your reviews on github?

cold island
sleek steppe
#

I meant for this PR lol

cold island
#

Which is it? the cleanup?

sleek steppe
#

Yes

green oriole
#

sounds like an excellent idea @fervent sage, wanna write it?

fervent sage
#

yup

sleek steppe
#

Should I make an issue for sir-lancebot to use AllowedMentions.none() by default? Which would mean if you wanted lancebot to mention someone, you'd have to explicitly pass allowed_mentions

green oriole
#

We do already restrict it to mod roles, don’t we?

sleek steppe
#

Nope

green oriole
#

Or do you mean user mentions?

sleek steppe
#

Well yeah I'm talking about any mentions at all

green oriole
#

Because I’m 99% sure roles are restricted

#

I’m not sure if we want to explicitely enable mentions for every message that should ping

sleek steppe
#

Or, I could just fix the .eggdecorate command to use allowed_mentions

green oriole
#

Haha, is there a bug with this one?

sleek steppe
#

.eggdecorate @green oriole ...

dusky shoreBOT
#

Sorry, I don't know these colours: @green oriole ...

green oriole
#

lol, okay

#

not sure if that’s really an issue tbh

cold island
#

can it mention here?

green oriole
#

we probably have a lot of different ways to make that happen

cold island
#

don't do it here lol

sleek steppe
#

the .uwu command escapes the mentions

green oriole
sleek steppe
#

Does it have perms for role mentions?

cold island
#

Oh yeah we disabled most of its perms, makes sense

sleek steppe
#

I guess it's fine then

stable mountainBOT
#

bot/bot.py line 208

allowed_mentions=discord.AllowedMentions(everyone=False, roles=_allowed_roles),```
green oriole
#

It will be escaped on discord’s side either way

sleek steppe
fervent sage
dry folio
#

does anyone know who's decorator-factory's name on discord?

sleek steppe
#

It's @celest charm iirc

dry folio
celest charm
green oriole
dry folio
celest charm
#

just to add to the confusion

green oriole
#

It is

celest charm
#

yes that's me in the pfp

green oriole
#

lol

dry folio
#

hi decorator-factory :) look at the comment i sent you on github, ima go work on the fuzz ratio for dynamic questions now

dry folio
fervent sage
#

okie dokie bot#1579

dusky shoreBOT
dry folio
#

my first time using higher-order functions in projects :) hopefully this doesn't frick everything up

green oriole
#

Noice

dry folio
green oriole
#

Looks like it should work

sleek steppe
green oriole
#

Oh I forgot about that one

#

Let’s do this

fervent sage
#

cc @patent pivot

green oriole
#

Nice.

#

Where is that?

fervent sage
#

thats when i click the requirement details on the github check

#

seems to be working fine now but i definitely wasnt expecting that error

green oriole
#

Let’s look at the logs, I guess

#

Okay, it isn’t on grafana, I need my k8s creds

patent pivot
#

hmmmmmmmm

#

found it

#

request ID matches up

green oriole
#

One day they’ll fix this

#

one day

patent pivot
#

the answer is that the GitHub api query timed out, so it was probably transient at our side or githubs side

green oriole
#

Also how did you get the logs?

patent pivot
#

loki explore, it's locked to admins rn

green oriole
#

aaah

patent pivot
#

I think this is just a GitHub bug

#

with a timed out req

#

policy bot should mitigate with retries but it's not a bug luckily

#

the only bug we've had recently is that if someone deletes their fork on an open PR things get whacky

green oriole
#

I mean, it is consistenly failing on merge commits

patent pivot
#

hmmm

#

yeah, but opening up details resolves that

#

it's a GitHub side thing sadly

dry folio
green oriole
#

Well done 🙂

dry folio
#

i didn't know that you have to type hint a type hint lmao

fervent sage
dry folio
dry folio
green oriole
#

Haha

#

You should setup precommit

#

pipenv run precommit

fervent sage
#

akarys is cool

green oriole
dry folio
green oriole
#

Yep

fervent sage
green oriole
#

Hah

dry folio
#

when you get 3 approvals and lint passed and higher-order function works first try:
E X A P O G G E R S

#

still need one more core dev approval tho

short snow
#

I will give it a review