#dev-contrib
1 messages · Page 180 of 1
I actually have a 70% complete condorcet voting slash command app!
Sounds about where I am on filters 😛
Slash commands make it nice and keep votes secret until you end it
No, not at all. Feel free to ask questions.
I have everything complete except for the condorcet part >_>
Would def recommend slash commands for a voting command thing
what's the advantage of slash cmd vs button?
does it allow for voting on multiple items?
slash command will let you vote for multiple things and all the commands are within the slash command, which I like personally
but also!! with slash commands it lets you rank your choices, which is vital for condorcet voting. You can't easily do that with buttons.
yeah i'd be curious to see that, with buttons i can only think of like.. sequentially clicking them in the order of your preference but ideally.. ideally some drag and drop interface lol
tbh the few websites i've seen for condorcet voting weren't super friendly UX either
would be curious to see how it works in a slash cmd
is this anywhere we can see it?
What method do you use to resolve cycles?
It was running on my dev server off of an RPi, but that RPi has been repurposed to be a MagicMirror. I can see if I can spin it up
So that's part of the 30% I don't quite have 100% down yet. I have the algorithm to calculate the head-to-heads like halfway done. For resolving ties, I was debating between just showing both or using two alternative methods of scoring and then seeing if a common choice is majority between the three methods
Is it possible to give two choices the same rank?
yes! That's the one nice feature of the slash command, you can give the same ranking
The way I did is that you would have the choices like:
A) sdfksdf
B) sdfsdfsdfasdf
C) lwerwer
D) ap[seasd
Then to vote it would be:
/vote A, BC, D
It would rank A the highest, B/C as ties, and D last. You can also exclude options to rank them always last
icic
Wait - You can have a slash command as a reply to a poll that the bot posts?
I didn't know slash commands could be associated with other messages
This is part of my proof of concept for a replacement for our poll command
I call it Lady of the Lake
The motivation was during some of the more controversial staff meetings, when we would poll, there was a desire to do proper Condorcet voting and also have it be a bit anonymous. My Lady of the Lake was seeing if we could do that nicely with slash commands
But then I bought a house and got engaged and haven't had time to finish it out~
Or... Do you just record all the responses from the vote command and have the results button pull them in?
Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
(Quick question - What tone indicator is ~ or -?)
So flow is: /vote start title: <insert title here> choices: <choice 1> <choice 2> <etc>
The web app/bot will post a visible-to-all reply with the choices.
Participants can then vote via /vote <rank your choices with , as the split
Then the person who initiated the poll can end it and reveal results via /vote end and it'll show the results
~ is my "hi I'm friendly and mean this in a friendly way, I know I come across as a bitch online"
- is generally a break in my thoughts
That's neat
My question is - can the participants /vote automatically send their selections into the poll?
I thought slash commands were supposed to be ephemeral and you couldn't do that
Slash commands have the option for ephemeral messages, but the votes themselves are stored within the webapp/bot and then the bot will calculate the results
So... they are separate?
Calling /vote <answer> causes the bot to record your <answer> into the DB, and calling /vote results causes the bot to query the DB for the answers?
yup! /vote results or /vote end will cause no more vote submissions to be accepted though, in the true Condorcet manner. Once you view the votes, the voting ends to avoid bias
What if there are several ongoing votes
That's part of the 30% I haven't figured out. I figured I'd keep track per channel and only have one on-going vote per channel and then check where the slash command was invoked. Alternatively, you need to specify which poll you're voting in
Can slash commands work with replies?
Okay, got it
That's where I was getting stuck
I was trying to figure out how you got the respondents slash command to send data to the initiators slash command
Ah ... I'm not sure actually. I'll have to do more looking into it
I'll see if I can get a PoC on a branch within Sir Robin or Python. My current implementation didn't rely on a bot at all because it was early in the slash command existing time.
can't we use a view instead?
A view for what? Voting or something else?
voting
So you mean with buttons?
How do you give two items the same ranking with buttons? How do you track which buttons you've pressed and pressing the same button twice in one "voting" round?
It was discussed above, but I've only skimmed. My implementation was done before buttons were a thing
The latter can be solved with an ephemeral message updating the user that they voted/unvoted. But yeah it's not geared towards condorcet voting
It would be more about replicating the current feature
One issue I foresee with tying the channel to a specific vote is it doesn't work nicely with things like announcement channels
One possibility would be to generate an ID for the poll, then the command would be /vote <poll ID> options...
sorry, tone indicators always start with / or \
other markings are up to the individual for what they mean
loool, I thought you were expressing regEx or something.
I reject your reality and substitute my own
The wikipedia page lists a bunch of different methods for condorcet. However, if it's too complex to implement and you lack the time, just letting the events team decide on the tie breaker may not be so bad.
why not simple ranked-choice?
Condorcet is ranked choice
Specifically it's a type of ranked choice that elects the "Condorcet winner"
What kind of ranked choice were you referring to
the most common ranked choice is just eliminating the option with the least first-picks and reallocating votes until one of the options has a majority
the benefit here would be that it always decides a winner
I think that's called instant runoff voting
All voting methods have compromises
I like the idea of a condorcet winner
i mean, there's actually a pretty cool way to do this: ```py
edit the embed
inter.response.edit_message()
ack the button press
inter.followup.send(..., ephemeral=True)
which is best practices rather than using inter.message.edit
The potential number of simultaneous presses is still fairly high
Solid spelling
https://github.com/python-discord/sir-robin/pull/58
(check the PR description)
lmao
When I run docker-compose up inside the snekbox project, I get this error:
ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.snekbox: 'pull_policy'
What could be happening here?
you want to do docker compose up with no -. docker-compose is different than docker-compose
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
and CONTRIBUTING.md says to do docker-compose up
It seems like that is incorrect, so it looks like a fix might be wanted
this error means docker isn't running
says 1.25.0
i just installed it yesterday
what command did you run to get that?
i did what the docker website told me to
I mean to get that version number.
docker-compose version
I think it is broken, we might still be using 3.6
Which doesn’t support arrays
then it's really out of date, I am running 2.6.1
But no one catches it because on most devices it’ll fall back to the non dash version which does not care about version
The version key in the docker compose is deprecated, and ignored
i think i installed docker-compose and docker compose
Not for docker-compose
docker compose version shows v2.6.0
It is deprecated tho
then you can use that instead
docker compose up
don't they result in different behavior because of the versioning diff?
that gives me the daemon error
then you need to start docker running
how do I start it up?
what os?
Im on WSL Ubuntu
They result in different behavior on some installations because our actual compose is technically incorrect for the version specified
I actually have a PR on site which bumps the version
If you use the dash version on it, you can get it to error
If you use the non-dash it’ll work
sudo docker -d should do it
unknown shorthand flag: 'd' in -d
I thought ever since 1.27.0 it is ignored
by both docker-compose and docker compose
that's what the compose spec says anyway
I can drop the version in my docker-comopse.yaml right down and the new stuff still works, so I am tempted to say that is right
It might be, but it doesn’t seem to do that locally. I don’t know what version I’m on, but I do keep desktop up to date
It might not be updating the other
try sudo service docker restart instead
what version of docker-compose do you have?
didn't work
I don’t have PC access atm
what does sudo service docker status say?
Docker is not running
does running sudo service docker start change that?
yes
its running now
docker compose up gives Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dsnekbox%22%3Atrue%7D%7D&limit=0": dial unix /var/run/docker.sock: connect: permission denied
we're making progress 🗿
you likely haven't setup sudo-less docker
you can run under sudo for now
or follow the post-install steps on the docker install guide
The first heading on there sounds right, so yea
No worries :)
I don't think Docker Compose v1.x supports pull_policy.
Yea, it doesn't
So yes, the instructions should be updated
the instructions are correct, the user just had an old version installed
Oh they state docker compose as the cmd?
The docs have docker-compose
The latest of which is on 2.6.1
IE I can run snekbox just fine on docker-compose
we can update the docs so that we cover ourselves for future though, as docker-compose is deprecated now
I thought docker-compose still referred to v1 and docker compose to v2. Unless Docker was updated to alias the former to the latter finally.
but at least for the time being it works
Running on windows docker desktop with compose v2 enabled it works fine on my machine
other os's and setups may be different of course
On other installs it’s a mixed bag
You know all OSes have desktop?
lol what, even linux?
Yeah lmao
xd
what do you mean?
Docker desktop is a gui version of docker
It’s available on windows, Mac, and certain Linux based systems
almost all linux based has
this is really weird though, since containers are named differently still
I wonder if it's some weird pseudo alias that pushes extra config to the docker compose cli
Lol wouldn’t surprise me anymore, the entire thing is messy
hah yea
docker-compose uses hyphens to separate contains from their IDs
docker compose uses underscores
Some golang jank
Should use spaces
@gritty wind Should async redis cache be using redis instead of aioredis given the former has merged into the latter? Will the latter even be receiving future updates?
So to answer your original question Mark, we probably should update the docs to say docker compose since docker-compose will only work as an alias in some configurations
It won’t, and that’s the plan for a feature release once the candidate is stable (should we do it in another rc instead?)
Btw I asked them on aioredis to write some fucking docs lol
SebastiaanZ/async-rediscache#19
Ok you're way ahead of me
We could do the migration now and publish it as rc2
If someone does that soon, I can review it
I think we’re supposed to keep it a little lower for compatibility
I hate working on libs lol
not sure what the comparable version is
possibly 4.2
so might just need some investigation on the minor version changes
the breaking changes from 4.2 to 4.3 don't sound like they'd affect us
but of course it being a lib means it may affect someone lol
Replace OSError exceptions from can_read with redis.ConnectionError
yea dude, screw semver
They could be like bot core and be on version 7 after half a year 😎
Dude we are so good it’s insane
excited
Pydis efficiency
when I bump async-rediscache and Python 3.10
Is that a breaking change lol
async redis cache will be
Ah true
That is the type of dedication and research I expect of a devops member
Well done good sir
lol
thanks
I wonder if you can get py3 running on DOS
probably not
Maybe some older Python2 versions if it's 32-bit DOS
You guys wanna leave feedback on this 🥺 https://github.com/python-discord/snekbox/issues/148
I like, nice stuff
To this day this is still the most cursed import statement I've ever seen
lol
@tawdry vapor I've never actually deployed to GH pages myself. AFAIK if we have some static HTML, maybe generated by redoc? we can throw some magic CI at it and it just works
@gritty wind is that at least semi-correct?
Yeah it’s literally just a single line in actions lol
cool cool
.github/workflows/docs.yaml lines 35 to 42
- name: Generate HTML Site
run: sphinx-build -nW -j auto -b html docs docs/build
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: docs-latest
path: docs/build/*```
AH cool, so we'd just need something to build the html from the openapi.json
The one below
Yeah
oh, so we could just have some CF worker running redoc that just points to the openapi json in the repo
If we don’t need it on GH pages yeah
I don't really care if it's on GH pages or not. Whatever is less effort
Just a means to an end
I think if you want the schema on the main branch
Yea, if it's just a few lines of HTML like in the example you linked, then we can just put it in a worker and point the worker at the openapi.json on main
It’ll be the same effort regardless
So we'd just need something to ensure the OpenAPI json is up to date before merging to main
Hmm that sounds a bit difficult because when would you build
DO you have any concept of the order of magnitude to generate the openapi spec?
If you instead have CI build on push to main and commit
On forms it’s instant
we could just have it build in CI and compare the build vs the spec in the repo
and error if there's a diff
Some pre-commit hook that diffs a new build vs the current build seems like it would work
add it to the linting flow
if snekbox has one
Do you think that's better than autogenerating it and making a commit
we could do that on push to main
I think that decision can be made once we know for sure it runs quickly
But it sounds good
might just result in more commits editing it than needed, if the PR author also updates to see what it would look like
If we’re happy with generating and committing the schema in general, I think you could move forward and we’ll revisit the spot where it happens once we have the data
Actually that sounds messy cause the CI is set up to release for every push to main. So if CI itself pushes to main it will trigger the release again?
very possible yea
Infinite releases lol
Would be less messy if the spec was auto pushed to the GH pages repo, if we use that
Would you use a different repo? I just assumed different branch
Oh can that work
At least that’s how GitHub implies you should do it I think
It might be wrong, because you do end up with a wildly wrong diff
Which I’ve seen confuse people
Chris 👀
https://github.com/python-discord/bot-core/tree/docs this is with the GH action
I pulled it aside to have a couple words
Nah no clue
