Skip to content

waybetterdev/Karma_Bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Karma_Bot

A basic karma bot for Slack. This is basically a Slack bot to track karma using a REDIS database as a storage system.

The setup of the program is as follows:

Let's say slack pings the program with a message.

  1. app.js recieves the message
  2. app.js redirects it to karmabot.js
  3. karmabot.js processes the message and spits back a return message.

As for funcitons within the chat:

Lets take an example of "@xephos"

  • To up vote: @xephos++
  • To down vote: @xephos--
  • To check karma: karma value @xephos

Function Refrence

module.exports

This function processes the message sent from the Slack outgoing webhooks.

deliverPayload()

This function takes the botPrePayload created in module.exports and sends it out as a response to Slack.

karma(item)

This processes the input from the if statement when the text is for karma value.

karmaVote(item)

This processes the input from the if statement when the text is from a vote.

processVoteMessage(msg)

This votes for or against someone based off of the msg inserted.

processIsVoteMessage(msg)

This is used to check if something is a vote message within module.exports.

processKarmaMessage(msg)

This is used to check if something is a karma value message within module.exports. This is also used to return the karma value of an item.

vote(item, ballot)

This just a simple function to pass from processVoteMessage to addValue.

addItem(item, value)

This hits the REDIS server and adds or subtracts the value.

About

A basic karma bot for slack.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%