#dev-contrib
1 messages · Page 143 of 1
The cog itself should then have some async init task to resolve the IDs to names for showing in the buttons themselves
that won't work, since you need to wait for the guild to be available
otherwise the role cache will be empty
yes
think it's something like bot.wait_until_guild_available()
yes, you can, which is why I suggested an async init task
no, you'd do something like this ```py
class Something(comamnds.Cog):
def init(self, bot):
self.bot = bot
utils.scheduling.create_task(init_cog(), self.bot.loop)
async def init_cog(self):
await self.bot.wait_until_guild_available()
...
You can add methods to make Tasks await until something before they run the first time, if you are actually using tasks and not just the entire cog
Yea, we have a helper for that
updated the snippet
since this is an init task, there's no need to use d.py's task ext
I mean like ```py
class MyCog(commands.Cog):
@tasks.loop(minutes=10)
async def new_comments(self):
@new_comments.before_loop
async def before_new_comments(self):
await self.bot.db_loaded.wait()
but yeah, that works
@vale ibex while you're here, what are your thoughts on the feasibility of having this cover some of Sir Lance's roles? Too much effort to be worth it?
So like lovefest and all?
it wouldn't be too bad, we'd need to implement a similar month gate
this could also have the month number in it, then in the init it checks the current month and only adds those that match, or without a month number
on this note: would rather keep it almost solely role IDs, and if we implement date gating then that as well, names should be picked up from the cache since we'll use different colored buttons and emotes to signify if the user currently has a role
no need for descriptions
that is a possibility, yes, it's just a bit harder to maintain and a bit weirder to integrate into the library
I think I'd rather keep as much compatibility with the current !subscribe as we can for the first iteration of this
So we still direct people to run this command for themselves
Otherwise that's a lot of messages in a lot of places we have to change
Well, we could add a tag saying we moved it, like we have
!free
Okay, we apparently removed it haha
Yea, no need for a description, we're just using buttons so want the text to be relatively small. The name should be descriptive enough
Here's your reminder: that
[Jump back to when you created the reminder](#dev-contrib message)
!remind 2H still in school smh
Your reminder will arrive on <t:1634071083:F>!
!remind delete 3266
That reminder has been deleted successfully!
@green oriole So I ran the pre-commit command but lint is still failing and I can't figure out why
It's actually flake8 that's failing
Those are PEP8 guidelines
Yeah, I understand
But I still can't seem to understand what in the guidelines I am still "breaking" so to speak
you have a syntax error on line 62
that needs to be fixed before the rest of them can be fixed
since as of now, the code literally will not work
True
On the right hand side it should let you know what to fix. I.e on line 84, you’ll want to continue the line to the next one so it isn’t breaking the PEP8 guideline on line lengths
Sublime Text
what about changing it entirely and instead of a command, a permanent message in #roles?
Yeah ik
What is the syntax error on line 62? The brackets? Btw I'm working on sir-lancebot#901
filtered_blanks = [if min_length < len(random_template["blanks"]) < max_length]
what is this trying to do?
I understand it's a syntax error, I don't understand where though
Thanks
I actually already had that same website open @fallen patrol 😆
what are you trying to do in that line
I want the user playing the game to be able to enter a range of numbers between 5 and 15 blanks (inputs) so that the bot chooses a random story from the JSON file based on what the user entered.
Ex: .madlibs 7 10
Does that make sense?
no, what is line 62 trying to do?
See my message below for concerns with that
Wait hold up
I think I know what I did wrong
below what....
random_template isn't defined
Below the message you replied to
Just stubbing out the button command, is there already a pyweek role Kat?
I can't see one, but not sure if I'm blind 😂
Nope, not yet
Yeah, don't want to limit it to participants
see the message akarys sent for my response
Yeah I'd still prefer to keep it is as a command you run instead of a permanent message
Even if we have the subscribe redirect it's still subpar UX for not a lot of benefit
Dang @vale ibex that's lightning fast
ping!
It's not done just yet, still stubbed out
just wanted to push before I closed it for the night
Just need to define button behaviour and then add buttons to a view
reviewed
Actually I was wrong about that @fallen patrol
I fixed it and it's still saying syntax error
This is what I did
Your syntax error is that if
If you want an if on one line, you can use a ternary, but from my limited understanding of your code you're just using it to convert to bool right?
Use bool()
!e [if 1 == 1]
@gritty wind :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | [if 1 == 1]
003 | ^^
004 | SyntaxError: invalid syntax
@gritty wind :warning: Your eval job has completed with return code 0.
[No output]
Ah
obviously tho, 1 == 1 is already a bool
Ok
so no real need for calling bool there, or the if
Ok, got it, thanks Scale!
you're using a f string but it doesn't have any {var_name} in it
so there's no need for it to be an f string
Ah, ok, got it, thanks!
bot#1868 is actually ready for review now if anyone was interested
going to leave it as draft since it's based on top of another PR
ready for review now
oops...
?
since i reviewed it earlier lol
ah
ah lol sorry @fallen patrol didn't realise it kicks you out
ye its pretty annoying, since your edit didn't even touch where i was ;-;
I personally like automatic dismissal, because it ensures things don’t sneak by, which I’ve had done to me
Just because I approved what you had before you changed it, doesn’t mean I’ll approve it after
Yea I like auto dismissal too, but this was me kicking arl out of a review by pushing changes
its poor design on github's part
the fact that a partial review can't be added to once a new commit is pushed doesn't make much sense
hey all
for cowsay
i was wondering how i should give the available cows to a user
oh
nvm
hey @vocal wolf, the module im using for cowsay doesnt have a license listed in the meta info on pypi, what do i do? this forces the checks to fail
yeah the license is apache
oh sorry I thought you were searching for the license
welllllll
maybe find an alternative?
the license is compatiable with the project
it could be ignored
!src
.github/workflows/lint-test.yml lines 19 to 26
ALLOWED_LICENSE: Apache Software License;
BSD License;
GNU Library or Lesser General Public License (LGPL);
ISC License (ISCL);
MIT License;
Mozilla Public License 2.0 (MPL 2.0);
Public Domain;
Python Software Foundation License```
.github/workflows/lint.yaml lines 20 to 28
ALLOWED_LICENSES: Apache Software License;
BSD; BSD License;
GNU Library or Lesser General Public License (LGPL);
Historical Permission Notice and Disclaimer (HPND);
ISC License (ISCL);
MIT License;
Mozilla Public License 2.0 (MPL 2.0);
Public Domain;
Python Software Foundation License```
!pypi pip-licenses
--ignore-packages
Apache Software License != Apache License maybe?
this is the run
this is the problem #dev-contrib message
it isn't listed whatsoever
pft
brb
maybe this will work lol
reason why its not added: pip saves the license data when a package is installed.
won't, the package is dead 😔
The maintainer is still an active user, so we have hope.
@vocal wolf if all else fails i can fork and add the license
but imma head to bed tonight, bye all
ah yeah, or we could just ignore the package for the time being if they don't respond.
@vocal wolf another option would be to allow the UNKNOWN license if they don't respond
What's the context?
@green oriole start from here
The workflow isn't detecting the license correctly?
I don’t particularly like that solution, and would prefer an explicit ignore for any libraries that are unknown
No the guy didn't specify the license in pypi
Hey! Can I have some opinions on api#22? 🙂
"a PR should come up anytime now" -- you are working on it?
Okay cool! Also i reviewed your PR
and you got a poetry.lock conflict 🙃
Yeah, because my model PR was merged a few days after that PR had been opened.
but...but... @vale ibex how will I spam buttons now 🥺
so what docker containers do you have running and what's the status of them?
how do you use snekbox again
i ran
❯ docker run --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox
and then
requests.post(r"https://localhost:8060/eval", json={"input": "print('test')"})
but that just gives me a huge error https://paste.pythondiscord.com/egejevozer.py
logs: https://paste.pythondiscord.com/juhalobani.apache
Use http instead of https
me?
lol no, was beating hsp to posting his message
oh lol
ahh thanks
Or self sign certs lol
...and i just got distracted and closed a tab with a review
github saves inprogress reviews
so if you open the review again it should still be there
Do you guys get email notifications from GitHub?
I am not sure if I want to turn it off 🤔
They're all marked as Important which is a bit :/
I do, I tried to make a rule that labels them and moves them to a special folder but it has not quite worked out the way I thought it would in gmail
In outlook it would be easy
works fine for me
I have all emails off from github except if something I pushed failed a workflow
The important stuff is already posted to other channels and places that I check daily, so the email is just extra clutter imo
Ah, where is this setup?
In settings, see all settings, then Filters tab
Oof, hate when that happens
@clever wraith they responded. License now exists in PyPi: https://pypi.org/project/cowpy/
Ty xith
np
re-running the workflow on the PR now
hmm
still failed
ah
@clever wraith I think you need to update cowpy to 1.1.1
This is why I dislike non-exact requirements, it's unclear when you need to relock, or when something significant changes smh
uhhh, that repo now has 2 licenses
yeah they have the one in the repo and the one in pypi
An Apache 2.0 added 6 years ago, and an MIT one added jsut now
the repo itself has 2
interesting
On it
I've commented on that issue anyway
hopefully they'll remove the incorrect license
and hopefully the incorrect one isn't the MIT one lol
Funky
So
Poetry is being picky and saying that cowpy v1.1.1 doesn't exist
Bad poetry
It just let me add it fine locally
are you typing literally v1.1.1?
it needs to be just 1.1.1
Chris, how difficult is it to use the Discord button components?
in what way?
I'm thinking of speccing out the Python Trivia night stuff and like... how to do that
So I guess my question is sort of batching time blocks where I look at which buttons are pressed
So like, for the next 5 minutes I will look at which buttons are pressed and make it count towards X. 10 minutes later I do the same thing but it counts towards Y because it's a different question.
I'd make each question have a different message with answers
rather than reusing buttons
Well fuck
soooo something like
.trivia 2 would start question 2, spit out the question and spawn the buttons with the associated answers?
that way you can do ```py
message = await ctx.send("answer:" view=answers_view)
bot.utils.scheduling.create_task(disable_later(message), self.bot.loop)
yea
after you send the question, create a task to disable the buttons after a defined time
okay that makes sense. You can just like... spawn a button view to do that, right?
Check failed again
yea, you'd define a view with the data you need to store, then define the model of a single button
Checked pypi API, license is listed
Okay, cool cool
then each command will create a view with a set of buttons
Updated and locked for 1.1.1
Time to scope out how to load in questions and do the answer reveal thing
yeaa 😄
I'd suggest a list of dicts
to store the emssage and answers
along with the correct answer
then you can use the index to refer to the question itself
Yeah, I think I'm going to expect the question/answers to be in json format, we can load it in behind the scenes so we never have to commit the questions
nicenice
Okay, a few questions:
- Can buttons be like... specific to users? So it shows the buttons to everyone, when user A clicks a button it disappears/locks out the buttons but only for user A. User B can still press the buttons.
- Can you only schedule the buttons to disappear? Can you send a command to force it closed/gone?
- You can tell who pressed the button right? I feel like that's a given "duh" but wanted to make sure
@vocal wolf I found the license problem
The license for cowpy is in LICENSE.md, not LICENSE so pip- licenses doesn't find it
- No, but this could give users the opportunity to change their answer before the time runs out
- You could use a command, it would significantly simplify the implementation if we enforce that only 1 question is active at a time, that we we can just store a reference to that message as a self attr, and then just disable the stored one on command
- Yes
Actually, for 1, we could make it so that after the first interaction, further interactions for that user fail with an ephemeral message
but we can't have buttons look different for different users
okay, but we can do like a "you can't keep changing your answer" type of thing
Also, the license isn't listed in metadata
So
I committed some metadata gore to get it working locally
would be easier to make a whitelist of packages
and then pin the version in requirements in case the license changes in the future
yea, you can. could even have it so that the user has X opportunities to change their answer, and output the remaining retries
It looks like he used poetry to upload the package and he doesn't list the license there
So I found the problem
I don’t see how that would work. We technically already have a whitelist - known as our lockfike - but the workflow is there to stop us from missing deps
Which has happened/almost happened before
Anyways, since they are willing to fix things, and quickly, I say we get everything fixed upstream then worry about it
oh lol
oSo I updated the channel IDs to the new values
but still getting the error from lance
turns out we overwrite them with env vars in prod
arthur deployments redeploy sir-lancebot
:white_check_mark: Restarted deployment sir-lancebot in namespace default.
deleted the env vars and rebooted, all is well now
About Advent of Code.. could someone take a look at sir-lancebot#857? 😄
Could someone also take a look at:
sir-lancebot#860?
117 commits holy crap
Haha yeah
There was a lot of great feedback
Oh shoot should I have grouped them in better
I shall test this PR
Sounds great, thank you so much :D
OH also while you're here Xith, this is a bit off topic but how good is CLion for Rust? I think i've seen you use it for rust but i'm not too sure
CLion servers for Rust are really bad sometimes. I'd suggest vscode instead with the rust-analyzer extension.
Ah alright
@trail pilot I haven't worked with the new discord ui before. If a user interacts with the dropdown menu, does it only show the changes on their side?
Or does everyone see the new embed?
everyone sees it
hmmm
I wonder if I could just only allow the author to change it
yeah
Alright that sounds good, I'll commit that rn
Hm
I think we should leave it like this for now and see if we need to change it in the future
Alright that sounds good
was there anything off putting you noticed with the command
still testing, that's what I just saw right off the bat
I really do like these buttons though
Thank you!
In general, that is, but also here. Good idea to use a dropdown.
Buttons being a feature in Discord is neat
Yeah I agree, I like the new Discord UI and the gates it opens up
yep
I wonder if the tic tac toe could be refacotre wiht button
someone in my old cs club did that on the day of discord.js getting button functionality
it was very quick lol
That would be really really nice, reactions are way more complicated than just arranging the buttons in a tic tac toe format
@trail pilot For the languages embed, should we have a maximum height for amount of languages?
I would like if I could run the command for someone
Idts, because it will never go over the limit from my testing honestly
Still, only I should be able to change it. But hiding it seems to defeat a bit of the purpose and limits the uses
And language names are fairly shor
Yeah I'm not worried about width, just about height.
in my testing, i got at most 20 languages which never exceeded the limit
descriptions have a 1024 character limit
but at the same time, the main description embed is sometimes large
That's true, however I don't think it'll be used in general so it won't be too much of a worry about flooding
right
anything else you've noticed while testing?
nope, just going through the code now
You do a functional test before doing a code review xith?
ah alright
Interesting, I like to do the opposite
To see what can be improved about the UI and if I run into any errors so I can include that in the code review/discussion
Yeah, I always prefer testing the thing before the code review
hey all, regarding sir-lancebot#902, it looks like it'll need whitelisting. The license isn't listed in metadata even though it appears to be on the pypi page
we need to wait for that to be fixed upstream
we can't merge in something with an unknown license
or well, inactive
We don't though, since there are two licenses in the repo
once that is compatible with our project, and one that isn't
are they not both compatible though?
There be a difference between dead and no one seeking improvements
Yea, Apache 2.0 isn't compatible
The Apache license adds a bunch more requirements to use
i wonder if you could just use ascii art yourself?
try and make your own impl if you wanted to
Cowsay is a pain in the ass
@molten perch AoC thingy reviewed.
why is the python stdlib kinda inconsistent
logging.getLogger uses camelCase
yet other things use snake_case
ig it's just too hard to go to PEP8 at this point
so they keep it as is
convention and it's old
Fair enough
they don't accept PRs on PEP8ing, I'm guessing?
Love it when national cs competitions using py 3.x have raw_input() in examples
It doesn't impact functionality and would affect a lot of codebases for no good reason
what requirements? I can only see the redistribution point which applies to the work or its derivatives
Hm...
I remember seeing that brought up in #internals-and-peps. Basically it came from Java and no one has bothered to fix it.
Additionally, at this point it is a huge breaking change because of how many codebases use it. So it most likely won't ever change
True
If there's ever a python 4 it is possible that they might change it
That's when they can change it. They probably won't, because that'll be annoying to update.
Thank you! 😄
@trail pilot I think we maybe perhaps should squash the challenges PR
Yeah, would you all do that or do I have to do it on my end?
Cause 117 commits is quite a bit
Where are the other two?
well
I only see log instead of logger
now logger isn't defined
logger.info on other lines will be wack
I think it was just logger.error
which I fixed
nice
ugh
status embed fail
in the future should I group my commits?
I think I committed too many times lol
?
the workflow?
Yep
@brisk brook also, thank you so so so much for all the reviews you did with the challenges PR. You were very thorough and you are an amazing reviewer
and the Hangman PR too
I just realized i requested the review at the same time Xith approved already, oops
heh
also if it isn't too much effort, would you mind marking in #changelog when it's merged? though to be fair you've been reviewing for quite a bit so feel free to do it when you're fine with doing so
oh yeah I was already thinking of how many mentions I'm going to do lol
alright it's merged, time to see if it connects and doesn't die
I don't know who "tooboredtocode" is on discord, though
Woo woo, challenge command!
@remote wigeon
no problemo
.help challenge
**```
.challenge [language=python] [query]
**Can also use:** `kata`
*The challenge command pulls a random kata (challenge) from codewars.com.
The different ways to use this command are:
`.challenge <language>` - Pulls a random challenge within that language's scope.
`.challenge <language> <difficulty>` - The difficulty can be from 1-8,
1 being the hardest, 8 being the easiest. This pulls a random challenge within that difficulty & language.
`.challenge <language> <query>` - Pulls a random challenge with the query provided under the language
`.challenge <language> <query>, <difficulty>` - Pulls a random challenge with the query provided,
under that difficulty within the language's scope.*
So for Python Trivia Night no database storage is needed. You just need to be able to accept a json file and convert it into a list of dicts or something similar
Ah awesome
I think I can already imagine how it would work
just trivianight as a group
and then a few subcommands
would discord.py allow # as a valid command name?
mhm! I think the only parts that may require some more thought is the scoreboard calculation.
Also the # is just a placeholder, it would be a specific number
so like .trivianight 3 would pull up the third question
Ahh
could I edit the functionality a bit to do .trivianight question 3?
so I can keep it organized as subcommands
who's onerandomusername again? I keep forgetting
@fallen patrol
aru / arl
How does one set up their environment to be able to contribute to lancebot? I've been wrestling with poetry for a little while. Do i need docker?
ty
You don't need it though it is preferred and easy to set up
!contributor
nah, not for lance.
Oh the tag in't added yet
oh yeah... I should do that contribute tag
What parts of setting it up for lancebot are you having trouble with?
Pycharm isn't recognizing the poetry command yet I've added it to my env path
#changelog is done
hmmmmm, which one of the core devs/regular contributors uses PyCharm a lot...
Yeah ik it's a shitty username 😔
I use intellij lol
nahhh
It seems to work in cmd prompt and powershell but not in any of the pycharm terminals
Well okay, but it's definitely a random username
@trim cradle
I think Scale uses PyCharm as well
Ye
pablo?
Wa
a wa
A qwa!
You use PyCharm, yeah?
Yes
oh yeah feel free. I am not married at all to my suggestions, I just put there as a starting off point so people can get a solid idea of what I'm after. So feel free to adjust to what makes sense.
Also bug me if you have any questions about how it should function and what not.
People have questions me thinks
Could you give me a hand with setting up poetry with pycharm? It's not being recognized by the terminal
My license expires in a few days so I've been hitting up my project leads asking them to buy it for me.
Sounds great, I'll create a branch on my local for and start messing around, could you assign kronifer and I to the issue?
And in the future if DM Friends wants to join in
You have to install the poetry plugin
so who other than vester is that?
yup! Thank you for picking this up~
I've installed it and it works in regular cmd prompt and powershell
My PR just got finished
I'm talking about at work
No I was actually thinking about the coincidence myself.
There's a poetry plugin for pycharm
Oh gotcha gotcha. Will have a look
I'll be back in a few minutes. Doing leg day because can't stop won't stop
Got it. Thanks a bunch, Stelercus
Would you want the leaderboard to persist across bot reboots?
nah, as long as we can somewhat ensure the bot won't restart mid-event
Sure
@summer garden no problem, just ping me if you have a question
I mean, it could restart at any time. If a pr was merged or something
How long are the events
When is the expected date for the event btw?
Like an estimate
This one will range between 45 minute - 90 minutes if I had to guess start to finish
January / February time range
Awesome
And what kind of questions?
Harder questions about the internals, or easier questions
No idea! I'm going to be querying staff for some questions and probably the community if necessary
Alright, sounds good
I'm guessing we won't be able to participate?
kron and i
Since we're going to be putting the questions into the JSON etc?
id assume so
But the json will look something liiiike:
{
'1':
'question': 'sdfsdfs',
'options':['ad','sfsd', 'sdf', 'hsrhas'],
'answer': 'sdf'
}
ah alright
I guess the questions themselves don't matter so much, more the fact that they will be multiple choice
You will be able to participate! Part of the magic of my requested implementation is that the json itself won't be committed. It'll be loaded in via command
What if we just made placeholder questions and we could still participate if the core dev would be actually adding the questions
Ah kat beat me to it
Ohh awesome
I think that the json isn't hardcoded, it's coming through another way
Toxic implemented a similar thing for the code jam teams and I liked it a lot
.trivianight load
{"hello": 2}
for example?
The former might be easier because I'm not sure if discord.py will actually catch the file in the message
Ah, in that case the bot could do some fuckery with the hastebin or smth to preserve a leader board, or use redis
it will, but it would be a bit messy
it will actually! let me grab a screenshot and toxic's code thing
!src codejam create is Toxic's implementation with CSV
Create code-jam teams from a CSV file or a link to one, specifying the team names, leaders and members.
oh that's cool
also i assume that command would have to be locked to certain roles @thorny obsidian
I have a lot of questions, sorry haha
what does "configured channel" mean?
because I'm wondering how we have dropdowns only be native to the user
Oh wait it's going to be buttons
and dropdowns
which are specific to users
It's going to be a specific channel created for the event I would assume
ooh I didn't know dpy could catch that
This will happen in a special channel, or honestly just the channel the thing is started in. It doesn't even need to be configured
I'm gonna make something in paint.net so I can understand what's gonna be going on for it
this is Toxic's code which handled that: https://github.com/python-discord/bot/blob/main/bot/exts/events/code_jams/_cog.py
this will just be buttons, visible to everyone. We just need to record their first interaction with the button, and then the second if there is one. Interactions after that should fail if it's the same question still
!codejam create
can you send ephermals with buttons btw?
its role locked of course
yes, I think. Only because I've seen Chris do it though
I think it oculd just be after one interaction if the user tries again they'll be faced with the epheremal as stated
wait what will the second interactoin be more?
be for*
I'll allow people to change their answer once in case they misclicked or misread
Yeah I think it's only for the Event Team
Yeah any interaction response
Judging by this
Admin locked
Yeah, this should be admin + event lead locked
Ok, got it
Nope, just locked to admin
I mean for this new trivianight command, it should extend to event lead
oh ok, it looked like they were talking about the codejam create command
codejam create I'm fine with keeping admin locked since it can be a lot
how does this look for the workflow?
it's a bit messy
oh i forgot trivianight stop
I may not want to delete the json entry, I can imagine a scenario where we may want to revisit a question by forcing it
perfect, that'll work
Also, if it simplifies it: the .trivianight start doesn't have to create a channel. We can just invoke it in an existing one
Ah
Ok I think I can understand how this'll work
Not as complicated as I originally thought
this is probably going to have to be carefully reviewed though, considering one small error might ruin the event as a whole
OH! Could you also add this command now that I'm thinking about it:
.trivianight list will list out the loaded questions with an indication of which ones have been selected?
Also the .trivianight # for forcing a specific one
I'll comment on the issue with this too
Yeah lol
Could you elaborate on trivianight list?
Yeah, I like that idea
writes to trivianight.json- I don't think you should need to be writing to any files, should just be sorted as a dict or w/e, unless I'm misunderstanding something, am sort of jumping in without reading the full context 
the only thing I'm worried about is how it would have to linger around
It'll produce a list of the questions that are currently loaded, with an indication of which ones have been used already soooo:
.trivianight list
Q1: "sdfasdfsadf" | :x:
Q2: "dsgaslikdgij" | :checkmark:
Q3: "asdfjk;sidfja;" | :x:
because load occurs beore start
unless we have start take the json as an argument
Wait I think i'm confused
The resouces should be lignering around as lnog as the bot is online and the resources are in a global state within the class (class variable in the cog perhaps)
yeah the class variable is fine
the cog is only ever ran as a single instance, right?
Well you could just have it as an instance variable on the cog, something like self.questions = ...
yep
Or that yea
either way would work
oh yeah that's what I meant, the instance variable
also for the trivianight stop, should there be an embed with just the scoreboard or scoreboard and winners
I'll trust your judgement on that
Alright
how do I go about running lancebot locally for testing?
Have you read the guide on our website?
A guide to setting up and configuring Sir Lancebot.
Dang you beat me to it
Ah i have not. I got distracted setting up poetry. Thanks I'll have a read of this!
I was gonna post it too lol
@trail pilot fyi we just got an error with your challenges code. Apparently (kata_information["rank"]["name"] can be None (not sure in what circumstances), so it does None.replace here, raising an AttributeError: https://github.com/python-discord/sir-lancebot/blob/main/bot/exts/utilities/challenges.py#L168
bot/exts/utilities/challenges.py line 168
color=MAPPING_OF_KYU[int(kata_information["rank"]["name"].replace(" kyu", ""))],```
I assume you'll want to work on that, but if not then no worries 👍
Oh no! I assume we could just say that it ran into an error and log it? and catch the exception?
I can make a quick fix now if that's fine
It's probably better to actually handle that
["rank"]["name"] is used in multiple cases, so we should dig deeper into what the root issue is and how to solve it
Hmm
I don't know why it would be none tho
maybe because there is no page?
but it just doesn't catch it
You'd have to debug that 🤷
Oh god, I think I know why
the language I used that raised that error is in beta for codewars.com
So the API might not have its rank and what not
Yeah, that would potentially make sense
Should I just entirely take out beta languages?
that is infact the reason why
These languages are fairly uncommon anyways
"beta": [
"agda", "bf", "cfml", "cobol", "commonlisp", "elm", "erlang", "factor",
"forth", "fortran", "haxe", "idris", "julia", "nim", "objective-c", "ocaml",
"pascal", "perl", "powershell", "prolog", "purescript", "r", "raku", "reason", "solidity", "vb.net"
]
Is it possible to just not display the section causing the error?
I think I might be able to just default it to 8 kyu
Because it deals with the colors
Or use a "Unable to retrieve {thing} for languages in BETA mode"
Oh yeah for sure those languages definitely don't look very popular
That sounds fine with me
I could just check in the very beginning if the language is in beta
and send an error embed
oh wait
Imo it's better to keep functionality where possible
nvm
I see what you're saying
Alright working on the change right now and should I just put up a PR for it?
if name := ...["rank"]["name"]:
embed_colour = ... # use name var instead of re-indexing
else:
embed_colour = ... # set to default```
Lemme see if I can get an admin to make the error into an issue rq
I've got to go to bed now but have made a request. Asked them to ping you here when it's done to lyk 👍
I'll remove the period and do beta
Nice!
I think "for beta languages." (Keep period and reword slightly)
Is it definitely not possible to get difficulty for beta languages?
Then yeah, that looks good with the sight reword I mentioned above
Sounds good, sorry for not catching the error earlier!
(Make sure it still works as expected for non-beta languages)
No worries! We all miss things lol
Hm, there is another bug that isn't breaking but is still weird
.challenge perl only works sometimes
Like the website will only load in beta languages at times.. weird
You're welcome to look into that if you'd like
But doesn't seem to be a massive issue
(Unless it's like ratelimitting or something)
i know the issue I thikn
Anyway I really should be going to bed.
If you'd like to fix that too in the PR then go ahead (just make sure to mention in the PR) 👍
Oh yeah, cya!
Yeah I can't figure out why it won't work
Nvm I know the issue
Fixed it!
I should not have set the level by random, as that might lead to no katas shown
Why did Lance react to this with a candy?? #sir-lancebot-playground message
Its candy collection system, it's random
Huh, ok
regarding sir-lancebot#907, is this simply a case of using a dict.get() with a default value, rather than a []?
ye pretty much
sir-lancebot#908
another dict.get() issue, if anyone wants to handle, haven't created an issue yet
that seems a little harder to fix, actually
looks like it hasn't fetched the latest comic yet
Are you allowed to open a PR without an issue? I wanted to open a PR regarding a fix for the .challenge command as it errors out at times
Yes as long as you link the relevant discussion in Discord
I need core deva pproval
What's the issue
i think
AttributeError
because sometimes with a beta language the kata will have the rank as none
You can go ahead, we're just waiting on an admin/core dev to open it via sentry
Ah alright
Ah
So should I make the PR?
Yeah go for it, you can blame me
sir-lancebot#909
Oh also question, for the trivianight, should the multiple choice be a button or a dropdown?
buttons or a dropdown*
mmmmm... let's go with buttons. Just to make it more fun
Just from an outside perspective, if there's not more than 5/6 options, I'd like buttons, easier to click
Awesome!
I always got misled since discord said ephermals only worked for slash commands
but turns out it works for buttons too
also, this is more of a question about the event itself, and i'm not sure if it's disclosed
but will this be more of a 'fun' event or one with prizes like pydis merch like the code jam?
(Sorry for all the questions)
probably more of a fun and casual event, possibly with a temporary Trivia Night Champion role
questions are good!
Ah alright, thanks!
Las tquestion -- how will the scoring work?
or will there be a score key in the json?
greaaaat question. I think for the first iteration all questions are valued the same, so no worries there. I need to have a think about it and figure out a decent scoring system that accounts for questions attempted, questions answered correctly, and maybe even speed
Oh yeah I forgot about the speed
I have an idea --
for the scoreboard, maybe it's a view?
there are buttons that show you the leaderboard by points, speed, etc.
and if you click on a button, it'll send an ephermal of that certain leaderboard
That'd be neat
and speed should also factor in correct answers and the second time you press a button if you do interact again, i presume?
Yeah, although I'm fine if you want to leave that part out for a future iteration/version
I think I could just give it all a shot at one go and any future suggestions could be added in later
I don't think speed should be too complicatd
complicated
just a time.perf_counter()
Another question - could I make a folder for the trivianight event? there will be so many views it'll be complicaetd
actually nevermind
i'll need to keep it in one file
yup! Probably should have specified this but you can make a trivianight folder under the events/ folder and go nuts
The only problem would be sharing resources
the views need to communicate with the scoreboard
I may just keep it in one file but have it well documented
can that be done on the class/instance level and import the relevant files? (I have no idea how views work)
I think we could just set up the views in different files, import them, set instance attributes for the scoreboard, and it should work
Should there be a group chat with you, Kron and I so we don't end up flooding this chat haha
Regarding the trivianight event
nah, that's what this channel is made for so no worries
Oh alright, great
I just wanted to make sure that no one else would get annoyed by all these message
s
anyways I'm gonna draw out a flowchart
something like this
arrows are imports (trivianight.py imports question and scoreboard
@vale ibex you are smarter with views than I am, can you take a look at the above?
get reviewing!
.remind 22H
uhh
wrong bot
!remind 22H
content
!remind 22H
content
Your reminder will arrive on <t:1634254872:F>!
which issue?
Maybe it's just me, but the language list and tags list can sometimes get long how about make them into pagination or add them as inline fields 
can take up the whole vertical space
found it nvm
sir-lancebot#903 i think
shouldn't the trivia event be done in DMs? Or people can see each other's answer
oh nvm
ok the issue sounds fun, "Users will be able to press the buttons to select their answer and should be allowed to change their answer once." does discord have some functionality for this or you are planning to use cache?
it would just be a simple dictionary honestly
for that question
bot restarts, whole thing gone 🙃
Yeah, I don't need it to persist as long as we can somewhat ensure the bot won't restart mid-event. Which is as simple as "core devs, please don't merge anything on lance for the next 90 minutes"
Hmm alright
From the issue i get we first load the questions and then start the event, how about loading the questions in the same command as .trivianight start?
I want to load the questions in a private channel, but then initialize the event in the channel that will be visible to everyone
I want a clear distinction between prepping for it and then actually starting the event
Ah 👍
I have a question - is it fine if code is a bit overachieving if it makes accessing it much more easier?
I'm implementing __getitem__ and __setitem__ for a scoreboard class for the trivia night so accessing it via across classes is much esaier
go for it~ This is also a learning/practice opportunity for you
since it holds a view and that view holds dictionaries so it would be very long in terms of length to accessing it
I think I'm gonna set up a draft PR for the trivia night event if that's fine
This is how I would go about doing this. A class for a "trivia event" would contain the questions list for that particular event. The list would be of a question object.
@dataclass
class Question:
question: str
options: set[str]
answer: str
# Leaderboard for the particular question
leaderboard: dict[str]
Where leaderboard is mapping the user discord ID to their points, for points I was thinking of them being relative to the time taken by the user to answer, like 5 sec 100 points, 10 seconds 70 points.
Now buttons, buttons would only be used for questions, the leaderboard would be just listing the first 10 users and others can be seen through a Pastebin link or something, like how AoC happens. On answering a question, the user would be added to the leaderboard of the question - if he got it wrong then 0 points or time relative points (using some formula). So now we can even ensure that they don't respond twice/can change their answer.
The time for the question would be taken when doing next. If the question is passed while running it then we can check if it is done already - if yes ask for confirmation through discord buttons -- if confirmed clear the leaderboard and send the question again.
I am having per question leaderboard here so that it can help to check no changing or double answers and we can have per question leaderboard views like we are having for AoC.
responding to this, I haven't worked with discord views so not sure about them.
I think for now the first iteration will just have a set # of points for all questions
I didn't get you 
For now, all questions will have a set # of points
that will be awarded if the user gets it correct
sir-lancebot#910 is up!
This is a draft for now just so that I set it up early on and I don't end up procrastinating making the PR
ah, but what do you think about the rest
Hm, I was honestly thinking having a link to the view for the question, and having the question be a class on its own
I'll show you what I'm thinking for example
something like this
Whaat would the question class contain
link to the view, link to view the scoreboard?
it would have the view for the question along with some other information
the view should contain the majority of the information, the question class is just sort of an "intercepting" class in the sense that it just abstracts away having to access the view for everythign
I finally get to use dunders other than __init__ and __repr__ in prod for once haha
inb4 power outage or crash on lance during those 90 minutes
no actually
datacenter fire 🥲
is there a special tag for hacktober?
if so, how do i add it? github isn't letting me add any tags
No I can
You are staff
Triage here is referring to a permission we have on staff for most of our repos
By default you can’t add labels to anything on GitHub yourself
Someone with perms needs to
Ah
Oh I see yes
Hello @trail pilot! I heard you wanted to work on sir-lancebot#912, right?
If so, can you please comment on the issue and ping me back so I can assign you? Thank you!
Hey! @hardy gorge (sorry for the ping).
What do you think about api#22 , is it fine to start implementing such an endpoint?
Congrats @static canyon
Thanks! 🎉 
Congrats to you too 😄
You've been doing some great work with all those reviews :p
IMO it shouldn't be a problem, as we are planning to shift all API endpoints to it eventually and were waiting for the DB setup originally.
And congrats bluenix and tizzy
btw bluenix i have requested reviews on preserving unloaded cogs and incidents enhacement pr
I'm not sure they need to be in different files at all, the scoreboard just needs to be a simple command that outputs an embed from a class variable of scores, the question view will be ~10 lines of code and the button view ~50
If you take a look at my subscribe PR on bot I have then all in one file and it's alright, I imagine the view and buttons for this will be simpler, since they don't need to self update
If it does get too big though, feel free to split out the view and button class into their own models file
@trail pilot fyi I've linked sir-lancebot#909 to the sentry issue (sir-lancebot#912) and also left a review 👍
Would be great if you can edit your PR message to say "Closes #912" so that the issue will be automatically closed upon PR merge
Maybe also update the title of the PR to like "Solve GH 912"
I've updated the PR description
tyty
Hey @cold island What's the status for bot#1570? Should I wait my PR (#1634) for it or it is gonna take sometime?
@vale ibex could you uh sir-lancebot#908
I can't edit it to actually link 907 rn
updated to solve the sentry issue too
mentioning the issue in the PR description auto-links it 😄
wasn't assigned to anyone 😛
Yea, doesn't really matter, issue assignments are more useful if the fix is going to take a while, so that two people don't work on the same thing
Yeah
I made the edit on github
Except because I'm so accustomed to black, I actually made the edit, copied the line, ran it through black, and then pasted it back into github

It's unfortunate how bad my coding style is without black
hah, I'm the same with my spelling, spellcheck has made it so that I can just spew out words and fix them later
dict.get('thing','' )
dict.get(issue, 'body', '')
But with isort and black, I don't have to worry about any of this at all :)
No, what I instead do is change the isort and black settings constantly
😄
Wish I was kidding
I added a second blank like under all of my imports in a pr, so 25+ files edited to add... \n
Isort is a very nice tool
I love Isort
Awh shoot you stole it from me 😝
Nah don't wait for it, I'll deal with merging
Sorry I wasn't awake, I made all the changes you requested!
I'll take a look shortly 👍
Ok thanks 🙃
cc @brisk brook regarding your comment
Thank you for all the reviews that you do! Congrats on your well-deserved Contributor (and congrats to @brisk brook too 🎊 !)
if query is not None and "," in query:
query_splitted = query.split("," if ", " not in query else ", ")
if len(query_splitted) > 2:
raise commands.BadArgument(
"There can only be one comma within the query, separating the difficulty and the query itself."
)
query, level = query_splitted
params["q"] = query
params["r[]"] = f"-{level}"
elif query is not None and query.isnumeric():
params["r[]"] = f"-{query}"
elif query is not None:
params["q"] = query```I don't particularly like the repeated `query is not None` here. Is there something we can do about that? @trail pilot
I was thinking about that too, but if we didn't want it to repeat, we'd have to put the if statement in the beginning with the pass
if query is None:
pass
elif ...
What do you think?
What do you want to do when query is None?
there should be no parameters
hmm
if query is not None:
if "," in query:
...
elif query.isnumeric():
...
else:
params["q"] = query```I guess this works
What do you want to happen if query is None?
Assuming the else is correct
I don't remember, can we return early when this happens?
Committed
You no longer have anything checking against language. Is that intentional?
It was originallypy if language and not query: level = f"-{choice([1, 2, 3, 4, 5, 6, 7, 8])}" params["r[]"] = level
Yes, because I removed the random choice for the level since that led to no results when there were results
no langauge and no params would just lead to https://codewars.com/kata/search/(langauge)
right, okay
As long as that's intended
By the way it's better to use the imperative for commits
So remove instead of removed etc.
Have approved, thanks @trail pilot 👍
Np
Btw I tested on my end and everything works fine
I was thinking to take advantage of the modular structure of events so that the code wasn’t hard to read, as packing both views in and the trivia night cog will get lengthy
The challenges PR reached to 300 lines with the view included and without it was ~220
Yea, you could have the view and button model in a separate file to the commands itself if it makes the file easier to parse
and extra 80 lines in a separate class isn't bad though, since they're clearly separated
True
I don't imagine this to take 80 lines though
Though it’s also easier to follow requested changes on my end
probably don't even need to subclass view at all
Yea, I’m planning on having the bare classes be in different files but the functionality linked in the trivia night cog
I think you need those for buttons though, right?
Or you could just subclass the button itself
you can subclass the button sure
not sure if the view needs to be subclassed or not
you may find it easier to do so to store some question data
but that's depending on your implementation
It’s easier on my end since I have the buttons which use the button decorator, and I can still pack in normal functionality for the view like the points and speed leaderboard dictionaries
Though I can take it out
That’s fine with me
Yea, I'd suggest subclassing button, rather than using the decorator for this
that way you can just define the base behaviour of a button and then init it with the label etc
Alright
I have to head to school but when I come back I can make the changes and get started on the trivia night cog
Yea no worries 🙂
Thanks for the feedback by the way!
no worries, I've recently gone through the struggle of learning the new ui stuff, so it's all fresh in my head 😛
yea it's nice
Congrats @static canyon and @brisk brook !! I knew it would happen someday
😋
Congrats @static canyon and @brisk brook!
My favorite feature is either the drop down or the ephemeral
Congrats to @static canyon and @brisk brook on contributor
@static canyon @cold island thoughts?
Looks good so far, can we add a sentence at the end saying to ask us in #dev-contrib if they have any question?
In addition to the "Chait with us in #dev-contrib ..." thing?
hmm, maybe change it "to ask what to work on" tooo "if you are ready to jump into it or have some questions". Something along the lines of that.
I think "any questions" > "some questions"
Maybe an exclamation mark instead of period at end of first paragraph and periods at the end of the 3 "where to start" bullets, and then with Akary's suggestion I think that's pretty good 👍
@vale ibex use the magic label!
lol I was in the process of adding the labels 😂
Hah
So currently, manually sorting imports is a pain, right? Well, I tried to make it painless! Lmk what you think https://github.com/python-discord/bot/pull/1872
isort is GPL 😅

Dude, don't get me scared like that
It is MIT
we're using it as a tool, the license should be irrelevant
Yea, what Numerlor says is true though,
Maybe we ignore dev deps in the linter?
Since they never ship
Eh, I would rather not take any chance and just remove it
The precommit is already checking for it
Does isort also remove the need for import order?
cool, we could remove that then
Besides the two of them aren't compatible
oh, you did
Import order is already removed, yeah
The package can be useful during dev for your ide to warn you