Skip to content

A bot for keeping track on score for different users on a slack team

Notifications You must be signed in to change notification settings

kurthopfer/slack-score-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack score bot

This is a simple bot that just keeps track of scoring for different users.

Installation

Installation is pretty straightforward, you need to have access to the slack integration parts, and your server needs PHP with curl.

Server

You'll need a server with php. (And it needs curl)

  1. Clone the repo anywhere on the server
  2. Copy the /config.example.php to config.php and edit it with the correct values for your slack
  3. Add an empty file in data/users.json, this is the datastore for all the scores and users.
  4. Point your webserver to the /public/ folder.

Slack

  1. Add an incoming webhook, copy the webhook url to the config.php.
  2. Add a Slack command called /score and point the command to your server.
  3. Add a Bot User, copy the API Token, and add it to the botToken in config.php. If you leave this empty, user names won't be checked with slack.

Commands

  • /score list will output a list with current score for all users (it will only be visible for the user issuing the command, it will not be visible in the channel).
  • /score [int] [str] adds score int to user str (/score -1 fooBar removes one point from user fooBar), this command will issue an output to the #general channel. If the user str doesn't exist, a new one will be created with that name.
  • /score [int] [str] [str] same as previous, but the second string will be used instead of the phrases, the custom message will be outputted as @from: custom message (@foobar -1)

Users.json

The /data/users.json file is just a json file with an array of objects, each object represents a user.

[
    {
        "name": "fooBar", // The slack name
        "score": -5, // The current score
        "alias": [ // additional names that this user should respond to, these may NOT contain whitespaces!
            "foobar",
            "foo",
            "bar"
        ]
    }
]

You can change the location of the user file in the /config.php

Credits

  • The IOC is powered by Dice

About

A bot for keeping track on score for different users on a slack team

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%