This is a simple bot that just keeps track of scoring for different users.
Installation is pretty straightforward, you need to have access to the slack integration parts, and your server needs PHP with curl.
You'll need a server with php. (And it needs curl)
- Clone the repo anywhere on the server
- Copy the
/config.example.php
toconfig.php
and edit it with the correct values for your slack - Add an empty file in
data/users.json
, this is the datastore for all the scores and users. - Point your webserver to the
/public/
folder.
- Add an
incoming webhook
, copy the webhook url to theconfig.php
. - Add a
Slack command
called/score
and point the command to your server. - Add a
Bot User
, copy the API Token, and add it to thebotToken
inconfig.php
. If you leave this empty, user names won't be checked with slack.
/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 scoreint
to userstr
(/score -1 fooBar removes one point from user fooBar), this command will issue an output to the #general channel. If the userstr
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)
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
- The IOC is powered by Dice