#dev-contrib
1 messages · Page 169 of 1
m = await bot.wait_for('message', check=lambda m: m.author == ctx.author and m.channel == ctx.channel) or whatever
it depends on when (possibly if) pydis chooses a fork
and you can use modals even in dpy if you want to make the raw requests yourself lolol
I know one that isn’t technically a fork
A simple script to add application command support to discord.py v2.0 - GitHub - XuaTheGrate/slash_util: A simple script to add application command support to discord.py v2.0
It’s made by a helper in the dpy server
Are you sure the user guesses are right?
Because when I try testing it, idk but it seems a lot of my guesses aren’t in that list
Are you using both lists?
Not anymore, only the solutions one now
I have NO clue how to play this game at all I can’t test it
The first one seems to be the possible wordle answers, and the rest are just other words that are accepted
Ah should I check if the given guess is in either list?
I’m randomly selecting from the solutions one as the word to play
this list doesn’t take the commonest words… shade, sodas doesn’t work
Update: I used or instead of and
Yes
Yeah
I’m literally getting my friend to solve this wordle
My mind is the solar
works!
another itty bitty PR bot#2096 
lol unreads again?
Pfff that makes things too easy if you don't have to copy the whole embed and extract the UID :P
Pretty sure I still have the muscle memory to do it
Anyway tested & approved even if that doesn't do anything 
Was there a reason for picking the question mark instead of the typical wordle orange?
Also from the screenshot, you had “plebe” when the word was “plume”, yet the last letter e was marked as incorrect
I’m guessing you’re doing an array of available letters and popping off from it if you find a match? If so, make sure to look for any greens before trying to do question marks
That’ll avoid these situations
Remember that the algorithm for repeated letters is a bit more complex
3B1B explained it in his last video
I've been looking around bot for some more bug fix PRs I can implement and stumbled across bot#2004.
The suggested fix was to add HTTPException to the supress, but the error seemed to be because the thread had already been archived by the time the bot tried to join it (based on the first line of the traceback), so wouldn't it be better to have a if thread.archived: return instead?
Although I suppose if the issue was because the thread had been archived, then that raises the question of why a thread in on_thread_join was archived.
I mean this is a race condition issue, so I don't think it is going to help. By the time the event is triggered, the function receives a thread object with archived set to false, since it is brand new.
Hmm
That does mean the bot won't be able to moderate those threads (thinking in terms of public threads) @vale ibex
Not sure if that's correct
Seems weird to get on_message for a channel you're not a part of
feel free to test it yourself
Yea
Huh
it'll just join after sending
exactly like users do
That makes sense
Is there any reason to autojoin then?
And if not, why was it added in the first place?
The only argument for it I can see is so that that bot is in the member list, so users get the prefix hint. Which isn't a strong one imo
it was added under the assumption that what I just described didn't happen
Right
In which case I'm happy to do a PR just removing the event
If that's the course of action we want to take
seems like the way to go for me, rather than investigating a race condition for a function we don't need
@vale ibex I committed your suggestion on the regex validation PR but that meant you were credited so your review now doesn't count 
bot#2094
Ah, nice
Cool
Will address your reviews on the other PRs later (probably over weekend) 👍
lol did you know on iOS copying from embeds doesn't work at all?
as scoff once said
more like whyos
also is it fine if i do a fix up PR?
add the same for antispam alert and remove for autoban alerts maybe
for the user id in mod log stuff?
yep
Sure, sounds good
do i try and squash it with the commit already merged to main? is that desirable/worth it?
although, if you meant fixup as in the term used for squashing commits, please don't do that 😄
so brand new commit
i did not delete my fork/branch yet, can i just do it there
since it rewrites history, and anyone with a local copy will hate you
Probably best to update your fork and make a new branch
oki
I was gonna suggest this then I woke up and it was merged haha
same as my username 😄
tehe
Lmfao, really
That's so stupid
Congratulations

Congrats @sleek steppe !!! 🎉 
Congrats @sleek steppe! 🎉
Congratulations Toxic! 🎉
Bump
@hoary haven re: bot#2098, the code you linked basically just checks if the spammed message's content (in this case there's only 1 message) is too long for an embed description, and then upload the content if it is too long. I guess you could do something like first_message_content for the content variable, but it's up to you 🙂
i couldn't find a way to test that section of code (test as in, watch it happen in a debugger) and that's what i've been doing to try and understand this behemoth bot haha
i couldn't think of ways to trigger antispam other than posting the same message repeatedly, or messages really quickly, by # of new lines, or by # of emoji
yeah that's pretty much how you do it
do you know when lines 99-101 would be hit? link in above PR
maybe a message with lots of emoji? haven't tried that
If the message has too many characters
A message has a limit of ~4000 characters, and an embed description can contain 4098 characters iirc. But the embed also includes metadata about the alert
So there might not be enough characters left to display the full message
but when would a singular message trigger antispam?
newlines for example
but look at line 89?
let's try
But it's good hygiene to have that condition there anyway
I'll make an additional commit to rename the content in the code block below, since it overlaps with the content parameter used a little later on.
Can you explain this part?
Is it because there's a function being called with an argument called content?
yeah bc i'm adding a content arg to that function call right below
I don't think we need to worry about the argument names of every function we call, it's fine imo
hey @hoary haven what's the reasoning for not including the ID for autobans? I assume in the case of a potential misfire you'd want to have the UID, wouldn't you?
I approved since it does what it is meant to, I'm just curious
i haven't yet seen a case where we reversed an autoban which was a misfire or a false positive (like a user copying/pasting a message they got in DMs for example) in the moment. i think 2-3x i saw such cases come in thru the appeals server though
thx for the review :)
I think I can remember one, but it is extremely foggy
like someone posting it as an example or something
yeah that's what i've seen 2-3x of. since these are usually users we don't know, we don't have an easy way of contacting them. i think it's easier to let them come to us via the appeal server
@rapid swallow when the time comes pls still get core dev approval since idk the technical details and can't provide input on that
yeah, ofc 
If I have a string e.g "add x", how can I make the bot run the command "add" with the argument "x" as if someone invoked "!add x" in the chat? I want to avoid having to parse the string myself, and I assume discordpy already has code which does this
Might need a bit more detail because the correct answer to this is add a command
You could try to get into the nitty gritty and manually call the dispatcher d.py uses to parse and dispatch commands, but you need a good reason
there's get_command that you could use, though that requires parsing on your own to a certain degree
I have a command that got invoked, but it's missing an argument. I'm making some calculation, get the missing argument, and now I want to invoke the command again with that argument appended. I'm not inside the command callback, I just have the Context object
doesn't the context tell you the command?
It does, but what do I do with that? there may have been arguments already provided
bot.process_commands(...) ?
I don't have the docs at hand at the moment, but I don't think the command would have any arguments bound? So you could reinvoke it after getting the command object from the context
Although that requires prefix to be involved in
But it can be modified such that it doesn't need to, I believe
I have the prefix so it's not a problem
On the contrary, I want the arguments
You may then use, process_commands or get_context followed by invoke
Would you be interested in code snippet?
hmm I'll probably manage, thanks
But yeah, this is probably what I was looking for
ctx.view.buffer seems to give me the original invocation as a string
@placid ermine they haven't responded yet so I'm just going to merge it
alright
woohoo is this the latex command?
yee
.help latex
**```
.latex <query>
*Renders the text in latex and sends the image.*
lmao who did it
hey @placid ermine FYI sir-lancebot#1035
did you want to work on it, or should I leave it up for grabs?
from the api ```
{
'status': 'error',
'description': 'Human readable message of what went wrong',
'log': '(LaTeX rendering log, not guaranteed here)'
}
log may not always be there
yea
with some deafult str
ill do it in the morning
foo.get("log", foo["description"]) maybe
.latex $\frac{a}{b}$
wtf!
mfw
@vale ibex currently, if an archived thread is added to the bump list, it stays archived and auto-bumping will happen only if someone manually unarchives the thread or if the task for unarchiving is run.
should we:
i) leave it as it is
ii) spout out an error message if you try to add an archived thread to the bump list
iii) add the thread to the bump list and make the bot unarchive the thread
iv) ...
this requires the message object, which contains the original message and not the one I want 😔
and
if (ii) or (iii), can I do the do \🥺
I vote 3 if it's been auto-archived, spout an error if it's manually-archived or do like a confirmation prompt thing
spout an error if it's manually-archived
I dont think we can rely on audit log for this since the thread could have been archived at any point in time
we'll have to use the Chris-bro-is-the-thread-archived™️ algorithm based on archival time and last message in the thread
(this message is more of a note to myself or/and chris)
hmm, if you are adding a thread to the bump list, you definitely want it to be unarchived. So, imo rn, I dont think it matters if they thread was manually archived or auto-archived
so a confirmation prompt would be nice
or straight up unarchive the thread
I'm not even sure the thread convertor will work for archived threads
but I can play around with it later anyway
planning to migrate it to use a site endpoint for persistance
Speaking of, feast your eyes on site#663
it works if you provide ID
i thinkk
I thought ThreadConverter fetches from the API, turns out it doesn't
Yea, it doesn't I checked last time 😄
So if the conversion fails I could extract the id and try to fetch it
I'll have a play after the site pr anyways
alright, no problem then
I managed to hack into the mainframe 😎
await ctx.hack()
Could use MessageConverter and see if there's a thread attached to it?
passing a message to the command doesn’t make much sense. I think a FecthedThread subclass or something there would suffice
Thread IDs copy their message ID ☝️
Ah didn’t know that
Fwiw, sir-lancebot’s timed command does exactly that
.src t
oh duh, how didn't I think of copy.copy
This is what I did lol
added = f' "{value}"'
self.ctx.view.buffer += added
self.ctx.view.end += len(added)
await self.ctx.command.reinvoke(self.ctx)```
@static canyon oi m8 file conflicts are a thing, pls fix thx https://github.com/python-discord/sir-lancebot/pull/1033
Yeah, I'm aware thanks
Been busy with family stuff past few days
Will get to it when I can
@vocal wolf
!ban 760770208809091082 Sharing Discord token grabbers is unacceptable.
:incoming_envelope: :ok_hand: applied ban to @glossy edge permanently.
hi
@vale ibex hello, I was testing bot#2078, but I came across an error (I'm surprised it wasn't found before). It seems that the _unclaim_channel function's claimant_id can be None, and it's passed to get_or_fetch_member which raises a 400 bad request error: https://github.com/python-discord/bot/blob/14bb17965765aae4ed25a339ac622594f29852ec/bot/exts/help_channels/_cog.py#L444-L448
bot/exts/help_channels/_cog.py lines 444 to 448
# It could be possible that there is no claimant cached. In such case, it'd be useless and
# possibly incorrect to lock on None. Therefore, the lock is applied conditionally.
if claimant_id is not None:
decorator = lock.lock_arg(f"{NAMESPACE}.unclaim", "claimant_id", wait=True)
_unclaim_channel = decorator(_unclaim_channel)```
the description is just "The server broke. This is bad.", which isnt really helpful for the user
i think the bot's response should be the "failed to render!" embed, but without the "View Logs" hyperlink
maybe a message like "no logs available" in its place
sir-lancebot#1036
what do you mean?
whoa, the ID of the thread is the same as the message from which the thread was created from
wack
Yea, that's the issue this PR is trying to solve
What you're describing happens when an active channel doesn't have a claimant on the cache
If that's still happening in that pr, I might need to move the ensure claimant call further up the init process
Would it be better to edit the bot token detector so that it will instead upload the token to a GitHub gist instead of deleting the message? Many newbies don't really know much about all this token stuff and tend to ignore the advices to regen the token.
The Discord API automatically detects the GitHub Repos and gists for tokens
Just for reference to this ^^^
the problem that was previously raised is pydis would rely heavily on the detection system being available at all time
if this system stops at any point, pydis just effectively spreads the token
hi
If u r talking about the token detection system built in @stable mountain, then the same could happen at the current time too. The bot won't delete the message with the token if, by chance, it goes offline due to any reason
can i be assigned?
https://github.com/python-discord/sir-lancebot/issues/1015
Description Uptime command https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/core/ping.py#L29-L40 Reasoning It look cool Proposed Implementation Use Relative timestamp of discord &a...
apparentally i dont see why should we delete the message with token if it is already invalidated
It isn't invalidated automatically as of now
It will be invalidated when it is uploaded to GitHub
ik
that doesn't make any sense, if the bot is offline it won't be uploaded to discord either
Discord already has a native token detection, same for the pastebin
In both the cases, the token can spread 🤷♂️
the question is why Discord doesn't already have an invalidation endpoint, but oh well
Hey @thorny spade! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
ic
Most probably they already have one, but only for backend use
I mean, there are still people who send tokens in #discord-bots and other help channels
Eh they just tend to ignore that warning from the Discord client
¯_(ツ)_/¯
Or when they are on a mobile, since iirc, it isn't implemented on the mobile client
Hey @clever wraith! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
ah yeah there is no warning
Indeed
Yups
@green oriole wdym #dev-log message
oh wait, @clever wraith, I think?
do you mean like a logger.warning
There's a difference between doing nothing and making it worse
Wait, mind telling me what do you mean by making it worse? Like what are you referring to here?
If we upload to GitHub and the server isn't online, then we're just making it worse by spreading the token
Whereas if our system is down, we're not making it worse, we're just not helping either
Ah, well the server in talks here, is the Discord API server. It is hardly down, imho
If discord had some DELETE endpoint or something like they do for webhooks, then we'd use that (as we do for webhooks)
Really it's down to Discord to provide a better way. We're not going to be uploading to github
Okay, was just a suggestion
Yeah, it's something that has been repeatedly suggested, and discussed quite a bit internally, but eventually we decided that it's not the route we want to take
Ah okay cool
ya
a
can i be assigned to this?
@thorny spade commented on the issue
It's not been approved yet, so not at the moment
ok! ❤️
bot/exts/core/ping.py line 29
@commands.command(name="uptime")```
Why is it not working
@dusky shore help
<@&267628507062992896> lance ded
We can't ping devops can we
I know the issue
Why git
I hate git sometimes
It's including random other commits when I go to push
what's the issue PR? Someone want to fix it or I can revert it?
yes
@timid sentinel I'm fixing it now
My PR got merged before I tested it
I even said I hadn't tested 
f
And it caused everything to die
If you haven't tested it you should either not open the PR or mark it as draft. Granted it still shouldn't have got past reviews though
Basuc automated testing when 
agreed
@timid sentinel sir-lancebot#1037
Well, bot ded so doesn't link lol
I've not been on my laptop so haven't been able to 
But yeah, you're right
Was going to later today but it got merged first
@dusky shore help
The bot's dead at the moment @thorny spade
oh no
.ping
Gateway Latency: 123ms
It's back 
.latex \LaTeX
Merged 
.help
AdventOfCode
.adventofcode
All of the Advent of Code commands.
Anagram
.anagram
Given shuffled letters, rearrange them into anagrams.
AprilFoolVideos
.fool
Get a random April Fools' video from Youtube.
AvatarModify
.8bitify
Pixelates your avatar and changes the palette to an 8bit one.
.avatar_modify
Groups all of the pfp modifying commands to allow a single concurrency limit.
.avatareasterify [colours...]
This "Easterifies" the user's avatar.
I started up 12 minutes ago.
🤔
Admetly it could use a timestamp, but oh well
there is a issue about it
and i am asking to being assigned
Yeah, I understand the original issue now 
The title was a bit confusing
What about something like "Use discord timestamp in uptime"?
I updated it by the way
Before I saw your message so it's not exactly what you suggested but it's clearer than what it was
Good stuff
yeah, but for some reason it's still raising that error 🤔 nvm read that wrong
the error is happening inside init_available which is after the ensure cached claimant part
Yea, should be a case of moving it up a bit then
The thing is, it’s possible that we’re passing None to get_or_fetch, which will always error
Yea, _unclaim_channel should only ever be passed an int for claimant_id, it receiving None is wrong
In unclaim_channel we could change the claimant_id = await _caches.claimants.get(channel.id) call to default to @stable mountain's user id if not present
as a safety net
Ahh I see why, if there are more channels than needed in the available category, it will move some to dormant by using unclaim_channel, however, those channels don't have claimants, since they're available
The other option is to change _unclaim_channel's signature to allow for None claimant_ids
yeah that makes sense
pushed a commit
This is annoying sir-lancebot#1039
I renamed the job because it's not just pre-commit & flake8 anymore
but github is still expecting a status from the old name 😦
hmmmmmm @patent pivot I might need to remove this from the branch protection
then add back in the new name when it hits main
orrr, we accept it won't be accurate and don't rename the job? 
yea I'd temp remove
@vale ibex @clever wraith re https://github.com/python-discord/sir-lancebot/pull/1036#discussion_r810661950
should i revert the commit then
I've responded to the comment
!source ot
Sorry, an unexpected error occurred. Please let us know!
AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'

That's an known issue btw @fallen sleet
oh okay
There's already an issue for it on the bot repo
!src doesn't work for tags, and when it doesn't raise an error the url it gives is wrong
Thoughts on a second latex command that doesn't wrap code in a template? Won't be used that much, but we can have fun things in that bot
So yeah, according to what Chris said you can revert
I'm looking at sir-lancebot#945 and trying to come up with ideas with how we would cache each user's palette in memory. The stored values should expire after a certain time. Would this be done with redis or some other approach?
current redis would allow you to expire the whole cache, but not individual members
Maybe setting a task to clear an ordinary python dict key after a certain amount of time?
it's a redis limitation, until we migrate to KeyDB
looking forward to it then :)
You can do expires on normal keys, though those aren't available from the normal redis cache interface iirc
hey @static canyon, last chance to review site#624
once i pass zig's review i'm going to ask to get this merged
i did address all the points you originally raised on the first version of this PR
yea, sorry, I should have specified, since async-rediscache uses sets, Redis doesn't support expiring individual members
KeyDB supports expiring individual members of a SET, SORTED SET, or HASH with the EXPIREMEMBER command
My laptop is currently dead so won't be able to review for 2 days at a minimum 
Thanks for addressing my points though
help
trying to run site locally
and i get this error when doing docker-compose up
this is when running site in its current state
run it with --build once
looks like your local image has an out of date version of django
right, i have a faint memory of doing that when first setting up site
ok
Yea, you'll need to run --build whenever dependencies get updated
will i need to build again when i switch back to my older branch
if your older branch has different dependencies/versions, yes
you'd need to run --build even for code changes, if it wasn't for the fact that we mount a volume in dev to make it so that you don't
since when you build an image, that image is then frozen
we mount a volume on the same path as where the code is in the image though, so that we can overwrite it on the fly in dev
but you can't do that for dependancies
well, not in any sane way
@vale ibex i independently figured out the line break thing. you're too fast for me 
hah
was it always 2 newlines required?
in the original there was only 1 blank line afaict
it varies depending on where it is relative to headings
since it was moved from mid-content to the end of a content block for that heading
npnp 😄
Hah nice @fallen patrol, just came across https://github.com/DisnakeDev/disnake/commit/2b5635fb4bb2d864624332e63cb2e09bf78b3e8d
was looking to see if that was fixed 😄
haha yup, waaay easier to change the src than monkeypatch
yep
out of interest does disnake do anything about Discord's decision to sometimes throw 403s for typing events?
That's the only other monkeypatch we currently have
well, root aliases as well
I say sometimes, it only ever happened once
Yea, root aliases I wouldn't expect to be added to the lib
yeah, we don't have any special handling for discord throwing 403s when they aren't supposed to
yea, that was annoying when they decided to do that
even more so, they're typing events
can't they like, throw a cf worker in front of that that makes it seem like it worked?
I doubt anyone cares if they get a 204 when typing events aren't being shown to anyone
its partially possible, I suppose. I did point someone a few weeks ago to pydis's implementation who was looking to use it
Yea, how to implement it in the lib isn't trivial
since failing silently is one option
but not ideal in all use cases
right
hahaha
Bump
❯ git pull
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.``` :(
so this branch is 270 commits behind, but the only files changed in this branch/PR are a markdown file and some images
if someone can walk me thru this pls let me know
it might be easier to restart with an up to date branch
so for site#624 this already has pushes tho
copy/paste my changed files, make a new up to date branch, set to track with the above remote branch,... ?
if it helps, it's no loss if all the commits in the above PR are squashed to 1
git pull --ff-only failed
checkout main branch
git pull
then checkout the feature branch
and git merge main
the other option is to do it from github web
and then force pull/hard reset your local copy
this is resulting in a commit called Merge branch 'main' into content/update-help-channel-timing
yup
so i made that commit and did git push
❯ git push
To https://github.com/python-discord/site.git
! [rejected] content/update-help-channel-timing -> content/update-help-channel-timing (non-fast-forward)
error: failed to push some refs to 'https://github.com/python-discord/site.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.```
ah, looks like you didn't pull before comitting locally
❯ git switch main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
site on main [?] is 📦 v1.0.0 via 🐍 v3.9.8 (.venv)
❯ git pull
Already up to date.
on your feature branch
So what that is saying is that on the feature branch, there are commits in the remote that you don't have
checkout to feature branch and then git pull?
and now you're trying to push new commits, and git doesn't know what to do with that
you'll likely have merge conflicts
Is what you have locally what you want?
yeah
i did git pull while i was on main, do i do it again on this branch?
but if what you have locally is what you want, it doesn't matter
if you do, it'll complain about divergent branches again
ok the commits for this PR are all a mess lol
lol
you won't be able to squash commits before the merge commit
you'll need to drop the merge commit, then rebase and then merge in again
otherwise you'll re-write the commits from main
i'm gonna leave it lol, pls do as you see fit when it's merged 
or i'll ask you tmrw. go to bed
if you do git reset --hard a7e2bd4dc4f1bbbc3c9c8407b64e6dba5f3b0296
that'll reset your branch back to before you did the merge commit
then you can git rebase -i HEAD~13 to get your interactive rebase
ok
then once that's done, you can git merge main and then git push -f
so git merge main is what you call a "merge commit"?
yea
that says grab the commits I'm missing from the main branch and add them to this branch as a merge commit
git rebase main means rewrite all the commits in the branch to be based from the HEAD of main
and which commit is a7e2bd4dc4f1bbbc3c9c8407b64e6dba5f3b0296?
mhm mhm
ok so rebase/squash my commits first, then repeat the process you said above
Yea, drop the merge commit, do you rebasing, then add the merge commit again
that means the only commits you're rewriting are the ones from your branch
@vale ibex fyi since you were looking at disnake commits today, i just merged what i believe to be our first breaking change with dpy except because so many people got confused by it, its a good change
Co-authored-by: shiftinv 8530778+shiftinv@users.noreply.github.com
Ah cool, I'm guessing calling Message.create_thread will still work?
yeah
Nice, makes sense as a change
that never took a type parameter
but ppl were trying to make private threads on messages, or not sure why it wasn't working by default (as private threads are only on level 2 boosted guilds)
etc
additionally the api removed support for having a default in api v10
because i am shitposting at 3:16am
i will do that when i rewrite arthur
for ansible

M-x ed [-GVhs] [-p string] [file]
Ed is the standard text editor.
M-x ed
M-x ed [-GVhs] [-p string] [file]
Ed is the standard text editor.
👍
uhhh
halp
i pulled from upstream/main so i could resolve some conflicts
but
On branch bug/infr-duration
Your branch is ahead of 'origin/bug/infr-duration' by 101 commits.
the 101 commits bit sounds
um
problematic
What commands did you run
And are the commits actually different hashes? It might just count merged commits as being ahead
I guess that makes sense, your branch is 100 commits behind
It shouldn't
aight
But I don't remember how the status message counts merge commits
If it's messed up you can still fix it so no worries
hmm unrelated (i think) but i cant seem to run the bot
i get a ton of errors looking like
discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.moderation.metabase' raised an error: ModuleNotFoundError: No module named 'botcore'
are you running with docker?
yes
docker-compose up --build
oh ok
(you need to do the --build whenever there's a dependency change)
hm
The --build just reruns the docker-compose file, which ensures your dependencies are up to date
If there's been no changes to dependencies then you don't need the --build
help a mac girl out and approve site#667 :D
Woo sir-robin repo exists
The bot does too 😄 @humble leaf
changing around colour schemes atm and will changelog shortly
Hmm is it using the standard merge policy
Oh yeah it is the site
Can't do anything for you my friend
wooo hi sir robin, lovely to meet you
Always more bots
I mean it is the correct way to go for both perms and rate limits haha
that and organizing codebases
I think organization wise it isn't so bad
You have all your code nicely sorted in modules and stuff
I've approved but you should probably add it to your global gitignore too
niice
yea, I have git config --global core.excludesFile '~/.gitignore'
You can set it to point to an additional gitignore file
then in ~/.gitignore I have a bunch of stuff
git config --global core.excludesFile "$Env:USERPROFILE\.gitignore" for windows powershell
the main reason was sort of org/review policy
we want a bot that we can speedrun changes into without affecting availability of other stuff, events is the only thing where we've got hard concrete deadlines, so being able to rapidly prototype on a separate bot is nice
that makes a lot of sense
Welcome @humble leaf !
It also lets us add additional dependencies that wouldn't be best for lancebot
I'm curious, what kind of deps are you taking about?
Snekbox, site
Ah right
me just looking over the rule text and being, "wait, what happened to devops again"
oo your font looks different
aha, that's interesting
I wonder if it is rendered using the system font
mine should be Noto
@vale ibex https://github.com/python-discord/metricity/pull/11 wouldn't there be an issue while syncing if someone joined while the bot was down, sent a message and then left
Yea, I guess there would be
I can add a step that checks if the user is there, and if not add them
since we have the user object at least
Do we have some sort of agreement on when we should log with info/trace/debug? I get the debug is for granular things we don't want to see in prod, but what about info vs trace?
I usually go with trace is for anywhere I would have but an old style print statement
debug is for slightly less verbose things, but still only useful in dev
info is anything that is good to know if prod, but isn't an issue to raise a sentry alert
yea, that makes it harder
didn't get the sentry part
warning/error/exception raises a sentry issue
so I'd use info for things that are useful to know in prod, but aren't things that need to be fixed
log.error supresses traceback by default iirc
I guess we could use datetime.min as a sentinel value for unknown
I'd rather use a sentinel, rather than something that could look like a "real" value
that's fair
the problem is that this isn't syncing message that the bot missed while offline, it allows for arbitrary dates
IE we could sync messages pre aug-2020
And you specify a date to reach?
eeesh
It's intended to do small ranges say if the bot had an outage
yeah ik
but there's no validation for the difference
yeah, letting it run from August 2020 backwards would be... interesting 😅
We used to have something about this in our contributing guide, but I know at some point stuff got shuffled around, so I don't know where it is anymore.
Additional information related to our contributing guidelines.
Ah yes, the logging level "Note"
I've never been totally happy with warning always going to Sentry. It makes us avoid that level even if it is semantically appropriate.
I sprinkled a bunch of warnings into the filters rework if that helps 😄
I guess the solution would be to either ignore stuff in Sentry or introduce a new logging level. I'm not too fussed about it though.
Specifically because these aren't errors, but should go to Sentry
Wait trace is below debug?
I thought it was the opposite
Both trace and debug are for debugging, but trace is more spammy and detailed.
TIL
Trace means tracing execution, so you end up with a lot of logs saying "im in function x doing y with z argument"
So when would it be appropriate to use debug instead of trace?
I think I did a good job of using them in the help system, though sometimes I have wished some of those trace logs were actually showing up in our prod logs to debug some confusing situations.
I'll answer that in a moment
I view the debug level as being for bigger picture debug information. It can be used to log some initial info about an operation, but doesn't go into every single function call involved in performing that operation.
Since neither trace or debug are showing up in production, it's really just a matter of making it nicer for developers to filter out the spammy logs that they probably don't care about.
It's not an exact science. There's some intuition required for picking the right log level.
If a message is sent in DMs, is it that message.guild is None, or that the message has no guild attribute?
it is None
thank god Messages always have a guild attribute
not that relevant but I fetched it now
https://docs.disnake.dev/en/latest/api.html#disnake.Message.guild
oh that's disnake
works too, I guess
same thing either way
aah, category is the missing attribute (from the channel object)
that would make sense, but note that it is totally possible inside the actual server
ah no, it would be null
Right, it is a field of GuildChannel but not DMChannel
carry on 
another dpy quirk: categories have a category attribute
fun!
hi @tawdry vapor could i poke you about bot#2071?
we'll need another review from someone else as well
oo new lance logo looks so good
I'll review it right now. I haven't been keeping up with GH notifications well lately.
ty!
Why did you author the PR but someone else made the commits?
It's not a problem; it's just odd
griff and i were doing it together.. he was teaching me
he ended up just making the commits but to my fork 
and didn't want to open a PR.. but it wasn't like i was gonna re-write the code myself lol
Are you now learned enough to finish it off yourself
that depends lol
scrap it all 😈
lmfao
Yeah I use it. I think I can trigger it myself pretty easily
https://www.pythondiscord.com/pages/guides/pydis-guides/contributing/site/#configuration-in-detail
Run on the host
Running on the host is particularly useful if you wish to debug the site. The environment variables shown in a previous section need to have been configured.
what does this paragraph mean?
A guide to setting up and configuring Site.
why is that more useful for debugging?
that's a good question. maybe because it might work better with e.g. the pycharm debugger? I'm not sure.
It's easier to attach a debugger. I believe it's possible to attach a debugger to a process in a container but I have no idea how to do that.
do the env variables not have to be configured when you're using Docker?
They have default values specified in the compose file, so you don't need to change them in that case.
im getting this when using the http://127.0.0.1:8000/admin/ link in the set-up guide
what's up with that
yeah that works, it just doesnt like the admin
nope, same thing
i don't think /admin ever worked for me either
Does the API work?
this is my first time anything whatsoever with the site, how do i test that?
http://localhost:8000/api/healthcheck should show a page since you're running in debug mode
yeah seems to be working
No idea about the admin page then
Apparently it also shows in prod https://www.pythondiscord.com/api/healthcheck
hmmmm
this looks to be it
in prod:
pythondiscord=# SELECT * FROM django_site;
id | domain | name
----+-----------------------+-----------------------
1 | www.pythondiscord.com | www.pythondiscord.com
(1 row)
so the manage.py suggestions there might do it
hmmmmmm
If not then we should modify the run command to create one
we must have at some point
let me see what it gets init'd with
hmm okay so
yea i get the same error locally
and in the tableeeee
aahhh
pysite=# SELECT * FROM django_site;
id | domain | name
----+--------------------------+--------------------------
1 | pythondiscord.local:8000 | pythondiscord.local:8000
(1 row)
manage.py lines 89 to 96
from django.contrib.sites.models import Site
query = Site.objects.filter(id=1)
site = query.get()
if site.domain == "example.com":
query.update(
domain="pythondiscord.local:8000",
name="pythondiscord.local:8000"
)```
i think setting SITE_ID to 1 should still work
let me try
yeah it does
@wild prism @hoary haven as a temporary fix, adding SITE_ID=1 to your pydis_site/settings.py should allow you to view/login/use /admin with credentials created with poetry run python manage.py createsuperuser
i don't think there would be any problems if we added SITE_ID 1 to prod settings.py tbh, or at least debug, but it'd make admin work out of the box
👍 working
Well there you go you can make your first contribution already
poetry run python manage.py createsuperuser what's this about?
You shouldn't have to do that. I am pretty sure the run command already creates one.
yeah its just admin/admin, right?
manage.py lines 61 to 62
name = os.environ["SUPER_USERNAME"]
password = os.environ["SUPER_PASSWORD"]```
manage.py lines 11 to 16
DEFAULT_ENVS = {
"DJANGO_SETTINGS_MODULE": "pydis_site.settings",
"SUPER_USERNAME": "admin",
"SUPER_PASSWORD": "admin",
"DEFAULT_BOT_API_KEY": "badbot13m0n8f570f942013fc818f234916ca531",
}```
@tawdry vapor
A
await channel.send(
f"There {'is' if number_of_channels_left == 1 else 'are'} "
f"only {number_of_channels_left} dormant channel{'' if number_of_channels_left == 1 else 's'} left. "
"Consider participating in some help channels so that we don't run out."
)```
or B?
```py
if number_of_channels_left == 1:
message = f"There is only {number_of_channels_left} dormant channel left. "
else:
message = f"There are only {number_of_channels_left} dormant channels left. "
message += "Consider participating in some help channels so that we don't run out."
await channel.send(message)```
i was considering A before i realized there's another plural word later in the sentence
Neither
verb = 'is' if number_of_channels_left == 1 else 'are'
await channel.send(f"... {verb} only {number_of_channels_left} ...")```
That is better IMO
then it's There is only 1 dormant channels left
also will we ever configure this to 1
Probably not. That's why I didn't make it a requested change
the rest is just removing some extra spaces and changing finally to else right?
also i'm wondering if this part in the config description is correct
# Note Discord has a hard limit of 50 channels per category, so this shouldn't be > 50
max_total_channels: 42```
i think 42+3 available is the true max across all 3 categories
its not when you think about it
or rather
it shouldn't be
42 should be the true max
this is because no one category can have more than 50 channels, so it doesn't help to have 53, because those 3 channels can never all be available at the same time
fwiw I was only confused on this 3 times 
Yes, I was running into this too. It wasn't counting available channels.
aah, ignore me then
However, the amount of names it generates uses max_total_channels... so I am not sure what was going on.
Maybe my bot was bugged out and miscounted channels. Might be related to one of the names having an emoji in it still.
right now when i hit the limit it's always
max_available: 2
- max_total_channels: 4
- 1
i think.
When I tried to test that pr, I got many errors, so I updated my local branch to main, and got a new one… https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_channel.py#L185 seems like this line doesn’t check if the regex matches, causing the infamous nonetype attribute error.
bot/exts/help_channels/_channel.py line 185
user_id = CLAIMED_BY_RE.match(message.embeds[0].description).group("user_id")```
i have no emoji in mine
There is this log line f"Got {len(names)} used names: {names}" what shows for you in the console when the cog is loaded?
And also "f"Getting the first {count} food names from JSON."
Wouldn't it fail earlier when it does int(None)?
No, it fails at the .group()
I was also getting errors when channels don't have claimants. It was fetching something from the cache presumably, but it returned None, so it tried to do fetch_user on None and was throwing errors.
Yeah, a pr was merged for that yesterday
I guess the notifications PR is not up to date yet then
bot#2078
yeah I think we merged something to try recover claimants from channel content
if the redis cache doesn't have a key for it
yeah, so I pulled from main and got the new error
6 used names
Getting the first 4 food names from JSON.
this is from running after resetting to 6 total channels all in dormant
That seems like an invalid state.
If the bot only generates 4 names, as you asked it to, how did it manage to create 6 channels? The only way would be if the channels already existed and you then lowered the limit. At least, that should be the only way in theory.
uh the 6 channels were there from a previous run. i've been manually moving occupied channels to dormant before rerunning
Cause the code path for new channels relies on the name queue https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_cog.py#L199-L203
And in turn https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_cog.py#L250-L254
bot/exts/help_channels/_cog.py lines 199 to 203
try:
name = self.name_queue.popleft()
except IndexError:
log.debug("No more names available for new dormant channels.")
return None```
`bot/exts/help_channels/_cog.py` lines 250 to 254
```py
log.info("No candidate channels in the queue; creating a new channel.")
channel = await self.create_dormant()
if not channel:
log.info("Couldn't create a candidate channel; waiting to get one from the queue.")```
I think the description in the config is right. You just started with more channels than configured.
If you delete all the channels, then it should work correctly I hope.
yeah let's try that
Or delete 3, so you have 3 left, and then it should create 1 more before saying it's full (assuming you leave the cfg at 4 max)
i did test starting with fewer channels than max, but not from 0
so starting from 0, it maxed at 4
ok
i'll wait for toxic's review before pushing changes? since they're very minor?
and yeah this notifications PR was opened and not touched since before that #2078
So y’all see how pings sometimes show up like this
I think it’ll be better if it were to say
"Please send a direct message to Python Discord ModMail#6914 ( @slow bone )" or sum
sounds good to me
Cuz if you were new and you don’t really understand how pings are formatted
It’ll look kinda strange
Is there any way for me to write a PR for this?
It’s a pretty simple pr honestly
not sure if we should include the nickname or username
Hmm
It could be nickname assuming the person would go "Okay I need to find modmail" and they swipe to the right and see modmail
I’m pretty sure most people would know this anyways
impressive ping count
*horrific
but yeah this sounds good, idk if a PR will work since it's just internal.. stuff. will ask admins to action it sometime tomorrow
how about a screenshot
"Please send a direct message to Python Discord ModMail#6914 ( @slow bone )"
it's a good idea but it would overwhelm the #rules embed for which we want the focus to be on rules
iirc discord doesn't allow for custom sized images does it?
oh
i thought it's the bot DM from when you join the server
sorry, no
Doesn't the welcome video mentions modmail?
kind of, are you talking about embed images?
i can work on this! can i be assigned? i have commented on github and didnt have a response yet
Haha
Me 😄
it was when Discord was erroring out at CF level, so API calls were returning full html pages
Too bad the Egyptian vs French boat battle didn't also include removing sea mines
Although wouldn't it make sense to use a thread to play minesweeper now?
It seems to have become quite common
🏓 @gritty wind as you wrote the issue
Sure a thread sounds good
battleship plays in DMs, but scale made sure it could still be played
that's the egypt vs france reference haha
it seemed as slow as an IRL battleship game haha
python-discord/sir-lancebot#1041
how do you think
yes, images in embeds
I've left a small comment, looks good apart from that
Although you should create a new git branch when working on a PR
Otherwise you may run into the risk of mixing commits between PRs, and it is a mess to fix
@thorny spade what do you use to interact with Git? Your IDE, the command line, github desktop, etc..
sometime ide
sometime github dot com
Oki, do you use PyCharm?
set a variable like MAX_LENGTH = 99980 towards the beginning of the file and pass it as an argument, instead of hardcoding the number directly
ic thanks
done!
Yea, for some context this type of things is referred to as a magic number or magic constant. It's considered to be an anti-pattern to use numbers directly within source code. It's said to be one of the oldest rules of programming.
So defining them as constants at the top of the file with a name, means that when they're used within the code itself there is some added context
which in turn makes it easier to read, understand and maintain. Especially if the same number is used in multiple places, it means you only need to change it in that one place at the top of the file
ic
thanks for the explanation!
No problem!
what chris said 
alas
hey @thorny obsidian, are you around?
what about what i said 😠 ||/s||
what you said too 
smh
Hmmm I'm trying to mock a channel with a category with a specific ID MockTextChannel(category=MockCategoryChannel(id=456))
But that doesn't seem to work, channel.category.id is some MagicMock object
oh now it's a number
but it's still not the right number
Think I found a bug in the mock class
Will make sure the fix doesn't fuck up the other tests
Basically it chained the input args and defaults wrong, so the defaults ran over the input
Does the ChainMap not correctly overwrite the defauit?
yeah
ahhh
lol i just looked at it and came to the same conclusion
Does the access priority from chainmap rely on the order they're passed to the constructor?
it's viewer/os dependent
essentially this happens if it's too large:
apparently
interesting
The class was only ever used once and without params
lol
If the tests test our code, who will test our tests 
you apparently
👁️
lmao
!otn a generative adversarial network-driven development
:ok_hand: Added generative-adversarial-network-driven-development to the names list.
aka Gandhi development
hahaha
i'm leaning towards the banner still, tbh
so long as we can size it correctly
and crop the unnecessary space on top
🤨
like look how good these look https://raw.githubusercontent.com/python-discord/branding/main/events/diwali/banner.png
it means the files that it stashed (because they weren't staged for commit) conflicted with changes that pre-commit tried to do
I don't follow lol. If it's stashed why is it conflicting
a pre-commit fix makes a change and saves the file right
what that's saying is the change it was going to do conflicted with the files that weren't staged for commit
how is that possible
since when pre-commit runs it stashes un-staged files and then applies the stash after it's done
what fix did pre-commit try to do?
The unstaged stuff is two files I'm just not adding
like.. they don't exist at all in remote
isort
The file that it's trying to fix the import for, does that also have changes that you haven't added to the staging area?
oh.. git is saying there are unstaged changes to another file... but when I pull up the diff it's... nothing
And now it worked.. even though I made sure it was staged before committing 🤨
ok, well, thanks lol
same, me too
looks fine on mobile too
only issue is the padding at the top
we can crop it with pillow or something
@stable mountain doesnt have pillow as a dependency atm
this is with the icon, i dont like how the text gets squeezed
the embed width flexes to match the image width?
i think this would be my preference, with the extra chunk on top cropped
also an option
that looks good too
i'm sure it'd be easier
yeah the last one seems preferable
@vale ibex I'm a tad surprised, (bot-core#32) no upper bound on the disnake dependency? Or I presume that's because its a package and it will be further restricted on the dependencies that use it?
Yea, the package will define the version more precisely
👍
didn't want to have to update bot-core along with the bots when we want to upgrade
can you show an example of this with the banner manually cropped?
yeah makes sense 💯
I've added it as a comment in pyproj to make that obvious
c'mon that looks amazing 
of this disnake.
haha
it was of this package
and I was like, lets be specific
didn't delete enough words
it does
mood tho
off-center and cropped a bit on mobile because, mobile
btw mina, you're in the server where vivek is testing this if you want to see it there: https://canary.discord.com/channels/928111022085144636/928113345079423037
is that how embeds look on android? they look funky
https://tenor.com/bbMap.gif
if we ban all the mobile users, will we finally be free?
iOS
I've also got the @stable mountain disnake migration ready too
yes
this looks fine on mobile btw
the padding and margins and stuff on android just look off lmao


