#dev-contrib
1 messages · Page 69 of 1
lol
Could not retrieve the list of watched users from the API and messages will not be relayed.
i just fired docker compose but i got this
bot_1 | 2020-10-10 14:00:22 | bot.exts.moderation.watchchannels.bigbrother | ERROR | Failed to fetch the watched users from the API
bot_1 | Traceback (most recent call last):
bot_1 | File "/bot/bot/exts/moderation/watchchannels/_watchchannel.py", line 149, in fetch_user_cache
bot_1 | data = await self.bot.api_client.get(self.api_endpoint, params=self.api_default_params)
bot_1 | File "/bot/bot/api.py", line 119, in get
bot_1 | return await self.request("GET", endpoint, raise_for_status=raise_for_status, **kwargs)
bot_1 | File "/bot/bot/api.py", line 114, in request
bot_1 | await self.maybe_raise_for_status(resp, raise_for_status)
bot_1 | File "/bot/bot/api.py", line 104, in maybe_raise_for_status
bot_1 | raise ResponseCodeError(response=response, response_json=response_json)
bot_1 | bot.api.ResponseCodeError: Status: 401 Response: {'detail': 'Authentication credentials were not provided.'}
you need this as env var
BOT_API_KEY=badbot13m0n8f570f942013fc818f234916ca531
Did you configure the config values to http and the local url?
what about the url
[404] #1193 Issue/pull request not located! Please enter a valid number!
.issue 1193 bot
Can we have another role: Voice Banned, because when voice ban remove speaking role, then user will see again voice gate channel
How about doing the opposite: every user who joins is automatically given the "Voice Muted" or "Voice Banned" role or whatever for the duration decided on before they can use the voice gate channel, and if they go through the gate then the role is revoked
That way you don't need another role to use the voice channels
the vban command would then just put the role back
My idea is:
- When user verify, then user don't have any voice gate roles.
- There should be task that checks every half hours for users who pass requirements (3 days after verification and 50 messages sent) and who isn't voice banned and give them
Voice Unverifiedrole. WithVoice Unverified, users are able to see voice gate channel. - When user verify in voice gate, then he get
Voice Verifiedrole.Voice Unverifiedrole will be removed. - When user get voice banned,
Voice Verifiedrole will be removed and user is not able to speak anymore and don't see voice gate channel too.
this is way more complex that it needs to be
we just have the voice gate, if a user sends a message who doesn't meet the criteria we just DM them and tell them why
if they get voice banned and see the gate so what? we are retaining that information I would think (if not, we should be, it should be with the infractions system)
we can just DM them saying they got banned from voice
Oh, so this shouldn't send anything to voice gate channel and use DMs instead?
it could use similar methods to the existing role gate in that eventually the messages sent are deleted
that would also be fine
but I think we can solve this without adding more roles and more complexity
it is just a gate to add a role, that is all it should be
I think sending to channel is safer for case when user have like DMs disabled or leave from guild
I'm trying to figure out docstring for voiceverify command, but I can't find what should clearly explain what voiceverify do.
Apply to be able to use voice within the Discord server.
In order to use voice you must meet all three of the following criteria:
- You must have over 50 messages within the Discord server
- You must have accepted our rules over 3 days ago
- You must not be actively banned from using our voice channels
right?
Is this possible to use f-string for docstring?
ah good point, no, it isn't
well, we shouldn't be changing the criteria too frequently, but we did decide within the team that we do want to make the criteria public, we don't just want a magic set of rules
However
that being said
we will be documenting those thresholds within the voice gate channel
so we could just give the vague stuff there
Apply to be able to use voice within the Discord server.
In order to use voice you must meet all three of the following criteria:
- You must have over a certain number of messages within the Discord server
- You must have accepted our rules over a certain number of days ago
- You must not be actively banned from using our voice channels
OK, thanks
I'll make the voice gate channel this afternoon and get you constants for that as well
I just found that I have to make changes in site too for voice ban
Add voice ban to https://github.com/python-discord/site/blob/master/pydis_site/apps/api/models/bot/infraction.py#L11
pythondiscord.com - A Django and Bulma web application. - python-discord/site
yep
I'm also tempted to say we refactor that new metricity_data to include whether the user is banned from voice
then we have all 3 criteria in one API call
This should be perfect. This will be performance win
yep
I will make site changes now
Once you do that give me a ping and I'll review it
Then continue with working on bot
lol
lol
@patent pivot Should voice ban support hidden infraction?
No, I think it's possible to change serializer later
okay
@cold moon DECISION MADE. yeah, we'll be letting users know of this so it will never be a shadow infraction.
Okay, then I disable it
👍
well yeah, I'll have a think about it in the next hour or so
answers in less than a minute
Basically site side is ready, I only test it now
try:
Infraction.objects.get(user__id=user.id, active=True, type="voice_ban")
except Model.DoesNotExist:
voice_banned = False
except Model.MultipleObjectReturned:
voice_banned = True
else:
voice_banned = True
this is how this get voice ban status
@cold island https://github.com/python-discord/site/pull/410
.pr 479
@eternal owl can u review the pr I have pushed changes
okay
.pr 485
@patent pivot But what about permanent voice ban?
I think site contributing guide should be updated to give information about metricity DB.
@patent pivot But what about permanent voice ban?
@cold moon hmmm, well, I presume we should support both?
if we need to permanently ban someone from voice, it's probably worth just banning them from the whole server
I think site contributing guide should be updated to give information about metricity DB.
maybe, yeah. the difficulty is that with docker postgres we can bootstrap it, but not with the host one.
but it wouldn't hurt to have it
@green mesa few more changes on the repos and then should be good to go
@patent pivot Site PR opened
reviewing
yep that works great
onto code review!
reviewed @cold moon
wow okay copycat @glass pecan
looool
i was feeling bad for writing that too
if only you were slightly slower
I could be getting that co-author 😛

im glad you caught that second except being useless
because
it felt weird seeing an except and else block doing the same thing
and i was sitting there going ... surely we could combine them with magic, right?
@glass pecan @patent pivot Changes is now made
hahaha yeah I was watching the commits stream in live
yeah already read the diffs too
I'll continue with Voice Gate tomorrow
What would be the right way to do redis things that aren't exposed by async_rediscache? Go through _get_pool_connection for the connection manually?
hmmmm, what are you trying to do
for https://github.com/python-discord/bot/pull/1014#issuecomment-695914438, setting an expire on the values and checking object idletime to clear unused
I'm not that familiar with redis so let me know if it's not possible with the redis policy like mark mentioned
ah
let me check
yeah, object idletime works
127.0.0.1:6379[2]> OBJECT IDLETIME ikonireqes
(integer) 21
So, just go directly through aioredis' object until it's possible in the wrapper?
yeah that sounds good
hi, i need some feedback with this. still gotta implement "pr acceptance" overriding invalid/spam labels, but i can't proceed until i know what i'm currently doing is on the right track : |
.pr 475
Is there any easy way to duplicate the channels/emojis/roles from this server to a test one for testing the bot when contributing?
@untold shore see pins, there's a server template, also for emojis i'm not sure
You don't really need the emojis for testing
perfect thanks
What's the end goal for async-rediscache, a simpler wrapper or covering most of what's provided? I'll need to look into how to do it since hashes don't seem to allow expires, but implementing the new methods requires a subclass because of the locks so I thought it might as well be implemented in the package instead of possibly doing it twice
hmm 🤔
👍
If I knew his discord
@nocturne hare hello ! I was just wondering why setting pride_leader_name to None as default isn't a good idea?
imo, the default value is better than the command error handler
this is regarding: https://github.com/python-discord/seasonalbot/pull/485#discussion_r500310241
this is the comment I made regarding the same: https://github.com/python-discord/seasonalbot/pull/485#discussion_r502812027
Do we have metricity docker image for local development?
Does the bot has some sort of scheduling system? for scheduling message in perticular channels or similar? (a command or something similar)
apart from reminders
this pic should be updated to also include
METRICITY_DB_URL=postgres://pysite:pysite@localhost:7777/metricity
https://github.com/python-discord/bot/pull/1228 This need review fast
Yeah, I found this while developing Voice Gate
i got the error when I pulled latest data nd tried makemigrations
somehow, my docker-compose.yml file already has the env var defined
yes
nvm, just ignore me
was confused
@cold island have we considered using the reminder system for the scheduling of events?
just for you guys
fire, I think you use update the contribution site guide too
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
i'm going to sleep now, so possibly another staff member could do it
alright, sleep well 👋
I just found that bot docker-compose up don't create metricity DB.
hi, i really need feedback on this one, pls give a review if anyone is free 🥺 tysm https://github.com/python-discord/seasonalbot/pull/475
hey @cold island , I can give you a demo of the user event feature by today night or tomorrow
I am making some changes to the models, I will show it to you during the demo
have we considered using the reminder system for the scheduling of events?
@eternal owl I don't mind using it for reminding the organizer, but when it goes off it should also do other things such as granting the role
hey , I can give you a demo of the user event feature by today night or tomorrow
That's awesome! I'll be pretty busy today though
oh okay, sorry if disturbed you 😅
File "C:\Users\HP\Desktop\bot\bot\exts\info\python_news.py", line 221, in get_webhook_and_channel
self.webhook = await self.bot.fetch_webhook(constants.PythonNews.webhook)
File "C:\Users\HP\.virtualenvs\bot-nF9pOG12\lib\site-packages\discord\client.py", line 1481, in fetch_webhook
data = await self.http.get_webhook(webhook_id)
File "C:\Users\HP\.virtualenvs\bot-nF9pOG12\lib\site-packages\discord\http.py", line 241, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
y i get this error
i have given all perms to bot
@green mesa is it administrator
Voice Gate is almost ready!
noice
fire, I think you use update the contribution site guide too
@eternal owl what should we change?
I got an error when running makemigrations, then I added that to the .env file and worked fine.
@deleted-role WARNING: Unable to get DEFCON settings!
how can i fix this error
site is running
Do we have metricity docker image for local development?
@cold moon https://github.com/python-discord/metricity/packages/371763
and i dont know what happen to snekbox i fresh installed everything and i am getting this
ClientConnectorError: Cannot connect to host snekbox:8060 ssl:default [None]
Soon it'll be on ghcr instead of docker.pkg.github.com so you won't need to login with GitHub to pull it
Thanks
i am running snebox container
It'll be behind the docker ip if you're not running the bot in docker
@hardy gorge Since you seem to be the primary maintainer of async-rediscache for now, any thoughts on https://discordapp.com/channels/267624335836053506/635950537262759947/764641490864701440 ?
I'm implementing types as we need them
I'm currently working on a taskqueue, but to do some things well, I need some features in fakeredis for tests (and dev usage with fakeredis)
If there are things you like to see, feel free to open issues
It's not going to be a wrapper of redis, as aioredis would already do that, but it's something implements convenient types to work with
A queue, a cache, and so on
e.g., our cache has a pop method, something that redis does not have. Those custom actions will be made atomic in a future release (once fakeredis releases the script features that have recently been merged)
Alright, I'll open an issue and maybe I'll get to it after familiarizing myself with redis and what I actually need with the redis features for the cog more
It'll be behind the docker ip if you're not running the bot in docker
In host file?
snekbox won't restrict the hosts so you can just set the bot to the ip directly
or just don't run snekbox if you're not developing something with it
@brazen charm If you describe the feature you'd want, I could also think along to see how we can add it
key expiration is something I've been thinking about
Just planning currently, but it's for caching the doc command output. Was looking at doing the expire so the keys don't stick around for too long in case the docs are updated and then clearing keys that haven't been accessed for a while through idletime
Not sure what the problem could be if the site is running and the bot can connect to it Anubhav, maybe try looking at the exception that's raised
Ok let me send exception here
!remind 2h #dev-contrib message
Your reminder will arrive in 2 hours!
2020-10-11 16:12:33 | bot.exts.moderation.defcon | INFO | DEFCON disabled @brazen charm this i am getting
Are you planning on doing more with the guides Akarys? The docker ip/hostname could also use a redo as machine is not available on win through docker desktop anymore
defcon disabled is fine
I think once the bootstrap project we'll be done, I will take at good look at the guides, yeah
Cool, will you keep it in mind or should I open a meta issue?
The message doesn't get sent in the debug mode
oo
Maybe opening a meta issue saying what you think is missing is a good idea, yeah
tnx look like bot is setup
@patent pivot Do you have Voice Gate channel ID and role ID? I will open PR after I finish writing unit tests for voice ban command.
@cold moon
channel: 764802555427029012
role: 764802720779337729
👍
docker image of bot has 1.4 discord.py version?
bot_1 | return _run_code(code, main_globals, None,
bot_1 | File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
bot_1 | exec(code, run_globals)
bot_1 | File "/bot/bot/__main__.py", line 50, in <module>
bot_1 | intents = discord.Intents().all()
bot_1 | AttributeError: module 'discord' has no attribute 'Intents'```
try docker-compose down && docker-compose up --build or something
The latter by itself should probably already do the job
Basically, you need to rebuild your container, as it will otherwise use the version that was already built before (with the older versions)
oo
The latter should be enough, yeah
Dont wanna sound annoying, but i really need reviews on this https://github.com/python-discord/seasonalbot/pull/475
i wnt to add transcan emoji id but when i edit constants.py of seasonal bot git detects it
how can i add it via env file or is there any alternative so i can add it without disturbing actual code
?
And Voice Gate PR is here!
Yeah... I tried to find one short alias
@green oriole
Here's your reminder: [#dev-contrib message](/guild/267624335836053506/channel/635950537262759947/).
[Jump back to when you created the reminder](#dev-contrib message)
iceman i have pushed the changes to both branch bug_ec and prideleader also
when u r free, can u have a look please😄
What's a voice gate?
From what I’m aware, it’s about voice moderation tools. Like banning, muting and silencing
Not currently
Currently this just control who can have access to voice channels and who don't
Ah ok. Who shouldn’t have access?
You need to have x (50) messages, you have been verified your account more than y (3) days ago and you have to be not voice banned in order to get access to voice channels.
There will be voice gate channel and voiceverify command.
Ah ok. So everyone who wants to get access to the voice channels will have to type “!verify” or something there?
!voiceverify or one of it aliases
And staff can remove your access from voice channels with Voice Ban, that remove Voice Verified role.
Ah ok, nice
I assume that’ll decrease the amount of traffic in the voice channels quite a bit
I don't think so. This will just help moderate things. Those who want help with voice will verify their account and then they can get help again.
We’ll see how it goes, but I think that extra friction will increase the friction enough to remove a few of the “just poppin’ in” types of users
we did run the numbers to figure out who was eligible
let me run them again
2,903 people are eligible
Only 2,903 people have sent 50+ messages here?
That can't be right
That might be right for "users that have ever joined voice" matching those... maybe
@patent pivot what did you query?
Hmm, I guess it makes kind of sense, then
actual query is uhhh
SELECT COUNT(*) FROM (SELECT author_id, COUNT(*) FROM messages LEFT JOIN users ON users.id=messages.author_id WHERE users.verified_at < (NOW() - INTERVAL '3 days') GROUP BY author_id ORDER BY COUNT(*) DESC) sub WHERE count >=
50;
we do two separate queries to determine if a user is voice eligible, but this is my hacky number generating one
Maybe hackstats command should count mature time too before showing has earned tshirt or tree
yeah I agree
I don't think hackstats takes into account whether a repo opted in? (https://hacktoberfest.digitalocean.com/hacktoberfest-update)
You'll need see if:
a) a repo has a hacktoberfest label
b) or the specific pr has a hacktoberfest-accepted label
(From a cursory reading, at least)
yes me
and no one has reviewed my pr yet
i really need reviews and had been asking for days
@green oriole @obsidian patio r u free?
Reviews take time. We're all volunteers, you must be patient.
What did you PR?
Not this next day. Preferably someone else will have time to review it
Have you fixed the logic of it to work with the rules?
oops
475
yeah
but there's one more where the acceptance has to override inlaid/spam
this involves more api calls
1 for checking merge and 1 for checking approval
so i need review before i do that to making what i'm doing is ok
@obsidian patio would it be a problem if at least 2 or 3 api calls r needed in the end
for each pr
If that’s what’s needed, that’s what’s needed. I wouldn’t have anything against trying to reduce that number, as long as it won’t compromise quality
ok then i'll try to do more checks to avoid the same calls for every pr
also r we supposed to list the pending ones (not approved yet) as well or, just the accepted (waiting for 14d timer) ones
I really don’t know about their API, but I’d love to see some good Code
What do you think would be logical?
probably both but list them separately
Hmm. I think we should try to make it similar to the Hacktoberfest status page on what gets listed
And I think they count ones that aren’t accepted yet (count as in “increases the counter”)
Yeah
I have to sleep now. Will hopefully have time to review the updated version on Tuesday or Wednesday
@green mesa probably more suitable in #community-meta but i don't think there's a rule against putting pfp as that 🧐
i think its related to rules and moderation
tho
hmm cus #dev-branding is for the pydis logo and stuff
Yes and u can't use other logo branding images unless u take permission from the owner
have you read the license?
Me?
@nocturne hare hello ! I was just wondering why setting
pride_leader_nameto None as default isn't a good idea?
imo, the default value is better than the command error handler
@eternal owlI'm not a fan of default None as a default parameter, when there's a feature in the library which handles missing parameters.
That's just my opinion on it
However, I'm fine with either way. It was just an opinion.
Oh, I feel an error handler is for catching errors due to un-expected behaviours, in the pride_leader_name case, not passing a pride_leader_name is an expected behaviour(so we can generate a random pride leader embed).
what do you think?
Woah cool, #dev-announcements
😄
It popped out of nowhere lol
aww
Nice!
fixed?
yea.....
okay
I just think that looks better
yeah
But yeah, awesome with that channel
i did not get this line You can also expect to see things about code reviews and contribution stats to our projects!
does this mean guides?
It could be things like "Reviewer of the month", "stats of PRs of the month" and similar
oh okay
Hi! In bot's contributing guide (https://pythondiscord.com/pages/contributing/bot/) you stated that you have to create server setup like described in config-default.yml file. And you wrote there
we're working on a solution
Well, why don't you just make a template of server? It require no more than 3 or 4 clicks. At least it sets up the channels, categories, roles still better than creating everything from scratch
We have a template in the pins
I guess we should add it to the guide
However you'd still have to manually copy the IDs
We have a template in the pins
oh okay thank you
But we are working a new solution to do that automatically, stay tuned 
However you'd still have to manually copy the IDs
yeah, but still I thought there was no template, since there's nothing about it in the guide
i think a sample .env file should be added (both seasonalbot and bot) because then the user can replace the values with the actual ones without having to copy/paste each variable name
!remind 1h add the template to the contrib guide
Your reminder will arrive in 1 hour!
We do have a template in the guide
Oh ok
i think a sample .env file should be added (both seasonalbot and bot) because then the user can replace the values with the actual ones without having to copy/paste each variable name
there's a sample
@patent pivot But what about automated announcements in #dev-announcements ? Like monthly stats and new contributors and core devs?
We do have a template in the guide
@green oriole is this what u mean? https://pythondiscord.com/pages/contributing/seasonalbot/#development-environment
I think the things will always be better with a human touch
Doing contrib stats in there feels game-y to me
Yeah this one hedy
@brazen charm yeah, what we discussed was less so to try make contribution competitive, but more to encourage contribution, and specifically encourage code reviews
Because when u copy that the descriptions r copied
I don't think we would do a per contrib thing, but more a like, "here are the major highlights of the month"
yep
I am planning on more or less nuking the guides we already have to make them more similar and more handy to navigate anyway
@hardy gorge Mind pinging me when you have the time to discuss some of the redis stuff?
I think we still should automate like general summary (issues opened/closed, PRs opened/merged/closed, commits made, contributors list (without any competitive stats, just a list)) and contributors and core dev adding announcement.
These stats should be sent out in first day of every month.
And contributors + core dev announcements should be sent out when bot detect role adding.
@rapid igloo I've renamed the issue, don't worry it is just about updating the guides now
@cold moon it would feel pretty impersonal; we have enough core devs to do that manually
Besides, when someone gets a new role for example, we would like to highlights why they got this role
Same the important issues/PRs, we want to explain why this are important
No, I don't mean highlighting specific issues/PRs with automation, just numbers.
Ah, right
Maybe we would have a little script to generate the numbers, yeah, but I still do think that we want some highlights to go with those numbers
@brazen charm Sure. I'm currently doing some other work that I need to do first. There's an update coming soon that changes some of the internal functionality and adds a few new features. It depends a bit on the release schedule of fakeredis (although I'll publish it with the workaround if fakeredis doesn't release soon).
@green oriole
Here's your reminder: add the template to the contrib guide.
[Jump back to when you created the reminder](#dev-contrib message)
do it
Done
My god, you have to write html to make a link
Now I understand why we are switching to markdown haha
Really? Is there a reason why?
We will use html rendered from a markdown file
Because when you look at current contributing pages, they have some HTML components what you can't put to Markdown.
I don't know the exact implementation though
I mean
Isn't there a field in markdown to input raw html?
lemon said that these articles have to be so simple plain MD how is possible without HTML.
I don't understand
The main thing is that most of what we're doing is basic, repetitive functionality
Which means that we should not have to solve that by turning what is supposed to be a markdown page into an HTML page
Which is what is happening now with the wiki
We want things like sidebars, boxes, and so on, which makes us insert a lot of HTML
We hope to do away with that for a big chunk of the website and @crude gyro is the main coordinator of that project
Things like articles, guides, and most of our pages (the content part) are completely doable with just markdown
Markdown make this also easier to write because you can use GitHub for it, what have preview.
Other things may be easier to solve with html or the combination of a specific Django template for that section + markdown for the content
Why don't we use markdown for the content then, yeah
Also, we can add a table at the top of the markdown file with the special things you want to include, like the navbar and such
I think that part of the confusion is now because we've split up different parts of the project into different issues
It is what github pages does
That ks is now working on the guides and the resources landing page, does not mean we won't use markdown for other parts of the website
Well, the contributing guide is a guide atm
I think it is worth exploring if we can convert it to markdown anyway
It currently uses a lot of HTML and CSS tools for the organization of the page, doesn't it?
Actually, we are using github flavored markdown, and it does support raw html https://github.github.com/gfm/#html-blocks
I'm looking at the source, I don't see a lot of html except for the navigation box at the top, and the warning boxes
Which page are we talking about?
It's mostly markdown right?
Only the part that's nested within those columns is necessarily HTML, as markdown within an HTML block does not render
Which is the main issue with some of our other pages, as everything is within a column div
Hmm, can't we make the renderer an html class, to have markdown inside html?
(I have a very basic knowledge of html though, not sure if that's possible)
It's mostly markdown right?
Some things like the links aren't, it is quite frustrating
Wait
Oh
The top section, which is the column layout, is HTML
Everything below that is in markdown
It seems like we can have a markdown link, yeah
I'll have to clean this up later haha
Oh! GitHub Markdown support HTML!
Then I think we should use this.
I'll look later how will some contribution page look like when using Markdown for it.
Is it possible to take out one of current contributing pages as HTML? I just don't want to start figuring out what HTML this uses.
raw html is bad
why are we talking about it
the whole point of the dewikification is to stop using html in our markdown templates
Yes
I'd prefer we just disable the feature if they support it.
any page that needs HTML, we should just make a regular template page
It should be trivial to create a DTL page with a fixed side bar for a section of the website with the content block still markdown
That's what DTL does best
And that's what I was getting at earlier: We should be able to do about everything we do in the content section with markdown only.
Any special sidebars or blocks can be solved in DTL
and then it would be nice perhaps to support a few markdown extensions, though.
like.. markdown has no way to embed a youtube video, but it'd be nice if we added an extension that allowed it
perhaps. not sure how easy it is.
Some markdown engines allow you to add custom tags
[youtube <youtube id>] would work well
Currently content app uses markdown2 and this don't allow custom extras.
split test starting on forms app
75% of users will get the new TS/TSX compiler
if anything breaks and a sentry form pops up please fill it in
but you're just gonna sell my data
lol
wait split test cancelled lol I am building to the wrong directory on CI
starting in like 5 minutes then
okay we're live
@cold moon It doesn't?
Ah, it does not
It does provide extras, but they are hardcoded into a monolithic file
hmm
Yeah
This code is hard to read because everything is in 1 file
This used Python Markdown earlier, what have even guide how to write a extension: https://python-markdown.github.io/extensions/api/
Of course we can implement regex parsing for HTML to find these tags and replace them with iframe.
It's not that difficult to work around the markdown plugin
I think you apply a DTL filter to a tag right?
We could implement our own filter that combines the markdown processor with something that just replaces our custom, simple tags
We probably don't need stuff like open-close markdown
Just things like [youtube id]
So we should make our own class that inherit Markdown class?
Uh, I've not looked at the implementation details of the markdown feature
I don't think we need to inherit anything
Normally, you have something like this in your template, right?
Yes
{{ content|markdown }}
Oh, you mean this!
we could write our own template filter that applies the markdown filter and does our own simple replacement, outside of the entire markdown extension
OK, now I understand. I'm going to create this when I finish eating.
I'm not saying that we should go this route
So, don't work on that yet
Ultimately, we may come to a better design for it
And it's @crude gyro's call to make
Y we don't use Jenkins?
why would we?
lol
@crude gyro What you think? Should we use markdown filter or like our own instance of markdown class to add our own MD stuff?
I don't know, I'd have to look at the package first. it doesn't need to be solved right now.
I think one thing that we should have our own parser is such alerts and this syntax should be:
!!!info|warning|danger
Here is alert text
!!!
I'm just looking at the code and this line https://github.com/python-discord/bot/blob/master/bot/__main__.py#L61 could be
activity=discord.Game(name=f"Commands: {constants.Bot.prefix}help"),
well, I'm thinking of making a PR(not for this), but fixing one line isn't a good commit i guess.
I don't see anything wrong with it
I'm fixing it
cheers
why are there \ns after `code' and `and'?
Run Python code and get the results.
Is it actually in the source code?
@green oriole idk,
!source help eval
An interactive instance for the bot help command.
where is the help command for commands stored?
It is in the docstring of the command
I see
Is python discord github bot open source?
No, because this is not wrote in Python
Huh, I don't have currently to search but this is mentioned somewhere in this chat.
okay I'll search
why didn't they used python for it?
I just prefer the elixir libraries for github & wanted to do an elixir thing
If you are womdering why it isn’t open source, it is because there’s a token somewhere in the history and we are too lazy to reset it haha
isn't there something like "Regenerate token" for GitHub?
Yeah
@eternal owl do u wnt me to remove error handler still? or i can skip
btw both of my pr are ready for review if u r free can u have a look 🙂
im not sure about the error handler, keep it I guess
ok
I will do another review tonight
tnx
actually only 4 day are left for passing mature time
and 2 of my pr are not merged yet
@eternal owl you wanted to talk about the events system right? I think I'll be available later today
thats awesome. Do you have any perticular time you will be available at?
like x number of hours from now
I think like in 4-5 hours
alright I will tag you by then
👍
isn't that simply a webhook
@lime mural well, webhooks are github -> bot, you need a token to go the other way around
but isn't it just github sending updates to the webhook
Yeah
I don't see why it needs to communicate in the other direction
But the python bot also send comments and add and remove tags
Ohh, that might be a different setup yeah
https://github.com/python-discord-bot, not the user that sends logs
im not sure about the error handler, keep it I guess
@eternal owl @green mesa -> @glass pecan Probably knows what's best, what i suggested is just a preference, scrags probably knows what is best here. (and others, im just brainfarting out a single name atm)
WAT
:O
i dunno what the context is so i'll have to read up a bit
its the difference between doing ctx, somevar = None -> if somevar is None: ... vs ctx, somevar -> errorhandler for missing argument
in essence
where is this
seasonal bot, prime leader iirc?
Ye we both made opposite comments
oh its in a review?
Yes let me get the link
i think i gots it now
one more comment is oppo i guess lol
anub, can you edit that PR's description so the closes statement isn't in quotes
lol
ok 😅
thanks
np
yeah i probably wouldn't handle random choice in an error handlier, sorry @nocturne hare
the primary usage will be to treat the name arg as optional, and giving it a default of None reflects that
the behaviour of random choice when the optional arg is not given is also a purposeful behaviour, rather than something erroneous that's being handled, so I feel like it's better representative to keep all that logic within the command itself.
i totally agree to the comment about the function name
always descriptive names, short versions of things can be aliases
i'm not 100% on agreement that all embed generation should be in a standalone function either, which is something @eternal owl suggested. it's nice for organisation if the command logic is chunky or if the embed needs to be built by multiple functions, but i'm not sure that's the case here.
It may have come out as "this is the correct way", but i did mean to add it as a consideration. It sounded correct to me then, but I do agree that all the "expected" logic should be part of the command
coolio
I stand corrected
this is still just my own opinion ofc, i'm definitely not some mandate on whatever should be the one and only way things should be lol
👍
Does something: Optional[str] accomplish the same?
but command sigs are the most important thing in this case
oh that was something i was definitely going to mention too, just hadn't finished typing
the typehint gotta match
Cause that reads better to me yeah
so if it's defaulting to None, it's gotta be Optional
@green mesa will need to address that
in a command function, i'm reasonably sure you should provide a default for optional args, yes
As in, does it have to be something: Optional[str] = None
yeah
darn
You probably have a bigger chance of knowing than me, scrags. Was defaulting optionals types to None ever part of the command spec?
the cleanest setup tbh would be to make a PrideLeader class that has the appropriate attributes, a method to produce a friendly embed, a classmethod to fetch a random instance and a convert classmethod that can be used in command typehints to provide a ready-to-use friendly object in the command function that both validates the command argument given and can do fuzzy matching.
at least, that would have been my approach
hmm not sure chibs, i'll have a look
I believe i mentioned a converter, either for this or some other PR
for zodiac u mentioned
aha, well the concept is the same here
If it's not provided, the converter would select the random name for you
instead of default None
At least, i think that's plausible
i think you'd still have to default to None, and just do
leader = leader or PrideLeader.get_random()
hmm
chibs, typing.Optional converter allows for skipping the parameter
❗
so in that case you wouldn't need to = None
but i do not know what happens with the consume args
I knew i had seen that somewhere :P
It's worth the attempt in my eyes >:(
pet peeve against = Nones
nullable bools?
is this another name for tribool
we don't have nulls
lol I heard someone call it troolean
we have Nones
Ye, which is why i don't like None related code, without a reason
what was the reason, again
A default None paramter sounds like a "this might go wrong, so we'll double handle it" in stead of trusting the usage of the function

it's fairly common for optional dependencies
i don't understand that stance lol
i have =None for lots of things
even my new paginator class uses it
In python you'd have to use kwargs probably to not having to default none where its required
i use =None for kwargs lol
def __init__(
self,
*,
header: t.Optional[str] = None,
footer: t.Optional[str] = None,
line_spacing: bool = False,
max_lines: int = 15,
max_line_chars: int = 2000,
max_page_chars: int = 2000,
public: bool = False,
timeout: int = 300,
delete_on_timeout: bool = False,
) -> None:
as in **kwargs
**kwargs is disgusting
lol
Doesn't it parse docstring as well for typehints / autocomplete?
it does, yep
some things just aren't though
Bot.run
Embed
anyhow, that's just one instance above
there's another
async def start(
self,
ctx: t.Optional[Context] = None,
*,
bot: Bot = None,
user: t.Union[discord.Member, discord.User, None] = None,
channel: t.Optional[discord.TextChannel] = None,
) -> None:
the exact thing you hate lol
👀
Maybe I'm just a grumby old chibs ¯_(ツ)_/¯
"""
Start the pagination session.
Any `user` or `channel` arguments given explicitly will always be used instead of the values on `ctx`.
This would allow pagination to occur in another channel, for example.
`bot` and `channel` become required arguments if `ctx` is not provided.
`user` becomes a required argument if `ctx` is not provided and `public` is `False`.
Supporting sessions without `ctx` ensures we can make use of paginators when it isn't available,
such as from an event handler or on bot start.
"""
the behaviour requires it
t.Union[discord.Member, discord.User, None]``` this though 🤔
yep
Shouldn't that... teeeeechnically be t.Optional[t.Union[discord.Member, discord.User]]
it's the same thing, without the nesting
you cannot pass more than 1 arg to Optional?
Also, can't you specify a parent class in types?
you can, yep
User is the parent of Member, iirc, so why not just t.Optional[discord.User]
discord.abc.User
is actually the one i'd have to use
which i can
but it wouldn't autocomplete the member attributes, such as .guild
Oh, am i throwing hate at your code?
nope

we're just having fun bouncing off each other, no? lol
I'm venting my frustration of our production code on other unrelated code, but with similar properties
:=
tbh i like going through my code
don't get enough feedback sometimes, especially for boring things like these
like, who'd actually willingly spend half an hr trying to understand a boring paginator
Doesn't python support the | operator for types?
as in, does it?
i have never seen it
probably
we just have interfaces for literally everything, one is bound to fit the 2 im trying to pass
i thin python has | its the bitewise or operator
it is, yep
but typehints are already weird
as in, they have nonstandard behaviour for things that used to be established
so throwing in a custom behaviour for the bitwise or to support shorter unions wouldn't be a terrible idea
there's a PEP for it https://www.python.org/dev/peps/pep-0604/
it's accepted but I don't think it made it into 3.9
especially since typehints can runaway in complexity sometimes
oh, planned for 3.10
that's good news at least
in 3.9 isnt there a dictionary merge thing that involves |
yes
ye this looks nice
probably, but the syntax would remove nesting from a lot of typing
yep
but with future annotations being strings in future, i'm unsure if that will be all that useful for inspection lol
code like dpys converter typecasting might eventually need to manually re-add some of this logic
or just give up doing converters
hah, that's a fun "but it will break with this" ```py
class M(type):
... def or(self, other): return "Hello"
...
class C(metaclass=M): pass
...
C | int
'Hello'```
ye
i override a fair bit of behaviours in some of my own code
not very pythonic of me lol
There's too much freedom in python 🙈
lol
Time to make Go syntax with python keywords
@nocturne hare btw it works
got distracted talking crap lol
@commands.command()
async def test(self, ctx, *, thing: t.Optional[int]):
print(thing)
await ctx.send(str(thing))
no = None required
neat
Then that's my preferred way of doing it
Time to monkeypatch something into my python to make that a globally available feature
yeah that's fine by me now that i know at least it works for consume
since it should still indicate it's Optional in the cmd sig
anywho, i'll disappear again for a while
hey @cold island , are you available tomorrow? I don't think I can make it tonight with the full version complete, I still have a few commands to go on the bot side(site is complete)
Sure, no rush
thank you and sorry for the trouble
Yes I did
what i can change in this
They are way too many info here IMO
yes
And both url should just be markdown links
package name could be the title and link the homepage, and then the summary could be the embed description
.gh gustavwilliam
Like in this command
(I don’t have a description, but try it with someone else in #sir-lancebot-playground)
Ah, I didn’t make it, but I reviewed it
on android embed is looking broken
and on pc its looking nice
can i skip maintainers ,i am asking this because most packages dont have maintainers
Yeah
Is there a limit to the description length? Because I can imagine some would be pretty lengthy
i am using summary as description
I think Project URL and Download command should be too in description, and download command should be inside inline codeblock
Yeah. That would be good
The download command shouldn’t even be there
Why not?
It is always pip install <package name>
it is just taking place on the screen for nothing
Besides, you’d check the pypi page before downloading a library, and the command is on it
I never seen any different name, I don’t think that’s possible
Hmm. Probably not
when i added title and description with inline = true its started looking weired
what u think i should add or remove 😅
I don't think monthly download is that useful
Besides it seems kinda broken haha
I think you should be conservative with what the embed contains, I see the feature as something you use to get a clickable link to open the PyPI page and maybe the repo, not something that will give you all information you may want to know
actually in my issue these things are mentioned
Name
Summary
Author
Maintainer
Project URL (PyPi)
Homepage
Required Python version
Latest version
License
Downloads (last month)
Quick installation copy paste string```
You should also get rid of the download command, and make the project url amd homepage (one word) just two little button at the bottom of the embed
thinking of getting rid of downloads also
i dont think its that much useful
how about this
I don’t think the python versions are really great, befause they end up being oretty spammy
Also, can you apply my suggestions please?
Do we really want maintainer?
I mean if we actually want to include it
Why is monthly downloads negative?
I don't think the API provides the information anymore
the API just returns the values to not break current software
It should be removed then nevertheless
It gives negative value to not break already existing tools that use the api.
I think it would be sort of nice to have a bit more of a description tbh, but not sure how well that could be done, maybe textwrap.shorten the first something characters of the main text?
Not sure how well that would work though/how useful I would end up being
actually thats summary 😅
some package have lots of info in required python
and some only one
actually thats summary 😅
@green mesa yeah, I know the summary is there, I'm just thinking it would be nice to also have some of the main text, i.e for docker it could takeA Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.
Maybe not necessary though
their description is readme file of their package
need some regex magic to get actual text 😅
or markdown
This is not possible to get this full summary, because there isn't any structure forced.
forms app is small now
@green mesa The PyPI icon may be better to use as a thumbnail
Or the logo of the package
It is the 🥒
Gurkult
I think this should check does package have logo and when it don't have, use PyPi logo instead.
Does the API even provide a logo?
Like, I never seen any package logo anywhere on pypi
Nah, I don't see anything on the response
Same here
How does a beginner get involved with supporting the python discord?
I think Last updated field should be in embed, because this is good to see is this package still active or not.
@full blaze generally it is,
You look through issues on given project of ours,
If you find any interesting one you check if no one is working on it yet and:
- if no one does, you can comment on it so core-dev can assign you to it and you can start working on it
- if someone works on it then check if they still are working on it [eg if they have said they will do it 6 months ago you might want to re-check that], if they still are working on it you gotta pass on it
You can also look suggest things for our projects, and if we accept those suggestions you can also work on them
You can also look for bugs within our code and tell us about it and work on it
@subtle kraken Some projects have easy or first projects that are identified to jump in with, do we maintain any of those?
Most of seasonalbot's issues should fit it, they also should have the good first issue and difficulty tags
The Python bot greets the user on opening issues and Pull request on github, how is it done?
I tried using Github Action but it kept saying insufficient permissions
we have a webhook from github to our app, when we get a new PR opened we check if github is saying it's a new contributor, if it is we send an API call to github to add a PR comment
ohh so it's a separate app running? is it open source 👀
not as of now, I've been meaning to rewrite it
really good guide by a Python core dev on building them though https://github-bot-tutorial.readthedocs.io/en/latest/
Oh cool, thanks
@patent pivot I'm planning currently library github.py that will have HTTP Client only and Webhook + HTTP Client and I plan to make this asynchronous, HTTP will use aiohttp and Webhook Starlette. Maybe when I finish it, PyDis GitHub bot should use this?
Or maybe this use GraphQL, not sure yet
@crude gyro I got idea about articles app: Currently this is loading all data over and over again from filesystem and last modified + contributors from GitHub every time when somebody visit article. But what about in ready function in AppConfig fetching all guides, categories and GitHub data at once and store them to cache, because in order to modify article, this have to redeploy, what means this cache everything again.
I’ve been looking at the github api, I couldn’t find anything about contributors and last modified times
File commit listing
There is every contributors, and from last commit this take last modified time
But can you ask to filter for the last commit on a specific file?
I think by providing limit=1 query parameter, but I fetch all commits because I get contributors from there.
Commit at position 0 is always last commit
But the last commit probably didn’t modified the guide page though?
No, you can ask for specific file commit history
Okay, nice
#dev-log message if you want to revert to the 'solved newline issue' commit, use git reset --hard b0da6c0, if you want to save your other commits, then use git branch any-brach-name master before you run that command
idk your discord so i cant ping you 😐
@timid sentinel i checked description of some other packages and noticed in description they mostly mentioned how to do basic installation and how things work
so i think summary explains well in this case what do u think?
in embed what i can more add ?
any suggestions from anyone
Make url to URL. This looks a bit weird.
And I'm not sure will this be always GitHub repository. I think this can be something else too
all fields are dynamic if it present there only then it will show
I mean that what you name GitHub repository is I think named in PyPi homepage?
yes
Then name this in embed too Homepage, because when someone host in GitLab?
Or somewhere else
Then this is not valid
hmmm let me rename it
name it repository 🤔
I'm pretty sure that this is not forced to be repository
This is named Homepage in site
Perfect
looks good, but why is it pypI, shouldnt it be pypi
i think it should be pypi
sure
pr coming in 30 min 😄
There has not been any update on this since a while, so I thought I'll ask it here directly-
https://github.com/python-discord/seasonalbot/pull/496
Ready to merge? Requires changes?
I will review it.
But I have one question to Core Developers: In theory, is this possible to add Redis to site?
i also need review on 2 pr my hacktoberfest mature time will end in 3 day
Do you have accepted label?
yes
Then you don't need it
What'd you need redis for on the site?
This is related to #dev-contrib message @brazen charm
Can you just not ask the os on when the file was last modified and only reload if the file and site times don't match?
Using Docker this OS time getting doesn't work.
I think this could be pretty good performance win when we could cache all articles
works fine for me
Ah right it'll restart on pushes to the repo (unless that's changed), but you only need to load them in on startup which I don't think it's worth using redis for
However, seems like currently site don't have any caching way
I think we should use https://docs.djangoproject.com/en/3.1/topics/cache/#memcached then
Doesn't really need it with the db being local to it
thinking of raising Bad Arguement error if package is not found or i should make different error embed for this?
Bad argument is meant to be raised when like invalid type provided.
I think it's better to catch this and send your own error embed, describing why this failed.
PyDis site is really really useful template for Django site setup with Docker deployment.
excellent lazy reference lol
lol, I'm creating site for new user event
How currently production environment variables is inserted to container?
usage of env vars
.env file?
nah, we deploy containers through saltstack
and it can insert env vars that we have listed in our "secrets" document
if you were to use something like docker-compose instead, you'd just use a .env file though for values across multiple services and specify that .env file to be used in the services compose
or if it's only relevant to one server, you'd directly place the env vars in that service's compose
if you use a different container deployment setup, then you'll need to refer to the docs of whatever you're using
.pr 479
[404] #1153 Issue/pull request not located! Please enter a valid number!
Just _
yes the PR is alive
@exotic ember Hello! I have made the requested changes, can you review it again? thanks in advance
need 1 more review
y at pybot repo there is no template for contribution?
Nope
We don't feel like needing one, as we mostly get only experienced contributors
@hardy gorge can I get a greenlight on that?
https://github.com/python-discord/bot/issues/654#issuecomment-708075348
umm but for new contributors?
@green mesa we have higher expectations on the bot repo. if a new contributor opens a PR that isn't satisfactory, it'll either be reviewed in detail outlining why or will be closed and marked invalid




