Karmabot is a Slack Slash Command that candivvy out “Kᴀʀᴍᴀ” credits to users (and even take from them). Users can be added to and removed from the database via Karmabot itself using the commands laid out below.
Karmabot has an array of responses while performing commands, ranging from adding and removing Kᴀʀᴍᴀ from a user, to even adding a new user to the database. While performing Kᴀʀᴍᴀ based tasks, such as resetting or adding Kᴀʀᴍᴀ to a user’s balance, there is a small chance of a “rare” or “legendary” response. Currently the response options are an array, and the array has a random item selected from it.
Standard Kᴀʀᴍᴀ balance is denoted in backticks (grave symbol) when displayed, with the Gemstone unicode icon
U+1F48E like so:
@alex now has
Karmabot stores all Kᴀʀᴍᴀ values in a database, which is configured in the
/config/config.php file. The database format is currently as follows:
id- An Auto-Increment field to track users.
users- A string with the user's
gender- A string
ffor gender based responses.
karma_received- An int field that tracks their Kᴀʀᴍᴀ.
karma_given- (Unused) Contains how much Kᴀʀᴍᴀ they've given out, total.
karma_available- (Unused) Resets to 100 daily. Contains how much Kᴀʀᴍᴀ they can give out.
Currently, I've set both
/karmabot, as Slash Commands, since it feels more natural to invoke karmabot using proper speech which can include an immediate comma which breaks the command
/karmabot. Below is a list of commands and arguments that karmabot knows and can parse.
/karmabot -help- Display some quick tips.
/karmabot -joke- Display a joke (currently disabled, some NSFW jokes showed up).
/karmabot -leaderboard- Display the leaderboard in descending order.
/karmabot, give @alex +10 karma- Add Kᴀʀᴍᴀ to a user’s balance.
/karmabot, take -10 karma from @alex- Subtract Kᴀʀᴍᴀ from a user’s balance.
/karmabot @alex -sudo --reset- Reset a user’s Kᴀʀᴍᴀ back to 0.
/karmabot add new player @name "m/f"- Add users to the game! “m” or “f” is required for gender pronoun selection.
/karmabot remove player @name- Being a party pooper? Drop them from the game.
/karmabot, how much karma does @alex have?- If a Kᴀʀᴍᴀ function isn’t ran, it will run a Kᴀʀᴍᴀ balance query instead.
build Getting StartedBleeding Edge: cloud_download download the development source package.
- Karmabot is not production ready, and thus isn't in the Slack repository.
- There is no prepackaged
.zipfile, use the master branch.
- After downloading the src, upload it to your server.
- Set up your database and place the information in /config/config.php (Note: Use the /config/config.sample.php as a template)
- First you'll need to set up a Slack Slash Command.
- Click on Add Configuration.
- For Command type /karmabot (I recommend making another configuration for /karmabot, as well)
- For URL use the url to your /karmabot.php file.
- Method should be set to POST.
- (Note: I've been using "-help" for options for the Usage Hint).
- Click Save Integration.
- In Slack, use /karmabot followed by a command above.
- The command list will continue to be updated, check back to download new master branch sourcesm, or add your own commands!
access_time Planned Features
- I’d like to have better “failure” notices, if the /karmabot command fails, or the mysqli query fails.
- I’d like to have a daily or weekly cap, whether it limits users giving, or users receiving. Like a max of me giving any combo of people 100 Kᴀʀᴍᴀ in a day, or have a max of being able to receive 100.
- I’d like a lottery system, perhaps making use of Action Buttons.
- I’d like “admin only” options, like “reset”, which would notify me (or an admin that’s defined in the db)
- I’d like some better “human-like” logic/