Friday Bottle Lottery Bot for Slack
Project description
PePuBot is a Slack bot that can arrange Friday bottle lotteries on a Slack channel with a specific set of rules.
The Name
PePu comes from Finnish words “Perjantai Pullo”, which means “Friday Bottle”. Bot is shortened from Robot, as you may know. ;-)
The Rules
PePu is arranged in rounds, usually a round is arranged on every Friday, but it’s also possible to arrange a round on any other day or to skip rounds.
When a PePu round is running in a channel anyone in the channel can attend and get a new ticket to the lottery box by posting a funny picture or video to the channel.
Each attendee may get at most one new ticket to the lottery box per a PePu round. If the same person posts several pictures or videos to the PePu channel, only the first one is awarded with a ticket.
When the round is ended, the winner will be selected by randomly picking one of the tickets from the lottery box. Then all tickets of the winner will be removed from the lottery box and the rest of the tickets will be stored for the next PePu round. I.e. your chances to win increase on every round until you win.
Anyone can arrange a PePu round, but the person who starts the round should also arrange the prize bottle.
The person who starts the round also decides when the round ends and is responsible to do so before the day ends.
Requirements
To run PePuBot you need Python 3.7 and a Slack account.
Installing
Add a new app to Slack in https://api.slack.com/apps and add a bot for that app.
Enable the following permissions for the app:
bot
To act as a bot user in Slack
chat:write:bot
For writing to the channel
reactions:write
For marking ticket additions with reactions to the picture or video message.
users:read
For filling user names to the tickets
Install PePuBot and its dependencies to a Python virtual environment or to a Docker container or using whatever isolation you prefer. You may do this with a command like:
pip install .
Copy the “Bot User OAuth Access Token” value to environment variable named SLACK_API_TOKEN or to a line in a configuration file named pepubot.conf. There is a pepubot.conf.template which you can use as a base.
Note: Each configuration option can be set in the configuration file or with an environment variable with the same name. If a variable is defined in both places, the value will be read from the environment.
Start the PePuBot with the script installed by Pip:
pepubot
By default the configuration file will be read from the current working directory by name pepubot.conf, but alternative location can be given via command line argument:
pepubot --config-file /path/to/pepubot.conf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pepubot-0.1.0.tar.gz
.
File metadata
- Download URL: pepubot-0.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f09fa41c0b17bffdf7e287fd1e0cd9317df2961dd2e6f55145952e60a2c4a61f |
|
MD5 | ea8bd862ceb9de73817bdde62e6308f7 |
|
BLAKE2b-256 | 5af648549ce047e1c31697c400ea213079836e3067cd2024babdc75aef22ea84 |
File details
Details for the file pepubot-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pepubot-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d44cfb5df76a229694cc5f618ed3ff3488bff7aad9abf385fabbcfc9d9ba4cb |
|
MD5 | 8142ffe60117c2715f35b610490532f6 |
|
BLAKE2b-256 | cc7fbd20bdf898abe477ecfd76247cb4706bdf23a752a9d25cd7ed51c6f85387 |