#dev-contrib

1 messages Β· Page 172 of 1

vale ibex
#

hopefully not

surreal veldt
#
PS C:\Users\tenuk>```
#

when I run python install-poetry.py --uninstall

vale ibex
#

uhh that's weird

surreal veldt
#

any specific dir to save it in?

#

directory*

vale ibex
#

Where ever you like

surreal veldt
molten perch
#

Hey! I'd love to have some review on sir-robin#20 , it's a fairly straightforward migration πŸ˜‰

dusky shoreBOT
austere hornet
#

!ot Wrong channel, you could ask in off-topic

stable mountainBOT
eternal hull
thorny obsidian
short snow
#

You could use context menues for that, or whatever they are called

#

arl implemented it for their bot

#

and it works pretty great

#

(didn't have immediate access to it, so copied hsp's screenshot)

signal forge
molten perch
#

Hey! It looks pretty good. If you wish to showcase your features I could suggest you to open a draft pull request. This way we know that you haven't finished it yet, but you have made progress. (Maybe you could upload this gif/video as the description for the draft)

signal forge
dim pelican
#

I think the only difference is marking it as a draft after creation

gritty wind
#

You can actually open a PR as draft right away, which has the added benefit of not auto-requesting reviewers until you're actually ready

#

It's in a dropdown under the normal open PR button

signal forge
#

Is anyone available to help me get Poetry up and running?

#

I've installed it, but am running into an issue that I can't quite figure out... none of the commands are working as they should.

ericfletcher@Erics-MBP ξ‚° ~ ξ‚° poetry run python                                                                                                                                                                                                                                                      ξ‚² βœ” ξ‚² 1391 ξ‚² 20:38:06

  RuntimeError

  Poetry could not find a pyproject.toml file in /Users/ericfletcher or its parents

  at .poetry/lib/poetry/_vendor/py3.9/poetry/core/factory.py:369 in locate
      365β”‚             if poetry_file.exists():
      366β”‚                 return poetry_file
      367β”‚
      368β”‚         else:
    β†’ 369β”‚             raise RuntimeError(
      370β”‚                 "Poetry could not find a pyproject.toml file in {} or its parents".format(
      371β”‚                     cwd
      372β”‚                 )
      373β”‚             )
#

Then from within the project in PyCharm with poetry run task precommit

 ericfletcher@Erics-MBP ξ‚° ~/Documents/open-source-repos/bot ξ‚° ξ‚  2079 ξ‚° poetry run task precommit                                                                                                                ξ‚² 1 ↡ ξ‚² 1393 ξ‚² 20:38:34

  FileNotFoundError

  [Errno 2] No such file or directory: b'/Library/Frameworks/Mono.framework/Versions/Current/Commands/task'

  at /opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py:607 in _execvpe
       603β”‚         path_list = map(fsencode, path_list)
       604β”‚     for dir in path_list:
       605β”‚         fullname = path.join(dir, file)
       606β”‚         try:
    β†’  607β”‚             exec_func(fullname, *argrest)
       608β”‚         except (FileNotFoundError, NotADirectoryError) as e:
       609β”‚             last_exc = e
       610β”‚         except OSError as e:
       611β”‚             last_exc = e
#

I think this is tripping me up / not properly executed:

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
vocal prairie
#

I think I've gotten this error because I haven't before

signal forge
#

I have this in my .zshrc

 export PATH="$HOME/.poetry/bin:$PATH"
signal forge
# vocal prairie Have you run `poetry install`?

I just did in my terminal on my Mac laptop:

ericfletcher@Erics-MBP ξ‚° ~ ξ‚° poetry install                                                                                                                                                                                                                                                         ξ‚² βœ” ξ‚² 1396 ξ‚² 20:45:22

  RuntimeError

  Poetry could not find a pyproject.toml file in /Users/ericfletcher or its parents

  at .poetry/lib/poetry/_vendor/py3.9/poetry/core/factory.py:369 in locate
      365β”‚             if poetry_file.exists():
      366β”‚                 return poetry_file
      367β”‚
      368β”‚         else:
    β†’ 369β”‚             raise RuntimeError(
      370β”‚                 "Poetry could not find a pyproject.toml file in {} or its parents".format(
      371β”‚                     cwd
      372β”‚                 )
      373β”‚             )
#

Oh should I run that command from within the project in PyCharm?

vocal prairie
#

from within the project, yeah

#

It'll install the dependencies from the pyproject.toml into a venv

signal forge
#

oh my

#

it's installing so many things

#

lol I'm such a noob 😦

#

Oh my the lint is so cool!

#

Everything passed except Flake8 for 4 errors i need to fix

signal forge
# vocal prairie from within the project, yeah

Now when ready to commit and push, after running lint and precommit, I get this commit failed with error message:

21:01:48.934: [bot] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -f -- bot/exts/info/resources.py
21:01:48.939: [bot] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F /private/var/folders/nn/7bxtpjwx1sbbfnynm05zdtjc0000gn/T/git-commit-msg-.txt --
Check for merge conflicts................................................Passed
Check Toml...........................................(no files to check)Skipped
Check Yaml...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
check blanket noqa.......................................................Passed
isort (python)...........................................................Passed
Flake8...................................................................Failed
- hook id: flake8
- exit code: 1
Executable `poetry` not found

vocal prairie
signal forge
#

running this from within PyCharm

vocal prairie
#

I'm not sure what could cause that

signal forge
#

lol

vocal prairie
#

ah, maybe it didn't load into the PyCharm session

#

glad you figured it out!

signal forge
#

Yea! going to enter a draft pull request now

#

Don't worry the issue was assigned to me πŸ™‚

#

And approved

signal forge
#

Hi, everyone. I just submitted my first ever draft pull request to the Bot repo. My PR has failed 1 of the lint checks and am not entirely sure how I can fix what it has identified.

Can anyone help me with this?

https://github.com/python-discord/bot/pull/2117

GitHub

Hi, everyone.
This pull request is in reference to approved issue #2079.
Please note, I successfully ran poetry run task precommit and poetry run task lint prior to submitting this pull request.
De...

tawdry vapor
#

Do you know how to view the logs for CI?

signal forge
#

I clicked details, and it says bot/exts/info/resources.py:5: ModuleNotFoundError

#

But it's properly working on my local version in PyCharm.... the disnake module

tawdry vapor
#

There were recently commits merged into main which switched from disnake back to discord.py

signal forge
#

oh no

#

I guess I could just replace disnake with discord./py and replace what I can with discord.py

tawdry vapor
#

Your branch is just out of date. If you merge the changes from main and update your import then it should work

signal forge
#

oh

#

ok i can do that

#

but then I have to re commit and then recommit to my pull request

tawdry vapor
#

Though it is strange that the CI used the latest changes (regarding dependencies) despite your branch being on an older revision...

signal forge
#

Do iw ant to merge incoming changes into the current branch?

#

Or rebase the current branch op of incoming changes

tawdry vapor
#

Since your PR is still a draft, no one has reviewed it yet. So you're more flexible with the git history. Doing a rebase would require you to force push, but it will result in cleaner history; the merge would create an extra "merge commit"

signal forge
#

It says I have no tracked branch

#

Can't perform the update

#

Can I share my screen with you?

tawdry vapor
#

Sure

#

Can you join the dev voice channel here or is it locked for you

#

<@&831776746206265384> please grant stream perms to @signal forge

vocal wolf
#

!stream 750693589532672100

stable mountainBOT
#

βœ… @signal forge can now stream until <t:1647481245:f>.

vocal wolf
#

wait that only gives 5 minutes

tawdry vapor
#

Thanks

#

No it's fine I think

#

It's just the window of time they have to start the stream

vocal wolf
#

ah

short snow
signal forge
hoary haven
#

what time zone are you in, out of curiosity?

#

there is a chunk of the day where we tend to have mods on vc, but it's usually not around this time.

surreal veldt
#

Sorry for ping but @vale ibex do you mind following up on what you were saying about getting the pre hooks installed?

gritty wind
surreal veldt
gritty wind
#

I was watching yesterday, you should just need to run the script with the correct environment 😜

#

But yeah you can wait for Chris, that’s fine

surreal veldt
#

When i run some code i now get this

#
task: <Task pending name='disnake: app_command_preparation' coro=<InteractionBotBase._prepare_application_commands() running at C:\Users\tenuk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ext\commands\interaction_bot_base.py:849> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000022E7F8BDF70>()]>>```
#

It maybe because of the files i added or changed yesterday I'm not sure what to do

gritty wind
#

This is good, it means the application is running

#

Did you stop it while it was running?

surreal veldt
#

It's a script for a discord bot

gritty wind
#

Python discord bots?

#

As in one of the server’s projects

surreal veldt
#

But it doesn't normally come

surreal veldt
#

But it doesn't run the code with that error

gritty wind
#

Could you post a full traceback

surreal veldt
#

I have a print on on_ready which isn't printed

#

I'm not currently on my pc but iirc that's the full tb

hoary haven
#

hm getting a 500 when trying to submit a PR

#

:(

vale ibex
#

D:

placid ermine
#

oof

vale ibex
#

webscale software sometimes has hickups

#

maybe they deleted /etc/ on one of their hosts

#

@patent pivot @last patio thoughts

last patio
hoary haven
#

all yellow now

#

PRs was green for a long time lemon_angrysad

clever wraith
summer garden
short snow
#

how did they close the issue

brisk brook
#

They're a helper

short snow
#

ah, didn't find a member tag on them, so got suprised

#

whats their discord tag, out of curiosity?

sturdy jungle
short snow
#

Ah πŸ‘

full fractal
#

In that case usually the tag is "contributor" or even nothing IIRC?

gritty wind
#

Contributor is unrelated to membership

#

It’s about making commits to any branch on the repo

#

But yeah a ton of hidden members

full fractal
#

well that's fair, I was just talking about the visible tags for hidden membership -- it's fairly common since members do typically make commits

#

but yes they are separate things, they only overlap when GH decides which tag to present

short snow
full fractal
#

No...? you'll only see it if you're also a member

short snow
#

ok yeah, got them confused with the contributor tag πŸ˜…

torpid grotto
cold island
#

Seems like a Discord hiccup

torpid grotto
#

πŸ‘

placid ermine
#

@tawdry vapor

try:
    is_future = target > arrow.utcnow())
except TypeError:
    is_future = True
if not is_future:
    await ctx.send("!!!!")
    return
func(...)

is a bit cleaner, i think?

tawdry vapor
#

Sure that works.

#

Or maybe instead of return early just do if-else.

#

Up to you I'm not super concerned about minor readability details at this point

#

I used up my quota for the docstring :D

placid ermine
#

lol

#

hmm also, how do i do the "resolved in <commit_hash>" thing on github

#

nvm googled it

tawdry vapor
#

Oh... I just realised we have almost 30 PRs open

#

That is not good

#

Possibly the most we've ever had

#

Even more if we consider other repos

placid ermine
#

all the more reason to merge mine quickly /s

tawdry vapor
#

Yeah I was gonna be lazy and review it tomorrow cause it's late but I'm gonna test it now while I'm still in the mindset of contrib stuff

#

Ah yes I am reminded of how painfully slow discord API responds on my machine

#

um? ```
Installing dependencies from lock file

RuntimeError

[BUG] bot-core (1.2.0) is not satisfied.

at /usr/lib/python3.10/site-packages/poetry/mixology/partial_solution.py:200 in satisfier

hoary haven
#

is this your first time setting up bot since bot-core stuff was added?

tawdry vapor
#

Yes I think

hoary haven
#

i've on & off had to destroy my venv and poetry install fresh

tawdry vapor
#

I tried that already though

hoary haven
#

kosa had a completely different issue

tawdry vapor
#

let's see if it gets fixed if I re-lock

hoary haven
#

but i think kosa's was smth abt python being set to 3.9.0a somewhere, which i'm sure is not your scenario

tawdry vapor
#

I don't think this lock is gonna work... 90 seconds and still going

#

Wait it finished

#

Nope still broken. No idea why. I'm using 3.9.9

#

The error says "bug" which implies it's some Poetry bug. Also weird that the lock took so long

odd hill
#

could I be assigned an issue from one of the python bots?

rapid swallow
odd hill
#

i don’t really mind

#

any would suffice

surreal veldt
#

when I use poetry commands in terminal it raises errors like the system cannot find the path specified. I'm not able to find them in the file explorer as well, so they might've been deleted.
Can anyone tell me how to re-install poetry?

fervent sage
#

you could use pip install --force-reinstall poetry

surreal veldt
#

after running that, in my command prompt i did pip show poetry and it gave something though

#

is that normal?

#

oh also it raises ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. httpx 0.13.3 requires idna==2.*, but you have idna 3.3 which is incompatible.

hoary haven
#

was helping raven, and for whatever reason poetry install only worked after pip installing poetry into the project venv

#

big Β―_(ツ)_/Β―

brisk brook
#

I am not sure how often you check your mail or GitHub notifications so I'll ping you here. I reviewed your pull request @signal forge!

surreal veldt
#

What does this mean?

vocal wolf
surreal veldt
vocal wolf
#

where was this notification found?

surreal veldt
vocal wolf
#

are you the author of this PR?

surreal veldt
#

yes

vocal wolf
#

ah, then this was most likely a mistake I believe

#

if you hadn't discussed this beforehand

vocal wolf
surreal veldt
#

i was looking forward to working on it lol it's my first time doing markdown and the YAML formatter

vocal wolf
surreal veldt
#

okay, thank you

surreal veldt
#

Does preview not support this? Actually first of all, is this how I should be using YAML formatter in a .md file?

wild prism
surreal veldt
wild prism
surreal veldt
#

Yeah I considered that but then thought I'd skip that step

patent pivot
#

We generally do review requests for that but that's the other meaning

surreal veldt
#

I'm sorry I didn't understand what you mean, you're talking for Volcyy he wanted to review it?

patent pivot
#

if he assigned himself to your PR it probably means he's going to review it

surreal veldt
#

so I can still change it and update it? Or he will do that

patent pivot
#

No all is still entirely up to you

#

It's just a reminder to him to review it

surreal veldt
patent pivot
#

@last patio maybe use review requests in future for things like this unless you have another meaning review reqs don't cover

surreal veldt
#

I hope I can avoid those steps because it's kind of a long task at least for me to get a small thing done

#

Oh wait I just realised he asked to use YAML frontmatter which I read as YAML formatter

#

Anyways, the member who self assigned it said he doesn't think markdown headers shouldn't be used for text, can I ask for feedback here? Right now it looks like this

last patio
vocal wolf
#

ty for letting me know

surreal veldt
#

But it's fine i misread a phrase

surreal veldt
vocal wolf
#

By headers I mean the many ###s

#

the top title stays

surreal veldt
#

oh got it updated

#

at first I thought it looked more readable but in retrospect the body was too big

signal forge
brisk brook
# signal forge Hey! Thank you so much <@!344404945359077377> .... a lot to learn πŸ™‚ This is my ...

I am not aware of one personally, sorry.

It's relatively simple though. Go through the comments and apply the feedback you agree with by making those changes locally, if there's something you don't agree with then make a reply on the comment discussing it. Once you've applied all comments you can commit the changes and push, lastly click "Mark as resolved" on the comments that you fixed. It's fine if you leave some open, as they may also be asking others' opinions as well. I recommend not force-pushing on larger PRs (it's fine on for example one-line changes) because all comments get marked as Outdated (even when they may not be) and if I mark files as viewed that gets reset.

Don't be too worried about messing up the Git history, your PR can simply be squashed in the end if things get messy.

surreal veldt
#

If i make a PR and update the code, how do i update it in the pr? Do i need to make a new PR?

brazen charm
#

the pr will be updated if you push to its branch

clever wraith
#

lol

surreal veldt
brisk brook
surreal veldt
brisk brook
#

Have you pushed the changes?

surreal veldt
#

I use the commit command right?

brisk brook
#

Yes, first you commit and then you push the commit to GitHub

surreal veldt
#

how do I stage files?

placid ermine
#

git add .

surreal veldt
#

cool thank you it was updated

surreal veldt
mellow hawk
#

@patent pivot hey can you accept my friend request just wanna ask you something

#

then you can remove me

mellow hawk
#

oh

#

didnt know that

jovial kite
#

lol

harsh pasture
#

hi

fallen patrol
#

Pre-fetching them with an asyncio.gather will speed this up dramatically, thanks to the power of non-blocking networking.
was it tested to see if this actually does speed it up?

hoary haven
#

when testing yeah it was loads faster

#

in the bot's current state it takes 25~50s to give us the bb watched message

#

testing that PR on the test server it took less than a second. granted that's with a much smaller set of users

#

bot#2115

dusky shoreBOT
hoary haven
#

not sure how we can replicate a larger number of users for testing

fallen patrol
fallen patrol
#

additionally, disable the member cache while testing

#

it's definitely going to be faster in the test server because all users will be cached automatically as the guild has less than 250 members, so it will be using the cache and making no requests, which means that the gather won't be doing anything in testing

#

and in prod it also won't do anything due to dpys sequential ratelimit handling

#

dpy makes one request to a route and waits for it to return before letting the next request through

#

it's slow, it's clunky, and it means that you get no api benefit from gathering requests together

#

and even if you did gather them together, there's not a great way for the library to handle the 50 requests/sec global baseline, but that can't be assumed either because bots can be given a different global ratelimit, and the only way to get those update ratelimits is to be cloudflare banned a couple of times and then reach out (seriously, this is what the docs say)

#

so if the library did make concurrent requests, which dpy does not, you would want to chunk asyncio.gather to make around 35 requests to leave overhead for the rest of the bot's functions, and then wait a second before making the next batch, and then repeat.

#

I'm working on refactoring the ratelimit handling for disnake to allow users to use the benefit of asyncio.gather if they desire, as right no there is virtually no benefit

hoary haven
#

and the only way to get those update ratelimits is to be cloudflare banned a couple of times and then reach out (seriously, this is what the docs say)
lol wat

fallen patrol
#

yes

hoary haven
#

but yeah if dpy itself is the bottleneck anyway i suppose this won't help

fallen patrol
#

disnake should soon have this handled better

#

as an example right now making 40 channels with dpy takes around 8 seconds, new ratelimit handling brings that down to 0.7 seconds

#

which is a huge speed increase, it allows bots to actually take advantage of ratelimits while also making sure you dont get 429s

fallen patrol
#

but there is also a gateway command which could help with this which I've detailed on the pull

#

wait

#

@hoary haven how many watched users are there

#

just curious if the websocket idea is any good

#

it might not, depending how many users there are to be fetched within 40 seconds, although I have to keep in mind that I have no idea how many are cached

hoary haven
#

this topic is whooshing over me so i'll let others comment tmrw BlushFluent

surreal veldt
stable mountainBOT
#

bot/exts/utilities/colour.py line 16

from bot.exts.core.extensions import invoke_help_command```
cold island
#

It is there.. imported from another file. That's not great of course

#

the correct import is bot/utils/extensions.py like hsp mentioned

surreal veldt
#

oh so it's not imported from the file the function is created in

cold island
#

yeah

signal forge
#

@brisk brook - are you around for a quick screen share? I'm working on your code review and have a couple questions about how I should go about creating commits.

brisk brook
#

Sorry no, but if you have questions I can answer them in here!

signal forge
#

Ok cool. Does each comment get its own commit with comment, or should I just make all the changes then commit?

brisk brook
#

If there's for example multiple typos you fix I would put those in the same commit.

#

If the changes are completely unrelated then I sometimes put them in different yes.

signal forge
#

Ok cool

brisk brook
#

For example, you can have one for fixing the docstrings (I left multiple comments for this), one having to do with extracting the tag from other content and one for embed improvements

#

I see some people just say "Fix after review comments" sometimes, but that can make it unclear what changed when you don't know exactly which comments were made and which were addressed.

signal forge
#

Ok cool thanks for the info! And so since httpx is not used, I can pass over your suggestion regarding request blocking?

brisk brook
#

Let me see where the session is stored, hold on.

sleek steppe
#

bot.http_session

signal forge
#

Hmmm... I'm not sure I really understand what aiohttp is doing. Is it making the request to the site?

#

So I would be accessing the site and pulling the html using aiohttp.

brisk brook
signal forge
#

Agh sweet.... I'd still use BeautifulSoup to get the data from the HTML, right?

brazen charm
#

yes

wild prism
#

does site not expose this in the API?

tawdry vapor
#

No. The categories are kind of hard-coded

#

I say kind of cause the icons are hard coded, but IIRC it actually uses whatever categories it finds in the loose files. Didn't see any validation for that.

signal forge
#

There is a particular API we can use to access data from the site? Like particular methods that allow for the gathering of data from the site?

molten perch
signal forge
#

@brisk brook - What do you suggest I do with the code that's removed from my PR ahead of the API update.... copy paste it somewhere and when the issue is open see if any of it is useful?

wild prism
#

the API also handles things not related to the site frontend, like moderation infraction history, but it's still tied into the site project

brisk brook
# signal forge <@!344404945359077377> - What do you suggest I do with the code that's removed f...
GitHub

The community bot for the Python Discord community - bot/resources.py at e268c7b9e5fcf829c7f2ddbaee0d584b07808aa3 Β· python-discord/bot

#

Even if you push more changes, it'll be right there in this commit. As long as you don't force push and delete it permanently

signal forge
#

oh wow

brisk brook
#

Simply comitting changes that remove it, will still keep it in the history

#

That's the point of Git and why it's used!

wild prism
#

if there's an issue open for the API changes, you could link to that commit in a comment

#

and if there isn't you could open one

signal forge
wild prism
#

you dont have to of course, but also opening an issue doesnt mean you have to be assigned to it

signal forge
#

I'd want to be assigned to it... it seems really interesting plus a terrific learning opportunity.,

#

I'm going to completely remove the scraping portion from my current PR and move it to the future API request issue.

brisk brook
#

I think you should just do some basic work to separate obvious resource from the user's message (like splitting by ., newline, | and similar) then just try to set that as a resource

#

Get this working and merged, meanwhile you can look at the site API and open another PR using this new API once it's been merged.

signal forge
#

Yea that's what I'm going to do.

#

Would you suggest not SCREAMING_SNAKE_CASE the url since it is being mutated via the appending on to the URL?

#

Actually, I don't need the resources url in my current PR since it's included in the string and fstring

#

I'm going to hope to have my PR updated later tonight.. I have to jet for a bit, but will be back

#

Thank you so much for all the help.

fallen patrol
#

it should just be on the context object

#

and use a custom context class

#

type hints would not need to be changed, as the methods do already exist

#

Context.send_help IIRC

#

That could be overridden to send the correct help and wouldn't require this weird method

cold island
#

idk, didn't delve deeply into that code πŸ˜„

#

It's likely to be replaced eventually with botcore

fallen patrol
#

should use a custom context IMO

trail pilot
#

i'm trying to set up the site repository, and docker runs and it gives me the link (http://0.0.0.0:8000/), but the link doesn't work and just says "site can't be reached"

vale ibex
#

that's the IP within the docker container

#

on your machine it will be 127.0.0.1:8000

cold island
#

or just localhost:8000

trail pilot
#

ohh

#

thank you

fallen patrol
#

@vale ibex bot#2115, are you fetching users that aren't in the guild

dusky shoreBOT
fallen patrol
#

i think you are

#

that means you have around 30 to 60 members who aren't in the cache, and are being fetched as a user

#

huh

#

no, every member is in the guild

vale ibex
#

There are many users that aren't in the guild yes

#

but they won't be fetched since we're using get member, so get_or_fetch member will just return None

#

my comment in the conversation isn't accurate, since I made it on my phone and didn't actually read the code properly

#

So we just need to get all the member objects for the people in the guild, but can't solely use member cache since offline user's won't be in there

fallen patrol
#

although why will offline users not be in the cache?

#

hm

#

seems like chunking should be done to fix the cache issues, although i wonder

#

what exactly is the data used for?

stable mountainBOT
#

bot/exts/moderation/watchchannels/_watchchannel.py line 368

line += f" ({member.name}#{member.discriminator})"```
stable mountainBOT
#

bot/exts/moderation/watchchannels/_watchchannel.py lines 371 to 372

if not member:  # Cross off users who left the server.
    line = f"~~{line}~~"```
vocal prairie
#

!d r

stable mountainBOT
#
Inventories refreshed
vale ibex
#

which was causing us issues with modmail

gritty wind
#

Start up cache?

#

Shit, not even online members are in it most of the time, as the reminders command constantly reminds me

vale ibex
#

nah, even after start up

#

we were having issues where offline users couldn't open modmail threads since they weren't cached

#

We had to change a get to a get or fetch iirc

#

but checking guild.members now, it looks like it's full

green oriole
#

that was a discord bug

#

they just didn't send every member for some reason

vale ibex
#

sounds believable lol

#

probably not worth forcing the command to take ~1 minute just to cover the case where discord might decide to do that

green oriole
#

it was painful to add fetches everywhere

vale ibex
#

might just change it to a get only

green oriole
#

you could try to get and fetch if it isn't in the cache

#

isn't there a utility for this already?

vale ibex
#

it's using get or fetch already

#

there's just so many not in the cache that it's causing a bunch of fetches

#

(this is for the bb watch list)

green oriole
#

lol

#

is there an option to lazily load pages

vale ibex
#

I was thinking about that lol

#

currently not, but it's already server-side pagination so why not add it πŸ˜›

#

probably just pass a coro instead of a line to the paginator and have it inspect for coros

green oriole
#

yeah

vale ibex
#

I've never had to do this before, so what's the most pythonic way to lay this out?

#

Ideally the paginator would take either a coro or a normal func

#

and then either call the func, or await the coro

#

is there a good way to tell if a given callable is a coro and await it, or just call it if not?

#

my first thought was something like ```py
result = a()
if isinstance(result, typing.Coroutine):
result = await result

placid ermine
#

there's inspect.iscoroutinefunction

vale ibex
#

ah, would I use that over the isinstance?

placid ermine
#
if inspect.iscoroutinefunction(f):
    await f()
else:
    f()
vale ibex
#

alright cool, thanks πŸ˜„

green oriole
#

!docs inspect.isawaitable

stable mountainBOT
#

inspect.isawaitable(object)```
Return `True` if the object can be used in [`await`](https://docs.python.org/3/reference/expressions.html#await) expression.

Can also be used to distinguish generator-based coroutines from regular generators...
green oriole
#

Even better @vale ibex @placid ermine

vale ibex
#

Wouldn't that require us to actually call the coro?

#

IE inspect.isawaitable(f()) vs inspect.iscoroutinefunction(f)

green oriole
#

Not really?

#

I mean

#

Wait

#

You want an awaitable object

#

You want to pass f()

#

then await it when needed

#

So you are free to pass whatever arguments you want to f beforehand, basically getting a more powerful API for free

vale ibex
#

Yea, so its py result = a() if inspect.isawaitable(result): result = await result vs ```py
if inspect.iscoroutinefunction(f):
await f()
else:
f()

green oriole
#

Yeah

#

Well

vale ibex
#

*args **kwargs to the coros ofc

green oriole
#

You probably want a check for callable, awaitable then just copy the variable

#

You do not need args and kwargs if you use an awaitable object

vale ibex
#

I was thinking of allowing the paginator to accept an awaitable, or a normal func

#

So IG it could accept a partial or an awaitable

green oriole
#

I think that's the best option if you want to pass a list of callbacks

vale ibex
#

Yea

#

so lines is list[Union[str, Awaitable, functools.Partial]]

green oriole
#

Yep

#

well you may as well put Callable[[], str] instead of your partial

#

I wonder if you can set the return value of your awaitable too

vale ibex
#

Yea, it would need to return a str

placid ermine
#

kind of a weird api tbh lol

green oriole
#

it makes sense whne you think about it

#

is the new paginator anywhere?

#

dead bot-core but it is imported as botcore

#

I see no paginator

vale ibex
#

paginator hasn't been ported yet

#

and this new thing I'm talking about I havne't written anny code for it

#

just thinking about how I'd implement it

green oriole
#

oh yeah, I was just looking for some code to steal

vale ibex
#

LinePaginator in bot then

#

can't remember the path off the top of my head

green oriole
#

the current paginator is a bit too much of a mess though :P

#

is it not using views

vale ibex
#

nope, haven't updated it

green oriole
#

no pydis bot has interaction based pagination?

#

I am probably misremebering then

vale ibex
#

Correct

#

The help command has interactions

#

!help bb

stable mountainBOT
#
Command Help

!bigbrother
Can also use: bb

Monitors users by relaying their messages to the Big Brother watch channel.

Subcommands:

!bigbrother oldest [update_cache=True]
Shows Big Brother monitored users ordered by oldest watched.
!bigbrother unwatch <user> <reason>
Stop relaying messages by the given user.
!bigbrother watch <user> <reason>
Relay messages sent by the given user to the #big-brother channel.
!bigbrother watched [oldest_first=False] [update_cache=True]
Shows the users that are currently being monitored by Big Brother.

green oriole
#

aah

vale ibex
#

not quite pagination

#

iirc you can control the interaction too

#

we didn't restrict to author

green oriole
#

looks like I'm asking the octocat for help

vale ibex
#

I think this solution wasn't too bad

#

Can't remember specifics though

green oriole
#

I see, I see

vale ibex
#

!src help

stable mountainBOT
#
Help Command

An interactive instance for the bot help command.

Source Code
green oriole
#

so much boilerplate

#

thank you

#

any resource to get started with views? :c

vale ibex
#

with fairly decent comments

#

not sure about written guides

#

I bashed my head against the API ref and it was pain

green oriole
#

I feel like that's where I'm currently going lmao

#

Represents a UI view.

This object must be inherited to create a UI within Discord.

#

I could have made those docs

vale ibex
#

lol searching discord py guides brings up our guide on site

#

gotta love that SEO

cold island
# vale ibex

Google adjusts results to you. Try searching from incognito

#

Unless that's what you meant by SEO πŸ€”

vale ibex
#

looks like this for me in incognito πŸ˜›

#

So yea, slightly changed

signal forge
#

Hi, everyone. I think I'm almost done with my current PR here: https://github.com/python-discord/bot/pull/2117

I am going to adapt a portion of my code from the above PR that was removed to create a new addition to the site API (open the issue and hopefully get assigned to the issue). I've never worked with an API before, so was wondering if there are any more experienced members who could help briefly explain the API and how it interacts with Discord / how the methods are called / utilized across the project? Perhaps a screen share voice chat session would be most beneficial for me. I live in the EDT time zone and can be available anytime after say 8:00 PM.

cold island
# green oriole so much boilerplate

Views and buttons generally don't need this much boilerplate, the use case here is just a bit on the edge since the components are created dynamically

green oriole
#

Hmmmmm

gritty gate
#

does @stable mountain use a database for anything?

brisk brook
#

Yes

gritty gate
#

what database does it use?

brisk brook
#

PostgreSQL, it's accessed using the site API.

gritty gate
#

oh ok

surreal veldt
#

Suggestion: not really major nor significant but on the discord.py articles for the website, make one about subclassing bot and/or Context?

green oriole
#

It will arrange items given by the list/(async) iterator to form a page until a certain character limit is reached

#

I basically needed that to format my infraction list, and I didn't know how many I could fit in a single page

#

You could use that for BB, with each item being a line about a user

#

Or alternatively scrap that item logic and just take pages straight from the source

dusky shoreBOT
#
In the future, don't do that.

@austere hornet, please enable your DMs to receive the bookmark.

austere hornet
#

Shoot, sorry for the ping

green oriole
#

/j

#

Don't forget the rule, if you steal code you star! (yes I just made the rule up)

austere hornet
#

Ok, I'll star it πŸ˜„

#

But I get the joke πŸ˜„

dim tangle
#

.ttt

vocal prairie
#

hmm interesting, it works in #bot-commands

#

maybe it was just the channel occupation thing

stable mountainBOT
#

bot/exts/fun/tic_tac_toe.py lines 256 to 257

@is_channel_free()
@is_requester_free()```
slim widget
#

Do you mind if I reload it, or do you want me to leave it so you can investigate what went wrong?

surreal veldt
#

oh wait it is the bookmark command, my bad

surreal veldt
#

I was going to make a PR about subclassing commands.Context and commands.Bot as an article on the pydis site. But as this requires some knowledge of OOP, I haven't found any articles on the site about basic subclassing so could this be made? I wouldn't mind writing it down

cold island
#

I'm wondering if that's the right place for such a guide. Wouldn't it be more beneficial on the discordpy docs?

surreal veldt
#

You mean for the dpy github? Or for the dpy docs on the pydis github

sharp crag
surreal veldt
#

I wouldn't helping?

sharp crag
#

Sorry

#

But about the custom context, don't we already have an example?

surreal veldt
#

Oh you do?

sharp crag
#

Well not us

surreal veldt
#

May have missed it

surreal veldt
sharp crag
#

Well they only have examples, I feel like it would be useful if we had both the example, explanations, and advantages/disadvantages of it

#

Just bare code examples aren't really helpful if you get what I'm saying

surreal veldt
#

Yeah

sharp crag
#

I feel that advanced topics within discord bots that require both examples and detailed explanations which discord.py doesn't do all that well

surreal veldt
#

So you think both are worth making pr's?

sharp crag
#

I do, yes, and make it much more detailed

surreal veldt
#

Can i make it?

sharp crag
#

Both?

#

I'm fine with whatever just make sure you can handle it

#

I wouldn't want you to have to do too much work :p

surreal veldt
#

I'll let you know and i enjoy making these now so it's fine haha

sharp crag
#

Great, think about it and let me know which ones you want to do :)

surreal veldt
#

Oh wait maybe they can be in the samd fil

#

File*

#

Because in order to subclass context you need to subclass bot

sharp crag
#

I think it’s best to seperate them but have custom context build upon subclassed bot

surreal veldt
#

What do you mean?

#

Oh i got it

sharp crag
#

Something like β€œin order to have a custom context, you need a custom bot, so it’s recommended to read the subclassing bot guide before reading this guide, if you haven’t already”

cold island
#

No

#

The former

#

lol

surreal veldt
cold island
#

@patent pivot out of curiosity, what's the traffic for our dpy guide? πŸ€”

#

Probably deserves an update after 2.0 comes out, it doesn't even mention intents

patent pivot
#

based on a 10% sample of requests

#

that's after the homepage, /resources/ and the code of conduct

#

again my usual disclaimer of these analytics are dodgy and should not be trusted

#

for last 12 months, Google Search puts it as our 5th most clicked page from search results after homepage, homepage with www, setting up test server and setting up test server with www

cold island
#

tnx

signal forge
#

Hey, everyone. Do any of you accept suggested changes from within GH Pull Requests? Is this advisable?

#

I'd have to update my local project so to have the latest changes locally, right?

#

That is if I accept the suggested changes in the PR.

vocal prairie
brisk brook
#

@vocal wolf I thought the future of that PR was somewhat unknown because of changes happening to the infrastructure?

signal forge
#

Hey @brisk brook! Thanks for the review.... I'm working on it now πŸ™‚

vocal wolf
#

which PR are you talking about? the global leaderboard?

brisk brook
#

Yeah

vocal wolf
#

I am unsure myself

#

since no one had commented on the issue about this, I have absolutely no idea, actually

vocal prairie
#

I'm pretty sure that DevOps is going to enforce that Redis (or KeyDB, not sure) not be relied on for persistence at all, so there shall be no persistent storage for Sir Lance.

#

cc @patent pivot because he knows

patent pivot
vocal wolf
#

very well

vocal prairie
#

Lance will never use site though, will it (in the foreseeable future)?

#

To keep a low barrier of contribution and all

#

So doesn't that mean that Lance will have no persistent storage?

sleek steppe
vocal prairie
#

that's what I meant, sorry if it wasn't clear

patent pivot
#

uhhh

#

I think with bot core we can make it not so bad

#

I don't recall us making the decision that Lance will have no persistent storage

signal forge
#

@brisk brook Would you happen to have time to briefly explain why from urllib.parse import quote is needed? Wouldn't it accomplish the same thing as the code currently is configured?

vocal prairie
sleek steppe
brisk brook
patent pivot
signal forge
#

Awesome. Thanks πŸ™‚

patent pivot
signal forge
#

What a cool module!

#

Damn.

brisk brook
# signal forge Oh wow.

It's not like it posses a huge security risk right now, don't get me wrong. I believe there was a PR that changed all URL formatting to it though so I think it's best to keep that, good practice as well!

Emojis come to mind immediately, they'll be changed because they're invalid in URLs

signal forge
#

urlparse so neat.... would love to see the source code for that.

brisk brook
#

Trust me, you probably don't πŸ˜…. I've looked into it once, and the code wasn't very clear. Very oddly designed.. but hey!.. it works!

signal forge
#

lol

brisk brook
signal forge
#

lol I recognize some of the names in the comments from my job.

#

I work as an Executive Assistant at MIT.

#

T. Berners-Lee

brisk brook
#

Cool haha

#

Well, yeah those classes are so odd to me...

signal forge
#

I got a weird error using quote

#

Unexpected type(s):(set[str])Possible type(s):(bytes)(str)

#

Sorry, an unexpected error occurred. Please let us know!

TypeError: quote_from_bytes() expected bytes

#

Bot is throwing an error as well.

brisk brook
signal forge
#

It is, but the bot is erroring after comman dis provided.

brisk brook
#

set[str].. huh? Where does that come from?

signal forge
#

async def resources_command(self, ctx: commands.Context, *, resource_topic: Optional[str]) -> None:

brisk brook
#

Can you show a screenshot where you hover over it maybe?

signal forge
brisk brook
#

Yeah look, you have an odd pair of { around respurce_topic

#

Also.. I was thinking you do the formatting inside of response_url = "...". Not sure if it's better that way though, but just to be clear πŸ‘Œ

signal forge
brisk brook
#

Awesome! I will have to take a look tomorrow

signal forge
#

Thanks for all your help...

#

Once this one is finished, perhaps I can work on opening the issue for the site API feature for scraping.

thorny obsidian
#

If you don't use docker site is still very =/ to set up (as someone who doesn't work with pg on the daily outside of specific work projects)

surreal veldt
#

There is no command that shows the python guides on the pydis site?

surreal veldt
wild prism
#

just a command to link that?

surreal veldt
surreal veldt
#

@sharp crag do you know any article which is good that explains basic subclassing in python?

sharp crag
#

Unfortunately no, it's just OOP that I learned from CS classes in school

#

I think if you know how inheritance works conceptually you can get subclassing within python relatively easily

surreal veldt
#

how do I make two seperate PR's?

sharp crag
#

Fork it, make 2 different branches, and PR each of those branches

surreal veldt
#

oh no i know subclassing but for the subclassing bot pr i'm gonig to make

sharp crag
#

What about the PR?

surreal veldt
#

What I mean is I asked for any good article on basic subclassing in python to put in the PR about subclassing bot, because basic understanding of subclassing is a better start to doing it

sharp crag
#

Ohh I see

#

Just like "Subclassing bot requires you to know how subclassing works, to learn more about that look at this article: " or something like that?

surreal veldt
sharp crag
surreal veldt
#

is a fork a branch?

sharp crag
#

You fork an entire repository and all the branches inside it

#

You can then add more branches to the fork

#

So you could fork python-discord/site then add 2 branches like: subclassing-bot and custom-context

surreal veldt
#

uhhhh

#

oh yeah

#

how do I add the branch again?

#

git branch [name]?

sharp crag
#

Hmm let me double check

surreal veldt
#

got it

sharp crag
#

Use git branch -b <branch-name> to make a new branch

sharp crag
#

Then to switch to that branch, use git checkout <branch-name>

#

From there you can git commit and git push

#

I'd recommend using vscode's native git integration as you don't have to worry about commands but worry about making the actual content

surreal veldt
#

ah welp on my local machine I meant to delete one new file I just made on the site but deleted a whole bunch...

sharp crag
#

Luckily you can always just delete the folder and clone it again if worst comes to worst

surreal veldt
#

yeah i'll just fork it again

vocal wolf
#

@surreal veldt in this case you can just do git restore . to restore all those files

surreal veldt
#

oh cool that worked thank you

vocal wolf
surreal veldt
#

i saw it in the error but wasn't sure

#

not error, in the git status command*

#
error: unknown switch `b'```
sharp crag
#

Ah my bad there's no -b flag

#

just git branch branch-name like you said

surreal veldt
#

what did I do wrong?

sharp crag
#

Nothing, my fault. It's just git branch without git branch -b

#

I was looking at something else

#

Got it confused with checkout -b

vocal wolf
#

if you want to make a branch and switch to it, you can do git checkout -b some-branch

#

git branch some-branch will just create the branch, and you won't switch to it

sharp crag
#

Yeah that's just 2 steps in one, doesn't really matter

vocal wolf
#

yep

surreal veldt
#

oh wait what's the difference between git checkout [branch] and git checkout -b [branch]?

#

I just did git checkout [branch]

#

but it seemed to do the same thing though

vocal wolf
#

Since you already created the branch, git checkout will switch to that branch you had previously created with git branch

#

git checkout -b some-branch combines the two steps into one by creating, then switching to said branch

surreal veldt
#

Can I ask here the benefits for subclassing bot to put in the PR?

vocal wolf
#

so, git checkout -b some-branch is equivilant to git branch some-branch && git checkout some-branch

surreal veldt
#

This is what I have already

#
Subclassing Bot can be very beneficial as it provides you with more control and customizability of how your bot functions. For example, the default `commands.Context` can be overridden to add more functionality.```
sharp crag
surreal veldt
sharp crag
# surreal veldt mind reviewing these?

Great, looks like you have it. Could you make a PR with it and I'll review it on github instead of here? I'd like to keep everything in one place and also have the others pitch in

#

If you could also request a review from me on github that sends me an email

#

You have a pretty good foundation to build upon which is awesome πŸ˜„

sharp crag
#

Once you make a PR, you should see something like this with a little cog in the top right:

#

From there you should be able to request a review

surreal veldt
#

What's your github username?

sharp crag
#

Should just be Robin5605

surreal veldt
#

okay thanks, will do in a bit

sharp crag
#

Cool, I'm off to bed then. Thanks again for taking this up πŸ˜„

surreal veldt
#

Good night!

surreal veldt
#

I've made the PR, but can't find the button to add reviewers I just saw it now, do I need to press the convert to draft button?

reef tinsel
#

You can't add reviews if you don't have certain perms on the repo iirc

surreal veldt
reef tinsel
gritty wind
#

If you’d like to request someone for review, you’re going to need to ask them on discord to request themselves, or just ask them to review right away

#

It’s a spam/harassment protection mechanism, otherwise you could just flood people with review requests

surreal veldt
#

CC @sharp crag ^

sharp crag
surreal veldt
sharp crag
#

πŸ‘

surreal veldt
#

For making PR's, if I am on branch x and add a file, and then when I switch to another branch (take it as y), that same file that i made for branch x comes to the branch y. How or can do I prevent this?

cold island
#

You commit it to branch x

gritty wind
#

First save your changes. You can commit or stash. Then checkout the main branch, then create a new branch. You can do the last two steps at once with git checkout -b y main

surreal veldt
#

i believe i did those steps

gritty wind
#

Which steps

cold island
gritty wind
#

I believe the lower b flag checks out if it already exists

#

The crucial step here is commiting/stashing tho

surreal veldt
#

by the way @sharp crag regarding the comment you made on the PR, would it be

async def start(self, token: str, *, reconnect: bool = False)
self.db = aiosqlite.connect('database')
await super().start(token, reconnect) 
#

I'll get it updated soon

sharp crag
#

And also, acquiring a cursor using custom context is another excellent use case. RoboDanny has that feature, I would recommending checking out its implementation and maybe include it in your custom context guide

surreal veldt
surreal veldt
surreal veldt
#

yeah i will remove the overriding start method from subclassing bot I think

#

or maybe I can just write

sharp crag
#

Yeah I think having custom context with a database connection would be really good since you can just do something like

async with ctx.cursor() as cur:
  await cur.execute(...)
surreal veldt
#
async def start(self, token: str, *, reconnect: bool = False):
# here you are overriding the default start method. You can do some code here for example establish a database connection
await super().start(token, reconnect) 
#

why is it blue?

sharp crag
#

You forgot the : after the function declaration

surreal veldt
#

oh lol

#
class _ContextDBAcquire:
    __slots__ = ('ctx', 'timeout')

    def __init__(self, ctx, timeout):
        self.ctx = ctx
        self.timeout = timeout

    def __await__(self):
        return self.ctx._acquire(self.timeout).__await__()

    async def __aenter__(self):
        await self.ctx._acquire(self.timeout)
        return self.ctx.db

    async def __aexit__(self, *args):
        await self.ctx.release()

Yeah I don't understand anything here

#

robodanny uses postrgreSQL?

sharp crag
#

yeah

sharp crag
#

the __await__ isn't important

#

__aenter__ and __aexit__ is what's important

surreal veldt
#

so..robodanny is able to do this


        query = """INSERT INTO guild_mod_config (id, mute_role_id)
                   VALUES ($1, $2) ON CONFLICT (id)
                   DO UPDATE SET
                       mute_role_id = EXCLUDED.mute_role_id;
                """
        await ctx.db.execute(query, guild_id, role.id)
sharp crag
#
async with ... as something: # __aenter__() is called and passed to `something`
  ... 
  # __aexit__() is called
sharp crag
#
    def acquire(self, *, timeout=300.0):
        """Acquires a database connection from the pool. e.g. ::
            async with ctx.acquire():
                await ctx.db.execute(...)
        or: ::
            await ctx.acquire()
            try:
                await ctx.db.execute(...)
            finally:
                await ctx.release()
        """
        return _ContextDBAcquire(self, timeout)
surreal veldt
#

is this a lot more easier or efficient for aioqlite? compared to using the default way

sharp crag
#

Definetely not easier. It's on the advanced side but gives you much more customizability

#

You can also include some other examples that RoboDanny has for the custom context doesn't have to be this

surreal veldt
#

i saw he has ctx.prompt too may do that

sharp crag
#

Yeah that might be interesting to people

#

For the database if you want you can just stick to overriding start() and doing it there so we don't confuse people too much

surreal veldt
#

okay also for that when it's self.db in main but self.bot.db in cogs, can you tell me if it is self.bot.db in cogs, why isn't it bot.db in main?

sharp crag
#

Well in main we're inside thee commands.Bot subclass so it would be self instead of bot

#

If we didn't subclass, then yeah it'd be bot.db

surreal veldt
#
class CustomBot(commands.Bot):
    def __init__(self):
        super().__init__(
            command_prefix = #your prefix here as a string
            intents = #your intents here
            #other kwargs can be put here
        )
        #custom bot attributes can be set here, for example:
        self.launch_time = datetime.datetime.utcnow()
        self.example_integer = 5


    async def start(self, *args, **kwargs):

    # here you are overriding the default start method. You can do some code here for example establish a database connection
    #as shown in this example below
    self.db = await aiosqlite.connect('database file')
        await super().start(*args, **kwargs)


bot = CustomBot()

token = YOUR_TOKEN_HERE
bot.run(token)

This is correct?

sharp crag
surreal veldt
#

wait

#

oh wait you have to

#

i guess i never used it that way

surreal veldt
#

Can I make some changes to the code by pressing the edit button?

#

I'm having some issues when trying to update the code in the PR

gritty wind
#

You can edit it in the GitHub interface if you want, that’s up to you

surreal veldt
#

okay so I noticed that if I start with a PR for branch x with a starting file, and then after that I make a new branch y and make a new file, when I PR the changes in branch y both the changes from branch x and y gets added

gritty wind
#

Are your changes commited to branch x or not

#

If they are, you have to make sure that the branch y is created from the β€œmain” branch, not the x branch. That is something you have to ensure when creating the branch.

If the change isn’t commited, git won’t automatically remove it when you open a new branch, you need to make sure you have no changes. You can do that by commiting your existing changes on branch x, or use git stash

cursive relic
#

Why does !ot <anything after that> not work?

surreal veldt
gritty wind
#

git checkout -b branch_name main

#

This will create a branch called branch_name, and it’ll start from the main branch, not x

vale ibex
cursive relic
#

Oh I see, thx for the info πŸ˜„

surreal veldt
gritty wind
#

No, it just won’t do anything special

#

But if you’re still in the x branch when you run that

#

It’ll keep your changes from the x branch in the new branch

#

Fwiw, I typically don’t recommend people who are still trying to wrap their heads around git start from the command line.

Tree visualizations, and not having to memorize commands helps you understand first, then you can learn the commands when you want

surreal veldt
#

oh okay so that's where I went wrong

#

unfortunately I made a PR with two extra files which weren't relevant so three in total now I have to delete them

surreal veldt
#

What's the status on the bots in this server's library? Are they fully moved to dpy?

cold island
#

yes

surreal veldt
#

so...i had a suggestion: Make the bookmark command into a message application command. Can I make a PR/issue?

vale ibex
#

a context menu would likely be even better

#

Does d.py support those yet? I'm not even sure

surreal veldt
#

the apps

vale ibex
#

Yea, that's called a context menu

surreal veldt
#

okay so I'm not sure why I keep calling it a message application command but I thought it was that

#

anyways, that's what I meant

cold island
#

We're not on the latest commit yet, but we thought of doing that, yeah

surreal veldt
surreal veldt
cold island
#

No, there isn't

surreal veldt
cold island
#

I don't think it's something that's ever come up before

#

That list and the quality of the guides is a little undefined at the moment

wind ruin
cold island
#

For example the dpy guide is very outdated

surreal veldt
#

fair

#

but, on another topic, it's going to be updated?

cold island
#

I guess so, after dpy 2.0 comes out

vale ibex
#

pinned to a commit hash

wind ruin
#

ah

wind ruin
small oar
#

Hi I downloaded the zip of python discord bot

#

like which file do i edit.

dim pelican
small oar
#

!!!! alr

#

thx

signal forge
#

Oh dear @brisk brook - I'm so sorry for waisting your time by removing the new lines again. I pushed the update adding back the new lines and will hopefully not cause such trivial wastes of time again!

wild prism
#

could we fuzzy-match tags only up until a newline?

surreal veldt
#

What is meant by a new line?

coral relic
#

It is the '\n' character, you can't see it, but it signals the device to print the other characters on a new line

#

For example
"Hello\n World!"

#

That will print the following
Hello
World!

surreal veldt
#

Who's jchristgit?

rapid swallow
surreal veldt
#

@last patio about the comments for the PR can I ask you something about it here? I find it easier

last patio
#

hit me

surreal veldt
# last patio hit me

What did you mean by It may be nice to maybe run the full codeblock through a formatter to adapt it to a single style.?

#

And this bottom comment should be a docstring?

sharp crag
surreal veldt
sharp crag
#

Python formatter, In goes ugly code, out comes consistent and good code

surreal veldt
#

How can I get that set up?

sharp crag
#

I haven’t used it before let me check

gritty wind
#

pip install black

#

There’s also an online version of it

sharp crag
#

Ah yeah just use whichever you find convenient, either way make a commit after you’ve prettied up the code

surreal veldt
#

it raises a lot of cannot parse errors

#

oh nevermnind oops

#

Cannot parse: 121:4: elif request_confirm is True:

cold island
wild prism
#

yeah that could work

surreal veldt
#

for site#703 how would I link another file on the site as a hyperlink? or would it have to be done by staff here

dusky shoreBOT
gritty wind
#

You just specify the path to the file. For instance, for a file in the same directory, the url would be:
./file_name

For a file in a directory higher:
../file_name

#

Etc

#

I found an example

stable mountainBOT
#

pydis_site/apps/content/resources/guides/pydis-guides/contributing/bot.md line 50

See [here](../creating-bot-account) for help with setting up a bot account. Once you have a bot account, invite it to the test server you created in the previous section.```
surreal veldt
#

thank you

#

also, the black code formatter is super helpful

hoary haven
#

right now are all users able to edit/cancel other people's reminders?

#

i just accidentally edited the duration of someone else's reminder

molten perch
stable mountainBOT
#

bot/exts/utils/reminders.py lines 476 to 477

if await has_any_role_check(ctx, Roles.admins):
    return True```
hoary haven
#

Skull ic ic

wild prism
#

can we exclude mina from that

hoary haven
#

lmao

#

hard code it

molten perch
#

Sure, sure πŸ˜‚

hoary haven
wild prism
#

!remind edit duration 4286 1d

stable mountainBOT
#
Nah.

You can't modify reminders of other users!

austere hornet
#

Hmm I wonder why anyone would need to edit someone else's reminder. That would be.....rude ig lol. Just like with the !user command, you can only run it on yourself, so I suggest the same for the reminder command.

cold island
#

Mods can run user on others though πŸ™‚

#

I think it's just an extension of admins being able to delete other's reminders, I don't mind disallowing editing though

hoary haven
#

even for deleting.. idk that i would expect to have that ability thru the bot. a confirmation would be nice if i'm about to modify or remove anyone else's reminder. it's all too easy to mistype a reminder ID

#

but yeah in the meantime i will be more diligent if i ever edit my reminders

cold island
#

I'd rather not have to directly mess with the database to delete a reminder

hoary haven
#

sure, it makes sense to have a feature to delete your own
it also makes sense for it to be made known if you're deleting someone else's bc you have elevated perms

hoary haven
surreal veldt
#

I updated site#703 , if anyone can check that

dusky shoreBOT
surreal veldt
#

also, site#702

dusky shoreBOT
signal forge
#

Anyone else have trouble installing rethinkdb on mac?

#
 ericfletcher@Erics-MBP ξ‚° ~ ξ‚° brew install rethinkdb                                                                                                                                                                                                                                                  ξ‚² 1 ↡ ξ‚² 1460 ξ‚² 19:11:14
Error: rethinkdb: no bottle available!
#

I could install from source, but am wondering if anyone else dealt with the above error.

signal forge
#

Or maybe I should use the docker approach to installation

signal forge
#

It appears that I've gotten things working with Docker... would love to screen share with someone more familiar with running site locally.

brisk brook
#

What's up? You need to modify the .env variables slightly, but afterwards, you should just need to run docker up inside the site folder and it'll start!

signal forge
#

I got it the website running locally that is!

#

So much damn abstraction happening with Docker....

brisk brook
#

Yup πŸ˜…

signal forge
#

Feel like it would be helpful to know what it's doing.

#

Excited to get going on the scraping API feature.

austere hornet
hoary haven
#

we might just have to correct something with the !docs command
i'm not too familiar with how to do that though

cold island
#

They just have conflicting namespaces

#

Not sure there's a better solution than dropping one of them

fallen patrol
#

add some sort of priority for packages

#

well, take the existing priority and add it to the site and add a command to set it

cold island
#

What would be the purpose of that? in the end it's for it to be fetched via the docs command

fallen patrol
#

catSip I see you're not familiar with the source

cold island
#

?

fallen patrol
#

there's already programmed priority which renames symbols when they conflict, as is shown in the screenshot above

#

it makes the stdlib and a few other things have top priority to not be renamed--it will rename the other object

#

(that's how the current docs inventory code solves the name conflicts, by renaming existing objects, unless they're in the priority)

#

so just take the existing system, and modify it a bit to store the priority on the site, and a command to set the priority

cold island
#

That's what I figured could be a solution, although I'm not sure how much I like it given that you're not actually going to use that namespace in code. But if it already exists then shrug

#

!d discord

stable mountainBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

cold island
#

That works too πŸ™‚

fallen patrol
#

what did you do?

#

add them in a different order?

cold island
#

I just re-added dpy yeah

#

I guess it retains the order

fallen patrol
#

I wonder if it does

#

could you check if this is persistent by reloading the cog?

#

ext is doc iirc

cold island
#

!ext reload doc

stable mountainBOT
#

:ok_hand: Extension successfully reloaded: bot.exts.info.doc.

cold island
#

!d discord

stable mountainBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

cold island
#

oh

#

bummer

fallen patrol
#

lmao so no consistency whatsoever

#

I should add some sort of priority to my own....

cold island
#

!src d

stable mountainBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
fallen patrol
#

you're all welcome to take some of its changes back upstream if you want to

vale ibex
#

So to add a new tag it's as simple as opening a pull request and getting it merged

#

This gives us the chance to check the content of tags before they're added to the bot.

#

No problem! As for tags, the usual process is to open an issue first, with your suggestion, just to gather interest in the tag, before you spend time writing it

surreal veldt
#

When we post github links with the line specified, how is the embed automatically removed when the bot responds with the code in the line(s)

stable mountainBOT
#

bot/exts/info/code_snippets.py line 257

await message.edit(suppress=True)```
surreal veldt
fallen patrol
#

to note that requires manage_message permissions in the channel

#

that is the only thing bots can edit about other user's messages

surreal veldt
#

Interesting

woven gate
#

I just wanted to say there should be a command for python discord bot, the command being called "give" (or any other name) the command passes over the channel to another user

austere hornet
woven gate
austere hornet
#

Ok, I'm not sure why that would be necessary then

woven gate
austere hornet
#

Hmm, not sure I'm following what you're saying, but let's see what the admins think about this

placid ermine
#

there's always 3 available

signal forge
#

Wanted to live stream my digging into site, but am unable to find out how to get the video role. Does anyone have guidance on this?

vocal prairie
signal forge
#

@warm vigil told me I have to fight to the death to be able to stream.... so am willing to do whatever it takes!

surreal veldt
#

For site#697 Migrate VPS services pin by Python bot to site, how about we incorporate this message in it too #discord-bots message
CC @sharp crag because you're the author of the PR

dusky shoreBOT
molten perch
#

We're gonna wait until the permission rework. Then we'll assess our situation.

wind ruin
#

discord is changing the way slash commands permissions work (as in, who can use or see slash commands and how admins can manage that)

molten perch
#

Yeah, and right now, everyone can see all of the commands, if I remember correctly.

gritty wind
#

It is not

#

We'll first see what they do with the new system

#

Then go from there

wind ruin
#

and even then, once some are implemented, it will most likely not be for all commands for quite a while (if ever)

vale ibex
#

For something specific?

wind ruin
#

iirc we're keeping an eye out on the Forums as a possible replacement for the help channels, and considering using threads for #discord-bots and possibly other topical channels, but either way no immediate action planned

vale ibex
#

We're currently looking at forum channels for the help channels. We have them on this server already, but the API doesn't support them yet, so we're waiting for that.

#

The publicly documented API that is

thorny obsidian
#

Threads for topical channels when πŸ₯Ί

wild prism
#

someone missed a staff meeeeting

wind ruin
vale ibex
#

There's a couple of moderation related things that need to be done before we allow members to create their own threads

#

which just hasn't had anyone pick it up yet, due to other more pressing things coming up

thorny obsidian
#

πŸ˜” on a Sunday for 14 days in a row

cold island
thorny obsidian
green oriole
#

Did a bunch of thread related stuff, might as well finish :P

brisk brook
#

Site does migration on startup right?

tawdry vapor
#

Yes

brisk brook
#

Okay, thank you.

muted osprey
#

Hi, any interesting python open source projects you're familiar with to contribute to? ones that are active and for building useful tools

austere hornet
dim pelican
#

(!contribute tag also lemon_wink)

austere hornet
#

Oh yeah forgot about that

wind ruin
#

!contribute

stable mountainBOT
#

Contribute to Python Discord's Open Source Projects
Looking to contribute to Open Source Projects for the first time? Want to add a feature or fix a bug on the bots on this server? We have on-going projects that people can contribute to, even if you've never contributed to open source before!

Projects to Contribute to
β€’ Sir Lancebot - our fun, beginner-friendly bot
β€’ Python - our utility & moderation bot
β€’ Site - resources, guides, and more

Where to start

  1. Read our contribution guide
  2. Chat with us in #dev-contrib if you're ready to jump in or have any questions
  3. Open an issue or ask to be assigned to an issue to work on
austere hornet
#

Not that I think this matters, but I noticed that the buttons for the Announcements and PyWeek Announcements roles on the !subscribe command have a period at the end I personally think the periods there are unnecessary, but it's such a tiny detail so I don't expect anything to be done about it, but thought I'd point it out anyway just to gather some other opinions purely out of curiosity.

sharp crag
cold island
#

Hahaha

#

@vale ibex looks like you reverted one too many changes

vocal wolf
brisk brook
vocal wolf
brisk brook
#

This is the way

vocal wolf
#

This is the way

molten perch
#

@fading gale
That's it. :)
Read the bot description. :)

vale ibex
brazen charm
#

It returns a link to the first symbol loaded with that name

#

Because the libraries all share it there's really not much to do apart from giving discord a priority, but I'm also not sure if the page that links is what people want when they try to look it up

stable mountainBOT
#

class discord.User```
Represents a Discord user.

x == y Checks if two users are equal.

x != y Checks if two users are not equal.

hash(x) Return the user’s hash.

str(x) Returns the user’s name with discriminator.
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

fervent sage
#

Hm I wonder how to get sphinx to just not document the 'discord' name for nextcord and disnake

#

cause the discord alias reaslly doesnt need to be included in the docs for the libs

#

since its only there for compat

#

ok I have concluded i dont have a clue how sphinx works lol

gritty wind
#

Surprisingly not much info to be found if you look it up

#

But we already do manipulation on the loader side, so this is just more manipulation

#

That said, a bespoke system for a single bad symbol is overkill

fervent sage
#

Yeah that's why I'd rather change it docs-wide

gritty wind
#

Are you suggesting changing it upstream?

fervent sage
#

Yeah

gritty wind
#

Ah gotcha

fervent sage
#

I'm in a slightly unique position of being able to achieve that too kek