All Projects → kamaln7 → karmabot

kamaln7 / karmabot

Licence: MIT License
upvotes and downvotes for slack

Programming Languages

go
31211 projects - #10 most used programming language
CSS
56736 projects
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to karmabot

captcha-generator
An NPM package to generate captcha images that can be used in Discord bots or various other projects
Stars: ✭ 45 (+87.5%)
Mutual labels:  slack, slack-bot
git-slack-notify
Sends Slack notifications for new commits in Git repositories
Stars: ✭ 12 (-50%)
Mutual labels:  slack, slack-bot
Yasuf
Very simple way of controlling your Python application via Slack
Stars: ✭ 23 (-4.17%)
Mutual labels:  slack, slack-bot
slack-mock
A Slack API mocker for Slack bot integration tests.
Stars: ✭ 61 (+154.17%)
Mutual labels:  slack, slack-bot
dienstplan
Slack bot app for duty rotations
Stars: ✭ 14 (-41.67%)
Mutual labels:  slack, slack-bot
Ferdi
🧔🏽 Ferdi helps you organize how you use your favourite apps by combining them into one application
Stars: ✭ 4,089 (+16937.5%)
Mutual labels:  slack, productivity
SlackLateX
Bot that posts posts Latex pictures
Stars: ✭ 39 (+62.5%)
Mutual labels:  slack, slack-bot
Secret Santa
🎅 The code behind Secret Santa, the holiday bot for Slack / Discord / Zoom
Stars: ✭ 170 (+608.33%)
Mutual labels:  slack, slack-bot
node-slack-events-api
Slack Events API for Node
Stars: ✭ 93 (+287.5%)
Mutual labels:  slack, slack-bot
slack-php-app-framework
Robust PHP framework for building Slack apps in PHP
Stars: ✭ 29 (+20.83%)
Mutual labels:  slack, slack-bot
Sactive Bot
😈 An extensible chat bot framework. sactive-bot is an evolution of the open source hubot project. - https://www.shipengqi.top/sactive-bot .
Stars: ✭ 212 (+783.33%)
Mutual labels:  slack, slack-bot
iou-slack-bot
💸 IOU Slack Bot - Keep track of your debts with your peers.
Stars: ✭ 13 (-45.83%)
Mutual labels:  slack, slack-bot
Go Sarah
Simple yet customizable bot framework written in Go.
Stars: ✭ 188 (+683.33%)
Mutual labels:  slack, slack-bot
Awesome Bots
The most awesome list about bots ⭐️🤖
Stars: ✭ 2,864 (+11833.33%)
Mutual labels:  slack, slack-bot
Chatskills
Run and debug Alexa skills on the command-line. Create bots. Run them in Slack. Run them anywhere!
Stars: ✭ 171 (+612.5%)
Mutual labels:  slack, slack-bot
emojibot
Emojibot is a Slack bot that announces new custom emoji to a specific channel.
Stars: ✭ 17 (-29.17%)
Mutual labels:  slack, slack-bot
Php Slack Bot
Slack bot user written in PHP
Stars: ✭ 161 (+570.83%)
Mutual labels:  slack, slack-bot
Fantasy football chat bot
GroupMe Discord and Slack Chatbot for ESPN Fantasy Football
Stars: ✭ 166 (+591.67%)
Mutual labels:  slack, slack-bot
slack widgets
An abstraction of the JSON structure needed to create widgets in Slack message attachments
Stars: ✭ 14 (-41.67%)
Mutual labels:  slack, slack-bot
SlackWebhooksGithubCrawler
Search for Slack Webhooks token publicly exposed on Github
Stars: ✭ 21 (-12.5%)
Mutual labels:  slack, slack-bot

karmabot logo

Build Status

karmabot is a Slack bot that listens for and performs karma operations (aka upvotes/downvotes).

usage screenshot

Syntax

  • upvote a user: <user>++
  • downvote a user: <user>--
  • add/subtract multiple points at once:
    • <user>++ - 1 point
    • <user>+++ - 2 points
    • and so on, limited to maxpoints points (see the Usage section below)
  • add a message/reason for a karma operation:
    • <user>++ for <message>; or
    • <user>++ <message>
  • query a user's current points: <user>==
  • upvote/downvote a user by adding reactjis to their message
  • motivate.im support:
    • ?m <user>
    • !m <user>
  • leaderboard:
    • <karma|karmabot> <leaderboard|top|highscores>
    • to list more than leaderboardlimit (see the Usage section below), you may append the number of users to list to the command above. e.g. karmabot top 20
  • user aliases:
    • it is possible to alias different usernames to one main username by passing the aliases as a cli option to the karmabot binary. syntax: -alias main++alias1++alias2++...++aliasN
    • repeat the option for every alias that you want to configure
  • karma throwback:
    • <karma|karmabot> throwback [user]
    • returns a random karma operation that happened to a specific user.

note: <user> does not have to be a Slack username. However, karmabot supports Slack autocompletion and so the following messages are parsed correctly:

  • @username: ++
  • @username++
  • username ++
  • !m @username:
  • etc.

Installation

Use the Docker images

  • kamaln7/karmabot:latest
  • kamaln7/karmabot:latest-webui
  • kamaln7/karmabotctl:latest

Download a Pre-built Release

  1. head to the repo's releases page and download the appropriate latest release's binary for your system

Build from Source

  1. clone the repo (find the latest version number in the releases page):
    1. git clone -b v1.5.2 https://github.com/kamaln7/karmabot.git
    2. cd karmabot
  2. install dependencies
    1. run go mod download
  3. run go build in /cmd/karmabot and /cmd/karmabotctl 2. cd cmd/karmabot 3. go build 4. cd ../karmabotctl 5. go build

Usage

  1. add a Slack Bot integration: https://team.slack.com/apps/A0F7YS25R-bots. an avatar is available here.
  2. invite karmabot to any existing channels and all future channels (this is a limitation of Slack's bot API, unfortunately)
  3. run karmabot. the following options are supported. you can use environment variables as well, but any CLI options you pass will take precedence.
option required? description default env var
-token string yes slack RTM token KB_TOKEN
-debug=bool no set debug mode false KB_DEBUG
-db string no path to sqlite database ./db.sqlite3 KB_DB
-leaderboardlimit int no the default amount of users to list in the leaderboard 10 KB_LEADERBOARDLIMIT
-maxpoints int no the maximum amount of points that users can give/take at once 6 KB_MAXPOINTS
-motivate=bool no toggle motivate.im support true KB_MOTIVATE
-blacklist string no may be passed multiple times blacklist string i.e. ignore karma commands for string [] KB_BLACKLIST
-reactji bool no use reactji (👍 and 👎) as reaction events true KB_REACTJI
-reactjis.upvote string no may be passed multiple times a list of reactjis to use for upvotes. for emojis with aliases, use the first name that is shown in the emoji popup +1, thumbsup, thumbsup_all KB_REACTJIS_UPVOTE
-reactjis.downvote string no may be passed multiple times a list of reactjis to use for downvotes. for emojis with aliases, use the first name that is shown in the emoji popup -1, thumbsdown KB_REACTJIS_DOWNVOTE
-alias string no may be passed multiple times alias different users to one user. syntax: -alias main++alias1++alias2++...++aliasN KB_ALIAS
-selfkarma bool no allow users to add/remove karma to themselves true KB_SELFKARMA
-replytype string no whether to reply in channel (message), in a new thread under the user's message (thread), or only visible to the acting user (ephemeral) message KB_REPLYTYPE

In addition, see the table below for the options related to the web UI.

example: ./karmabot -token xoxb-abcdefg

It is recommended to pass karmabot's logs through humanlog. humanlog will format and color the JSON output as nice easy-to-read text.

Web UI

karmabot includes an optional web UI. The web UI uses TOTP tokens for authentication. While the token itself would only be valid for 30 seconds, once you have authenticated, you will stay so for 48 hours, after which your session will expire. This is not meant to be a fully-featured advanced authentication system, but rather a simple way to keep off people who do not belong to your Slack team.

How to use the Web UI

Requisites

  1. download the www directory from the repo's root and place it in a directory that is accessible to karmabot.
  2. run ./karmabot -token x -webui.listenaddr x -webui.path x. You may keep all the options set to x, as they will not be used at all. karmabot will generate a random TOTP key for you to use, print it, and exit. Copy that token.

Start karmabot

Once you have performed the steps detailed above, pass the necessary options to the karmabot binary. You can use environment variables as well, but any CLI options you pass will take precedence.

option required? description default env var
-webui.listenaddr string yes the address (host:port) on which to serve the web UI KB_WEBUI_LISTENADDR
-webui.totp string yes the TOTP key (see above) KB_WEBUI_TOTP
-webui.path string yes path to the www directory (see above) KB_WEBUI_PATH
-webui.url string no the URL which karmabot should use to generate links to the web UI (without a trailing slash!) defaults to http://webui.listenaddr KB_WEBUI_URL

If done correctly, the web UI should be accessible on the webui.listenaddr that you have configured. The web UI will not be started if either of webui.listenaddr or webui.path are missing.

Usage

The web UI is authenticated, so you will have to generate authentication tokens through karmabot. You can access the web UI by typing karmabot web in the chat. karmabot will generate a TOTP token, append it to the webuiurl and send back the link. Click on the link and you should be authenticated for 48 hours.

Additionally, you may use also use the link provided in the Slack leaderboard (karmabot leaderboard) in order to log in and access the leaderboard.

karmabotctl

karmabot comes with a maintenance tool called karmabotctl. It can be used to perform certain tasks without having to run karmabot itself.

Commands

A list of all arguments for each command can be printed by running karmabotctl karma migrate --help. In addition to the arguments listed in the tables below, some commands may also require a <db> argument containing the path to the database file.

karma

command arguments description
add <from> <to> <reason> <points> add karma to a user
migrate <from> <to> move a user's karma to another user
reset <user> reset a user's karma
set <user> <points> set a user's karma to a specific number
throwback <user> get a karma throwback for a user

webui

command arguments description
serve <debug> <leaderboardlimit> <totp> <path> <listenaddr> <url> start a webserver
totp <totp> generate a TOTP token based on the passed secret

License

see ./LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].