karmabot is a Slack bot that listens for and performs karma operations.
The main difference from other bots is that this one is community oriented. This means that no karma will be applied unless community react using emoji.
-
Initiate a karma voting by posting to public channels:
@karmabot @username ++ for blah blah
@karmabot @username -- for blah blah
Number of
+
or-
is limited tokarma.max_diff
points (see the Usage section below). Upvote/downvote a user by adding reactjis to their message. -
Get/set a karma of specific user by posting a direct message to karmabot.
$ pipx install https://github.com/hacklabkyiv/karmabot
$ karmabot-init
$ # update config at ~/.config/karmabot/config.yml
$ karmabot
Install docker
and then:
$ git clone https://github.com/hacklabkyiv/karmabot && cd karmabot
$ # update config at ./data/config.yml
$ docker build -t karmabot .
$ docker run -d --name karmabot --restart=unless-stopped --network=host -it karmabot
This Dockerfile
from repo contains setup for RaspberryPi.
You can modify FROM field in order to target your distro.
$ git clone https://github.com/hacklabkyiv/karmabot && cd karmabot
$ make install
$ karmabot-init
$ # update config at ~/.config/karmabot/config.yml
$ karmabot
$ pipx install https://github.com/hacklabkyiv/karmabot
$ karmabot-init
$ # update config at ~/.config/karmabot/config.yml
$ sudo wget https://raw.githubusercontent.com/hacklabkyiv/karmabot/refs/heads/main/systemd/karmabot.service -o /etc/systemd/system/karmabot.service
$ sudo systemctl start karmabot.service
$ sudo systemctl enable karmabot.service
- Add a Slack Bot integration
- Invite
karmabot
to any existing channels and all future channels - Run
karmabot
Set a channel in digest.channel
and a day of a month in digest.day
and get a monthly digest.
option | required? | description | default |
---|---|---|---|
log_level |
no | set log level | INFO |
lang |
no | options: en, uk | en |
slack_bot_token |
yes | slack bot token | |
slack_app_token |
yes | slack SocketMode app token | |
admins |
no | admins who can set karma to users | |
karma.initial_value |
no | the default amount of user karma | 0 |
karma.max_diff |
no | the maximum amount of points that users can give/take at once | 5 |
karma.vote_timeout |
no | a time to wait until a voting closes | true |
karma.upvote_emoji |
no | reactjis to use for upvotes. | +1 , thumbsup , thumbsup_all |
karma.downvote_emoji |
no | reactjis to use for downvotes. | -1 , thumbsdown |
karma.self_karma |
no | allow users to add/remove karma to themselves | false |
digest.channel |
no | channel to post digest to | |
digest.day |
no | a day when auto digest will be posted | 1 |
db |
yes | DB URI | postgresql://admin:qwe123@localhost:5432/mydb |
All the commands should be sent into direct messages to karmabot.
command | arguments | description |
---|---|---|
get | @username |
get a user's karma |
set | @username <points> |
set a user's karma to a specific number |
digest | show users' karma in descending order (zero karma is skipped) | |
pending | show pending votings | |
config | show config for this execution | |
help | show this message |
Multi-language support in this project depends on gettext
.
sudo apt-get install gettext
In order to add support for a new language one runs
msginit --no-translator -i lang/karmabot.pot -l uk_UA.UTF-8
- Basic Information
- App-Level Tokens
- Create an app token (
config.slack_app_token
)
- Create an app token (
- App-Level Tokens
- Socket Mode
- Enable Socket Mode
- Features affected
- Interactivity and Shortcuts
- Turn on
- Slash Commands
- Add
/karmabot
- Add
- Enable Events
- Subscribe to bot events:
- app_mention
- message:channels
- team_join
- Subscribe to bot events:
- Interactivity and Shortcuts
see ./LICENSE