#dev-contrib

1 messages · Page 180 of 1

cold island
#

Ok, I'm going to do some homework before I waste your time with more questions, I clearly don't understand the mechanism

thorny obsidian
#

I actually have a 70% complete condorcet voting slash command app!

cold island
#

Sounds about where I am on filters 😛

thorny obsidian
#

Slash commands make it nice and keep votes secret until you end it

molten perch
thorny obsidian
#

I have everything complete except for the condorcet part >_>

#

Would def recommend slash commands for a voting command thing

hoary haven
#

what's the advantage of slash cmd vs button?

#

does it allow for voting on multiple items?

thorny obsidian
#

slash command will let you vote for multiple things and all the commands are within the slash command, which I like personally

thorny obsidian
hoary haven
#

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

wild prism
tawdry vapor
#

What method do you use to resolve cycles?

thorny obsidian
thorny obsidian
# tawdry vapor What method do you use to resolve cycles?

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

cold island
#

Is it possible to give two choices the same rank?

thorny obsidian
#

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

cold island
#

icic

outer oasis
#

I didn't know slash commands could be associated with other messages

thorny obsidian
#

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~

outer oasis
#

Or... Do you just record all the responses from the vote command and have the results button pull them in?

outer oasis
outer oasis
thorny obsidian
#

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

thorny obsidian
#

- is generally a break in my thoughts

outer oasis
thorny obsidian
outer oasis
thorny obsidian
cold island
#

What if there are several ongoing votes

thorny obsidian
#

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

cold island
#

Can slash commands work with replies?

outer oasis
thorny obsidian
#

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.

atomic ivy
#

can't we use a view instead?

thorny obsidian
#

A view for what? Voting or something else?

atomic ivy
#

voting

thorny obsidian
#

So you mean with buttons?

atomic ivy
#

yep

#

or is that something that's already been discussed 😅

thorny obsidian
#

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

cold island
#

It would be more about replicating the current feature

gritty wind
#

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...

full fractal
#

other markings are up to the individual for what they mean

molten perch
outer oasis
tawdry vapor
wild prism
#

why not simple ranked-choice?

tawdry vapor
#

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

wild prism
#

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

tawdry vapor
#

I think that's called instant runoff voting

#

All voting methods have compromises

#

I like the idea of a condorcet winner

fallen patrol
#

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

cold island
clever wraith
#

Solid spelling

molten perch
clever wraith
#

lmao

jolly parcel
#

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?

thorny obsidian
jolly parcel
#

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

vale ibex
#

either will work

#

what version of docker-compose do you have?

vale ibex
jolly parcel
#

i just installed it yesterday

vale ibex
#

what command did you run to get that?

jolly parcel
#

i did what the docker website told me to

vale ibex
#

I mean to get that version number.

jolly parcel
#

docker-compose version

gritty wind
#

Which doesn’t support arrays

vale ibex
gritty wind
#

But no one catches it because on most devices it’ll fall back to the non dash version which does not care about version

vale ibex
jolly parcel
#

i think i installed docker-compose and docker compose

gritty wind
jolly parcel
#

docker compose version shows v2.6.0

gritty wind
#

It is deprecated tho

vale ibex
#

docker compose up

thorny obsidian
jolly parcel
vale ibex
jolly parcel
#

how do I start it up?

vale ibex
#

what os?

jolly parcel
#

Im on WSL Ubuntu

gritty wind
#

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

vale ibex
jolly parcel
#

unknown shorthand flag: 'd' in -d

vale ibex
#

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

gritty wind
#

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

vale ibex
vale ibex
jolly parcel
gritty wind
vale ibex
jolly parcel
#

Docker is not running

vale ibex
#

does running sudo service docker start change that?

jolly parcel
#

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 🗿

vale ibex
#

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

jolly parcel
#

ah yeah

vale ibex
#

The first heading on there sounds right, so yea

jolly parcel
#

aight thanks

#

first time using Docker, sorry for the trouble

vale ibex
#

No worries :)

tawdry vapor
#

I don't think Docker Compose v1.x supports pull_policy.

vale ibex
#

Yea, it doesn't

tawdry vapor
#

So yes, the instructions should be updated

vale ibex
#

the instructions are correct, the user just had an old version installed

tawdry vapor
#

Oh they state docker compose as the cmd?

vale ibex
#

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

tawdry vapor
#

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.

vale ibex
#

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

gritty wind
#

I’ve looked into this last time

#

On docker desktop it’s a direct alias

vale ibex
gritty wind
#

On other installs it’s a mixed bag

vale ibex
#

ah, well clearly this means windows is the best OS ever

#

thanks Scale

gritty wind
#

You know all OSes have desktop?

vale ibex
#

lol what, even linux?

gritty wind
#

Yeah lmao

dusty wolf
#

xd

vale ibex
#

is the daemon still ran in a "vm"

#

or is it native on unix systems?

dusty wolf
gritty wind
#

Docker desktop is a gui version of docker

#

It’s available on windows, Mac, and certain Linux based systems

dusty wolf
vale ibex
#

I wonder if it's some weird pseudo alias that pushes extra config to the docker compose cli

dusty wolf
#

idk why I like linux but using win

#

haha

gritty wind
vale ibex
#

hah yea

#

docker-compose uses hyphens to separate contains from their IDs

#

docker compose uses underscores

#

Some golang jank

gritty wind
#

Should use spaces

tawdry vapor
#

@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?

vale ibex
#

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

gritty wind
#

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

vale ibex
#

SebastiaanZ/async-rediscache#19

dusky shoreBOT
tawdry vapor
#

Ok you're way ahead of me

gritty wind
#

We could do the migration now and publish it as rc2

#

If someone does that soon, I can review it

vale ibex
#

4.3.4 is a thing now too

#

could just bump to that

gritty wind
#

I think we’re supposed to keep it a little lower for compatibility

#

I hate working on libs lol

vale ibex
#

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

gritty wind
#

Breaking changes? In a feature version

#

Great stuff

vale ibex
#

yea dude, screw semver

tawdry vapor
#

They could be like bot core and be on version 7 after half a year 😎

vale ibex
#

version 8 soon

gritty wind
#

Dude we are so good it’s insane

tawdry vapor
#

excited

gritty wind
#

Pydis efficiency

vale ibex
#

when I bump async-rediscache and Python 3.10

gritty wind
#

Is that a breaking change lol

vale ibex
#

async redis cache will be

gritty wind
#

Ah true

vale ibex
#

also, 3.10 required OpenSSL 1.1.1 or newer

#

might be breaking if you're running on DOS

gritty wind
#

That is the type of dedication and research I expect of a devops member

#

Well done good sir

vale ibex
#

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

gritty wind
#

Can you get docker running

#

Can you get a win 11 installer running

#

This can work

tawdry vapor
gritty wind
#

I like, nice stuff

cold island
vale ibex
#

@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?

gritty wind
#

Yeah it’s literally just a single line in actions lol

vale ibex
#

cool cool

gritty wind
#

Wait let me grab the botcore version

stable mountainBOT
#

.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/*```
gritty wind
#

This is literally it lol

#

Wait no

vale ibex
#

AH cool, so we'd just need something to build the html from the openapi.json

gritty wind
#

The one below

tawdry vapor
#

See my comment on GH

#

We don't need to build HTML I think

vale ibex
#

oh, so we could just have some CF worker running redoc that just points to the openapi json in the repo

gritty wind
#

If we don’t need it on GH pages yeah

tawdry vapor
#

I don't really care if it's on GH pages or not. Whatever is less effort

#

Just a means to an end

gritty wind
#

I think if you want the schema on the main branch

vale ibex
#

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

gritty wind
#

It’ll be the same effort regardless

vale ibex
#

So we'd just need something to ensure the OpenAPI json is up to date before merging to main

gritty wind
#

Hmm that sounds a bit difficult because when would you build

vale ibex
#

DO you have any concept of the order of magnitude to generate the openapi spec?

gritty wind
#

If you instead have CI build on push to main and commit

vale ibex
#

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

gritty wind
#

Which is using the first

#

The first being spectree lol

vale ibex
#

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

tawdry vapor
#

Do you think that's better than autogenerating it and making a commit

vale ibex
#

we could do that on push to main

gritty wind
#

I think that decision can be made once we know for sure it runs quickly

#

But it sounds good

vale ibex
#

might just result in more commits editing it than needed, if the PR author also updates to see what it would look like

gritty wind
#

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

tawdry vapor
#

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?

vale ibex
#

very possible yea

gritty wind
#

Infinite releases lol

tawdry vapor
#

Would be less messy if the spec was auto pushed to the GH pages repo, if we use that

gritty wind
#

Would you use a different repo? I just assumed different branch

tawdry vapor
#

Oh can that work

gritty wind
#

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 👀

vale ibex
#

yea dude

#

I was so close to deleting it

#

huh did lance just die

gritty wind
gritty wind
#

Nah no clue

tawdry vapor
#

I think it will be best to rely on a pre-commit hook

#

Mainly because if the spec changes, the API version needs to be bumped

#

And someone requested we version the API, which I don't really mind doing.