#dev-contrib
1 messages · Page 146 of 1
this is completely irrelevant
it's for verification
metricity will not be verified
argh they rewrote the page
the data metricity collects is essential to the operation of the community, opting out is leaving the community, the data is only viewable to admins now, and in future users if they want to through Discord (and already technically, if you send me an email I can collect all data PyDis has on you)
i'll ask in dapi #devs chat if there is concern about policy, but I was pretty scrupulous at the time to ensure we were compliant
i can't find it because they rewrote the documentation page ;-;
but it intially said this was against the developer tos
The goal isn't to totally stop people from straight up running the code snippets, because that would be an impossible task. The goal is to put a barrier that results in them being penalized by time if they do try to get the code snippet and run it
ah ok
Somehow the type of person that can do that doesn’t strike me as the type that will cheat in a fun game with no rewards
A webhook ID is the ID at the beginning of its URL right? before the hashed string
yes
yeah, the format is https://discord.com/api/webhooks/<id>/<token>
@thorny obsidian Question --
Is it fine if I remove the scoreboard at trivianight stop instead of adding it in trivianight start and removing previous ones?
the questions, which load depends on, needs the scoreboard, which by hte current logic shouldn't be existing before trivianight start
So essentially to prevent scoreboards from lingering resetting the scoreboard at trivianight stop would be fine I presume?
because right now .trivianight start doesn't do anything since the scoreboard is already added in the __init__ constructor of the cog
Another question, I'm wondering if the unicode trickery (zero width spaces) should be done on the end of the JSON before being loaded in, or should be done by the bot?
Question to anyone here I suppose:
I keep getting an error regarding No running event loop, which is odd, because it has worked other times but this time it's talking about how there isn't an event loop
At what point of changes of a file that I borrowed from somewhere, am I able to remove or lessen the license from the third party?
or,,, how do I edit it to affirm that I've made a lot of changes to it
I haven't seen your code 
I fixed it, it was because I initialized a view outside of a command (no event loop)
Sorry for the ghost ping; the video didn't come out well but it got attached, but the trivianight basic commands are done!
Demonstration:
there are a few bugs and a few more things to add, but the first iteration is close to being finished 🎊
Looks really good! maybe the chosen answer can have a more distinct color?
Hmm, could you elaborate?
Yeah
I might add some stats in there for the correct answer embed
It’s a bit bana
banal
Like how many users got it right or wrong
Maybe an ephemeral message saying what you chose as an answer. Not sure what the limitations are on those
So when the user interacts with it send a message to show what they chose?
Interacts with the actual question
Yeah. Basically let you know that you picked what you intended
yes
Will do
Although
If many people click at once
I'm not sure if there are any rate limits on ephemeral messages
The callback for the interaction is asynchronous so it shouldn’t have a problem
It's async like anything in d.py, but I'm wondering if Discord will throttle the amount of messages that can be sent
For example, the bot can't send an unlimited amount of messages
It's X messages per Y seconds
I think ephemerals work differently where you send a message back to the already existing response for the interaction
does incidents archive work for you guys? I need to add this extra line to make it work, it doesn't detect None as MISSINS
@cold island Re: https://github.com/python-discord/bot/pull/1446#discussion_r733101611
the task isn't used anywhere as in if we assign a variable, it won't be used anywhere, and even in duck_pond it is ignoered (used for the same use case)
(Btw, how about displaying comments like we display code snippets)
It's working although I remember a recent PR to fix it. Maybe you need to merge main
👍
Fixes #1884
Fixes BOT-1NY
Discord.py 2.0 changed how this works, webhooks now look for the MISSING sentinal, rather than None to determine whether files are being passed.
This was updated in this ...
Hey I've been having some trouble with running my Madlibs program (sir-lancebot#901) in my test server the past week or so. If anyone is interested in helping, just let me know and I can DM you an invite to my test server. I'm thinking most likely there is something wrong with my code that's causing it to not run, but I literally am out of ideas at this point. This is my code: https://paste.pythondiscord.com/tofisojopu.py
(It's not currently committed in the PR, that's why I pasted it here)
could you push the latests changes to the pr, so i can pull and test it out
you can squash them later if you want
the json remains the same right?
nvm i would just copy that bin code then
Yes
But that's most likely not what's causing the problem
It's more the way I might have set up the test server
But I'm pretty sure I did everything in order as stated in the set up guide
ok yeah i got it, gimme a minute
you never call self._loaded_templates(), you just use as a variable
@static functions are functions but they just don't use the class variables, rest all is the same
also templates should go down in resources
and madlibs module should be made into a single file
Wdym? Isn't it already a single file?
its inside madlibs/madlibs.py should be made into just `madlibs.py
I thought I changed that already
Ohhh I didn't commit it
That's why
await self.bot.wait_for(event='message', timeout=TIMEOUT)
Also here you need to catch for timeout error otherwise it would catch an error IIRC
rest good job 👍
You mean try except?
Thanks!
yeah
Alr
@short snow (sorry for pinging you a bunch of times lol) question: I'm getting unresolved reference errors here, is that a problem or can I ignore it?
Unless it errors when running, ignore it. If that's PyCharm, it might have to do with docker/poetry.
Ok, thanks
@austere hornet you should probably install the poetry plugin for pycharm
Oh, that's probably a good idea. How do I do that?
settings -> plugins -> extension marketplace -> search poetry -> install the plugin
after a restart that you'll probably need of the program, create a virtual environment using poetry and that should resolve the missing imports
Got it, thanks!
How do I create a venv?
oh wait, it's PyCharm, nvmpoetry install should do it
When using pycharm there should be a section in the bottom right corner to select your interpreter.
You can click on that, add interpreter, select poetry environment
Make sure "Install packages from pyproject.toml" is checked
hitting ok after that should do it
What's the poetry executable?
you should install poetry
But I already have it installed. I've been using poetry run task lint to lint all the time, so shouldn't it be installed already?
I think it's the path to the poetry binary or executable file after you install poetry
Well yeah, I know, but I don't know what the path to that executable file is 😄
Yes
iirc where in cmd or something
is that from cmd/powershell or do you have git bash or a unix like shell emulator?
Yes, from Windows Terminal is what I use (basically another version of cmd prompt)
try where poetry
nice!
Lmfao @vocal wolf
But then
I took the first screenshot right before the second
So in the end I still have errors
interesting
does everything else work? like the REPL or running a single file from pycharm
By "repl" you mean the console?
Oh no worries
looks like pycharm is using the python interpreter from poetry's venv... which may not be activated unless poetry is run
So how can I activate poetry on the venv? Is there a cmd prompt command for that?
I could still run the python from poetry's venv when it's not activated. Can you try copying the path in the error from that image and run it manually from cmd to see if cmd shows the same error?
I know you can do poetry shell in the regular terminal, not sure how that corresponds to PyCharm
So you want to me to cd into that path and run what?
~~to activate the venv you can type ~~ ok dawn got it before me :)
Haha
there may be problems with the \ escaping (maybe not, windows is weird anyway), but I just meant like run C:\Users\...\python.exe from cmd
What I'm asking is under what path? The project root or the path from the error that you asked me to copy/paste?
from this error message here, it's saying Cannot run program "{}" (in directory ...) CreateProcess error=2 ... we want the {} part
you mean cd to what path when running it? if so I don't think it matters since the python interpreter path is absolute
Ah ok yeah that answers what I was asking
Lol @rapid igloo it's not even gonna let me cd into it so nvm
if you wanna cd to it, it's gotta be a directory. the /Scripts/ is a directory and python.exe is a (executable) file, so you gotta remove the python.exe from your command above.
Ohhh ok wow that was stupid
Ok thanks
I didn't actually mean cd to it (which is why I didnt tell you to remove the python.exe part) but cd can tell us whether the dir exists oo
so it's ok
haha
So I did this, what should I do next @rapid igloo ?
pycharm would auto-enable the venv inside the cmd if you have selected it in the right-hand corner (python interpreter)
so now if you wanna run your bot you can do task start which is basically an alias to python -m bot (specified in pyproject.toml
earlier you did poetry run task lint right?
did cding into the dir from before work? looks like poetry just created the venv so pycharm might not have the error now
Yeah
so poetry run basically ran the command inside the poetry shell
so poetry run task lint would become task lint if you are inside the peotry shell
Got it
hmmm
don't enable it from there, go to right hand corner python interpreter
and make a new poetry environment
select your poetry path as what is the output of where poetry
i dunno the windows command for where
they did that earlier
ok so what are you trying to do now
You're right
I'm getting unresolved reference errors here
Trying to resolve them
do poetry install in your commandline
I thought I installed it already
when you selected an interpreter did you create a new one or choose an existing one?
New one and I got this after doing so
ok, i am not sure what has happened, so i had just do the thing again, go to ../pupoetry/Cache and delete the sir lancebot venvs (all of them)
then go pycharm select the poetry venv tab, put your python3.9 path and the poetry executable path and wait for a venv to be created
pycharm should have installed the deps for you so it should work then
What's the full path?
if it doesn't, go the commandline inside the cwd of the sirlancebot repo
see the path shown in the inalid python sdk error
Oh right duh
and run poetry install and the deps should be added
should be working now
C:\Users\miret\AppData\Local\pypoetry\Cache
yeah that ^
Thanks
also removing the venvs won't cause any problem 🙃
i going afk, it is doesn't work, gimme a ping, i might come back
Ok @short snow looks like everything works now, but I'm a bit confused. The errors in the code are gone now but I'm still getting an error in the console
looks like the same behaviour as we had earlier
did you choose your python path as system path or poetry venv python path
what does the warning on the discord import say? unresolved import still?
No no
nah that's gone, most probably it will be requirements.txt
It's just a warning
Yes you are right
does pycharm have an integrated terminal
After the new venv got created I think
this ^ and try checking if the path which is not being found (error in teh console) exists or not
Ok hold on
Yup, the path in the error exists
And how would you do that?
alright, i dont't htink you can do it now, but in while making the venv from python it asks you select the python path
so what did u select for that
I think jason meant what you selected for the python interpreter path
Ohh
I'm not sure tbh 😄
I might have put the output of where poetry without realizing it lol
ok, lemme see if it is possible now, a sec
try copy pasting the error on google and searching
try using the run option to run python -m bot, so we can check if the python interpreter is getting selected properly and packages are there
if the above works, then there is some problem in activating the venv in the console
This is all I get
remove your path, jsut keep the common error
Oh ok
So just this: CreateProcess error=2, The system cannot find the file specified?
yeah, maybe include something like poetry virtualenvs, and pycharm
.idea/workspace.xml what does this contain
Where is that?
inside your repo cwd
it would be a folder
and the last possible thing i can think of rn is you can go to Settings | Build, Execution, Deployment | Console | Python Console and check for the python path
Hey @austere hornet!
It looks like you tried to attach file type(s) that we do not allow (.xml). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
sigh
Yeah ik
@gritty wind any idea?
Ok ig lol
yeah just use pycharm as an editor and run with your terminal
for now
i have a empty windows pc at school, i can try setting up pycharm and see if i get the same error
empty in the sense there is no pycharm/poetry setup
Honestly tho, doing exactly that is perfectly fine and that's what I have been doing all along so now that I think about it I feel like Jason and I wasted time that could have been saved lol
Go ahead!
lol
or use an editor without python support if you don't like the errors, lol
at least pycharm has autocomplete
I have been using a different editor until yesterday when Tizzy told me to install PyCharm lol
It's called Sublime Text
ooh does it have LSP integration like go to definition, find references etc?
lol sublime text is great then!
I mean for editting
also wut, goto anything wonder what that does
Yeah I know I like it a lot but I have no idea why Tizzy "made" me install PyCharm so to speak
I have no idea lol
Well now that we got that out of the way I'm still having trouble running the game in my test server. I commited the updated code with @short snow 's requests and it still isn't working...I remember seeing a message from you that said to try poetry run task start, right?
I think jason said that
Ok I was just checking to make sure I actually saw that and it wasn't a dream lmao
Let me try
not a dream nope :)
This is what I get when I run that command:
When I try to run .madlibs in my test server
@vocal wolf What do you think is going on here?
@austere hornet the tldr is this
https://github.com/DMFriends/sir-lancebot/blob/madlibs/bot/exts/fun/madlibs/__init__.py needs to not be a 404 🙃
eg, the folder needs to be a module
which is as simple as just adding that file, even if empty
didn't i tell you to make it a single non module file like fun/madlibs.py as we aren't using a sub _utils.py or anything similar
Lol was just about to say
the bot has a detection system for detecting all of the extensions, and any new folder needs __init__.py to be detectable
Yeah I understand
K just commited that change
it should work now
I just commited what Jason asked me to do - move the Python file into bot/exts/fun instead of bot/exts/fun/madlibs. Should I not have done that? I'm a bit confused 😕
Well yeah, but you're commiting before testing if it works locally
True yeah
But still shouldn't it still work now?
it should, got any logs?
yeah, before that?
Before that was just the cogs loading
Do you still want to see it?
ye
K hold on
!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.pythondiscord.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.
The madlibs cog isn't being loaded, hmmm
I'm looking at the repository, setup function seems fine as well
Wdym? It should be under bot/exts/fun
trying saving this to a file and running it from the project root:
from bot.utils import extensions
from pprint import pprint as print
exts = [x for x in extensions.walk_extensions()]
print(exts)
print('madlibs' in exts)
You mean Python file?
i mean, the file extension doesn't matter for the above snippet 😛
python thing will work if its named thing
Oh ok got it
@fallen patrol I guess it has to be a Python file?
i mean, what did you name it as?
thing.txt
python thing.txt
ah, needs to be ran in the project venv 😅
How do I do that? Inside PyCharm?
honestly, idk
Well I created the poetry venv in PyCharm so that's why I asked
Let me try
@vocal prairie This is what I get after running that: https://paste.pythondiscord.com/uzekevapog.less
So madlibs is there, weird
in retrospect could've asked you to run .ext list lmfao
Haha
This is what I get when I run that:
nah as a bot command
Oh
So ummm, the function just has this sitting here, what does it do? https://github.com/DMFriends/sir-lancebot/blob/madlibs/bot/exts/fun/madlibs.py#L97-L100
bot/exts/fun/madlibs.py lines 97 to 100
Embed(
title="Here's your story!",
description=random_template["value"]
)```
Maybe that's unrelated, but I don't see it doing anything
That was intended so that the bot sends an embed
And I don't see a ctx.send after this
Yeah was about to say
Whooooops
But now it is, right?
.
Yeah, that was just something I noticed
The setup function looks fine, which is making me confused
have you tried running the .ext list command in your server? @austere hornet
Yes
gimme 2 minutes, will have a look
No doesn't look like it showed up
Ok one sec
Something is weird with my bot ngl
It duplicates messages and I don't know why
It's driving me crazy
It was doing that when I ran the .ext list command
?
heck, kill them all
not sure where they are running and dont care either tbh, you can just eval an exit
.eval exit()
I did and nothing happened
Can I assume it worked?
Nvm it did it again
But anyways why isn't this working?
I don't get it
Why is every command running twice, do you know? That may or may not be part of the problem.
That was my same question
If you don't know, the easiest thing to do would be to go regenerate the token and only start it once with the new token.
where are you running them?
...in the server
Ok, I can do that
@vocal prairie Can you remind me where I have to update the bot token after I regenerate it?
In the .env, I believe
Ok, I will do this tomorrow I have to go it's getting late on my end
Same, good night
💤
got it
@austere hornet
random_template = choice(self._load_templates)
should be self.templates
sorry had to cook breakfast, parents are out
self._load_templates is a static function which is calleld in init and stored in self.templates
also no matter what, all functions are called with () even if they are static
static functions just don't use the class variables
rest everything is same
line 56
.eval exit() even easier 😄 (like aru said)
No worries thanks for looking
Dang
How did I not catch that earlier?
isnt't it late for you? go sleep
Yeah ik I'm heading to bed now gn
gn
Hell yea
yeah that's fine, for having the scoreboard finalized, outputted, and then cleared with .trivianight stop.
Also the unicode trickery should be done by the bot, I want the questions in the json to remain normal. But the unicode stuff isn't required for this MVP. It can be a later thing that's added
we wouldn't need Unicode trickery if we have an image as the question, which sounds better
unicode trickery is less intensive than an image
My original plan was an image, but Chris also suggested some unicode stuff
nope
Sadge
Plus images aren't friendly to those on low bandwidth internet, while text still renders
probably some linux distros, but I don't think catering to non-fully set up unix distros is worth it
right, bandwidth is a good point
🤷♂️ both hold the same weigth imo
do they?
Also Unicode usually work on every distro, only emojis aren't working on some of them
Yeah, someone operating on a wacky unix distro that doesn't support unicode out of the box does not hold the same weight to me as someone in a region with not as stable internet.
Some unicodes present in ot channels didn't work on 16.04 ubuntu earlier and i had to install some font
in my mind that's the dangers of operating on those systems and it's on the person to get the relevant font packages.
This is a scheduled event that will get an announcement and all, right kat?
mhm
although, I really think this is an edge case and I don't want to put out a warning for something so minor that the person should honestly have figured out when initially setting up the distro
we can include some symbols in the announcement and tell people to fix their install if it doesn't render lol
But yeah, we already use a bunch of emojis in our channel names
It should be obvious something is off
I don't know how you'd select those characters
Seems like a lot of trouble for nothing
nor do i know lol
So we're just gonna go with the unicode we can think of and renders on the systems for whoever is going to PR and review this feature. This is not worth the time.
sounds good 👍
@thorny obsidian we could sneak in some Unicode chars in the announcement and if someone tells us in #community-meta why the heck they can't read some chars they can go fix their system lol
write teh whole announcement using unicodes
But you can fix that
Awesome — the base of the MVP is working now too so that’s nice
There's an assumption here that answers will always have 4 options, and that we want the buttons to be a, b, c and d. Is this an acceptable assumption @thorny obsidian?
or would you prefer that the buttons themselves had the answers in them, and the number of buttons is determined by the number of defined answers
Iirc I’m pretty sure she said that it’s a guarantee
yes! For a first iteration I can guarantee always 4 possible answers
Hey! Could someone take a look at api#23? I'd really appreciate it! 😄
(With the merge of this PR , the migration of API endpoints to FastAPI could officially begin, I think...(?) 😄 )
@vale ibex when you have time can you look at bot#1889?
I remembered the number hell yeah
Oh nvm I'm blind
while I'm here, could people look at bot#1889? Just needs one more approval
OOOOOHHH
So that's why I had to change the HSV values
the blurple color did change
well now you have failing tests @static canyon :P
Could I get a core dev approval for sir-lancebot#859 ? It's been stale for a hot minute
@vocal wolf
.
hi, shouldn't this be the walrus operator? https://github.com/python-discord/sir-lancebot/blob/main/bot/resources/fun/trivia_quiz.json#L814
bot/resources/fun/trivia_quiz.json line 814
"answer": "assignment-expression operator"```
The official name is assignment-expression, walrus is a nickname
During discussion of this PEP, the operator became informally known as "the walrus operator". The construct's formal name is "Assignment Expressions" (as per the PEP title), but they may also be referred to as "Named Expressions" (e.g. the CPython reference implementation uses that name internally).
https://www.python.org/dev/peps/pep-0572/
alright that's fair the question says "official" explicitly
The python quizzes could really use more questions since people memorize them now
I think that's an issue that got accepted actually
and for this https://github.com/python-discord/sir-lancebot/blob/main/bot/resources/fun/trivia_quiz.json#L834 I think we should also allow \@ because the only way to type the literal @ afaik is with @<left_arrow>, and the HTTP newline question does accept \\r\\n
bot/resources/fun/trivia_quiz.json line 834
"answer": "@"```
nahhh it's not stale
Sorry I took a while to get back to you, I was doing stuff and things
Haha alrighty, I guess it can sit for a bit longer. And no worries at all
anyway I've approved and it be squashing now
I'm going to have to trust you on the regex part
Blue and I both tried to break it
no u
that's the semi-main thing lol, teh regex part
ok it's merged
god that commit description, use refined github pls
refined github?
its a browser extension I think
Basically don't keep such long commit descriptions when you are including the PR number IMO
And refined github is https://github.com/refined-github/refined-github (not really needed, but it does what i just said above)
Your input was invalid: query is a required argument that is missing.
Usage:```
.wtf_python <query>
@dim pelican noice
.wtf del
Search result for 'del': ▶ Ellipsis *
Go to Repository Section
Well that ain't right
what's wrong with that commit description though? It's lengthy, but I don't think that's a bad thing necessarily
Its just not needed when you have the pr linked
but what about when you're offline and can't necessarily access github?
its much easier to go through the pr rather than going through the commit description
which is imo not at all readable
well i can't help then
I agree
@vocal wolf If you have a moment. If you remember yesterday, I couldn't get my test bot to run my Madlibs game in my test server. Even after I fixed what @short snow pointed out (#dev-contrib message, it's still not working. However, when I run .ext load madlibs, it tells me I already have it loaded. But if I run .help, I don't see it there. I find this incredibly weird. Please tell me what I should do in this situation.
Well, that's the big blocking thing for me. I frequently go offline with projects and not having a descriptive commit message and instead relying on "go look at the PR" wouldn't be a solution
i will have a look after sometime ^
@short snow I don't think there's anything wrong with the long commit message.
Btw sir-lancebot#901 if you want to take a look at the PR
hmmm
how are you running the bot?
Using Docker
It's not about long commit messages, it's about the commit message which is formed when you squash down all the commits into one, all the commits are merged into and when you look at the description it's not really readable, everything is squished together. Rather than that will you understand more if you look at the PR? Yes, you have the commit messages separately and you have the code changes with them and you get more context, I know going offline is a valid point raised by kat but I can't help that.
AHA!
I reloaded it and it's there now
Oh oops
you gotta test before pushing 🙂
True yeah
Again, this is my first time contributing, I'll get the hang of it at some point I'm sure 😄
👍 yeah, stay cool
I think the squashed commit message is more readable since the PR has a lot of reviews which go in between the commits. By looking at the commit message you know exactly what the commit is, plus some additional details if any. Someone from the future may not want to look at the reviews or discussion behind each commit, perhaps just what got changed and why. Despite the message being long, I think it's much more concise than scrolling through the PR
there is a commits tab
the commit tab is the same thing except it has user icons, more padding between each commit, plus a need to click an additional button to expand and see its full commit message
yeah, basically the commit description in a neater way giving more context
So, my hint for what the issue is, is this line:
remove the ()
I just did
self.templatesis an attribute, not a function. So you want to remove the()
- Look at what
self.templateslooks like.
Print it out and figure out what piece of data you're trying to extract. You need to drill down one more level.
Ok, let me see
What do you mean by "print it out"? await ctx.send(self.templates)? Is that what you meant?
yeah that or just a straight print(self.templates). I run lancebot through poetry locally, not through docker so I'm looking at my terminal output
Ohh I see
So now I added the send command after that but it's still not working, the bot isn't printing anything
you want to see what it looks like before that line, because that line is going to error out
Ah true
can i get reviews on bot#1889
are you using an online editor?
No PyCharm
you don't need to commit your temporary changes
Ok, so my guess is that if I just save the file locally, that will work?
you only need to commit once the changes you made are finalized and you've verified they're working or are complete. In the meantime you can just save locally without committing
of course, you're running your bot using your local code
True yeah
Ok well I'm learning new things everyday 😄
Ah, you thought you need to push to make the changes registered in the bot?
git is just an online copy of your code nothing else, the bot runs just like all your other python scripts
@austere hornet do you have the pre-commit hook installed?
(btw xith if you missed it)
aka if you do git commit -m "some message", you'll get a bunch of checks that'll either pass or fail?
I didn't
yeah
Yeah I think I did that a couple of weeks ago
poetry task run pre-commit, right?
yeah
poetry run task

This is driving me crazy. I think I asked yesterday about this, but something's definitely not right. Does anyone know what might be causing this?
two instances running?
I only see one in Docker Dashboard
hmmm, what happens if you do docker container ls in terminal?
That looks like a Linux command - I'm on Windows
The ls part
it will run just fine
Oh ok I tried nvm
(ls will also run in windows)
Oh I didn't know
That's what comes up when I run that
what happens if you do .ping in your test server?
definitely two instances
okay, so definitely two instances running. At any point did you run this command? poetry run task start?
I think I have
Did you try regenning the token like I suggested yesterday? If you can't find a running process anywhere, that's the most surefire way to stop them all.
so yeah, you probably somewhere in a terminal window have the bot running there too
.int e exit() I think will kill them?
let me test
yup, .int e exit() should kill the bots
then you can restart just the one you're interested in
Ok let me try
Yup it worked @thorny obsidian ty!
whoo
But I still can't get the program itself to run in my test server....sigh
did you see the output of the print() you added?
In the test server? no
no, in your terminal because print prints to standard output
check the logs in your terminal
so, self.templates looks something approximating:
{'templates': [{'title':'sdasdf', ...}]}
which is a dictionary, right? The dictionary has one key, templates and the value is a list of the templates.
yeah @austere hornet you'll see that printed in the terminal when you have the print line
So the thing is I didn't use print(). I used await ctx.send(self.templates)
but it would raise an error because the content is too long, so nothing will show in the test server
Aahhh
I see
I have to head off to bed, but my recommendation is to break it down to the basics.
The line random_template = choice(self.templates) is trying to select a single random template.
You know what self.template looks like, a dictionary with a key of templates. How do you use random.choice() to pull a value from a key in a dictionary? Then apply that answer to your code and see how it could work together.
Ok, got it, gn 
use print debugging 🙃 that's what i do with bots
How do I do that?
print() things which you think is sus and then check your terminal output to inspect it
basically add print("here: the list contains this") so you would know where all it went and where it doens't go
and yeah like hedy said
you might then notice some variable doesn't contain what you think it has, which would then help you debug the problem :)
I haven' used the pycharm debugger with bot so not sure how we would go about with that
Ah ok no worries
got it working?
So I'm kinda confused on what I need to do. What exactly do I need to print? Like what exactly goes inside the parentheses?
also send your code i will have a look
Honestly I'm not even sure what's not working atp
I've tried pretty much everything I could and I still can't get the program to run
All I want right now is just to be able to run my program as is in my test server so I can see how it currently works
do you know where you can find the logs or terminal output?
No, is it located somewhere locally on my machine?
where are you running the bot from? is it from your terminal or from docker dashboard or something else?
Docker Dashboard
by logs I mean something like this btw
yeah ik
ah you might wanna search up where the stdout is for that
I'll look into it too
Traceback (most recent call last):
File "/home/shivansh/.cache/pypoetry/virtualenvs/sir-lancebot-AEHeZmjC-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "/home/shivansh/Programming/pydis_projects/sir-lancebot/bot/exts/fun/madlibs.py", line 56, in madlibs
await ctx.send(self.templates)
File "/home/shivansh/.cache/pypoetry/virtualenvs/sir-lancebot-AEHeZmjC-py3.9/lib/python3.9/site-packages/discord/abc.py", line 1422, in send
data = await state.http.send_message(
File "/home/shivansh/.cache/pypoetry/virtualenvs/sir-lancebot-AEHeZmjC-py3.9/lib/python3.9/site-packages/discord/http.py", line 335, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 4000 or fewer in length.
yeah that's for await ctx.send which I've said above
just use poetry to run sirlancebot it doesn't necessarily need anything else
yeah poetry run task start (iirc) or docker-compose up from the terminal, it's easier to find and view logs
I think both work tbh
then pick one :)
Running docker-compose up now
cool, after you send .madlibs in your test server you should see a lot of output in your terminal
there we go! you got your error now
What does it mean by "overridden context"?
it just means you are allowed to use that command because you have good permissions, but you don't have to worry about that. the problem is with the error traceback at the bottom
you can try using print instead of await ctx.send, that will show self.templates's content in your terminal directly
this will display all the stdout, so all the logs and print messages
Changed it to print() and that's what I got
did you rerun docker-compose up?
Oh, I have to rerun it?
yeah
Ok one sec
be sure to stop it first though, else you'd get two instances like before
Yeah I remember this time lol
I have learned my lesson
great 😄
@rapid igloo Let's go! (sorry that's tiny)
nice!
scroll up a bit and you'd see the start of self.templates then you should think about how you can change your choice() line to do what you want it to do
like what kat said here
Yeah, isn't that exactly what I have?
In the screenshot above?
yup that's what self.templates contain
but you'd have to change the choice(self.templates) a bit to actually get a random choice from the list of templates
Would it be choice(self.templates[templates])?
remember that the templates in [templates] isn't a variable here, it'd need to be a string
So choice(self.templates["templates"])?
well have a try and see :)
can you send your current code?
weird, did you change anything else since your last commit?
I don't think so
because it does this for me
Hmm
For some reason it's printing the dictionary form instead of just the story
If that makes sense
you can fix that later, but the bot isn't sending anything into the channel atm right?
Nope
can you try doing git restore . and then update the choice() line again? you should only do this if you're ok with losing any other uncommitted changes
Where should I run that? in the server?
in your terminal from the sir lancebot directory
i fairly frequently toggle my DMs on and off for this server. was it an intentional decision for !helpdm on to have to be re-run every time i turn my DMs back on?
not sure, but it probably isn't intentional
Done
okay update your choice() line again because the changes are reset, then try running it
bot#1629
oh yeah and remove the await ctx.send line, I forgot that was in the commit sorry
no worries
@rapid igloo HOORAY!!
nice!
Well let's end this on a good note I have to head to bed now
Thank you so so so much for your help!
gn, looks like you forgot that you changed something else in your code earlier :)
Yeah
Gn 
@vale ibex boop bot#1629, do you know?
Oh, I assume we turn them off if we get a 403
is that specific to this feature, or in general?
We get a 403 when the user has DMs disabled and the bot tries to DM them
It seems like if it happens in the helpdm cog we run !helpdm off for them
is it "expensive" in any way to not do that and let the setting stay as is?
Hmm, it is one more API call that doesn't need to be done, but I think it should fine? You could raise an issue on the bot repo and we can discuss this idea
Yea, would be a case of changing this except https://github.com/python-discord/bot/blob/main/bot/exts/help_channels/_cog.py#L594-L608
I think it makes sense to leave them there
one extra api call isn't bad really
Just need to delete line 602 and update the trace log to reflect the new behaviour
i don't recall ever getting that message on line 605 (i might've and just don't remember) but it will still be nice to get that message so i can be reminded to turn DMs back on
It is deleted after a few seconds, do you get ghost pings from bot-commands?
OOOOO that could very well be it
i didn't realize it goes there
i'm often on mobile when helping so don't check pings right away
if it's going to send the message in bot-commands might we consider just not deleting it? or making the time before deletion longer?
really simple PR right there, would appreciate some reviews [python-discord/bot] Pull request opened: #1904 Modlog: explicitly write thread names
._.
bot#1904
Discord does impose a limit on how many 400-family errors you can get in a time period
I do not know, I'd guess yes but it is supidely large, it is just to stop erroring apps
Like if you try to connect to the gateway more than three hundred of so times to the gateway in a minute it will reset your token
Ehhhh.. I would stay as far away from that limit as possible
They don't reset your token, pretty sure you get banned from the gateway
Heh, I'm usually the one being worried about rate limits 😁 I think it is fine there
Nah, it is just a friendly reset, it happened to a community bot on another server I admin
If you break the 120/60s gateway limit you just get disconnected with - and this is entirely from memory so there's a high probability i got the code wrong - 4006 Rate Limited
nothing more
unless you repeatedly spam the gateway across multiple sessions
damn i was close
4008 is rate limited
But I am talking about the "enough 400 errors", not hitting the IDENTIFY limit
Will appreciate if bot#1895 can be merged this weekend, currently blocking another PR of mine
that doesnt apply to the gateway
unless youre somehow bullying the gateway endpoint in such a way to get bad request responses
and i wasnt referring to the identify limit anyway thats a totally different thing
Hey! Could someone take a look at api#23? I'd appreciate it!
(With the merge of this PR , the migration of API endpoints to FastAPI could officially begin, I think...(?) 😄 )
Your reminder will arrive on <t:1634938115:F>!
Can I get another review on bot#1906
Y'all better stay around in case we need a revert too 😛
lol
Nah just kidding, already saw it on chris' bot
Would be great if the bot would redeploy already :P
Okay, deploying now
Here's your reminder: review migrations pr
[Jump back to when you created the reminder](#dev-contrib message)
Hope you had a nice vacation!
Hi, I have a question. So I (finally) got my Madlibs program to work in my test server, but whenever I run the command (ex. .madlibs 5 7), I get the following error. Here is my code: https://paste.pythondiscord.com/pijozocawa.py
I think the problem lies on line 58, but I can't seem to figure out what exactly is causing the problem.
Would appreciate any assistance. Thank you!
Never mind, I think the problem is that the range I entered is too short lol
Right now I have the range set to minimum 5 and maximum 15. Does anyone think I could change that?
Hmm interesting, it worked fine for me when I tested my PR
But thanks for fixing it
Yea, notes and warns were fine, it was only if the search included an infraction with an expiry
I didn't find it during my testing of your PR either 😅
Continue with the game and we can fine tune the values later on in the process
Btw @short snow in case there's some misunderstanding, I'm waiting on https://github.com/python-discord/bot/pull/1446#discussion_r733101611 to review the PR again
I had pinged you here with a comment on that sometime back, lemme find it
Hello. I want a code modified in Python. Who should I talk to?
The problem is with:
lstrip() and rstrip() cause conflict when it comes to LTR and RTL.
@ RUST
trim_start(), trim_end()
" ياخشىمۇسىز بالىلار. "
" Merhaba arkadaşlar. "
Oh, didn't see that. Better to reply in the PR
Yeah, you were active in the channel so i just posted it there
You should open a help channel #❓|how-to-get-help
thnks.
Quick PR for anyone interested site#617
Hmmm @short snow your message link regex uses {15, 20}, but the regex used in discord.py is {15, 21}
Not sure what the API says
!e ```python
print(len(str(int('1' * 64, 2))))
@brisk brook :white_check_mark: Your eval job has completed with return code 0.
20
got a long time until 20 lol
It takes up to 20 digits to display a 64-bit integer
@cold island :white_check_mark: Your eval job has completed with return code 0.
18446744073709551615
Ah, right that's signed actually
yeah that's what I was checking
@brisk brook :white_check_mark: Your eval job has completed with return code 0.
20
Still 20
So why is dpy using 21 🤔
!e ```py
import datetime
DISCORD_EPOCH = 1420070400000
id = 1000000000000000000
print(len(str(id)))
timestamp = ((id >> 22) + DISCORD_EPOCH) / 1000
print(datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc))
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
001 | 19
002 | 2022-07-22 11:22:59.101000+00:00
ok, we're gonna hit 19 next year
!e ```py
import datetime
DISCORD_EPOCH = 1420070400000
id = 10000000000000000000
len(str(id))
timestamp = ((id >> 22) + DISCORD_EPOCH) / 1000
print(datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc))
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
2090-07-20 17:49:51.015000+00:00
20 has us for a few years
lmao
After that, doesn't the timestamp overflow?
!e ```py
import datetime
DISCORD_EPOCH = 1420070400000
id = 100000000000000000000
print(len(str(id)))
timestamp = ((id >> 22) + DISCORD_EPOCH) / 1000
print(datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc))
@vale ibex :white_check_mark: Your eval job has completed with return code 0.
001 | 21
002 | 2770-07-09 10:18:30.155998+00:00
Discord.py using 21 like it's going to survive world war 7
I don't think DIscord is going to exist that long 
Because of the fact that it's stored in milliseconds
wdym
A normal timestamp can store 64 1s of seconds
But Discord stores it in milliseconds
Which equal out to less seconds
Actually no my brain is foggy I don't think I can explain this better
Tl;Dr less space and more precision
Yeah because of milliseconds
Oh... Ahh
I'll just leave that in the air with a thinking emoji
🤔
Hi! Could someone take a look at api#23? I'd love start working on other issues of api, but that PR is blocking them right now! 😄
Sounds good
lol this code is copied from discord.utils.snowflake_time
Yup
Thank you! If you have any questions with setting it up, let me know! 🙂
the only reason i recognise it is because i was trying to patch dpy use arrow for created_at times
and that method is the method to patch since every created_at method uses it
however, some of them use from utils import snowflake_time so you have to patch them in the methods
@thorny obsidian Should I implement error catching for .trivianight question # if the question number isn't in the bank or should I just keep it as a guarantee that the correct number will be entered
You don't need to error check the provided the json for the MVP. You can assume the info you need is there and complete
Alright, awesome. The MVP is about to be done so that's great, just cleaning some things up
I assume I can take off the draft mark once the MVP is done
for the PR
mhm, I'll then review it~
Last question, do I need an embed for the .trivianight list? because embeds are limited to 25 fields and i'll add to need pagination
yeah, you'll need pagination
Ah alright
well....
okay yes, you need pagination, but for the scoreboard
the list does not have to be an embed
Ah alright
Ohh, so we'll display everyone that participated?
I would like to, maybe we cut it off at people who answered at least X questions
Yeah we should probably cut it off considering that events get quite a good amount of participants here, maybe some sort of percentile judgement and only those who got above the 50th percentile or maybe we just have a constant number of questions they have to get correct to be on the leaderboard
Does that need to be in the MVP or should I add it later?
I would like at least a top 50 for the MVP
I doubt you'll get 50 of us, but I'm willing to join your test server and help
Not sure if I can send an invite here due to the whitelisting, but I can DM it to you
ok
We can probs get a test event going and get some staff and regulars to join
ah alright, awesome
@thorny obsidian Hm, I'm wondering if I should do a dropdown with the scoreboard pagination because I can't do buttons since it'll be an ephemeral
buttons and dropdowns are both views, why can you do one and not the other?
well I can do it, it would just be quite weird because with pagination, when you send the ephermal it's an entirely different thing and pagination usually means editing the embeds
can you edit ephemerals?
Not sure, but wouldn't that be the same with dropdowns?
I'm not quite sure what you're proposing, could you explain it a bit more?
I'm 99% sure yes
So basically, instead of having a pagination system with the scoreboard where it only goes to the next page and the page before it, and since it'll need to use ephemerals, maybe just have a dropdown that has the different placements (like top 25, top 26-50, etc.)
Oh, turns out you can't apparently
Ah right, IG you could do the same for buttons anyway
but why not show all 50 in one embed?
Oh what, I swear I've seen that before
embeds can only contain 25 fields
Does it need to be a field?
Hm true
I'll just put it in the description then
descriptions can only contain up to 1024 characters though, I think
nvm it's 4026
4096*
Yea
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
They got bumped a few months ago
4096 should allow a decent amount of users to be shown, around ~256
imo it might look better as just the top 100 or even less
and then a button that allows the user to get their individual rank (ephemeral)
Since its a case of changing a limit number, could you show us an example of both when you get a chance?
we may want to limit it to 50 anyway for size
I can change it to the descriptions right now, though I'm not sure how I can emulate a lot of users
Just populate it with a list of random names
alright
it's very long
I think it should be top 10, and then have a button where the user can get their rank
How about just having top 25 as inline fields in an embed?
And then the user can get their own rank separately
I like that idea a lot
Can you put them on one line, and only separate every 10 users
No need for the one average in each row either
since it's in the title
and, you have 3 decimal places, but are the numbers actually that precise?
Yeah, though I can shorten it down to only 1 or 2 decimal points
I wonder if we could just get the top 25 and place them in inline embeds though
Yea, 1 is fine
that looks much nicer imo, though it depends on what you think
Sure, that sounds good
@vale ibex
Not quite what I had in mind.
- namehere (1s)
- namehere (2s)
... - namehere (4s)
- namehere(34s)
ohhh
@vale ibex This looks pretty decent
Hm, I already thought I made it sentence caes
to and a are not capitalized
Yea, still title case
Yea
Sure, seems good
And last question, should I mention the user?
I originally had them as Member instances, so I could just get the mention
sir-lancebot#910
I (think) I'm done with the MVP for it
@thorny obsidian If you wanna review it when you're free
I went with Chris' way of the scoreboard though let me know if you want me to change it
I'd be keen on having some reviews on api#23 as well 😄
I wish I could review but I don't know FastAPI at all and I'm not very educated on APIs, sorry!
No worries! 🙂
Your reminder will arrive on <t:1635070820:F>!
I'll take a look tomorrow
Sounds good. Thank you! ^^
How come the bot docker-compose doesn't need ```yml
volumes:
- ./postgres-data:/var/lib/postgresql
in the docker-compose?
the docker image defines a volume, so I think it's always persisted
it's just that with that we bind it to ./postgres-data (which project is this?), otherwise it'll just reside in the docker dameon data directories
which project is this?
I am writing my own docker-compose.yml and looking at the bot's one.
ahh
Where? I don't see this in that file
there is a VOLUME instruction which means docker will create a docker volume, not a bind mount
so it's defined at the image scope - rather than the docker-compose scope
Ah, awesome
in prod you should almost always put a volume elsewhere, be it a bind mount or with kubernetes some sort of pvc
but for dev implicit volumes are fine
So you guys use another docker-compose when deploying the bot?
we don't use docker-compose at all in production
all our docker-compose files are entirely development purposed
the deployment manifest for bot in production is this: https://github.com/python-discord/kubernetes/blob/main/namespaces/default/bot/deployment.yaml
Ah right, awesome
Here's your reminder: Are you free for a review :P
[Jump back to when you created the reminder](#dev-contrib message)
For sale?
okay 👍
I could sell my time
Anyways, I'll have a look over it now
Do we need dev-ops around for the merge
Well, we need it for the review at least
If you're talking about the API PR, then yeah. I modified the Dockerfile. :/
That PR should probably also add an action, which will also need Devops sign off
That should be fairly simple though, it'll follow what most of our other repos do
I tried requesting the dev-ops team on the PR, but I didn't have the permissions
Joe and Volcy will do though 🤡
Action? What for?
To build and publish the docker container, so we can actually use it in prod
It also means we can verify the integrity of migrations in CI
Oh, I see.
There are no endpoints as of now. But in the future, of course 😄
Well, we don't need any endpoints now to add the action now lol
If you don't want to do it, that's okay we can PR it later, but I think it does fit under the scope of this PR
What do you mean by verifying the integrity of the migrations?
If alembic upgrade throws an error right now, we wouldn't know since it's not running in CI
Though ig it wouldn't run anyways lol
I mean.. isn't it Initial? 😂
It's sort of straightforward in that context.
Btw. the Initial migration is an autogenerated migration, so it should be fine, I guess. 😄
I think I can add it when I add the reminders endpoint, and the corresponding tests.
I don't think that's a good idea. If we end up with multiple PRs adding endpoints at the same time (I imagine we will), you'll have all of them blocked on one PR that handles unrelated functionality
Less relevantly, it'd be out of scope for those PRs
Alright, then. I'll add it.
If you follow one of the existing actions, it should be fairly straight forward
Perhaps bot or site would have a good base
Okay, thanks! 😄
We have an action right now running on the site that checks the migration history


