#dev-contrib
1 messages · Page 119 of 1
there we go
✅
Thank you!
Can someone confirm this, https://github.com/python-discord/bot/pull/1634#pullrequestreview-682324315
@brazen charm I didn't understand what you meant by this, https://github.com/python-discord/bot/pull/1634#discussion_r650391876
ah
this part i presume
Would need confirmation as I'm not sure if I got it right myself but I don't think the 16 hour limit was meant in this way, but the other way around (as a maximum). With a 16 hour minimum the moderator will always have less than 8 hours for personal non-ping time.
thanks 
Yeah the 16 hour limit is a maximum
for the helpdm command can the dm be deleted once the channel is closed? the command is close to having no benefit
ah thanks for the clarification! 
This is my code: https://github.com/python-discord/bot/blob/bb52bdf38e053935995ad4e9bc04f36831f93fbb/bot/exts/moderation/modpings.py#L188..L216 Whenever i do !modpings schedule 2h22m 2h23m i.e. it should schedule the task at 2:22 UTC timing but for some reason. It schedules the task at that exact minute when I invoked it
invoking time:
wait, does that mean past?
like it the time was in past, so it is getting scheduled immediately 
Yeah, that was the issue, fixed it and pushed
The create_task util does the exception logging for you now. I noticed three errors when reading through it, those should now be logged as error level logs when the method gets ran as the bot starts up
Ahh cool, we can free up some emoji slots on emoji server 2 now
We're actually at the limit atm
Can do it when I'm home
lol, I guess it is time for server 3
Lol Yea
Realised deleting emoji was possible in mobile, so I've just done that
We've got 4 emoji slots left on there
We probably have a few that aren't used anymore
I think we still have the egg chase cog in sir lance
Don't think I was around for that event
It is very old
Maybe two years or so
I believe the last 8 or so emojis in the first server can go away
Seems like @stable mountain is triggering typing for quite a while after the docs command was invoked. this might be a discord bug though
not sure if this was the right channel to send this to so lmk
Do you have example input that causes it?
Yea, this is the right channel for discussing it
Just any documentation lookup it seems
I've only seen this in the discord.py channel
About every time it was used now
So the typing event stays even after the doc is sent?
!d str
class str(object='')``````py
class str(object=b'', encoding='utf-8', errors='strict')```
Return a [string](https://docs.python.org/3/library/stdtypes.html#textseq) version of *object*. If *object* is not provided, returns the empty string. Otherwise, the behavior of `str()` depends on whether *encoding* or *errors* is given, as follows.
If neither *encoding* nor *errors* is given, `str(object)` returns [`object.__str__()`](https://docs.python.org/3/reference/datamodel.html#object.__str__ "object.__str__"), which is the “informal” or nicely printable string representation of *object*. For string objects, this is the string itself. If *object* does not have a [`__str__()`](https://docs.python.org/3/reference/datamodel.html#object.__str__ "object.__str__") method, then [`str()`](https://docs.python.org/3/library/stdtypes.html#str "str") falls back to returning [`repr(object)`](https://docs.python.org/3/library/functions.html#repr "repr").
Yes it hangs for a good few seconds I'd say around 5?
Isn't it a discord limitation
Seems alright to me, but there could be some client side issues
It seems to be happening when more then one people do it at the same time though
That it has a minimum time it lingers for
I didn't keep a close eye
Feel like it is, remember reading about that
Yea, the typing events in discord don't have an end event, you send the typing event and then it ends when you send your message
Or it times out
I guess we could remove the typing as most fetches will be almost instant
Agree with this, the documentation look up is quite fast
I don't think you need to trigger typing after every fetch or whatever it is in this bot
I haven't read the source code of this bot so I'm unsure
There's a context manager in d.py,which you just wrap the command in
I pretty certain that's what we're using
Ah sorry, I haven't read through this bot's source code much
I see the context managers now
The typing event either stops after you send a message or a 5s timeout
But the context manager isn't really a reliable method and may retrigger a typing just after the message is sent, meaning that will have to wait those 5s
Doesn't it send the message outside the context manager?
That's even weirder then
it shouldn't matter, what's meant to happen is the client receives the typing event, then wait for message from typing_author in channel then cancel_typing in the client, only if you send the typing and send events close enough together it's possible for delays to cause them to be desynced which makes the typing linger
The typing could also be moved to only trigger when a web request is made but the channel would need to go through a few method calls to get there
?
The linked message doesn't look bad to you?
What's bad about it?
Pain.
lol not sure what's happened there
I'm guessing something to do with the square brackets in the post title is breaking the android app
You are not allowed to use that command here. Please use the #bot-commands channel instead.
it should be escaped, since it works on the desktop client.
I'm guessing it's a bug in the android app
Yep, you can blame that one on Discord
Would need it uploaded to paste to see the exact markdown and why there's an issue
!raw #reddit message
Sorry, an unexpected error occurred. Please let us know!
RuntimeError: Line exceeds maximum page size 1992
I really hope that bots get the 4k limit
Thank you bot
Run an eval command to upload the output to hastebin 👀
Well, not like I can do that
The year 2021 is not yet supported
yea, all through June the bot posts on a timer
but ofc, we don't have any 2021 facts in the repo
weeeee cj8 is coming 
June 21st
wait June 14 for yesterday 
Monday, June 14 - Form to submit theme suggestions opens
good spot
I guess it's June 14 in some of the world, but 15 in UTC where we put these calendars
its 15 even in UTC i think, i am 5.30h ahead, and it is 7.43h now
yeah, it's 15th in UTC now, so we should amend that
spelling mistake, unimportant
vimeo should be capital right 😛
ya it could be
feel free to add review comment to caps youtube/vimeo
i'll disable auto-merge
welp,you disabled it just on time
lul
nice, its gonna be CLI/TUI this time
Well.... the precommit hook failed me ;_;
lol
lint before you push 
👀 interesting
it's because you merged in a suggestion that a trailing space
probably u merged by commit through UI, and it caused error
but i only did change in one word, not aything else
yeah, but git has no concept of a word
it's a line change, and the suggested line had a trailing space
oo
okay we're good to merge
whats github bootcamp? walkthrough it?
hahaha now you mention that the github is capitalised incorrectly
It's a git crash course basically
welp, i forgot even github is GitHub
Github should be GitHub yeah
lol
oh we never changed the date to tuesday either lol
You forgot to change this
yeah, i noticed that too
and that lol
adding it to my patches branch
lmfao

this is a bug in english and needs to be solved IMMEDIATELY
lets see if there is something else remaining
what about this
could do, probably not in this PR though
why don't we have a label for html in site
lol
shouldn't we?
Doesn't the platform agnostic rule conflict with some frameworks which are not cross platform e.g.ö curses
is it straightforward or straight forward 
The former or straight-forward
@patent pivot another one
The latter would be used like "look straight forward" which is a different meaning
yeah
yeah, good question. we mention WSL on the frameworks page so I guess that sort of works, but it is a conflict it seems
cc @thorny obsidian
Since it's only one framework maybe you can just list https://pypi.org/project/windows-curses/ as an alternative, though I am not sure how much of the same API it supports
hmmm
Never mind, urwid is also a problem
we could revert the PR adding events page, make all these necessary corrections there (both those in my PR & those mentioned here) and merge when it's ready for sure, having stuff picked up by scrapers & linked from various bits of the site when unclear probably isn't great
linking to docs for each of the frameworks seems smart
linking would be hyperlinking the heading or adding another line below?
probably adding a documentation anchor to each
better 
ugh, I've changed so many sidebars already ;_; they keep appearing
The platform agnostic is a holdover from Django. Considering the framework of the jam I don't think it's necessary since we have choices of frameworks
Did codejam8 page just go down?
yep, I rolled it back while we get stuff ready
ah alright, is there a PR open with the changes?
can we get the template of python discord so that we can make one of clone like it
and then I can run the bot and make changes
Or I should create the new one with specific channels and roles
auto-merge is spooky
lol
is site autodeploy? or is your k8s still blocking?
oh
It worked locally ;_;
Clear your cache
I swear
ah
I tested it
It's working, just caching lol
Does this happen a lot? Or is this just a rare issue
uhh
Visually what happened was, I saw the typing indicator for the bot for a few seconds. Then it just vanished, then a minute later it sent
right now we're upgrading our kubernetes cluster
Ah
so services are coming and going
Ok that makes sense
!ext r help_channels
:ok_hand: Extension successfully reloaded: bot.exts.help_channels.
@fervent sage tag has been reviewed.
!ext r help_channels
huh?
So I was wondering, why do you guys add init.sql as a volume in your site's repo? https://github.com/python-discord/site/blob/main/docker-compose.yml#L22
docker-compose.yml line 22
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql```
afaik /docker-entrypoint-initdb.d/init.sql gets picked up by the postgres container on start and runs it for you
so having the init file in that path means the init.sql gets ran on startup
It runs on startup?
It's a volume, rather than in the docker file, as we don't want that to be part of the image that get's pushed to prod
ah, alright
you can look at what the script does
it inits the metricity db and adds some testing data
since metricity isnt managed by django's ORM
you need to create the tables manually
@patent pivot can prob correct me if I'm wrong
yeah, that's it
we use two DBs for prod, but postgres docker image only inits 1 by default
hey, i'm wondering how does one implement a tag? is the md file in resources/tags the only step?
yup 😄
yay :D Time to PR ™️
thanks!
bot#1644 is now on 😄
although this isn't my first time contributing to pydis... it says i need workflow approval
approved the workflow run
thanks!
First time contributor to the bot repository
ah... so it's different for each repo!
yeah, that's my bad, it's been a long time since i've commited to a formal repo (been recently working on my own repos) so i forgot, but i listed the correct commit messages here:
Yea, those still aren't ideal either, since they don't really tell me what's happened in those commits
you can always ammend or rebase while someone is not working with the branch or if they won't affect reviews
how would i do that?
ah... alright
git rebase -i would be the easiest. You can change the commit names, save the file and close it. Then git push -f
at least that's how I usually do it
@vale ibex are the messages better now?
so i run that right in my command-line?
git commit --amend is used to add to the last commit, for going further than that you'll need the rebase, git rebase -i works or if you have a GUI utility for git it most likely provides an interface
oof- i don't have a gui
wait wat- speedrun
yay only one approval needed
@vale ibex i added a new commit and it's asking for approval again- why? isn't an approval enough?
no way
bruhhhhhhhhhhhhhhhh
alright, i guess that's how it works 😄
guess i'm waiting for this first pr then lol
For a tag, we should probably squash merge anyways
There is no reason for 5 commits to get a tag
i agree, just squash it all to "create tag" lol
It’s still good practice to give them meaningful messages during the process, to aid reviewers, or at least get the experience
got it!
Is anyone available to review bot#1638?
No point when I can't merge lol
oh wait auto merge was on
I thought it updates it automatically
👀
@green oriole @sleek steppe thanks!
I had time to write it so 🤷🏻♂️
is any core dev available to review sir-lancebot#756? last approval then it can be merged, this pr had been waiting for almost a month. thanks so much in advance!
are mine good :P
thought it'd be cool to have token detection added to the !paste command . So if someone pastes a token , and clicks save .. before it is saved it reads the whole text looking for the word "token" ... and then checks with the user before confirming save . what do you guys think?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Issue: bot#1385 can be closed, since it is much clear right now
why would it search for 'token'?
wouldn't it be better to use our existing token detection & somewhat validation (also, the pastebin isnt part of the bot)
The time that i almost posted my token into a pastebin , it had "token" listed .
so i see it could also search for a series of numbers/letters that look like a token , and verify that its not .
also there was an update on that issue on github
basically heard that the pastebin service is one that is not easy to add onto . As its a hosted application from another company
was just thinking of any ideas that could support users in not accidently posting their token . I nearly did . (i turned on logging for something else .. and it inadvertently turned on logging of my token in the log)
i just scroll through the log prior to posting . I see others will not
I haven't seen this existing token detection
very cool
hmmm
well ... if theres a way to put a message on the "backburner" before being posted.... a bot could grab every pastebin and search the html text for anything that looks like a token .. in the same way.
and if it doesnt pass, deny the message post . And if it passes, paste the link
not possible
the backburner idea is not possible?
no, discord doesnt let you do that
i see ...
the link could be passed to the bot , instead of being directly posted into the channel , and then the bot posts the link when it passes
using a private message to the bot option .. using the / commands
thats just becoming harder and harder to actually use though
its not worth it for the minimal benefit it'll provide
idk , i see there could be a lot done with that . The bot could even create a new pastebin that doesnt include the tokens , and instantly post that instead.
and users could use it and know that their code is safe .. could be optional
and preferred
people can still scrape the link before it does that anyway
mhm , yes . i see tht
i see there could be another way to post bulk code with it being checked like the token_remover does
maybe passing it to a bot instead of using pastebin
again its just removing ease of use for little added value
we've considered various ways of adding token removal and in the end it boils down to just not being worth it for the few occasions it actually helps
i generally saw preserving tokens as high value .
understanding that it has already been looked into
We won’t be adding features to the pastebin if it can be helped
We’ve shot this idea down many times before. There is some gain, but not worth the hassle of maintaining our own fork of hastebin
The hastebin also doesn’t have as much a risk of scraping as on server messages, because accessing it involves more steps and resources than scraping the server
The issue and linked PR both state that the current setup is only a partial resolution of the issue. I’d still like to see the other suggestions
I wonder if we could proxy the requests to the pastebin
Yeah, we can totally do that (CC @patent pivot)
Put a proxy that analyse POST requests, and if a token is found put a placeholder instead
Yeah that sounds doable
Also worth checking the error responses, we might be able to forge one of those to display it to clients
Hmm
I guess I could try to reach the characters limit
Seems like it answers with 400 and a json message body
cool
Could I make that a traefik middleware?
Ah right! I will go through the related code and see if there is something I can do
nah, would have to be cloudflare workers
right
it would be nice if it did, but it would have to be a permission thing. Ig like manage messages.….
discord has the api to make this possible, but i wonder if it could handle that many requests.…
what if bots could set up regexes within discord to be deleted so discord blocks them because they match a regex and then it lets the bot know with the interactions api or smth?
hm.…
I'm rambling at this point lmao, respond in #ot2-never-nester’s-nightmare
@green oriole do you wanna open an issue on workers to add token filters
Your reminder will arrive in 13 hours, 59 minutes and 59 seconds!
lolol
@green oriole
Here's your reminder: hope you did it, you lazy bastard.
[Jump back to when you created the reminder](#dev-contrib message)
I am officially a lazy bastard
lmaooooooo
expiration
No active reminders could be found.
wat, i set an 8-year reminder...
WOOO
inline timestamps
<t:1618953630:d>
seems worth adding to @stable mountain for when stuff infractions end
it will show it in the user's local time
oh wait nvm it doesn't work on mobile (android) yet
Mhm, that's most likely the plan once it's on stable
oh that's wonderful, but I don't think it is gonna get stable anytime soon lol, see files
wdym
<t:1624047476:t>
<t:1624047476:T>
<t:1624047476:d>
<t:1624047476:D>
<t:1624047476:f>
<t:1624047476:F>
<t:1624047476:R>
ye, the question is mobile
android has it
what version and build
yeah, it's probably alpha
but we won't look at implementing it at all until docs are merged and it hits stable on all 4 platforms
4?
desktop, web, ios, android
in parts
gateway for desktop and web is completely different
desktop uses erlang term format (ETF), web uses JSON
why even lol
because browsers can't handle ETF very well
the TL;DR is that web & desktop operate differently
Anyone seen this on bot before? ```
postgres_1 | 2021-06-18 19:03:41.124 UTC [69] ERROR: integer out of range
postgres_1 | 2021-06-18 19:03:41.124 UTC [69] STATEMENT: INSERT INTO "api_role" ("id", "name", "colour", "permissions", "position") VALUES (476190141161930753, '@everyone', 0, 4397059136, 0)
web_1 | Internal Server Error: /bot/roles
web_1 | Traceback (most recent call last):
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 86, in _execute
web_1 | return self.cursor.execute(sql, params)
web_1 | psycopg2.errors.NumericValueOutOfRange: integer out of range
loading this on the site directly, it seems the permissions column in only an integer, not a bigint
hmmm, wonder why this is pushing a larger number than normal
ah ok I got it
d.py 1.7 added 3 new permissions
so we will need to bump site max val to allow for that, before bumping bot to 1.7+
Soooo, bumping d.py up to 1.7 for @stable mountain will require changing a column type on site from int to bigint
would that just work with a migration?
lol so the breaking change is breaking due to integer handling 
should be something like ALTER TABLE <table> ALTER COLUMN <column> TYPE BIGINT
actually, exactly that
might take a sec though, it has to rewrite all of the rows in the table because the size changes from 4 bytes to 8
yea, django does it all for you
was mostly asking if there's other things to consider
site#534 bot#1648
shouldnt be, should be pretty smooth as long as the table isnt like millions of rows
only other thing I saw was the new linesep arg in the Paginator class
if it is massive no issues, just the table would be locked until the alter finished
but thats a pretty smol table iirc
yea, it's the roles table too, so it's not huge
Ello, can I get a review on https://github.com/python-discord/bot/pull/1649 please?
Thank you wookie and Chris
you now owe me 1 groote
Hm....
Not sure that's the best solution
I feel like it should check a user's flags and have the 4.2k limit for nitro users and 3k for non nitro users
We are not going to implement any nitro gate either way
Every user should be equal no matter what
and for what is worth I'm really not happy with the 4k chars change
im confused why we increased the limit of a spam filter because it was possible to send more? surely no matter how much discord raises the limit, what qualifies as spam remains the same?
Well, I we don't think we should be muting someone for sending a full length message
At least not automatically
They can tho
So ig the bot spam filter raise is good, however I feel like two back to back full messages should mute
you can see if a user boosts or has an animated avatar
Well, tell that to discord ¯\_(ツ)_/¯
you cannot see if they have a nitro subscription
I thought you could lol
nope
Two full length for a non nitro is the same as one full length for a nitro user
I don't see why we would punish the former but not the latter
Again, nitro is a Discord thing, we are not discord
We don't care if the user has nitro or not
True, idk what I'm thinking
Ah yep
Can't get the nitro flags
Can get every other flag
yep
i dont think they'll ever add that
just think the amount of data that would mean for bots like dyno or mee6
yeah, it's closed
data discord definitely doesnt want in competitioners hands
Yeah and there's already two ways for bots to figure out if one has nitro
Three, I guess
Which all require user input
Is there a way to check if a user accepts DM's without sending them one?
Don't think you can do that
nop
I think so
Well it's still making an API call, but you can send them a blank message and see if you get a 403 vs a 400 :P
Hah, I'd rather not spam people with blank messages
thats the thing
the blank message will 400 if its not a 403
and never be delivered either way
im curious though which takes precedence
if I were designing the api (as i have done lol) then I'd do that sort of message validation pre-database query to see whether I could send it
so in my api a blank message would always 400, even if it couldnt be sent to a user
unsure if thats how discord handles it though
huh, discord validates that a message can be sent before it validates content length, very interesting
Yeah I tested it and it 403's before it 400's
@timid sentinel that's one small pr
lol. small pr's are my speciality
and this is more of a bug than an enhancement I think
I love small PRs
Hmm on mobile it says I can enable auto merge but when checks pass it doesn't merge 😔
wait you can enable auto merge on bot repo prs...
Nah I think it's a github mobile bug
I disabled because it didn't merge
@sleek steppe @fervent sage here take https://github.com/python-discord/bot/pull/1650
already on it
mmmm good
lol
I dont have bot issues piped into my brain tho 
You're turning into aboo lmao
.
:incoming_envelope: :ok_hand: applied mute to @fair spoke until 2021-06-19 20:38 (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
add some of the tui stuff to @snekbox
how would you be able to use it
yeah snekbox isn't suited for that sort of stuff
rich.tracebacks 😏
!d rich.traceback.install
rich.traceback.install(*, console: Optional[rich.console.Console] = None, ...) → Callable[[Type[BaseException], BaseException, Optional[types.TracebackType]], Any]```
Install a rich traceback handler.
Once installed, any tracebacks will be printed with syntax highlighting and rich formatting.
I don't think we should be adding rich knowing that only a couple of functions will work corectly
It may not even work because it is lacking a big part of the tty interface
Could we get bot#1653 reviewed pls
no
@brazen charm Could you give bot#1634 another review? :D
Have you fixed the errors in the rescheduling method?
I don't get any errors now
I can still see them, do you have anything in the redis cache for it to reschedule?
From the ones I checked, there's an unawaited coro for the mod var, it's trying to unpack int keys from the dict instead of using items directly and is passing a string to fromtimestamp
That would have been the issue probably, i probably would have forgotten to disable fake redis when I shifted to docker for testing 
i will have a look
Hey, I'm kind of new to this open-source world, however I think I spotted an issue(in Sir-Lancebot) that I might be able to fix, and haven't been assigned to anyone.
If I'd like take it, my only job is to leave a comment? 😄
(Sorry, I haven't done such things before)
yep, leave a comment saying you're interested in solving this issue and someone'll assign it to you
okay, thank you!
If you get stuck while reading through the setup guide, or want some help with git in general, feel free to post here 😀
Okay! However that issue doesn't seem to be a hard one.
Yea, should be a good introduction to the code in general
Any other opinions on bot#1641 ? Also waiting for an approval/consensus on bot#1545
I like the idea of 1641
1545 had a core dev ping 2 days ago, so you should get a consensus soon
I think 1545 might break too many things, but I haven't gone through the codebase much
It'll be a decently sized change to the users, but it opens up a lot of command name space
Do stale issue ping or was that for some other reason/manual
We created a poll to decide how we should interact with the namespaces
Yea, it was manual
modmail or an email to admins would probably be the best if it's an actual vulnerability
Normally how ir looks when I launch my python script
ah
this channel is for python discord projects
And it seems to load parts of random images on my desktop bar.
Hovering with mouse makes it go grey then change permanently into another random image, until I hover over it again and it changes
Oh, ok
I'm not sure what that framework is but they should have their own tracker or other contacts
Oh I see, that is tkinter for python, to make graphical stuff
Well, I am off to sleep, found it when I did finishing touches before bed. I'll do more bug testing tomorrow and try to find more info. On top of contacting the right place

you can find the python bug tracker here https://bugs.python.org/, tkinter should have its own component category
oh is api open for contributions?
Alright, giving them a look over. FYI (literally fyi, just so you don't do more work) you don't need to merge master in very often when working on a part as isolated as this. Github can just merge it back up so long as there's no conflicts (which, given its a new file and nothing is changing around it, is cool)
Alright, just two last things
Github (discord probably) sets that on it's own, not sure we can pull it for ya
It's mostly just an inverted the github logo tho
hmmm we probably shouldn't use <a>'s here for this navbar item
using a <span> seems to mimic behaviour
ah, i see. got it, thanks!
will look over them now
@sharp timber changes implemented
thanks a lot bast!! also, why is it not merged? everything's approved
It’s linting
Ah... well i need the workflow to be approved
I triggered it now
Woohoo, thanks!
Everything works!
!dunder-methods
Aww, still not updated?
Hm, i guess it takes a while
!dunder-methods
Dunder methods
Double-underscore methods, or "dunder" methods, are special methods defined in a class that are invoked implicitly. Like the name suggests, they are prefixed and suffixed with dunders. You've probably already seen some, such as the __init__ dunder method, also known as the "constructor" of a class, which is implicitly invoked when you instantiate an instance of a class.
When you create a new class, there will be default dunder methods inherited from the object class. However, we can override them by redefining these methods within the new class. For example, the default __init__ method from object doesn't take any arguments, so we almost always override that to fit our needs.
Other common dunder methods to override are __str__ and __repr__. __repr__ is the developer-friendly string representation of an object - usually the syntax to recreate it - and is implicitly called on arguments passed into the repr function. __str__ is the user-friendly string representation of an object, and is called by the str function. Note here that, if not overriden, the default __str__ invokes __repr__ as a fallback.
class Foo:
def __init__(self, value): # constructor
self.value = value
def __str__(self):
return f"This is a Foo object, with a value of {self.value}!" # string representation
def __repr__(self):
return f"Foo({self.value!r})" # way to recreate this object
bar = Foo(5)
# print also implicitly calls __str__
print(bar) # Output: This is a Foo object, with a value of 5!
# dev-friendly representation
print(repr(bar)) # Output: Foo(5)
Another example: did you know that when you use the <left operand> + <right operand> syntax, you're implicitly calling <left operand>.__add__(<right operand>)? The same applies to other operators, and you can look at the operator built-in module documentation for more information!
Let's go!
that is a big one 👀
you're implicitly calling
<left operand>.__add__(<right operand>)
type(<left operand>).__add__(<left operand>, <right operand>)👀
I mean it is almost the exact same thing
!e ```py
class A:
def add(self, other):
raise Exception("Fail")
a = A()
def add2(self, other):
return A()
a.add = add2
print(a + a, a)
@sharp timber :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 10, in <module>
003 | File "<string>", line 3, in __add__
004 | Exception: Fail
I am not sure what could be causing this
@green oriole what operating system are you on?
Linux Manjaro
run grep cgroup /proc/filesystems and see if there is a cgroup2 line
if so, it's because you're using cgroup v2, so you'll have to switch it back to v1 https://wiki.archlinux.org/title/Cgroups#Enable_cgroup_v1
at least, I think that's how I fixed it
I have v1 and v2
yeah, you're probably using v2 since it supports it
check the link for switching it to v1 and try running it again
hmm, will do later on
I probably won't need it before a long time
Hey @sharp timber, can you please have a look at https://github.com/python-discord/site/pull/536#pullrequestreview-688238871 ASAP? If not I can take care of it, there are just a couple of lines to remove
It's not running because coverage is misconfigured
It's testing the test itself's coverage
@exotic ember @sleek steppe could you give sir-lancebot#745 and sir-lancebot#618 another review
I can change this to just an assertEqual(bool(), True) but that's bad practice. We should be using --omit or something on the tests so coverage isn't testing recursively for coverage
I'm not all familiar with the tool so I'm not really sure I want to touch it
Couldn't you just do without the try/except?
Yeah, although that turns any failure fo the test into an exception rather than a failure
Eh. It feels wrong to not test it and return results and instead error out
I can change it to that though
We do have a coveragerc file it just doesn't have the test locations in it for some reason
we can do that then
Should I make that part a separate PR?
I can do it now over the next, say, 30 minutes
you can do that in one PR if you wish
Sorry, #539 already filed >.>
no problem haha
now let's poke some people
Good morning @cold island, do you have a second?
hey
Having coverage on tests can be useful, I'd just ignore that one branch
could you please review site#539 and site#536 ?
I approved the first one, not available to look into the second
EYYYYYY CONGRATS ON HELPER POOP!
everyone in the cat dev is ascending
so happy
thank
Receiving 1.53 events per second.
28,006
19,278
11,112
2,527
1,264
1,022
965
462
453
400
259
225
203
201
171
48
17
7
7
4
4
4
3
1
1
Big Brother
!bigbrother
Monitors users by relaying their messages to the Big Brother watch channel.
!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.
Bot
!echo [channel] <text>
Repeat the given message in either a specified channel or the current channel.
!embed [channel] <text>
Send the input within an embed to either a specified channel or the current channel.
BotSource
!source [source_item]
Display information and a GitHub link to the source code of a command, tag, or cog.
Branding
!branding
Control the branding cog.
Clean
!clean
Commands for cleaning messages in channels.
Yeah, it does look rate limited
yeah, thanks
there was a small break between the second and third emoji
Switch to buttons
Buttons are the future
maybe later
when discord.py 2.0 is out
poggr s
yet 👀
Give it a few minutes
There are two pinned questions in #help-peanut 😮 what could cause this?
like when you got the Python bot stuck in an infinite loop 
Doesn't sound like something I'd do 🤔
Idk but last time they were manually removed
Hm
Rather than actually fixing the bug, seems like it would make sense to just make the bot iterate through all pins and remove them when a channel is closed
It could happen if the cache is cleared.
Or if an exception occurs during the process of making the channel dormant, and before unpin gets called.
That would likely only happen if Discord is having issues
The first case has a log message but it's a debug-level message, so it doesn't show up in production logs.
Seeing how laggy discord was yesterday, I'm blaming them
I was looking at the Wolfram command as I am using it for myself...
I got some error at this point and I literally have to idea how to deal with it.
async with j1.http_session.get(query) as response:
It was this. But it is a little modified.
There used to be a self.bot there but as I am not using a class so I removed it.
There is no http_session in Bot so I don't know how to deal with it
You can use your own http session here
I mean, I literally know nothing about it...
How do I even do that?
http_session needs to be an aiohttp.ClientSession, make one yourself and use it for the requests https://docs.aiohttp.org/en/stable/client_quickstart.html
anand too fast

!d decorators
= decorator+ decorator ::= "@" assignment_expression NEWLINE parameter_list ::= defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]] | parameter_list_no_posonly parameter_list_no_posonly ::= defparameter ("," defparameter)* ["," [parameter_list_starargs]] | parameter_list_starargs parameter_list_starargs ::= "" [parameter] ("," defparameter) ["," ["" parameter [","]]] | "" parameter [","] parameter ::=...
what's up with this embed 👀
Uhhh
Isn't that the EBNF syntax?
Okay, yeah
It is misdetecting a segment of the syntax as a valid symbol name
There is a doc symbol which points to the middle of the code block for every token so there's not much to be done there. The symbol names are from the inventory file so the bot can't misdetect them, just a bit of not so great parsing
That's stupid
Why did they put a symbol there
I wonder if we can submit an issue for it
I mean, it makes sense to scroll you in there with the fragment, just not for our use without some heavier parsing which may be incorrect in other cases
Uh I read the how to contribute to the bot but it confuses me even for the sir lancebot
What's confusing?
We can help you out
TBH, the entire thing. Apparently we need a docker container and what not?
Docker makes it very easy to start up, I'd highly recommend using it
Do you know what Docker is?
The application is set up in docker so you can get it running with 1 or 2 commands.
Ohh ok
Yeah it's a container right?
idk what it exactly is htough
Docker helps "containerize" applications. Basically, that means it run it in an isolated environment. It's not as heavy as a VM, since it doesn't use it's own part of an OS or anything like that. It also helps with compatibility across OSs
I mean if you are using a docker container you don't really need anything else, just your config.yml
if you are not using docker container, then you need
In the cj8-qualifier repo's readme, it says that "If an item cannot be centered evenly, the extra space character should be to the right of the item (see example 3)".
However, after line 90 in local_test_suite.py, there seem to be 2 outputs for each of the test case. This indicates that the extra space character can be put either to the left or to the right of the item.
Shouldn't the readme be changed so as to reflect the condition used in the test cases?
Yeah, we'll update that, thanks
np :)
wouldn't it be handy if we kinda have a command for meaning of mutating arguments since people seem to stumble upon it quite a bit in qualifiers?
!mutable
Mutable Default Arguments
Default arguments in python are evaluated once when the function is
defined, not each time the function is called. This means that if
you have a mutable default argument and mutate it, you will have
mutated that object for all future calls to the function as well.
For example, the following append_one function appends 1 to a list
and returns it. foo is set to an empty list by default.
>>> def append_one(foo=[]):
... foo.append(1)
... return foo
...
See what happens when we call it a few times:
>>> append_one()
[1]
>>> append_one()
[1, 1]
>>> append_one()
[1, 1, 1]
Each call appends an additional 1 to our list foo. It does not
receive a new empty list on each call, it is the same list everytime.
To avoid this problem, you have to create a new object every time the
function is called:
>>> def append_one(foo=None):
... if foo is None:
... foo = []
... foo.append(1)
... return foo
...
>>> append_one()
[1]
>>> append_one()
[1]
Note:
• This behavior can be used intentionally to maintain state between
calls of a function (eg. when writing a caching function).
• This behavior is not unique to mutable objects, all default
arguments are evaulated only once when the function is defined.
eeeeey
takes up like 1/3 of my portrait monitor 😬
we could shorten it by removing a bit of whitespace and using foo = foo or []
Theres a typo on the last line, "evaulated"
Also wouldnt it be easier on the eyes if the tags were like a brief description of the concept and linked to a full article on the PyDis site mayhap?
That's the overall goal now that dewikification is done. Just requires some people to ~do the thing~ which hopefully we'll have a bit more time after the jam
Oh, neat
hey, is any core dev available to review sir-lancebot#756? it's been sitting there for a month now, and i'd greatly appreciate any review! thanks a lot in advance!
@thorny obsidian https://github.com/python-discord/site/pull/543/files#r657571738 I don't think this had been mentioned, atleast I can't see the change
repost from #community-meta:
you use sentry for error collection dont you? I'm setting it up rn and cant figure out how to get it to send issues to discord
@gritty wind but how do i do that
i saw a guide that used a legacy slack integration but i cant find that anymore
I was about to link that guide
Umm, that is what we use, but I don't have permission to mess with it really
It doesn't show up in search like the issue says, but it definitely shows up if you directly visit the link
following the guide on my own project, seems it definitely does work

Which step is giving you trouble?
i might have overread the part that i need to directly visit the link 
You can technically get to it through the menus, but that's an overly complicated process
It's hidden under the "legacy integrations" menu, which only shows up on individual projects not orgs
Tried it there as well 
But this is kinda annoying, having to configure it for each project
Kinda tempted to make my own integration
Shouldn't be too hard, just copy the slack integration, and change it's name to discord :troll:
I'm totally 100% kidding
https://github.com/getsentry/sentry/tree/master/src/sentry_plugins/slack
Internal plugins and integrations are different
Tho kinda tempted to make a pr like that
Perfect timing albedo, I just came here to ask that question lol
oh, so slack plugin works with discord, nice
Ah alright thanks
tho seriously it shouldnt be that hard, even using the native discord format
su uh the one currently used is a bit more complex
I think sir-lancebot#594 can be closed.
pythondiscord got tasklists 👀 and yeah that can be closed
actually I don't think it can be closed
I think we can just do an asyncio.Lock on the in_executor function
or change the max_workers here to 1 https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/avatar_modification/avatar_modify.py#L23
bot/exts/evergreen/avatar_modification/avatar_modify.py line 23
_EXECUTOR = ThreadPoolExecutor(10)```
yeah I thought I had saw it as one earlier, which is why I thought the issue could be closed
I will make a PR that
Ah right, yea that's what i had intended to do
I was going to look into if there was a way to detect when there were a bunch of commands pending, so that we could deny them until the queue lowered
we could use an asyncio.Queue with a maxsize
Yea, that would be a good solution
@vale ibex power move
bump ^
Do not open a pull request if you aren't assigned to the issue.
So I had an idea for a project idea command in lancebot which gives one idea instead of the kindlings page on the python disc bot but --
am I not allowed to contribute because I need to open a pull request to suggest the idea because i presume this is already an issue that is occupied
I"m a bit confused by the wording
You can go ahead and open an issue on the Lancebot repo.
You just shouldn't make a PR unless it's confirmed you're allowed to make that change.
Oh ok
So I just ask to make a PR, otherwise I just open an issue with what I suggest?
The issue is your way of asking if you can make a PR
On the issue template, you can choose either "I would like to implement this" or "Anyone can implement this"
The fomer is saying "I'd like to implement this, can I do so?" and the latter is saying "This is an idea for anyone to implement
@green oriole missing a space after the -U in the dump
Probably a good time to bump postgres in bot's compose as well
psql doesn't mind missing spaces between single char args like that, so it won't error, but it does look weird
I agree we should take this opportunity to upgrade everything to pg13 really.
huh I seem to have missed that
Yeah it is correct, both works. I'll add it for consistency though, thanks.
Hey if anyone's got a Mac, I'd like to get someone to test bot#1626. More testing in general is helpful, but mainly Mac is needed right now
Hello! This channel is for discussion of Python Discord's projects. If you have a project you'd like to share, you might be better off doing that in a place like r/python.
!rule 6
Sorry, but we don't allow advertising on the server, @terse vine
I am Ayman Essalai, I'm a young freelancer and I really appreciate creating stuff. One of my best qualities is my problem-solving skill. I can debug errors fast and this has really helped me during my coding journey ! I love programming, I dream code and I know : HTML, CSS3, basic javascript and python. With my different services, you're guaranteed to be happy.
Feel free to check out our open-source projects here https://github.com/python-discord
but please dont spam your message in multiple channels
I'm rly sry. Won't happen again
no worries 👍
I forked the sir lancebot repo but the entire thing is just confusing me
for one I have to download all the requirements so that'll take a while
two where is the file that reads from the yaml files?
Have you taken a look at this guide? https://pythondiscord.com/pages/guides/pydis-guides/contributing/sir-lancebot/
A guide to setting up and configuring Sir Lancebot.
It explains everything you need to know to get started
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
I got this error trying to do docker-compose up
is docker running?
I forgot to install docker 🤦♂️ oops
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect
getting this error
Hey! Can I get assigned to issues that hasn't been approved yet?
Generally you wouldn't get assigned until the issue is approved, if you're unsure whether it's approved or not then you can ask here
Well, there's no approved label there. (https://github.com/python-discord/sir-lancebot/issues/743)
However, that's a relatively small change.
Done, thank you! 🙂
You're welcome 😄 Feel free to message here if you need a hand with anything 😄
Sure, thank you! 🙂
Have you managed to get it working. Running with elevation usually entails right clicking, and selecting “Run As Administrator”
Nope because I kinda gave up for now since I'm tired
so I run docker desktop as administrator?
problem is i'm accessing this from my ide's terminal
I’ve never run into this problem personally, but the top google search results imply it’s a problem starting the docker engine itself. If the engine is started, you should be able to start the bot itself from the terminal fine.
As for starting the engine, you can try the right click method as described above, or alternatively this from the top SO result:
https://stackoverflow.com/a/61062715
You don’t need to try this now, just ping me if you’d like more help in the future
Ah ok - it said the docker engine had trouvle starting itself
What do you guys think of introducting pytests sugar to the testing setup on bot and site?
https://docs.docker.com/docker-for-windows/troubleshoot/ Does this help? I am not windows so can't help myself
I'll try
I installed the sir-lancebot today but evergreen games commands are not working
It is showing HTTPException('400 Bad Request (error code: 10014): Unknown Emoji')> i didn't see any emoji requirements and which emoji Ids to add in documentations
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
06/29/21 18:17:46 - asyncio ERROR: Task exception was never retrieved
future: <Task finished name='Task-65' coro=<Message.add_reaction() done, defined at C:\Users\Raghav\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-AZvk8AtN-py3.9\lib\site-packages\discord\message.py:1192> exception=HTTPException('400 Bad Request (error code: 10014): Unknown Emoji')>
Traceback (most recent call last):
File "C:\Users\Raghav\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-AZvk8AtN-py3.9\lib\site-packages\discord\message.py", line 1221, in add_reaction
await self._state.http.add_reaction(self.channel.id, self.id, emoji)
File "C:\Users\Raghav\AppData\Local\pypoetry\Cache\virtualenvs\sir-lancebot-AZvk8AtN-py3.9\lib\site-packages\discord\http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
That's probably the trashcan emoji
or should i paste whole logs after startup
It isn't necessary to add that emoji, and it's safe to ignore
If you want to add it, you can add it under the TRASHCAN_EMOJI environment variable
it's the output of \:emoji_name:
ok
but .ships and other commands are throwing these is error when used
Without a fuller traceback, I can't help since that command doesn't even use any custom emojis
full traceback meaning? exception origin from sit-lancebot package ?
.
Honestly anything you can post, since the error above is missing any sort of traceback, it's just an http exception
All the code in the battleship command uses default emojis, so I'm not quite sure how you're getting that error
yeah but it is the only thing showing up in my terminal
a reproduction method would also help
I can share name of environment variables which i am using
other than that all is standard procedure
Can you share the commands/steps you took
poetry install
poetry run task start
I'm confused, do you get this error when starting the bots, or when using the ships command?
i am getting these error after running the ships command
Bot instance is running and logging the whatever exception is generated
Could you add BOT_DEBUG=true to your .env file, and see if more info it output?
ohk
is it not just DEBUG?
definitely bot_debug haha
for lance it's bot_debug yea
I think debug mode on bot is inferred on whether site is local

DEBUG_MODE = 'local' in os.environ.get("SITE_URL", "local")
and then trace is enabled via the cool per cog thing we have
any luck? 😄
You'll need to restart your bot after enabling debug mode fyi
That's a command yea
I'm pretty sure it's not the command
It seems to be right after the reddit cog loads, so I'm thinking it might be that emoji
But that error is invoked before the bot is done loading, and is ready to accept commands
oh i looked it in source code so thats why i am using thats
If it was the ships command, you'd see this before it:
06/29/21 16:05:07 - bot.utils.checks TRACE: Scaleios#8200 may use the
battleshipcommand as they are in a whitelisted channel.
06/29/21 16:05:07 - bot.utils.decorators DEBUG: Scaleios#8200 tried to call the 'battleship' command and the command was used in an overridden context.
Can you put TRASHCAN_EMOJI=:x: in your .env and see if that fixes it?
i am not using env
i am using powershell script for initialzing environment
not poetry task run start?
only environment variables
ok, then can you put that above in whatever you're doing then?
yeah i did that
and...?
output from what?
or i need to put its id
.
the env var TRASHCAN_EMOJI needs to be set to an emoji.
if it is a custom emoji you need <:name:id> I believe
I recommended you set it to :x:
if you want to use a custom emoji, rather than a default one, then you need to do what Ak said
!python -> \:python:
ohk i will do that
But be aware, your bot needs to be in the server with those emojis, otherwise you will get that 400 error
is there any emoji which is present in all the server?
so i can use there code right?
ok
what about command .ships was wrong right?
There's nothing wrong with the command no
Could you show the logs?
It should work, but try it in the correct bot command channel
It doesn't make sense, but I hit that same problem till I tried that so
meh
Well i didn't research properly
yeah it worked
I am not defining .env files but logs are showing Found .env file, loading environment variables from it. Why?
does load_env loads empty file when .env is not present?
it's a little misleading
That is always printed out by us
That should say it found the module
if the import works
joe is just bad at copy pasting
Yeah or not found the module
?
I think module is automatically installed by poetry
It's a dev dependency
It's a dev dependancy
it doesn't make sense to depend on import error
Why not?
How does env variables initialized in production environment
We use kubernetes in production
All of those env vars are already loaded as secrets in the environment
My bad it makes sense if we aren't installing python-dotenv in some any case
Yea, if you look in the Dockerfile, you can see that we build deps with poetry install --no-dev
--no-dev 
blame yarn
lol
More info on our infrastructure 😄
But it also leaves edge case when we use dev environment
We have documented steps on how to setup a dev environment, using both poetry and Docker
if people want to do things themselves, then that's on them, including any issues
we can always help with them here though
The print is misleading, but that's less of an intentional decision, and more of an oversight
Yea, since we assume if python-dotenv is installed, a .env file is going to be there
Like chris says, dotenv is an optional helper, even if we do recommend it for most
Thanks for the help
#ot2-never-nester’s-nightmare message some more 👀
It is a complicated one lol
Hey! I have a question. When using Sir Lancebot's "issue" command I experienced a strange behaviour when the first argument (numbers) was not shipped, or was put in the wrong place, the numbers parameter will be an empty array, and because of that it won't fetch any issue and just simply will return a embed with a Github link that points to either sir lancebot's repository or the repository you typed in or in case of wrong order it points to a 404 Github page, but no issues from Github or error message whatsoever, is this an expected behaviour?
Because, it would be cool if it sent an embed with an error message, and invoked the help command.
Can you reproduce?
While testing, I managed to reproduce, yes. Would you like me to send one into the bot commands?
PS C:\Users\Chris\src\kubernetes> (Get-ChildItem -Recurse | Measure-Object).Count
179
```lol yea
on the issues command, i remember us saying we can just remove it entirely, in favour of the regex listener
yeah, it's a bit difficult to understand without an example
Here is fine too
.issue site 1
.issue site 1
Yes, it should. But the bot doesn't throw any kind of error, or something.
And since that's not an int it will return an empty list, yeah.
I wouldn't mind it throwing the help embed in that case
Yes, that was my idea. Actually, I might have done it wrong, but I've already implemented a solution for that.
if not numbers:
raise commands.UserInputError("You must enter at least one issue/pr number to fetch.")






