Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranked Choice Voting #2

Open
mikedotexe opened this issue Jun 29, 2022 · 0 comments
Open

Ranked Choice Voting #2

mikedotexe opened this issue Jun 29, 2022 · 0 comments

Comments

@mikedotexe
Copy link

mikedotexe commented Jun 29, 2022

Video explaining this:
https://youtu.be/RfxiWfmaKgU

Took me a while to make that, hopefully it's helpful.


We're going to implement ranked-choice voting for this Pollmaster bot.
Quick info here: https://en.wikipedia.org/wiki/Ranked_voting

Also, this is a good video on Ranked Choice Voting (RCV):
https://youtu.be/P10PFuBFVL8?t=16

You will have to create a Discord server and Discord bot and a in order to develop, and debug.
To create a Discord server:

create-server

To create a Discord bot (free):
https://discord.com/developers/applications

Then make sure to click around on all the settings in the sidebar, especially the Bot section. You will set up a bot and get a secret Discord token. We will use this in our launch script.

Also, get Docker installed and make sure you have Python 3.7 or above


I had to figure out how to get this running and I made some awful hacks so that the "sharding" part of the code would operate properly.

This is how I get a local Pollmaster running, after creating my own sandboxed Discord bot from above. Remember, we're using the update-requirements branch of this repo (at least right now)

First, get a Docker container going for MongoDB:

docker pull mongo:4.2.21-bionic
docker run -d -p 27017:27017 --name pollmaster-mongo mongo:4.2.21-bionic

Make sure you update your secrets.py file as mentioned in the video I recorded.

Then have two tabs open in Terminal, both inside the pollmaster project root.

Modify ./my-launch.sh to include your Discord token.

In the first tab run:
./my-launch.sh

In the second tab run:
env VALIDATOR=http://localhost:3000 yarn start

They should not have any errors.


Now clone the verification React site located at this repo:
https://github.com/starryzone/cosmos-webapp

Look in the README and copy/paste the command toward the bottom:
https://github.com/starryzone/cosmos-webapp#local-development


When we want to add Pollmaster and starrybot…

Notice how I have two Pollmasters in my bookmark bar. This is the best way to do it.
You use this link, replacing it with your Application ID from the Discord Applications page.
https://discord.com/oauth2/authorize?client_id=6666666666666666666&scope=applications.commands%20bot&permissions=8

This will allow you to add your bots to your own Discord.

Then, like the video says, we'll first add a token rule. You (the Discord admin) can use:

/starry token-rule add

and follow directions. Probably easy to have a simple rule, looking for 1 native JUNO token, since I sent everyone 6 JUNO recently.

You can then test tat it's working by running:

/starry join

This should give you a private reply in Discord with a link to your localhost that's running the Starrybot Verify React website. You should be able to sign with Keplr and see that it added a role.


Now let's run the Pollmaster advanced command, which is the one I think we'll use all the time.

pm!advanced

Will bring up a series of questions about your poll.

After everything is working locally, we can begin to work on adding additional steps, allowing users to have three choices for the poll, and write the logic for RCV. Maybe there is a step that says, "there can be X winners"

For instance, for a presidential election that might be 1 winner, but for Stargaze, they might be nominating 6 artists to appear on their homepage's launchpad. https://app.stargaze.zone/launchpad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant