#dev-contrib

1 messages · Page 67 of 1

green mesa
#

for small fix also I need to wait for review?

#

Only 2 line I have changed

cold moon
#

Oh, @crude gyro thanks. I just finished renaming guides -> content/article(s).

green mesa
#

.issue 796 bot

green mesa
#

Can this issue get approved still waiting 😅

#

For answer

lime mural
#

you're already assigned tho?

#

Xithrius assigned it to you

obsidian patio
#

@surreal gulch Sorry about missing that solution last time around and giving it now instead. One extra commit hahah

surreal gulch
#

oh no problem

#

Im just glad I learned that

obsidian patio
lime mural
#

@green mesa ^

cold moon
crude gyro
#

yes.

cold moon
#

😭

surreal gulch
hardy gorge
#

This doesn't mean that it won't happen; just that it will probably be a separate app/microservice

#

We're planning on making some major changes to our back-end, as we're not quite happy with our current deployment automation scheme

obtuse arrow
#

Hi, this time I'm trying to run the bot and site in docker, and the bot is unable to connect to api.pythondiscord.local. I assume this is because my hosts file is not configured correctly? I set the urls up to point to localhost when I set things up to run natively before.

tawdry vapor
#

Can you access the website in your browser?

brazen charm
#

I believe you need to point them at docker's default ip (should be in your hosts file somewhere), I also needed to run the services on 0.0.0.0 isntead of localhost

obtuse arrow
#

@tawdry vapor Yes

tawdry vapor
#

Via the pythondiscord.local domain?

obtuse arrow
#

Yep

brazen charm
#

Ah should be something else then if you can connect to it

tawdry vapor
#

Do you have the bot configured to use http instead of https?

obtuse arrow
#

Yes

tawdry vapor
#

Did you include the port in the site domain?

obtuse arrow
#

Yes

ruby pulsar
obtuse arrow
#
urls:
    # PyDis site vars
    site:        &DOMAIN       "pythondiscord.local:8000"
    site_api:    &API    !JOIN ["api.", *DOMAIN]
    site_paste:  &PASTE  !JOIN ["paste.", *DOMAIN]
    site_staff:  &STAFF  !JOIN ["staff.", *DOMAIN]
    site_schema: &SCHEMA       "http://"
brazen charm
#

What is it failing with?

tawdry vapor
#

Hmm well if they're both in docker then you may need to be connecting via web:8000 instead of the domain, since web is the name of the website service in docker compose

obtuse arrow
#
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.pythondiscord.local:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
``` for example
tawdry vapor
#

That is surely the problem

obtuse arrow
#

@tawdry vapor Running both in docker is sort of made out to be the recommended option in the setup guide. I would've thought other people would run into this frequently.

tawdry vapor
#

Because the bot and site are separate containers, so the bot doesn't consider the site to be on localhost.

#

Yeah the guide says "If running the webserver in Docker, set it to "web:8000"."

obtuse arrow
#

Oh really?

#

Ah, sorry, so it does.

tawdry vapor
#

We're working on making this easier

#

I think our bootstrap project should have a short questionnaire that asks if you're using docker and whatnot, so it can automatically set the right values.

obtuse arrow
#

What do you mean by bootstrap project?

hardy gorge
#

It's basically something that sets up everything for a contributor, including a test server on Discord

tawdry vapor
#

(it doesn't exist yet)

obtuse arrow
#

Ah, I see.

#

That certainly would be nice, setting up a complete test server is no joke.

eternal owl
#

the test server setup is going to be super handy

obsidian patio
#

.issue 481

obsidian patio
#

This should be a fairly quick review

cold island
#

Sorry vest 😅

obsidian patio
#

First the command should remain the same, then it should be rewritten

#

This was supposed to be an “add one line” fix 😂

cold island
#

The loop would be kinda ok without the spaces, but the rstrip at the end makes it feel patchy

obsidian patio
#

I agree

#

Tomorrow, I’ll probably just rewrite it and make it presentable

crude gyro
#

I don't like the rstrip much either, even though I used one in my suggestion too

#

feel free to get rid of it

#

the original code using a 1, 6 range is totally a bug, by the way

#

that would not be a full set

obsidian patio
#

Yep. I’ll finish it tomorrow. In your proposal, the rstrip is probably not even needed

crude gyro
#

oh right, yeah the rstrip isn't needed in mine

#

stupid of me

obsidian patio
crude gyro
#

huh, I'll be damned.

#

turns out randint is inclusive

cold island
#

randint is incluse

#

Yeah, it always bugged me

crude gyro
#

TIL

#

that sucks

#

very inconsistent

cold island
#

yep

obsidian patio
#

Yeah

cold island
#

and they prob won't change it because it's backwards incompatible

obsidian patio
#

Sadly, yeah

#

@crude gyro would you mind if I force push the changes tomorrow, so we can get rid of this back and forth history?

crude gyro
#

it doesn't bother me if you force push to this branch, it also doesn't bother me if you don't.

obsidian patio
#

Okay. I’ll probably fix this history, then

crude gyro
#

I don't really care about linear history

#

but in this case, it also won't do much damage if you rebase, so

#

knock yourself out

obsidian patio
#

Yeah. We’ll see tomorrow

obtuse arrow
#

How does Github handle review comments when you rebase? We use Bitbucket at work and rebasing annihilates comments, so we don't allow rebasing feature branches once the first review comment has been posted.

green mesa
#

Xithrius assigned it to you
@lime mural the issue has planning label not approved label

#

So xithrius asked me to hold up until the label changes from planning to approved

obsidian patio
#

@obtuse arrow not sure. I assume they could disappear

#

Maybe I’ll just let it be 3 commits and be done with it

tawdry vapor
#

They also disappear in GH

#

Well, maybe if you load up the specific commit (which now isn't tied to any branch), then you'd still see the comments.

late wolf
#

Would someone care to explain to me the bot's actions during the lemon pinging 90k people incident.
Like why did it mute so many members, what triggered it and what would happen if the rule was triggered.

If u can answer my question pls ping me

#

also the does the bot's mutes us if we send 10 lines in 10 seconds?

subtle kraken
late wolf
#

let me look at it

green oriole
#

The newline rule triggers at 100 lines in 10 seconds

late wolf
#

Oh i did not know that existed

#

the config i meant

subtle kraken
#

Our file naming scheme is simple

late wolf
#

welll I did, but I did not know it contained the rules

subtle kraken
#

And github allows you to search for keywords in code

late wolf
#

for mutes and other stuff

subtle kraken
#

Actual code that takes action is in rules directory afaik

late wolf
#

well i wouldn't understand it anyway lol

subtle kraken
#

Reading code, running it and modifying it is a good way of learning

late wolf
#

kinda depends on the person dont u think.

Also it says burst, what does that mean?

obsidian patio
#

That’s an English word. Feel free to check in a dictionary or with some translator

subtle kraken
#

It doesnt really depend on the person unless you mean it depends whether or not the person is willing to do it to learn

late wolf
#

I meant how ther person learns

subtle kraken
#

Base to learn programming is reviewing code of others in all fairness

#

You dont learn much just from theory

late wolf
#

I see, it hasn't been much since I started programming so that's most likely the reason of my ignorant

green mesa
nocturne hare
#

Sure, they way would have to make those functions send the message. But I'll admit I thought linepaginator was a bit more.. class-y, and not so static. So you can disregard that comment

green mesa
#

ok

#

i have made the other changes and pushed it

green mesa
#

what i can add more

green oriole
#

What’s that?

green mesa
#

.issue 208

green oriole
#

That’s interesting

green mesa
#

UwU

#

anything more i can add?

green oriole
#

Maybe a field saying which LGBTQ+ community they “are in”?

green mesa
#

at footer?

#

or will i add one field

#

LGBTQ has more community?

#

i thought its one community and tim cook is member lemon_sweat

green oriole
#

Well, uhhh

#

I guess it doesn’t matter then

green mesa
#

one more question will i mention born date and stuff?

obsidian patio
#

I think that would be interesting

green mesa
#

just came to know Tim Cook real name is Timothy Donald Cook

obsidian patio
#

Wait what? Really?

green mesa
#

yes @obsidian patio

#

in footer i think i can mention Member of LGBTQ+ family

green oriole
#

Nah, I think there are enough information like that

green mesa
#

ok

#

in json i will add 30 LGBTQ famous leader info UwU

obsidian patio
#

You could add it like fields on the side

#

And remove the underline

green mesa
#

ok let me try

#

actually they are fields only

#

embed broke 😟

obsidian patio
#

Maybe awards isn’t really interesting

#

Just remember that short and readable info is key

nocturne hare
#

Where are you getting the info from?

short snow
late wolf
#

There should be more games in seasonal bot. If I can i will try to add it. but how do suggest something that can be added?

#

to bots

nocturne hare
#

Is this info not available from some api, instead of having a bunch of different jsons for each command the bot implements?

#

Make an issues on the seasonablbot repo, and have it approved. Then you can work on it, or have others do it @late wolf

late wolf
#

what is an issue?

#

idk github

#

never worked with it

nocturne hare
green mesa
#

@nocturne hare i am fetching from json i am not able to find any api for this

nocturne hare
#

Where are you getting the info from?

late wolf
#

The Python Bot has anti raid right?

green mesa
#

yes

late wolf
#

how does that work?

#

the anti raid

green mesa
#

!src AntiSpam

stable mountainBOT
#
Cog: AntiSpam

Cog that controls our anti-spam measures.

Source Code
green mesa
#

@late wolf

late wolf
#

I don't want the code. I want to know like what it does and what triggers it

patent pivot
#

I mean, the code is the best way to learn that. It isn't an ```py
if user.is_spamming():
await user.ban()

late wolf
#

well i can code it myself though, i just wanna know it's features

obsidian patio
#

If you’re looking to make an anti-spam bot, I think #discord-bots or a help channel would be appropriate

late wolf
#

i am not, i am askking the feature of the anti spam for the python bot

#

like what triggers it and which situations does it consider as "raid"

#

and what does it do in those situations

patent pivot
nocturne hare
#

compare message content to previous messages with a count in a time frame, with more

patent pivot
#

alongside that there are rules which are not public knowledge.

green oriole
#

Without going into too much details, the cog takes each filter, defined by a config entry and some code in the rules folder, gather the last x messages the filter wants, run it, and if it returns true, it mutes the user

late wolf
#

ok

green mesa
late wolf
#

compare message content to previous messages with a count in a time frame, with more
Oh ok I get it. How many same messages have to be sent to be considered as raid?

patent pivot
#

That threshold is in the bot repository

late wolf
#

ok

patent pivot
#

and frankly, I don't want to be throwing around the ins and outs of our anti-spam system to a user who isn't willing to read the code, sets off some alarm bells

late wolf
#

sorry

#

I just wanna do something similar to the bot that's why I am was asking for the details

#

I did not mean anything bad, it was not that I wasn't willing to read the code it was that I did understand it.
That's why I was asking.

patent pivot
#

i am about to push a cool new thing to the forms app

green oriole
#

Isn't the form app private though?

patent pivot
#

no

#

public repo

green oriole
patent pivot
#

i will do that

#

but I will be adding lots and lots and don't want to spam

#

about to open PR™️

#

okay just awaiting code security

green mesa
patent pivot
#

why are we not using fields there

#

non-inline ones would be perfect

eternal owl
#

hey joe, how about having a link to the official pydis website on the forms website?

patent pivot
#

yeah

#

we will

#

I don't think it needs to be super prominent, but we can have some copy at the top or put it in a footer

eternal owl
#

alright

patent pivot
#

it's fairly evident what the app is for when you reach it — I don't expect SEO to be wild on this

#

okay deployment is live

eternal owl
#

Oo the loading animation, damn

#

its awesome

patent pivot
#

(only form that is supported right now is ban appeals, even if you visit another one, there is no backend yet and the loading time is faked to demo that SWEET SWEET ANIMATION)

green mesa
patent pivot
#

that is inline fields

#

Oo the loading animation, damn
🥺

#

I uh

#

stole it from NPM lul

#

nice package called react-spinners

eternal owl
#

I might try to do that with css and js

green oriole
#

Spinner!

green mesa
#
            embed.title = f'__{pl}__'
            embed.description = self.pride[pl]["About"]
            embed.add_field(name="__Known for__", value=self.pride[pl]["Known for"], inline=True)
            embed.add_field(name="__D.O.B and Birth place__", value=self.pride[pl]["Born"], inline=True)
            embed.add_field(name="__Awards and honors__", value=self.pride[pl]["Awards"], inline=True)
            embed.set_thumbnail(url=self.pride[pl]["url"])

i am using fields

patent pivot
#

yeah, but you are setting them to inline

#

set inline=False

green mesa
#

then it shows like this

patent pivot
#

oh right

#

you have underlined the fields

#

okay

tough imp
#

we're getting seasonalbot ready for discord.py 1.5 with this PR: https://github.com/python-discord/seasonalbot/pull/478
if anyone wants to help out, you can do that by either thinking about whether there's any functionality that would break with the proposed Intents setup, or you can test your favourite features to see if they work

green mesa
#

i am confused with what are intents lemon_sweat

patent pivot
#

intents are like

#

a way of telling Discord "send me info about this, not about this"

#

so by disabling the presence intent, you don't get any updates when a user changes their custom status or goes online or offline

green mesa
#

ty

patent pivot
#

and the relevant events that are tied to them

green mesa
#

i am looking for this type of explanation only ty

patent pivot
#

👍

late wolf
#

Sorry If I am being annoying about this, I really am.
But I had a quesiton.

When multiple users send the same message does the channel get silenced or does every single person who has sent the message gets muted?

patent pivot
#

burst_shared mutes users, not channels. moderator silence channels with !shhhh

late wolf
#

ok thx

green mesa
#

we need Intents.all() right i dont know what we need to change more in cog?

tough imp
#

the approach taken is that we create an Intents instance with all options enabled, and then manually disable those that we don't want

#

this means that e.g. because of intents.bans = False, the bot will not receive any ban events

green mesa
#

we are using like everything

#

lemon_sweat so is there anything which we need to disable?

patent pivot
#

for seasonalbot? totally

green mesa
#

for seasonal bot bans can be false

patent pivot
#

kwzrd has made a good start

#

we don't need member presence

tough imp
green mesa
#

ok tnx

patent pivot
#

I need to make a PR to reduce the seasonalbot message cache

empty sluice
#

Do you think it would be possible to filter out the hyperlinks in the !docs command, or make them clickable?

nocturne hare
#

Not sure what it's based on, but maybe just make it a hyperlink as well?

empty sluice
#

Shouldn't it automatically send as a hyperlink, though?

#

It works for other documentation pages.

#

!d discord.TextChannel

stable mountainBOT
#
class discord.TextChannel```
Represents a Discord guild text channel.

`x == y` Checks if two channels are equal.

`x != y` Checks if two channels are not equal.

`hash(x)` Returns the channel’s hash.

`str(x)` Returns the channel’s name.

`name` The channel name.

Type [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.8)")

`guild` The guild the channel belongs to.

Type [`Guild`](#discord.Guild "discord.Guild")

`id` The channel ID.

Type [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.8)")

`category_id` The category channel ID this channel belongs to, if applicable.

Type Optional[[`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.8)")]

`topic` The channel’s topic. `None` if it doesn’t exist.

Type Optional[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.8)")]... [read more](https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel)
nocturne hare
#

huh

#

Might be a different format

#

Just aguess though

obsidian patio
#

Is that an issue with Python's formatting or the docs themselves?

empty sluice
#

The URL is [4](https://docs.python.org/3/library/stdtypes.html#id15) for the str.lower docs.

nocturne hare
#

!source docs

stable mountainBOT
#
Command: docs

Lookup documentation for Python symbols.

Source Code
empty sluice
#

I'm thinking it's an issue with the markdown converter.

nocturne hare
#

Nah, I might just be right

#

this is the source for the [4]

Return a copy of the string with all the cased characters [4]_ converted to
   lowercase.```
#

which is defined at the bottom

.. [4] Cased characters are those with general category property being one of
   "Lu" (Letter, uppercase), "Ll" (Letter, lowercase), or "Lt" (Letter, titlecase).```
empty sluice
#

I got the other link by right clicking on the 4 and selecting "Copy Link Address".

nocturne hare
#

Could probably create the url based on it. I have 0 clue how the docs command works, but shouldn't be hard to prepend the url to the id returned from href

empty sluice
#

The rest of the !docs command is just assembling the embed and error checking.

cold moon
#

How to write django URL regex that allow subcategories (content/category/my-category/.../.../) this should allow unlimited categories.

green oriole
#

[A-Za-z0-9/]+?

#

I’m not sure

brazen charm
#

1014 handles hrefs in the html and a bit more. Jus need to figure out the caching and think I'll mark it ready, leaving partial matches to an another pr

green mesa
#

how many LGBTQ leaders are required to be present in json atleast

green oriole
#

A good amount?

green mesa
#

10?

green oriole
#

30+ would be nice

green mesa
#

lol

#

articles only showing 13

#

.pr 479

dusky shoreBOT
green mesa
#

need 1 more review on this

green mesa
#

Can someone add hackstats accepted on this pr too

#

😅

patent pivot
#

done

green mesa
#

Ty

nocturne hare
#

What is this about starting bot?

2020-10-05 17:28:04 | deepdiff.diff | INFO | jsonpickle is not installed. The to_json_pickle and from_json_pickle functions will not work.If you dont need those functions, there is nothing to do.```
cold moon
#

@crude gyro Does content app need currently multi-level categories? This just need major refactoring that I don't currently want to do + don't have time to do. This currently support 1 level categories.

green oriole
#

@nocturne hare if something blows up, then we have an issue

#

For real though, that's not a problem afaik

#

We don't use those functions

nocturne hare
#

What are we using, I'm guessing, deepdiff for

green oriole
#

Mod logs

nocturne hare
#

mkai

green mesa
#

On phone it looks okish any more modification needed?

nocturne hare
brazen charm
#

Any reason those fields are underlined? Don't think that adds much beyond some visual noise

green oriole
#

That's the style we are currently using for seasonalbot, if we do change it we would have to do that across the whole project

nocturne hare
#

Is bot supposed to be LF or CRLF

brazen charm
#

lr afaik

nocturne hare
#

;-; ran linter. it molested all files and their line ending

green oriole
#

Weird

nocturne hare
green oriole
#

The git standard is LF as commit, checked out as you like

#

Well, it is CTRL + Z time

nocturne hare
#

The linter converted the files to LF

green oriole
#

What linter did that? Flake8?

nocturne hare
green oriole
#

Oh no

nocturne hare
#

so, yeah.

green oriole
#

Which ending is you OS using and which ending did it convert to?

nocturne hare
#

windows uses crlf afaik

#

And now it's all converted to LF

brazen charm
#

Try setting eol to lf and autocrlf to input in the git config

nocturne hare
green oriole
#

Sounds about right lol

green mesa
#

@green oriole if u r free can u check out my pr 🙂

nocturne hare
#

I might've picked up some format when inspecting source files of python

#

and flipping vsc out

green oriole
#

I'm not sure if I'll be able to, not today for sure

brazen charm
#

Does anyone use pycharm's precommit with the projects here? I'm having trouble with it trying to get flake8 outside of the working environment for some reason and failing because it doesn't exist there

green mesa
#

U can take your time Akrays🙂

nocturne hare
#

This makes absolutely no sense. It fails the pre-commit because of inconsisten line endings, however it is converting one of the files to LF itself

tough imp
#

Does anyone use pycharm's precommit with the projects here? I'm having trouble with it trying to get flake8 outside of the working environment for some reason and failing because it doesn't exist there
@brazen charm Doesn't work for me either, never figured it out

brazen charm
#

Worked for me on my previous install, but might've just had a global flake8 install then

cold moon
#

Can anybody who know english lang well review my Content app how to write a article guide?

nocturne hare
#

For anyone wondering... bot.py is LF, rest is CRLF... for some reason. According to the diff as well

brazen charm
#

The config vals I sent above fixed the line ending mess for me

nocturne hare
#

Am i correct in assuming that settings.py populates settings.html through the context passed?

#

in site

cold moon
#

.issue 393 site

dusky shoreBOT
cold moon
#

Bot added needs 1 review label, but this needs 2.

obsidian patio
cold moon
#

I think this is how Azure works

#

But why dewikification branch have old version of pyyaml? I used latest version in my branch and now these are conflicting

obsidian patio
#

Not sure that quite explains it

patent pivot
#

so

cold moon
#

I think this Seasonal Bot work will only success, when all it's children success. Seasonal Bot (Lint & Test) is child of Seasonal Bot, and in theory there may more children.

patent pivot
#

yeah

#

best way to think of it is ```
Seasonal Bot
|-- Lint & Test

#

now, on PRs that is the only check we run

#

but on prod release

#
Seasonal Bot
|-- Lint & Test
|-- Build and Deploy
nocturne hare
#

Hey joe, how familiar are you with site code? pydis_snake

obsidian patio
#

What is Test?

nocturne hare
#

Run tests?

obsidian patio
#

I mean in the Lint & Test category

#

Chongus

nocturne hare
#

Yeah, should be running tests?

obsidian patio
#

Do we even have any tests set up for seasonalbot?

nocturne hare
#

Probably not, it's probably a copy of the config for bot/site or some other template?

crude gyro
#

@crude gyro Does content app need currently multi-level categories? This just need major refactoring that I don't currently want to do + don't have time to do. This currently support 1 level categories.
@cold moon

I don't remember the specification for the issue you're working on having anything about multi-level categories.

#

I don't think it really even had anything about categories at all

obsidian patio
#

Hmm, ok. And the Build and Deploy part? Is that the second one shown in the PRs?

#

The one which only says Seasonal Bot?

nocturne hare
#

No, that's a 3rd step for when it's being deployed

#

runs the build step and deploys to the hosting service.

#

(not that i know much about this process, just assumptions from other projects I work on)

cold moon
#

OK, this support one level categories to make this look better. But now PR have conflicts and I don't know how to solve Pipfile.lock conflicts @crude gyro

hardy gorge
#

Build and Deploy should only run for when it's actually deployed. I don't think we do a test build without deploy.

#

Basically, it's this step:

  - job: build
    displayName: 'Build & Push Container'
    condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
    dependsOn: 'test'

    steps:
      - task: Docker@2
        displayName: 'Build & Push Container'
        inputs:
          containerRegistry: 'DockerHub'
          repository: 'pythondiscord/seasonalbot'
          command: 'buildAndPush'
          Dockerfile: '**/Dockerfile'
          tags: 'latest'
#

We should GitHub Actionify that

crude gyro
#

yes please

#

we really should update our roadmap

#

and put stuff like this into it

hardy gorge
#

I mean, it's not that difficult to Actionify this

#

but yeah

#

roadmap + task

obsidian patio
#

Aah, ok. So in this image, what is the first one?

crude gyro
#

that's a special build called "why the hell are we using Azure DevOps"

#

basically there's absolutely no reason there should be two builds, but because Azure, we're doing it anyway.

#

it'd be fixed by moving to actions

obsidian patio
#

HAhah alright. Seems like GH actions is the future, at least here

crude gyro
#

you don't really need that comment, I mostly added comments to my example code for your benefit

obsidian patio
#

Yeah. But do you think it would work?

crude gyro
#

sure

#

your syntax highlighting has docstrings and block comments the same color

#

mine doesn't.

#

generally speaking it's fine

obsidian patio
#

Ah, right

#

Docstrings are usually green, I believe

cold moon
crude gyro
#

no. We already have a linting workflow for django-simple-bulma that we will be using on those repos.

#

we can't use flake8-action because we need to honor the pre-commit

tawdry vapor
#

How will we auth with admin. Via the pinned credentials?

#

The only thing they'd be able to authenticate into would be the admin pages, and there's no real use for granular ACL in there. It might as well just be a simple login.
Okay I did my research

#

Also lemon, I did find a way to use a flake8 action with pre-commit. I used that technique for rattlesnake

#

Turns out there's a way to disable hooks with pre-commit via CLI args

crude gyro
#

@cold moon I resolved your conflicts now.

cold moon
#

I have concept for improving reviewing process: I think review process should have 3 labels: grammar ✔️, code ✔️, functionality ✔️ and I think this will help reviewers to see what is already checked and what is not.

#

Thanks

crude gyro
#

How will we auth with admin. Via the pinned credentials?
@tawdry vapor

either that or you can make yourself a user and just put that in your password manager

#

I just don't think it's worth having 2000 lines of code complexity just so we can OAuth into the django admin pages

hardy gorge
#

Depending on the direction we take, there may not be a lot going on in that admin anyway

#

but that's future talk

crude gyro
#

not that far int he future. Aperture has already taken the lead on seeing if we can move the API into a separate app.

tawdry vapor
#

Was this message view/notification stuff only used by allauth to indicate when a user has logged in or out?

crude gyro
#

it was used by the wiki for a lot of those pages

#

that was its primary use

#

but yeah, only really by allauth after we got rid of the wiki

cold moon
#

@crude gyro About content system, with new system, headers can't be made links anymore, otherwise HTML generated IDs mess up. Just found this.

crude gyro
#

headers being links is hideous anyway.

#

I've been saying for over a year I want us to have a feature to hover instead.

hardy gorge
#

the use of making the headers links is a way of getting the URLs that point to these IDs

#

but hoover sounds nicer

#

I guess it would still suffer from the same problem ks has found, though? (I don't quite understand the problem yet)

#

What's the issue with generating the links (we'd need to generate the URLs for a hoover as well)?

crude gyro
#

yeah I don't understand it either

hardy gorge
#

(and yeah, I agree that the hoover is a million times better, as I did the last time)

crude gyro
#

the way Django docs does header links is what I want for us, ideally.

#

a nice little ¶ that shows up when you hover

#

it's gorgeous

cold moon
#

In markdown, links is

[This is text](#this-is-text)

and then HTML ID will be this-is-textthis-is-text, because markdown2 parse this so.

hardy gorge
#

The idea is that the links should be auto-generated, not inputted by the user, ideally

#

Is there no option for that?

cold moon
#

No, I mean

## This is header

then this automatically get ID this-is-header

hardy gorge
#

right

#

Well, we could write a bit of javascript to add that hoover effect, if it's difficult with markdown

#

maybe even plain css

crude gyro
#

that's because you are using the header-ids extra, right?

cold moon
#

Yep

crude gyro
#

we can easily write some code to generate those pilcrows with links to the id's.

#

I think we might need javascript

#

but that can be a separate issue

#

so just don't worry about it

tawdry vapor
#

@crude gyro Do you need to make a migration to remove the role mapping model?

#

Cause I got a warning when starting the site

crude gyro
#

uhhh. yes I think I do.

tawdry vapor
#

web_1 | Your models have changes that are not yet reflected in a migration, and so won't be applied.
web_1 | Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

crude gyro
#

thank you

cold moon
#

OK, then content system is ready for review

crude gyro
#

thanks @cold moon

#

I will take a look when I'm back to linux, and I'll also make that migration @tawdry vapor

#

just let me finish up in photoshop here

cold moon
#

👌

tawdry vapor
#

That error may be more generally from all the stuff that's been removed on dewikification

#

Well no, it should run any new migrations to remove stuff if they exist. I don't know.

ruby pulsar
subtle kraken
#

If no one does, I will review it in 10h or so @ruby pulsar

ruby pulsar
#

Alright

obtuse arrow
#

Is docker-compose only used for local development in the site repo?

patent pivot
#

yep — we don't run in prod with compose

obtuse arrow
#

Cool

ember cloud
#

can anyone link me to the help channel part of the bot in github?

rapid igloo
ember cloud
#

thanks

#

I wanna do something like that

#

except create the channel for someone if their DMs are off

green mesa
#

We use html to create form or we use django forms?

cold moon
#

@tawdry vapor About content app, is this okay to rename this to articles only at frontend, because I really don't want to remame everything again. Also I can add contributors too, because I found that this have to fetch last modified from github.

neon garnet
#

We use html to create form or we use django forms?
@green mesa you mean pydis forms?

cold moon
#

PyDis Forms use React? I think

green mesa
#

@neon garnet yes

neon garnet
#

Yep

green mesa
#

Ok tnx

green mesa
#

Why dont we do something with ml in bot?

neon garnet
#

Machine learning?

green mesa
#

Yeh

#

Let me show u something real interesting

#

The bot is in js

#

We use this for war in game called coc it uses image recognition and gives yt searches as output

#

And it's very accourate

#

U can say 98%

#

We can have something like this in seasonal bot also 🙂

neon garnet
#

The backend for that bot seems to use a third party application

green mesa
#

With little twist

neon garnet
#

That's correct

green mesa
#

It sends picture to site process it and then send the output

#

Python is known for widely used in ml field so we should have little features like this

neon garnet
#

It's not a little feature per se, plus, utilizing a third-party service like that for machine learning fails to achieve what I think you want it to do

green mesa
#

Ss is just an example

neon garnet
#

If we're going to introduce ML to our bots, it would have to be handrolled for it to feel significant at best, the thing about it is that it requires a lot of time and additional resources

green mesa
#

True😔

neon garnet
#

We may be able to use ML for statistics (and more graphs joe_8bit) though, although that's just a concept

green mesa
neon garnet
#

@patent pivot Have we ever considered that? or is it a bit out of scope?

patent pivot
#

ML is a maybe™️

ruby pulsar
#

If no one does, I will review it in 10h or so @ruby pulsar
@subtle kraken hey, no one did it, can you check it out when you have the time?

subtle kraken
#

I will soon~ish

cold island
#

A word about ML: the dependencies are probably going to be pretty heavy, and you will need to store the data somewhere. Meaning if you were to train a model based on messages... you'd actually need to store those messages somewhere, which I'm not sure is ok by users or us

late wolf
#

has indents already been applied on the current bot?

hardy gorge
#

@stable mountain has intents

green mesa
#

.pr 479

dusky shoreBOT
green mesa
#

need 1 approval lemon_sweat

short snow
#

💀 🎃 🍬 how those the bot react this mesaages and why?

green mesa
#

bcz of halloween

green oriole
#

The candy is a sort of minigame

#

.candy

dusky shoreBOT
#
Top Candy Records

🥇 @crude gyro: 1
🥈 @lapis phoenix: 1
🥉 @surreal gulch: 1

Candies will randomly appear on messages sent.
Hit the candy when it appears as fast as possible to get the candy!
But beware the ghosts...

brazen charm
#

There's no rush for the PRs, the repos are active so someone will get to it when they have the time

green mesa
#

main thing is i wnt my pr to get merged in this month only

brazen charm
green mesa
#

discord android bug

green oriole
#

Oh god

#

It works fine on the web client

green mesa
#

this is normal for me

#

on android its common

brazen charm
#

Taking up something like 3 full screens without content

green mesa
#

yeh this only happens 😂

#

its very irritating

green oriole
#

sigh

#

Switching channels doesn’t solve it?

green mesa
#

yeh it solves the issue

brazen charm
#

Doesn't do anything

green mesa
#

try to scroll down and then up

#

i mean opposite way

#
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')```
i dont know y but i am getting this warning again and again
green oriole
#

That’s fine

#

It is perfectly normal

green mesa
#

ok

subtle kraken
#

@ruby pulsar have you tested the command with different inputs? (valid and invalid)

lime mural
#

can we add an alias .pickup for .pickupline command, it is too long too type? thnx

green mesa
green mesa
#

.pr 485

dusky shoreBOT
green mesa
#

@patent pivot can u add hacktober accepted label on this pr also lemon_long

green oriole
#

Done

green mesa
#

ty

green oriole
#

Although the whole repo is tagged hacktoberfest, you don’t need the individual labels

green mesa
#

oo

#

akrays i asked for label to start mature time early

#

bcz it dont start unless u add label or merge it

sour sierra
#

So, I noticed hackstats command for the seasonal bot does not check if the repo was tagged with hacktoberfest or if the PRs were tagged with hacktober-accepted

green mesa
#

now my all 4 pr are done

sour sierra
#

Good job dude

green mesa
#

So, I noticed hackstats command for the seasonal bot does not check if the repo was tagged with hacktoberfest or if the PRs were tagged with hacktober-accepted
u need to use hacktoberissues command @sour sierra

sour sierra
#

Well thats not what i meant-

green mesa
#

hackstats command pulls your all pr of oct of current year

#

only

sour sierra
#

welp yeah I know

#

It shows 3 repos for me, which should actually be 0
Because none of them are valid ones, as these repos are NOT tagged with hacktoberfest

green oriole
#

We don’t have updated the command yet afaik

sour sierra
#

Yeah I saw an issue and a PR which talks about filtering out spam and invalid tags

obsidian patio
#

Could anyone with access to the YouTube API token for @dusky shore have a look at this?

#

.issue 450

obsidian patio
#

Seems like it may be an issue with an invalid token

tough imp
#

where have you seen this error, and do you have the full traceback?

green mesa
#

Someone commented on pr

#

I meant issue

tough imp
#

in production it gives

bot.exts.evergreen.snakes._snakes_cog ERROR: Unhandled tag command error: Command raised an exception: KeyError: 'items' ('items')
green oriole
#

No full traceback in the logs, that makes me sad

tough imp
#

yeah, the cog has its own error handler that loses the traceback

#

it could be an expired token, looks like the response doesn't come as expected

#

it tries to log the response but fails before that

cold island
green oriole
#

Alrighty, I saw that but I didn't have time to review it yet, will do

cold island
#

ah, no problem then

obsidian patio
#

Yeah. Since it seems to work for them, as long as a valid token is entered, I’m just confused why it would suddenly fail for us, though @tough imp

tough imp
#

the error in the issue is different to the one that makes the command fail in production

#

I imagine you will get the None error if you don't set the env variable in .env

#

but it's difficult to tell because there is no line number or traceback

green oriole
#

Can you try witha seemingly valid random token?

tough imp
#

in production it dies on a KeyError on line 1092, but it doesn't log the response, so we'd need to replicate the call it's making to see what the response is and why it fails

obsidian patio
#

Honestly, it may be easier to just disable the command. I don’t think it’s really used either way

#

At least I haven’t seen anyone using it (except myself testing it)

green oriole
#

Well, it would be a shame to remove it, it is from one of the first jams

rapid igloo
#

Yeah I saw an issue and a PR which talks about filtering out spam and invalid tags
@sour sierra @green oriole that was from me and 2 approvals but no one merged it yet

green oriole
#

Can you link it please?

obsidian patio
#

Either way, I think we should disable it (if there’s a good way to do that). No need to have a non-working command available to run

#

@green oriole we two were the reviewers 👀

#

I assume that was part of my spam to your email ;))

green oriole
#

We can’t unload only command afaik

#

Oh, I remember now haha

obsidian patio
#

Hahah yep!

#

That’s annoying

#

Let’s unload the entire snake cog /s

#

Also, in my testing, there was a TypeError (NoneType). Maybe that was the absence of an API key, while we’re receiving another issue in the production @dusky shore

#

As kwzrd noted, it’s on this line (I’m talking about the actual @dusky shore now):
data = response['items']

#

To me, it seems like it’s just an API change or something that lets the request get through and possibly gives us a return value of some sort

#

@tough imp what do you think?

tough imp
#

as I said, we need to see what the response is, otherwise it's just guessing

#

the response could be telling us that the token is expired

#

I don't have a (or the) youtube API token that I could try right now

obsidian patio
#

Yeah. True

rapid igloo
#

@green oriole it's pr 475

obsidian patio
#

.issue 475

green oriole
#

Thanks

#

Although, the rules changed again

#

I am gonna comment on the PR

obsidian patio
#

It changed a lot since your approval tbh

cold moon
#
relevant_links = {link: value for link, value in zip(                     article_result["metadata"].get("relevant_links", "").split(","), article_result["metadata"].get("relevant_link_values", "").split(","))}

What I have to change to make this return empty dictionary when any of relevant_links or relevant_link_values is empty strings?

green oriole
#

Sounds like you can add an if any(s for s in relevant_links) block beforehand

cold moon
#

Actually, this was simple: generator if check.

sour sierra
#

Can someone take a look at issue 486 I just created and validate it?

green oriole
#

Done

sour sierra
#

Oh ty

#

So we can go with limiting the issue body some number of characters right

cold island
#

Sounds like you can add an if any(s for s in relevant_links) block beforehand
Isn't that just any(relevant_links)?

green oriole
#

...

#

yes haha

cold moon
#

Why when I add new environment variable to site and define this default in settings inside environ.Env, this uses default, but I have defined environment variable?

#

Like

env = environ.Env(
    DEBUG=(bool, False),
    SITE_SENTRY_DSN=(str, ""),
    SITE_REPOSITORY_OWNER=(str, "python-discord"),
    SITE_REPOSITORY_NAME=(str, "site"),
    SITE_REPOSITORY_BRANCH=(str, "master")
)
# Information about site repository
SITE_REPOSITORY_OWNER = env("SITE_REPOSITORY_OWNER")
SITE_REPOSITORY_NAME = env("SITE_REPOSITORY_NAME")
SITE_REPOSITORY_BRANCH = env("SITE_REPOSITORY_BRANCH")

And then when I use this

from django.conf import settings

print(settings.SITE_REPOSITORY_OWNER)

then this still print out default, but I have it defined as environment variable.

cold moon
#

Looks like that this is just not finding it, because when I use printenv, this is not listed there, but all other values in same .env file is there

cold moon
#

I wasn't passing these environment variables to container, this is solved now

#

Content/Articles app now fetch contributors and last modification date from GitHub API.

#

Now I only have to write tests for them

#

But this I can do tomorrow

#

Because this takes time, and I don't like writing unit tests anymore...

cold moon
#

@crude gyro Content/Articles app now supports last modified and contributors getting with GitHub API, but in order to test it currently, you have to define SITE_REPOSITORY_OWNER=ks129 and SITE_REPOSITORY_BRANCH=guides-app environment variables.

obtuse arrow
#

Would you guys mind if I grab these two?
https://github.com/python-discord/site/issues/397
https://github.com/python-discord/site/issues/398
I know the latter is still labeled planning, but I'm pretty far along with a draft for a solution

brazen charm
#

Something up with azure?

crude gyro
#

@obtuse arrow check with @patent pivot, he's overseeing that project. I think it sounds great that you grab those.

patent pivot
#

All fine by me, let me know if you need information on how the Metricity thing should work but otherwise go ahead

obtuse arrow
#

Cool. I'll push my PR soon and you can let me know if it's deviating a lot from what you had in mind.

patent pivot
#

👍

obtuse arrow
#

I don't know what the metricity schema actually looks like so I created a mock one and kinda just guessed.

patent pivot
#

hmmmmm

#

@obtuse arrow so the aim of this is to return a message total

#

which means the query is somewhat like SELECT COUNT(*) FROM messages WHERE author_id='165023948638126080';

obtuse arrow
#

Ah, right

#

Yeah, I see now. I was a bit distracted by lemon linking to the user model.

#

Ok, let me give it another go.

obtuse arrow
#

Like that?

tawdry vapor
#

You have to do some digging to get the right types for the schema

#

Or just ask joe to export it for you 😄

#

For example db.String in sqlalchemy maps to varchar. There's no length specified, which is valid for postgres.

#

Makes it work with any size

#

Pretty sure db.JSON maps to the json type in postgres

obtuse arrow
#

I read the docs for gino, and it made it sound like it would map dynamically to an appropriate type for the given db, so I kinda gave up there and just guessed.

#

But I'll fix those things for now. @patent pivot a schema export sounds nice though.

patent pivot
#

sure thing, one sec

#
metricity=# \d messages
                          Table "public.messages"
   Column   |            Type             | Collation | Nullable | Default
------------+-----------------------------+-----------+----------+---------
 id         | character varying           |           | not null |
 channel_id | character varying           |           |          |
 author_id  | character varying           |           |          |
 created_at | timestamp without time zone |           |          |
Indexes:
    "messages_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "messages_author_id_fkey" FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE
    "messages_channel_id_fkey" FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE
#

metricity=# \d users
                            Table "public.users"
    Column    |            Type             | Collation | Nullable | Default
--------------+-----------------------------+-----------+----------+---------
 id           | character varying           |           | not null |
 name         | character varying           |           | not null |
 avatar_hash  | character varying           |           |          |
 joined_at    | timestamp without time zone |           | not null |
 created_at   | timestamp without time zone |           | not null |
 is_staff     | boolean                     |           | not null |
 opt_out      | boolean                     |           |          |
 bot          | boolean                     |           |          |
 in_guild     | boolean                     |           |          |
 is_verified  | boolean                     |           |          |
 public_flags | json                        |           |          |
 verified_at  | timestamp without time zone |           |          |
Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
Referenced by:
    TABLE "messages" CONSTRAINT "messages_author_id_fkey" FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE
#

@obtuse arrow

obtuse arrow
#

Great, thanks.

tawdry vapor
#

By the way, I'm leaning more towards only returning what we need rather than the whole table

#

We have the flexibility to change our API down the road if needed

patent pivot
#

yeah

#

agreed

obtuse arrow
#

Also, should I create these schemas in their entirety in init.sql right now? I will need to add channels as well in order to declare the foreign keys in that case.

#

I don't think it's necessary for local testing of #398, but I don't know how you want to scope #397.

tawdry vapor
#

I think it should be the same idea - just add what's needed right now for the endpoint

obtuse arrow
#

I would much prefer that as well. It's easy to add onto the script as needed down the road.

#

Fixed.

#

I'd like to wrap the raw SQL queries to the metricity db in an abstraction. It would make it easier to write a unit test, and I think it would be neater in general. Should I put it with the models?

patent pivot
#

Hmmmm that sounds suitable

#

but I'm not entirely sure, Django ORM is not my speciality

obtuse arrow
#

Sure about what?

patent pivot
#

about where things like that go with Django

obtuse arrow
#

Ah, yeah, well, I guess raw SQL queries kinda violate the Django model in the first place.

#

I guess I could create an entirely separate directory if that feels better.

cold island
#

so.. I tried to run pipenv run precommit like a good boy, and it's telling me

pre-commit installed at .git\hooks\pre-commit```
Is that right?
sullen phoenix
#

yeeep

#

now when you commit, it'll lint your code before allowing you to actually commit

#

if the lint fails, it won't let you commit

cold island
#

interesting

#

so that's a thing. Seems like this message is scheduled even when the command fails

sullen phoenix
#

i believe it said failed to cancel that when you tried to star yourself

#

nope nvm

cold island
#

It might be just this specific case though

#

Might not be something worth dealing with even

sullen phoenix
#

it probably isn't worth it, yeah

cold island
#

antivirus

#

aborted the precommit

#

'flake8' is not recognized as an internal or external command, operable program or batch file. I thought this was supposed to be part of the environment?

obtuse arrow
#

Did you create the venv and install the dependencies?

cold island
#

Yeah, I have the bot running on the test server

obtuse arrow
#

Are you running the git command from within the venv?

cold island
#

Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project.
So I assume that yes

obtuse arrow
#

And you can't run flake8 manually either?

#

Or actually

brazen charm
#

is that from pycharm by chance?

obtuse arrow
#

Did you activate the venv in your shell?

cold island
#

I tried to commit with git tortoise. I assume that's the issue?

obtuse arrow
#

Ah, yeah

#

That won't run in the venv

cold island
#

ah, bummer

#

thanks

brazen charm
#

Pycharm seems to have the same issue where it's running outside of the venv and getting precommit from somewhere else.
Not sure here, but how does the precommit config work? With the pipenv run flake8 entry I'd have thought that it shouldn't even try to resolve flake8 as a batch command

obtuse arrow
#

@brazen charm Does it do that even when the project interpreter is set as a venv interpreter?

brazen charm
#

Yes, have the bot set up as a normal pipenv project. Run git hooks from pycharm fails with the flake8 getting not recognized, but works fine from the activated environment in the terminal (and manual pipenv run flake8 works from just the dir)

obtuse arrow
#

Well, it's plausible that the git plugin isn't aware of pipenv I guess.

#

Since the former is not Python-specific.

brazen charm
#

I'm not very familiar with it, but have no idea why it's trying to run flake8 directly when the config does it through pipenv

obtuse arrow
#

Has anybody been able to run the the site unit tests in Pycharm?

#

I get ```
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

obtuse arrow
#

Ok, just had to set the settings file in the run configuration

rapid igloo
#

@green oriole for PRs opened before 3 oct the old rules still apply

#

@green oriole but for after, the PR must: not have invalid or spam, must be in a hacktoberfest topic repo (unless hacktoberfest-accepted)

#

nvm i've just commented that on the pr

flat marsh
patent pivot
#

done @flat marsh 🙂

flat marsh
#

Thanks a bunch!

patent pivot
#

having a look at the metricity PR now, dem 😃

#
$ curl -H "Authorization: token [redacted]" http://api.pythondiscord.local:8000/bot/users/165023948638126080/metricity_data
{"verified_at":"2020-09-12T02:31:51.295812","total_messages":37}

works with the metricity tables!

obtuse arrow
#

Yeah, I tested it 🙂

patent pivot
#

ahh rock solid, wasn't sure if you'd made the tables yourself or used metricity 😄

lime mural
#

what is api.pythondiscord.local custom entry in hosts?

patent pivot
#

yep

obtuse arrow
#

Oh, wait, now I get it. No, I didn't use metricity.

#

That's great that it works though.

lime mural
#

ok

obtuse arrow
#

Though, it should've, since the test database aligned with your schema export.

patent pivot
#

yep

#

is there a reason you insert data in init.sql?

obtuse arrow
#

For testing

patent pivot
#

gotcha

#

okay so

#

there are some edge cases I wanted to handle

#

there may be a point where when metricity restarts it doesn't capture a verification date for some users, since they verified while the bot was offline

#

in those cases I think we can probably just ignore the verified constraint and just return a date 3 days prior so that the criteria is met

#

there may also be points where a user exists in api_user from @stable mountain but has not yet appeared in the metricity database, which leads to responses like:

{"verified_at":null,"total_messages":0}
#

hmmm

#

I'm trying to think of the best way to handle these things

obtuse arrow
#

Won't it return 404 if the user is not in metricity?

patent pivot
#

hmmm

#

maybe I actually did have an entry for this user

#

hah, yes

#

I did

#

hmmmm

#

no wait, no it won't, it'll 500 if the user doesn't exist

#

because it attempts to fetch from api_user, succeed, and then try to unpack data["verified_at"], = cursor.fetchone()

obtuse arrow
#

I should probably handle that

patent pivot
#

yeah should just be a none check on cursor.fetchone()

obtuse arrow
#

I'm gonna write some unit tests, I will make sure to cover this case

patent pivot
#

awesome stuff

obtuse arrow
#

But it will have to be tomorrow, my baby-watching shift is over and I'm going to bed.

patent pivot
#

sounds good, nice work on this!

obtuse arrow
#

Thanks!

green mesa
#

What is the purpose of big brother channel?

tawdry vapor
#

It's where messages of users are relayed

#

Moderation purposes

subtle kraken
#

Will review it later today

#

!remind 8h ^

stable mountainBOT
#
Yeah okay.

Your reminder will arrive in 8 hours!

green mesa
#

😂😂😂

#

See discord android

eternal owl
#

Should I go with list or set? If set, then I need to convert the dict to a tuple

tawdry vapor
#

You don't need to store the entire user in the set

#

Just the ID

#

Oh this is something else

#

Let me see

#

I thought this was about the site api

eternal owl
#

okay

tawdry vapor
#

Yeah, you can use lists for these two ```py
users_to_create = set()
users_to_update = set()

eternal owl
#

alright 👍

tawdry vapor
#

They no longer need to be sets.

#

Keep in mind my code was not tested

eternal owl
#

also updated_fields = {} should contain the user ID too

tawdry vapor
#

One mistake I just noticed is

#

Yeah, exactly that

eternal owl
#
    async def _get_users(self):
        query_params = {
            "page": 1
        }
        while True:
            res = await self.bot.api_client.get("bot/users", params=query_params)

            for user in res["results"]:
                yield user

            if not res["next_page_no"]:
                break

            query_params["page"] = res["next_page_no"]```
this is the async generator I made, quick thoughts?
tawdry vapor
#

I think you could have used a recursive approach still but iterative is absolutely fine too

#

Or is there that weird thing where async generators can't use yield from?

eternal owl
#

ye i tried yield from, didn't work

tawdry vapor
#

like yield from res["results"] event

eternal owl
#

no

#

it gives me invalid syntax

tawdry vapor
#

Shame

eternal owl
#

does yield from make anything better? just curious

tawdry vapor
#

It's just shorter syntax than having a loop in this case

eternal owl
#

oh

tawdry vapor
#
    async def _get_users(self):
        query_params = {"page": 1}
        while query_params["page"]:
            res = await self.bot.api_client.get("bot/users", params=query_params)
            query_params["page"] = res["next_page_no"]

            for user in res["results"]:
                yield user
#

Pretty sure this will work

eternal owl
#

oh cool

#

i pushed changes to the site PR, just gotta change the tests on the bot PR, and everything should done i guess

tawdry vapor
#

You still haven't caught IntegrityErrors

#

I've seen it done in other serialisers (not necessarily in our site) before, so it may be important

#

IIRC we have had 500 errors due to constraint violations, and DRF doesn't properly catch IntegrityErrors on its own.

eternal owl
#

actully, duplicate ID are already cought

tawdry vapor
#

Are there no other constraints in the DB for the table?

eternal owl
#

there are, but the error message automatically is sent

tawdry vapor
#

Maybe it's fine. I just thought it'd be a good safety thing, cause getting 500s is weird for this. However, like I maybe mentioned, this should probably be solved with a more global approach, like a custom error handler. So it could be considered out of scope.

eternal owl
#

if I provide an invalid discriminator, the response is 400

#

i guess this line serializer.is_valid(raise_exception=True) handles that

#

it sends a 400 response

#

we had to check for duplicate IDs by adding ignore_conflicts=True because I had to define the ID field in the serializer explicitly as mentioned in the docs, and that id field has no unique constraints

tawdry vapor
#

I do see an error in sentry for an IntegrityError for off topic channel names

#

For a null constraint violation

#

So it is possible

#

But it looks like DRF has handlers for most things

#

I think it handles validators like validators=(MinValueValidator...) fine

eternal owl
#

yep

tawdry vapor
#

Okay let's leave it for now and address it down the road if needed

eternal owl
tawdry vapor
#

Regarding docs, you should add one for the 404 status code as well

#

And this line at the top multiple users with the same id in the request data will raise an error. is redundant since you already documented it under the status codes section. Also the first word isn't capitalised but you should remove the whole line anyway.

#

"if multiple user objects with the same id is given" should say "are given" since "objects" is plural, verb must agree with the plurality

eternal owl
#

right

obsidian patio
#

@crude gyro could you give the dice command another review (preferable approval👀)?

dusky shoreBOT
green mesa
#

👀

#

How seasonal bot sending messages on its own?

#

Someone deleted the msg?

neon garnet
#

I see who did that lemon_eyes

#

But I won't tell lemon_smug

green mesa
rapid igloo
#

how does the seasonal bot and python bot show "SeasonalBot is typing" after you send a command?

rapid igloo
#

thanks @glass pecan

eternal owl
#

in the bot tests, when I do

print(type(guild.get_member(43)))
print(type(guild.members[0]))```
I get `<class 'unittest.mock.MagicMock'>` for the first, and I get `<class 'unittest.mock.MockMember'>` for the second. Not sure whats going on here, but shouldn't both be the same?
#

here guild = self.get_guild(fake_user())

#

it uses MockGuild()

green mesa
#

@eternal owl do u have emojis at your server?

#

Bcz if no emojies are found it fetches emojis name from server

eternal owl
#

I have 0

green mesa
#

That's y its showing that embed

#

u can try here

#

It will show the available emojies category

eternal owl
#

Ye, we can avoid that embed by checking if there are any emojis present in the first place

late wolf
#

Why are all the __init__ files empty?

eternal owl
#

Init files are used to mark python modules

late wolf
#

huh?

sour sierra
#

packages*

late wolf
#

but why leave them empty

eternal owl
#

Ye packages to be exact

green mesa
#

I don't think server will remove all emojies at once

#

Bcz init file helps to load the package and we run python bot file as package

neon garnet
#

It's more of an edge-case for newly-made servers that want to deploy @dusky shore

late wolf
#

how, it is empty?

eternal owl
stable mountainBOT
#

@subtle kraken

It has arrived!

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

cold moon
green oriole
#

12 files, +170 -0 is definitely not quite simple lol

cold moon
#

I mean that this is just plain HTML + everything Django app stuff (and most of adding is in HTML file).

green mesa
#

i dont know y but pipenv dont raise error locally for missing annotation

cold moon
#

Oh shit. I just found out that GitHub Codespaces will be not free after beta.

green oriole
#

Nope, but it is really cheap

cold moon
#

No when you don't have fixed monthly income.

green oriole
#

Ah, I know this feeling haha

hardy gorge
#

@eternal owl I heard you were a bit confused about the mocks?

eternal owl
#

yes

hardy gorge
#

In general, the mocks do not have the promise of returning a mock of the right "type" when you call a method on them. There's no "deep inspection" going on to try and guess which return mock type would be appropriate. This means that whenever you call an attribute of one of our mocks, you typically either get an AsyncMock (for things that should be awaitable) or a MagicMock.

#

If you have a method that should return a specific mock type, you'll need to set the return_value yourself.

#

There are a few exceptions, like if you look at the MockContext, then the most commonly used attributes are assigned an explicit mock type in the __init__

#

class MockContext(CustomMockMixin, unittest.mock.MagicMock):
    """
    A MagicMock subclass to mock Context objects.
    Instances of this class will follow the specifications of `discord.ext.commands.Context`
    instances. For more information, see the `MockGuild` docstring.
    """
    spec_set = context_instance

    def __init__(self, **kwargs) -> None:
        super().__init__(**kwargs)
        self.bot = kwargs.get('bot', MockBot())
        self.guild = kwargs.get('guild', MockGuild())
        self.author = kwargs.get('author', MockMember())
        self.channel = kwargs.get('channel', MockTextChannel())
#

So, here, the bot, guild, author, and channel attributes will have a default value of the appropriate mock type (unless you specify an explicit one in the __init__

eternal owl
#

right, the return_value is helping

cold moon
#

🎉 I found why .snake video command is not working and PR is coming soon

nocturne hare
#

@green mesa Pull your pr before making any edits to it, I merged master into it

obsidian patio
#

@cold moon what’s the issue about?

green mesa
#

i already pushed the changes

nocturne hare
#

I merged master 2 minutes ago

cold moon
#

urllib.parse.query convert spaces to %2520%, but YouTube API don't know how to parse this and then this can't return result. When I use urllib.parse.query_plus, then this replace spaces with + and this YouTube API supports. @obsidian patio

#

When I change this to it, everything works well

obsidian patio
#

Oh really? That’s a simpler issue than I’d anticipated

cold moon
#

This was just about adding some debug prints and googling.

green mesa
#

@nocturne hare ok emoji command is waiting in another pr by Atie

obsidian patio
#

Yeppp

#

Nice

green mesa
#

making changes rn

cold moon
#

PR opened

obsidian patio
#

@cold moon Where is the YouTube API key entered?

#

I assume I need to get one to test it

cold moon
#

You have to get it from console.developers.google.com and then add this as YOUTUBE_API_KEY env. Make sure you get API key not OAuth2 keys. @obsidian patio

obsidian patio
#

Alright. Where is the YOUTUBE_API_KEY env found?

cold moon
#

What? Just set key from API Console to .env

obsidian patio
#

Ah, okay

#

Wasn't sure where it fetched the key from

green mesa
#

.pr 475

green mesa
#

Bot got stuck?

#

I mean azure pipeline

#

This thing is in process

green oriole
#

Azure is having a stroke since a few days

eternal owl
#

so satisfying

late wolf
#

When we do the !user it shows the date it joined, you guys store the date that we join right?

nocturne hare
#

It should be part of your user, not something we store afaik

late wolf
#

oh @eternal owl u got the tests working

#

ohhh

#

ok

nocturne hare
#

I don't know for sure, but we try to store as little as possible. If the api provides it, i dont see areason to store it

late wolf
#

right, I thought we needed the date and the time that they joined for that command

eternal owl
#

oh @eternal owl u got the tests working
@late wolf yes finally !

late wolf
#

Congrats!

#

gj

cold moon
#

I think one way to avoid KeyError is use response.get("items", [])

tough imp
#

I think that's a completely separate issue

#

I think this error is raised when you don't specify the API key in .env, but it's hard to tell because there is no traceback or line number

#

@obsidian patio can you confirm?

obsidian patio
#

When I didn’t specify the API key, I simply got a TypeError regarding a NoneType

tough imp
obsidian patio
#

When I use a valid key, there are no issues present

cold moon
#

Yes, so looks like #450 need to be fixed by somebody who have access to environment variables.

tough imp
#

Yes, I think so too

cold moon
#

I'll unlink this issue

tough imp
#

your PR is fine, but won't solve the keyerror

cold moon
#

I'll make quick fix for it with get

tough imp
#

that would be good, yea

#

but I think we will need someone with the devops role

#

cannot ping the role 🙁

cold moon
#

Pushed KeyError fix

obsidian patio
#

@tough imp why not just ping the devops people

tough imp
#

I dont have permissions to ping the role

#

but I'll get someone

cold moon
#

Yeah, Discord permissions system, especially for pinging is nightmare

obsidian patio
#

I meant pinging the people manually

green oriole
#

There are 4 devops people, you could make a manual role ping lol

obsidian patio
#

Exactly what I was talking about

green oriole
#

Maybe you should ask in #dev-oops though @tough imp lemon_pleased

hardy gorge
#

@tough imp sup?

tough imp
#

hi

#

I think there is some issue with seasonalbot's api token

hardy gorge
#

which one?

tough imp
#

youtube

#

I cannot see the response we get from the api

#

so its a guess

#

but the cmd works with a valid key

hardy gorge
#

It uses the same API key as bot has

#

What does bot use it for?

obsidian patio
#

.snake video

tough imp
#

I can give more info later, Im buying bread right now

hardy gorge
#

buying bread sounds important

#

@obsidian patio No, I mean @stable mountain

obsidian patio
#

Ah, alright

hardy gorge
#

Both @stable mountain and @dusky shore seem to have the same YT API key

#

if it works for bot, then I'm not sure why it doesn't work for seasonalbot

green oriole
#

Do we use any feature on @stable mountain that requires a YT token?

#

I can't think of any

hardy gorge
#

I'm not sure, that's why I was asking if anyone knows that

#

I'll try looking at the developers panel

obsidian patio
#

I can’t think of any either. Could you try searching the repo for the keyword?

#

YOUTUBE_API_KEY

#

Should exist somewhere in the code, if it’s used

hardy gorge
#

.snake video

dusky shoreBOT
hardy gorge
#

Is that better?

obsidian patio
#

What did you change?

hardy gorge
#

I've enabled the YouTube Data API in our Google Developers Console and changed the API key to a key that was actually listed under our account

#

Not sure what it was using in the past, but I wouldn't be surprised if it was a key that used to belong to someone's personal account

obsidian patio
#

Oh, really that simple?

hardy gorge
#

@tough imp once you're done breading, could you check if everything works now? I've swapped the old API key out for a brand new one and enabled the YouTube Data API in our Google Console.

tough imp
#

yes yes

green mesa
#

😅 still ongoing

tough imp
#

thanks Ves

cold moon
#

But does this mean that my PR is useless?

tough imp
#

no

#

your PR still fixes an issue, I will look at it once I bring this bread home

obsidian patio
#

You’ve been buying bread for 45+ minutes. Must be a fancy sort

green oriole
#

Tsk tsk tsk, you need to pay more respect to the bread, young one

long brook
#

can I make a command to transform text to yoda-like speech?

green oriole
#

Haha, that'd be fun

long brook
#

should I submit an issue?

obsidian patio
#

Sure

green mesa
#

Yoda?

green oriole
#

Sure, have fun, but I'm not sure about the implementation though

#

How do you detect which part of the sentence is what?

long brook
#

About something like this i'm thinking.

green mesa
#

I think list of words can help

rapid swallow
#

can I make a command to transform text to yoda-like speech?
lemon_smug

long brook
#

i'll think about how to do it

#

but is it ok if I submit an issue first?

green mesa
#

Yeh

long brook
#

ok

rapid swallow
#

why is there a new dev-contrib?

long brook
#

thanks

#

yea there is a locked one

obsidian patio
#

It’s a voice channel

rapid swallow
#

is that a vc?

#

oh

obsidian patio
#

Yep

long brook
#

do you have to have a contrib role

obsidian patio
long brook
#

also how did u get the lovest role

rapid swallow
#

he is staff

#

he gets access to stuff

long brook
#

o i see

rapid swallow
#

I control him though

long brook
#

true is that