i followed all your instructions and opened this pr 3 days ago https://github.com/python-discord/sir-lancebot/pull/726. after some reviews and hours of debugging, we finally got three staff approvals and only need one last core dev to review. would you mind looking at it a little and see if you can review if you have time? thank you in advance Zig!
#dev-contrib
1 messages · Page 112 of 1
!remind 11h resolve
merge conflicts 
Sure thing!
Your reminder will arrive in 11 hours!
ID: 2097, Due
·
@vale ibex
Here's your reminder: this.
[Jump back to when you created the reminder](#dev-contrib message)
!remind 2y remember objects, you have an eight-year reminder
Affirmative!
Your reminder will arrive in 2 years!
ID: 2098, Due
·
@green oriole ty for .. syntax PR
did you see mine
I like mine
where is it stored? can we see it?
Probably in the bot's db
in a database somewhere, you probably can't view it on your own unfortunately
You can see yours with !remind list though
yeah you had some good ones
Reminders for Xithrius#1318
Reminder #1729: expires in 10 months, 3 days, 3 hours, 11 minutes and 55 seconds (ID: 1729)
make pyday logo
don't remember setting this
I think we have that now

!remind delete 1729
Sure.
That reminder has been deleted successfully!
ID: 1729
ah alright
!remind list
Reminders for Object#9891
Reminder #2098: expires in 1 year, 11 months, 29 days, 23 hours, 56 minutes and 44 seconds (ID: 2098)
remember objects, you have an eight-year reminder
Reminder #1959: expires in 7 years, 11 months, 8 days, 15 minutes and 33 seconds (ID: 1959)
if you see this in 2029 and are still in this server, hello future object
heh
Thanks!
!remind list
Reminders for Kronifer#5647
Reminder #2096: expires in 1 day, 2 hours, 13 minutes and 54 seconds (ID: 2096)
go remote
Reminder #2105: expires in 3 days, 11 hours, 57 minutes and 14 seconds (ID: 2105)
check for 200k
!remind 1h check pr
ROGER THAT
Your reminder will arrive in 1 hour!
ID: 2107, Due
·
@dry folio
Here's your reminder: check pr.
[Jump back to when you created the reminder](#dev-contrib message)
When I use api, and it requires api key
can i still contribute
ill give u api key
Tell us the website, and we'll sign up for one ourselves
But first, you should have it be cleared
nevermind, i found one without api key
i making anagrams
so i need to check
if a user input is a valid word
so that why
i try to check
unless there easier way
wdym
a text file of words
oh yea
i was given a link to a github with 20k english words
but
20k
too much
one line is probably like half a byte but still
if check1:
try:
async with aiohttp.ClientSession() as session:
async with session.get(f'https://api.dictionaryapi.dev/api/v2/entries/en_US/{user.content.lower()}') as response:
data = await response.json()
if data[0]["word"]:
await ctx.send("GOod")```
this is the check
indeed. no core dev approved the pr yet lol
i. love. this. api.
yaaaaaaaaaaaaassssssssssss
yeet, verb - to throw something forcefully in a specified direction.
yeet, exclamation - expressing a strong emotional reaction, often for humorous effect
examples:
"i yeeted my dog yesterday"
"YEET!"
yeet, verb - to throw something forcefully in a specified direction.
examples:
I yeeted the key out of the dict
examples:
yeet > del
This dict empty, yeet
when i get to know cpython a little better I'll probably stream hideously mutilating it in a fun way
PCBuild for cyeethon still fails for me 😔
Which project?
i think i need to make an issue
i dunno what’s the different between issue and pull requests
senor lancebot
An issue is a description of something that should be changed or added. A PR is a request to add that code.
oh ok
i guesss me open a issue
what does it take for a command to be added
like what are the procedures
First, you open an issue
m first time contributing to anything
A core dev will approve it at some point, possibly after some discussion. Once an issue is approved, anyone is free to work on it, and make a PR. That PR then gets reviewed, and once it has approval, it's merged to the bot.
https://pythondiscord.com/pages/contributing/sir-lancebot/
This page describes how to setup sir-lancebot, which you will need to PR a feature. The bottom links to the contributing guidelines which describe all of the procedures, and a guide on git.
does this load
Can the contributing guidelines link on that page be changed to link directly to the guidelines page? Currently it links to the repo which says to check the website.
Yes, so
That's the plan eventually
Previously, the github link did have all the info
but then we wanted to standardize it across all repos
So we put a link to one page
We can't update anything right now though, because we are in a wiki freeze
All part of the django site migration
Got it.
So it would have to be changed on the markdown pages after dewikification is farther along?
That's the plan + the guidelines themselves have had a major rewrite
You can tell the current guide isn't exactly high quality when it says "use black"
Would the new rewrite encompass https://github.com/python-discord/site/issues/483 ?
That's a very long issue title
I should shorten that
Much better
Hmm I take it back
those are the new guidelines
Well, I'll get that black part removed as soon as I can
I think
Do not open a pull request if you aren't assigned to the issue. If someone is already working on it, consider offering to collaborate with that person.
Covers that though
It doesn't explicitly state the process
but you obviously can't get assigned if no issue exists
My only issue with that was that many people are new to GitHub and open source projects in general. They might not understand unless it's explicit.
Did i do the issue correctly?
@short snow
Here's your reminder: resolve  merge conflicts .
[Jump back to when you created the reminder](#dev-contrib message)
@gritty wind So for the preserve unloaded extensions issue, for the extensions found in cache but not on the bot, I will send a embed in (i) in which channel, and (ii) Will i add reactions
for clearing those items from the cache and wait for (iii) x amount of time.
Also whom should the message ping?
admins?
Send it to #dev-alerts, ping core devs, and don’t add any special reaction logic, just immediately remove it from the cache
cool
@gritty wind dev alerts channel id?
820712029245538314
k ty
Are you using fake redis?
What's fake redis?
yeah i am using fake redis
I guess you could insert the values during program startup before you get to the step that checks
It would probably be easier to use redis
are we gonna allow users to use helpdm on/off in a help channel and just delete the command message or no? I am assuming no but just want to make sure.
https://github.com/python-discord/bot/issues/1567 For context this is the issue
But that seems to make the most sense to me so we avoid having to deal with ^
Yeah, that's what I am doing.
But should we allow users to be able to use that command in help channels.
If that makes sense
Don't think that's necessary
Ok, that's what I am thinking as well
This is what the embed that will be sent to the users dm looks like as of now.
Basically the same as the claim but without the first message field.
cool, I will try doing that
I went through my pr again sir-lancebot#618 , and didn't find the need to break the code into many files, and rather break it done into two classes, Game, and the cog itself, where, Game contains the logic for the game, and the cog contains the discord stuff
For that cleanup PR it might be best to make it several PR's. Get the changes for some of the cogs merged, and then move on
Otherwise you're going to have to resolve conflicts for every single PR that's merged in the meanwhile
or maybe do a freeze and let the spring cleanup PR get merged?
I'd rather split the clean into parts. Even if we do a freeze we won't have to freeze everything
Splitting it into PRs is gonna take some effort, and the PR is currently in the final stages, with most of the cleanups mentioned
Why is it going to take effort?
Also keep in mind that just because you wrote most of the changes you wanted, it doesn't mean it's going to be merged in the next couple of weeks. It still needs to be properly reviewed and tested
My suggestion is that you stop working on additional cogs and PR what you're done with
The feedback you get might change how you address the cogs you you're not done with yet
since one commit, contains changes across many cogs, and i don't know a simple way of diving them
@green oriole your change requests have been applied :D
I left few comments on my review comments, did you have a look at them
there, the convo starts from here. i don't think i'd have to provide you every single instance, just start reading from this
installation of env for the bot is messed up on linux.
File "/usr/lib/python3.9/site-packages/pipenv/project.py", line 24, in <module>
from .environment import Environment
File "/usr/lib/python3.9/site-packages/pipenv/environment.py", line 16, in <module>
import pkg_resources
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 559, in _build_master
ws = cls()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 552, in __init__
self.add_entry(entry)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 608, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2063, in find_on_path
for dist in factory(fullpath):
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2121, in distributions_from_metadata
if len(os.listdir(path)) == 0:
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.9/site-packages/i3ipc-2.2.1.dist-info'
The bot uses python 3.8, but it seems you're using 3.9
What command did you run to get this error?
fwiw, many of us also develop on linux, so I don't think there's an issue with the env installation being messed up on linux.
weird, never came across this, i also develop on linux
I used pycharm and default installation of python is 3.9
using archlinux
installed pipenv systemwide
lmfao
yeet myDict
Cool, busy rn, will look into that
you need to use python3.8 on bot, it doesn't support python3.9
but the issue you are having seems to be something else
i just realized- 163 messages... insane
lol
probably the issue
#define inf 1000000000000000000000000000.0
🙂
infinity is not a finite number-
ah yes
and in any point in computer science
so there's an upper limit
even in python specific classes for nums
well in python we have float("inf") to represent infinity, and it's like a special value in the float class
btw yes there is much more interesting thing in python. Called bitarray 🙂
no idea what that is lol
for example if you are doing a sieve for prime nums or something similar you want to not use full byte for storing only two possible bits as it would be a for example array of 10000000 nums so instead of using 10000000bytes you use that many bits. 🙂
8 times more space efficient. 🙂
w o w
its different thing but nice to know about.
Which of our projects is this for?
resume porfolio
This channel is for discussing Python Discord projects. If you need help with your own projects, please take a read of #❓|how-to-get-help
bump
Porting the help command from bot fixes this issue. There is a pr already open for that
Which one?
One sec, finding it, https://github.com/python-discord/sir-lancebot/issues/470
there's a pr that ports command suggestions but not help
sir-lancebot#470 is the issue
Ah yes, I thought there was a Pr for that too
What migration is occuring?
We moved the reddit cog from @stable mountain to @dusky shore a few days ago
yep
Cool so Lance has manage message perms there, nice
Shortly after migration it was given them yes 😄
since we realised it didn't when it spewed errors lol
hahahahahha ya i saw that
oooh poetry 👀
I'll fix CI, and soon we will finally be ready
i just realized my pr also broke the commits record- almost 50 commits
I think the record is over 4x that
ohhh that's right lol
Not that it's a record you should be trying to break
yeah
ah, dang it
true, but i just have tons of minor bugs here and there littered over my code and when someone reviews they find like 30 of them
@dry folio did you work on that pr with cat group & what ide do u use
the other cat devs provided question-answer pairs for the database, and i programmed the code. i use pycharm
Ah & ah
if you like i can send you an invite to our server, and you can test out the current quiz
.quiz math
ah sad
I'm good 😄
k
Have my own bot so I can checkout the pr myself
ah yes
Also busy working on @slow bone
is there a way I can test raw_message_edit?
yeah
ok so
u guys have temp mute and tempban right
how do u guys unmute and unban after times up without using json
Well, we still use a database
JSON files are not the only form of data storage
We have a postgres DB
wow
so how do u guys know when to unmute and unban
The unmute time is stored in the database
When the bot starts up, it fetches them all
The bot then uses a "scheduler" to unmute or unban once the expiration time is reached
bot/exts/moderation/infraction/_scheduler.py lines 43 to 55
async def reschedule_infractions(self, supported_infractions: t.Container[str]) -> None:
"""Schedule expiration for previous infractions."""
await self.bot.wait_until_guild_available()
log.trace(f"Rescheduling infractions for {self.__class__.__name__}.")
infractions = await self.bot.api_client.get(
'bot/infractions',
params={'active': 'true'}
)
for infraction in infractions:
if infraction["expires_at"] is not None and infraction["type"] in supported_infractions:
self.schedule_expiration(infraction)```
This code is run on startup
oh
Whats the alternative for this? So that I can call await on it?
And there has to be an additional part that when an infraction is made it schedules that if it expires.
When the bot is (safely) shutdown, it cancels all of the scheduled stuff.
bot/exts/moderation/incidents.py lines 522 to 527
try:
channel = self.bot.get_channel(int(payload.data["channel_id"]))
msg_after = await channel.fetch_message(payload.message_id)
except discord.NotFound: # Was deleted before we got the event
await self.delete_msg_link_embed(payload.message_id)
return```
right, so the next question is where are you defining bot
No, where are you defining it in your tests
self.cog_instance = incidents.Incidents(MockBot())
Right, so
you basically want to define the get_channel method of mockbot to return a MockTextChannel
And you want to define that MockTextChannel to have an AsyncMock called fetch
yep
Is writing tests basically just reimplementing the library itself?
(unit)Tests basically check that a unit of code performs the expected function
So how do you test the tests?
If you have the following function:
def xyz(number):
return number + 2
You can throw at it different inputs, and check that the return is the expected value. A good testing suite would throw all different sorts of inputs to make sure the function behaves as intended. You could for example test this function with a positive number, a negative number, a decimal, a really big number, a really small number, not a number, etc.
There are no hard rules for unit tests, and you test what you think is important. Unit tests just help confirm that a unit of code performs the expected behavior
so this is what i did, but i get this error:
AttributeError: 'coroutine' object has no attribute 'fetch_message'
get_channel isn't async
fuck yes 🤦♂️
https://github.com/python-discord/sir-lancebot/pull/595 really really short needing core dev approval
Uhh, did you get your problem solved?
that's... pretty damn neat. combining a schedule AND a database-
in our cat bot we did a check every 0.5 seconds to see if the current time has passed the one stored in unmute_times.json lol
we passed 50 commits lol
hopefully get this done before 100-
@dry folio I had left a comment on the default 0 issue
I simply do not understand why you persist to argue about this. It is personal preference, and I think I've explicitly declared that numerous times already.
You can say "oh, that embed's in blue, i want it in orange" and request changes.
It is inherently the same thing as to what you're doing right now.
We can debate about this for years, if you'd really like; but I prefer not wasting my time on a problem of purely subjective opinions.
which issue is this? can someone link me the pr comment
There are three more ppl agreeing with this.. Thankyou
one sec alec
you gotta be kidding me- this keeps on going
it is literally pointless
a matter of opinion, like i've already said
you don't like it, i like it
Ok i dont have time right now to dive deep into the code, if there's something that can break that needs to be fixed, unexpected errors shouldn't be able to exist
yes, but there are no unexpected errors.
Ok I'm going to clarify on
I disagree, if it were half way through execution or something that might make sense, but given its an initial argument it should just error
There are two sides to this:
- If the user is running the command they clearly want to play the quiz, so 0 should go to a default
- There is no reason that the user should be explicitly entering the value 0 for the amount of questions, it just doesn't make sense to do so.
In my opinion - and this is generally agreed upon in software - things shouldn't do 'weird' things that you wouldn't expect. A function should be conservative in what it accepts, and shouldn't (generally) try to compensate for 'weird' inputs, which can lead to said 'weird' behaviour. In addition to this existing Lancebot commands already error if 0 is entered and they expect a positive integer, for example .mosaic, so for the sake of consistency it's better to follow that pattern.
tl;dr: The command should behave in a consistent and predictable way, which is not something the current system does where you can enter 0 and it goes to the default. Instead I propose you check whether questions is None, if so you set a default, else check if it's a valid positive integer, if so then set that, else raise an error explaining that you should leave it blank or use a valid number
alright, i understand what you mean. i will do it for the sake of consistency.
I have a bot instance running on the test server and I don't know which process it is or why it's still running 😦
Spam the bot, and keep htop open. The process you see rising would be the bot lol.
Docker or pipenv?
Linux or windows?
and Docker or not docker
!int e exit()
lol
one last core dev approval c'mon...
let's see if it's possible for the pr to be approved and merged before it reaches 200 messages
hey akarys, yesterday you requested some changes on sir-lancebot#726 and i immediately applied them, along with some other refining. would you mind taking a look if you are currently available? thank you very much! :D
while you've been pinged could you take a quick peek at this tag suggestion :P bot#1585
That tag seems like a nice idea
Should there be a spring cleanup on python bot too?
python bot spring clean up be like:
- add tests
- add tests
- add tests
- add tests
- add tests
Huh? Does adding tests come up in cleanup 
thats a really big gif, you should probably make it into an emoji so that it doesnt take up as much room
No nitro ig lol
I would probably not go down the route of another cleanup PR
from a review POV
do a single change per PR, and do many PRs
i did, but 1) i don't have nitro 2) sebastiaan rejected my suggestion of adding it
Streamlines things a lot
Lol, maybe if we take zig’s suggestion into picture?
yeah, when it gets to the point where im glad i cant review because i committed its probably too big
Yeah single change per pr
😔
Lol, black helped me do most of the review
yeah small PRs should be much better
i love this emoji so much and i want ittttttt
I don't think I'll have much time to do a proper functionality review. I'll check if they are applied and dismiss my review though.
thank you akarys!!
review when?
in 14 hours 
I'll uh... Try tomorrow
Should sir-lancebot#348 be closed?
have the issues been resolved?
or should I transfer the issue to lance?
oh, it's already in lance, nvm
Have all the issues listed been resolved?
Yep
docker on linux
Can you run docker ps?
anything for you 💚
and it gives me a container ID. how does one kill the processes associated with a container when the container id is known?
docker kill $id
Although you may just have forget to docker-compose downbefore shutting down
Anytime!
Hi I just finished my first PR on another repository. (just updating a text file)
There is something that i would like to contribute to @dusky shore. Do i make an issue on github and ask that it is assigned to me?
If you wish to contribute to an existing idea, you can check out the issues on the Lancebot repository that haven't been assigned. If you have an idea for a new command that you'd like to implement, you can open an issue on the repository or discuss it here.
Its and upgrade to a command is that ok?
Yep that's fine
You can discuss that here or open an issue on the repository.
:) i will go create an issue now. ||that sentence sounds weird when you say it XD||
!remind 999y yeet
Aye aye, cap'n!
Your reminder will arrive in 999 years!
ID: 2116, Due
·
LMFAO YESSSSS
!remind 1000y hmm
Alright.
Your reminder will arrive in 1000 years!
ID: 2117, Due
·
heh
One of my first bot PRs was fixing an overflow for that command
@fervent sage did you change your gpg key? Why are you unverified on the first commit here?
just wondering, nothing serious
im pretty sure i started using a gpg key after that point
@vale ibex since you're here, please review this PR.
before then i just never used one
ah
I see
Understandable, have a nice day.
Am here but on phone lul
oof
Lemme try and landscape review
lmao i was a second late
i spent 3 seconds deciding on what emoji to put in the review comment
lol, did you test though 👀
😔
my code is so good it doesnt need testing smh /s
I always use 
yes it's the best way to test
I sent my issue now i just wait until it gets assigned to me/approved?
yes
👍
interesting idea
I'm not sure what to think about it though
@fervent sage what do you think of this? https://github.com/python-discord/sir-lancebot/issues/731
brain is fried atm
long day :)
got to have the food!
Xith is always tired 
I'm ordering the food now!
My body resists caffeine like it resists troll PRs
lmao
that gif was fucking up my client
User removed
your body gets troll PRs too? 😳
is this part of being a bot
lol
Ping if you have questions but i might be away for a few minutes
Aren't there already images returned for 404s?
Ones that are designed by the websites
oh wait, i misread
So this would be calling the group directly and then randomly choosing which subcommand to run
yes.
I dont currently have a linter. What is recommended?
For pycharm if that matters
or is there one already on pycharm?
the pre-commit uses flake8
So, you're definitely going to want to follow your IDE's recommendations
but we also have a flake8 config which you should use
(You should use the project one because it has a ton of plugins)
On top of that
we have a style guide
I'll take a look now
flake8 can't enforce everything, so it's good to go over that too
I'm pretty sure if you do pipenv sync --dev pycharm will pick up the linter
thank you :)
Yeah I like that idea, though I'll note you should invoke the command with ctx.invoke(command) instead of using the command's __call__ method similar to this: https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/evergreen/timed.py#L38
bot/exts/evergreen/timed.py line 38
await new_ctx.command.invoke(new_ctx)```
that actually probably makes more sense if you look at the whole file than just the snippet lol
ok noted.
Yeah, because ctx.invoke runs checks
^
ty
Heya, welcome to the server
This channel is meant for discussion about our projects at python discord
If you'd like to introduce yourself, and meet the people here
pop over to
!ot
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
The first one seems quite at the moment
Uh, I had an instance of Lancebot running on Docker a couple days ago, and when I restarted my computer, that Lancebot just turned on again and now I can see it in Docker Desktop. Is that something I can avoid?
docker-compose.yml line 10
restart: always```
Yeah, I ran with compose
that's probably causing the container to restart on system reboot
Is it ok if var names have "typo in word" notices. Im getting one with subcmd
Yeah
Your IDE is probably looking for english words
not all programming terms will meet that criteria
So as long as it's not an actual typo, you're fine
This is the anagrams command
is it worthy of being submitted to sir lancebot?
the reactions where supposed to be a green check mark
ah this is very cool!
i would say 100%. this is super good
tyyy
hey, does anyone know what the type: enhancement means? because for me it kinda means the same thing as type: feature lol
enhancement is like good
g o o d
Usually enhancement is an improvement to an existing thing while feature adds a new thing
sir-lancebot\bot\exts\evergreen\status_codes.py:74:0: C0301: Line too long (103/100) (line-too-long)
sir-lancebot\bot\exts\evergreen\status_codes.py:1:0: C0114: Missing module docstring (missing-module-docstring)
Got this while linting
Should i fix the first one even if it wasent me who made it? also im not sure what the second one means
The line length for lancebot is 120, not 100 as that error suggests
It seems you are not running flake8 correctly
which folder are you running it from?
You should be running from the folder that has the file tox.ini
ok 👍
OK so flake8 did not output anything. Dose that mean i passed or i did something wrong?
ok. ||THere should be a all tests passed message||
we have other checks such as line endings, and trailing whitespace
You'd have to raise that with flake
pre-commit does give you that message
and it runs flake as well as the other tests
pipenv run lint
hey @short snow i just found something amazing for merging 2 dicts in quackstack so I'm gonna go make it so all options are optional: https://pypi.org/project/deepmerge
@sleek steppe you around in 10 mins to approve another 
lol yes
im gonna stick the redoc generated stuff on /docs instead of the swagger docs since they're far more useful at a glance and switch normal docs to /swagger_docs
joe that was speed lmao
PR speedrun
next up, making the details endpoint deal with manducks too
Whaat... I look away one second and it's merged
LOL IT DOES"T WORK
wat
it works perfectly localy?
this is why we don't PR speedrunn
pain
lol
Service unavailable 
oe sec
will open a fix pr
two fixes?
nah I've got it
lol
lol
i WaS fiRsT
LOL
ok riddle me this
this squirrel mofo is really indecisive about showing up
everywhere in code its called manduck
except the assets folder which is called duck-person
lol
Discord is bullying us 
Eyy
back in businesss https://quackstack.pythondiscord.com/docs
The PR worked
redoc is so beautiful compared to swagger imo
once I finish with school I'm going to add S3 + app structure changes to quackstack I think
i have structure changes planned alr
but yeah we need to stop serving static files from the api
or
given pydis infra runs on linode we could use their s3 compatible object buckets
ya, that's what I was thinking
is that bad?
I was going to test #42 too but it got merged after 2 seconds lol
atjoe
issue with that is that its then annoying to stick package stuff in there too, cause eventually the plan was to make a pypi module
https://github.com/python-discord/olli is the structure I follow
I wish i put another hour of thought in before initially starting, the code currently does not spark joy and i feel like i wanna rewrite it before its too late
fix all the structure at the same time
Is bot#1565 approved? If so, can I implement it?
is there any other outstanding stuff that needs a willing human currently?

Oh hey a few d.py people here
What's the best way to invoke a command from code so that it runs checks and converters?
ctx.command.invoke
That doesn't do checks and converters
ctx.invoke doesn't lol
.src timed

oh?
you type in a message, and the bot calls the command for you
it's in the error handler
!shh
ah
that calls the silence commmand
bot.invoke runs checks, but it doesn't allow you to manually define the arguments
which I need in this case
in that case you probably want to copy the message object, set the content to the command that should be invoked, and then run bot.process_commands(message)
i think that rather comes with the territory of doing hacky commands 
lol
but yeah, as far as im aware of there isnt a better way really, and I have a decent knowledge of d.py :P, but there may be something ive just forgotten about
Cool alright
!silence
Hey im trying to run the bot and am getting this error socket.gaierror: [Errno 11001] getaddrinfo failed
looks like something to do with a SMPT server
can you show more of the traceback
!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.
Do you have redis running?
ah it looks like the redis connection is failing to be created, you should consider using fakeredis instead for testing
If you’re not sure the answer is no
I'd highly recommend the docker setup, will make things much easier
I should port the startup error handler
chrisjlmnop lol
Are there any deps beside redis
I am using fake redis i think?
do you have USE_FAKEREDIS=true in .env?
BOT_GUILD=678359965081141286
BOT_ADMIN_ROLE_ID=678366948995760128
ROLE_HELPERS=763874843787001878
CHANNEL_ANNOUNCEMENTS=821404230601408522
CHANNEL_DEVLOG=821404230601408522
CHANNEL_COMMUNITY_BOT_COMMANDS=678359965081141291
USE_FAKEREDIS=true
is REDIS_HOST=redis needed for fake redis?
I wonder if the env is loaded
Should be fine with w/
O.o it might have forgot this
yea, you should run using pipenv, since it'll load your env
because pipenv loads env for you, as does docker compose
pipenv run start
If it says venv in front of the path in the trerminal that means its pipenv right?
I also used this
Could you upload the full output from when you run that command?
looks like youre in a non-pipenv virtual environment, which means pipenv isnt doing things it would it its own env
I get that same error notice on windows if I run start after pipenv shell lol
among the software i install when i set up a new pc is redis so i dont have redis issues anyway 
though in that regard im very much an atypical user
My interpreter is PYthon 3.8 not pipenv. When i try to make it pipenv it wont save for some reason
exit out of your venv
run python -m pipenv shell
that'll get you into a pipenv shell
How do i exit. (this stuff confuses me)
deactivate
Im using pycharm. I think it automatically makes one and i dont know how to deactivate it.
Ah, right. i'm not to familiar with pycharm's env setup
Hopefully someone who is can help you out soon
you should be able to select the correct interpreter in the lower right corner
where is the error handler for @stable mountain?!
nope,i didn't need it
wait i think i deactivate it
!source ErrorHandler
Cog: ErrorHandler
Handles errors emitted from commands.
Source Code
bot/exts/backend/error_handler.py:19
backend.
but now i dont have pipenv installed XD
https://pythondiscord.com/pages/contributing/installing-project-dependencies/ explains how to set that on pycharm here
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
https://pythondiscord.com/pages/contributing/sir-lancebot/ everything is explained here
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
i feel ashamed-
flashbacks to "fix 4th copy paste error"
@dry folio you can make commits via git
rather than making every commit on the website
it also means that you can edit multiple files per commit
we should probably have a policy of squashing PRs with listing commits
wdym
squash merge?
drop the ping thing, getting really annoying now.
squashing is where you take several commits on a PR, merge them into one and then merge that into the main branch
ping thing?
and what's listing commits?
https://github.com/python-discord/bot/pull/1586 hey, this pr only changes ONE CHARACTER. can we get a speedrun and get this merged? lol
ah nice!
uhhhh
hm?
oh lol thought the changes were the opposite
lol, do you think this can get merged within 8 hours?
I mean, if it gets approvals? lol
OH WE ALREADY GOT YOURS!! GGS
it's got enough approvals now, just waiting for linting
LESSSSGO
lint so slowwwww
I'm not sure following convention here is appropriate
wait what
we treat cogs like components of the bot, and I think it's clearer to say that the ErrorHandler, which there will always one of, handles errors
I've approved but I'd like to note that I don't think in future this type of small non-important change is really worth doing, plus what joe said
Yeah I think we can leave this
awwwww but the lint already passedd
Wait did we get shut down
i agree
no speedrun :( alright, i'll close it
Take a look at this as well, I think it will provide some useful insight https://youtu.be/voXVTjwnn-U?t=1877
Why are we placing such emphasis on speedrunning PRs?
yeah I really really dont think we should set a precendent of speedrunning code into production
If it was a really major and urgent P0 feature, sure
here it's just 1 character and clearly wont break anything, but what happens when its a few lines and some people say "oh its just a couple of lines its fine i'll approve"
Otherwise it doesn't seem very wise
didn't want to aim to a user, so deleted it
true... i understand.
I also think for changing things we should really do it in bulk rather than a one line PR to change something that we probably have multiple inconsistencies on
:megathis:
I feel targeted, this is what i do on my bot!
…and follow it with a commit fixing the glaring error.
and I'd much rather focus efforts on actual issues and logic things than some single character documentation changes
On your own bot i dare say it's not that bad - but @stable mountain is part of pydis' core server infra
sorry, it was a joke lol because my pr only changes one character
Wow sounds like me
ah i see, so if i do see other one-char stuff like this what should i do?
I think we're just waiting on akarys to approve now iirc
smh wow this feels to me that you're implying my bot isn't as important to me as python is to pydis yeet
Lol
on the quiz pr? yeah
I mean, not to be rude but thats exactly what im saying lol
sir-lancebot#732 gosh, i like this but is this going to be "allowed", every variable has type annotations
Did you removed the question without an answer?
smhhh
lmao
yes!
here
what even is this diff?
https://github.com/python-discord/sir-lancebot/pull/732/commits/32c858106adb7b2baf8ab5bbf946686e48b0f62e
huh?
that seems normal
they just structured it alphabetically
oh, GG
I like that actually it's quite clean
Core devs should give explicit approval before opening a pull request
main point was those type annotations on every variable, gets more than half of the imports
Kudos to them
they did make changes there, see the last fm creds
ohhhh ok
bring it here, see if there are more instances than one char, if not, it's a nogo, but yeah, talk to core devs
It is covered in the contributing guidelines, and is something that you should have read before creating a pr
yeah. I did. But the fact that they all were edited stood out to me. Although @short snow mentioned that it was alphabetized and now I like it
It does also say you don't need an issue for minor changes iirc
I did read it but I thought a one-char bug fix wouldn't need to go through all that complicated process... that's my mistake lol
got it.
a one char fix wouldn't need to go through an issue, but it's only worth fixing if it's part of a wider inconsistency
Hey while y'all are here good job on killing the raid
i didn't even see the raid and everyone is talking about it-
ok ok
Unfortunately it looks like my data projection for 200k by Saturday will be off
88e990dc82c8 sir-lancebot_sir-lancebot "python -m bot" 2 months ago Up 54 seconds sir-lancebot
why is my instance of lancebot going up when I run docker-compose up in the python bot directory...?
megapoggers
Huh
Did you docker-compose down last time you ran lance?
726 is gonna be squash merged right?
idk, that would have been months ago
Well, it may have been running this whole time 
Up 54 seconds
i hate it i hate it i hate it
Try to run docker-compose down in sir lance and systemctl restart docker to see if it worked
bump
is extra imports for type annotations a bad thing?
I think there are too many type hints there
i don't mind them as such
dunno if it's worth the effort to make another commit just removing type hints
I don't see the need for limit_key: str = "limit"
and adding them to client sesions, when the variable name say so
Actually flake will complain about that
Call it useless typehimt when str is inferred
typehints should only be there where the type is not already known, normally I'd say the extras were a pretty minor thing, but there are a huge number here and i think some should be removed
oh didn't know flake8 would complain about that
oh this is bad tho
test
Does it? I typehint those like a dum dum and it never complained
We already saw how hard it is with the spring clean Pr
Passed 
other stuff like : Bot is good
Failed 
😳 did you ban them?
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.
Hi banned I'm dad
Stele was spending too much time on server and not enough responding to my DMs
He’ll have to respond now
does this error make sense to anyone? https://paste.pythondiscord.com/iqilozokas.sql
yeah discord does that sometimes
you just have to try again and then usually it works
Connect call failed ('some_ip_address', 443)
Is it the actual error or you removed discord's ip
Stele is locked out again
@green oriole the second one
locked out?
Okay, good
received
Seems like you are having fun haha
I am not
I'm mad as hell, and I don't care who knows 
!otn a only stelercus gets to be mad
:ok_hand: Added only-stelercus-gets-to-be-mad to the names list.
@fallen patrol^
@patent pivot i thought about it a bit more, and i would like to suggest... if the untold rule is to NOT use imperative mood in cog docstrings, could we update https://pythondiscord.com/pages/contributing/style-guide/#mood and say this in the Mood section?
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
That talks about methods, which makes sense in method context, I'm not sure classes should be documented there
and yes, we're blocked on wiki rn, potentially within next week though we'll be able to
Imperative mood and present tense usage is preferenced when writing docstrings.
it only says "docstrings", and no where does it say this only applies to methods
alright. it's just that this wouldn't be too consistent with the other stuff, like here where it lists the difference between methods and classes
Why did bot#1573 add the Reddit constants back?
It's not upto date with main, so will likely be deleted after the update branch
alright, would you like to comment it on the pr?
or, it might have been a mistake on my part when resolving conflicts previously
Hey can people who looked at sir-lancebot#699 re-review
I think i might just need to restart the entire venv process becouse i cant get anythin to work
Might try docker this time. If it is not to hard.
@vale ibex did you forget config-default.yml 😛
that is highly possible
don't commit when in a conference call
lesson learnt
I'll grab it later
Alright lol
Done 🎉
yeehaw
cool
@celest charm re bot#718, for https://github.com/python-discord/sir-lancebot/pull/718#discussion_r628940481, do you want me to change all the Path.open's and open(Path) to Path.read_text? And, for https://github.com/python-discord/sir-lancebot/pull/718#discussion_r628941435, I'm not sure what parts of that could br broken down.
sir-lancebot#718
oh shit, miss click 🤦♂️
My issue is that it has high cyclomatic complexity. Lots of nesting, hard to see what's going on. 140 lines is way too much. I'll try to figure out how to break it up and come back
yes, read_text is nice.
@celest charm i left comments on your change requests and i'm opening pycharm up rn to fix errors (||see what i did there?||). would you mind explaining what's a "dataclass" you want me to make, and why is that better than a type alias? thank you!
MO?
.wa short define modus operand
Failed to get response
Ofc
.wa short define modus operandi
an unvarying or habitual method or procedure
Missing an i on the end as well
ah i c
!e
a dataclass is a shorthand for creating a 'record' class
from dataclasses import dataclass
@dataclass
class QuizEntry:
question: str
answer: str
print(QuizEntry(question="life universe n everything", answer="42").question)
print(QuizEntry("life universe n everything", "42").answer)
you can also make them immutable
@dataclass(frozen=True)
class QuizEntry:
question: str
answer: str
print(QuizEntry(question="life universe n everything", answer="42").question)
print(QuizEntry("life universe n everything", "42").answer)
@celest charm :white_check_mark: Your eval job has completed with return code 0.
001 | life universe n everything
002 | 42
003 | life universe n everything
004 | 42
yeah, i've worked with collections
It's often better than just a type alias because you can ask .question and .answer
oh... and why is this better than type aliases?
...and, for example, you can give it methods, like format_embed
so it would return an instance of the class QuizEntry, with the attributes question and answer?
Yep.
got it. i'm going to read @short snow's link and then getting to work
magiccode's music pr is full game of dataclasses 🙃
if you name a class or method with leading underscore (make it private), does flake8 still demand a docstring on it?
i think so, not sure
They aren't required in private definitions or dunders
I'm confused what did you mean here?
???
When there isn't a yaml.loads 😔
it refers to dataclasses (from the context)
since we have this topic on, I was going through magic's music pr, and got one question, whats the difference with between a frozen dataclass and namedtuple?
i'm reading the article by realpython right now, and yes i see many resemblances
Is there any difference between open(path, ...) and Path(path).open(...)?
See above. #dev-contrib message
yeah i saw that, but it doesn't really mention the difference between a namedtuple and frozen dataclass
stuff like this. which can be avoided by using dataclasses, from what i understand
Dataclasses get rid of a lot more boilerplate for the non trivial classes, the main difference would be that a named tuple is an actual tuple with all of its feature and limitations while a frozen dataclass is a normal dataclass with some limitations on the attr setting
namedtuples are tuple extensions so they make sense if you want to maintain e.g. the iterability
- frozen dataclasses support fields: https://docs.python.org/3/library/dataclasses.html#dataclasses.field
- frozen dataclasses aren't iterable or accessible by index, they don't have
__len__and__contains__
@celest charm should I be using Path.write_text too?
hey, i have another question... regarding the four related dicts, you would like them to be attributes of instances of a new Game class, yes? how would that work? do i just dump everything in there and refactor the entire code so that they look like self.games[ctx.channel.id].owner_id or something?
ooooooof this will take a long time lol
you can make this subject of another PR 🙂
it's not a small refactoring
yes
Well, 3 dicts, because one of them is just not used lol
gotcha. i'm just eager to get this pr merged first so we can finally get math and science questions in the quiz, as so many people demanded about 2 weeks ago lol
Hey quick question does quackstack support seeds?
yeah, literally nobody cares about sports smh
soon
hmm... it is
awesome
ah, ok. But is it read anywhere?
i'm not sure tho, i didn't go thru that part of the code
i'll check for usages in pycharm, one sec
yes, it was read in 2 cases and written in 2 other ones
ah ok
If you do refactor it into a game state object, try to give it meaningful methods, like I showed in the comment
yep, and so instead of littering +=s everywhere i would use the method, making the code much more cleaner
@celest charm last thing: how do i enable precommit?
i read that it's not good practice of committing just for little bug fixes and lint fails, so i'd have to know
It's in the contrib guidelines
🤷 check the guideline
I'm a noob
pipenv run precommit
I'm just an architect astronaut wannabe that reviews others' hard work
guideline only says this lol, doesn't say specific command
No arguments
🪟 
There shouldn't be any arguments
wat
We'll update the guide to make that clearer
so how does the code know which file it's precommitting
It doesn't work like that. pipenv run precomit just installs the pre-commit environment
It'll know when you run git commit ...
so i cd sir-lancebot then pipenv run precommit?
It installs a git hook. That's how it will know
You only need to run that once per project
and then i git commit trivia_quiz.py?
You can read this guide to learn the basics of learning with the git cli https://pythondiscord.com/pages/contributing/working-with-git/cli/
was my issue rejected?
What was your issue?
Can you link it?
If it was rejected, it would be closed
is it closed?
Nope
oh
You need to install dev dependencies first. I suggest you follow the contributing guide for lancebot. That's on our website too.
ah ok, i'll check it out
nvm
@celest charm your changes have all been implemented :D
OH WAIT I JUST REALIZED YOU'RE A CODE JAM CHAMPION
congrats!!!! you're actually the first i've ever saw
Thanks
@dry folio Can you explain the dynamic_id logic? I don't quite get it
It doesn't seem right that some quiz entries are dicts, and some are QuizEntrys
I underestimated how complex the questions are lol
why are dynamic_ids numbers? why not strings like linear_system?
because they all used an id system, so i thought it'd be better for consistency
what are ids even for?
It gets the functions from this dict https://github.com/python-discord/sir-lancebot/blob/aa3a38649e465c1299f3adfc5a5e4aa6fb8102b8/bot/exts/evergreen/trivia_quiz.py#L180..L189
bot/exts/evergreen/trivia_quiz.py lines 180 to 189
DYNAMIC_QUESTIONS_FORMAT_FUNCS = {
201: linear_system,
202: mod_arith,
203: ngonal_prism,
204: imag_sqrt,
205: binary_calc,
301: solar_system,
302: taxonomic_rank,
303: base_units_convert,
}```
I understand
but it sems overly cryptic
none of them return dicts, they all return QuizEntrys whose attributes question and answer are then assigned to variables
Right, but the quiz entries are still present as dicts taken out of the JSON
the original id system was for detecting which questions have been done iirc
ah yes right
but dynamic questions have to then be formatted