Giter Club home page Giter Club logo

heyburrito's Introduction

Logo

Makes people smile Built with love

Whats Heyburrito

Heyburrito is a slack reward system that allows slack team members to recognize and reward team members who have performed well. Reward your colleagues / friends by sending them a ๐ŸŒฏ, each burrito is converted to points witch can be showed on a scoreboard. Heyburrito is like heytaco, but free and you host it yourself.

How does it work

Each burrito will increment the users "burrito" - points. And a rottenburrito will decrement "burrito" - points

Give away burrito to a colleague if they done something good. ...Or maybe a rottenburrito ( :rottenburrito: , emoji needed ) if they done something bad.. :)

Ping one or several of your colleagues and give away a burrito if they deserv it. Otherwise rottenburrito if not ...

Example:
This will increase chralps "burrito" - points by 3 @chralp :burrito::burrito::burrito: - awesome app!

This will decrease chralps "burrito" - points by 2 @chralp :rottenburrito::rottenburrito: - bad app...

This will increase chralps and fagges "burrito" - points by 2 ( each ) @chralp @fagge :burrito::burrito: - awesome app!

You can run heyburrito and disable rottenburrito by passing environment variables. By disabling decrement you can send rottenburritos but it will not decrement the users score.

In the default theme you will find filters to show diffrent leaderboards, burrito board and rottenburrito board. If env for disable decrement is passed the burrito board will not count rottenburritos. But you can see leaderboard for rottenburritos ( sent and received ).

You can also disable decrement emoji completely. This way you will not be able to send any decrement score.

Check environment variables section.

Requirments

  • slack ( of course )
  • node ( lts/erbium )

Get started

  1. Go to https://yourworkspace.slack.com/apps and search for Bots.
  2. Add Bots ( Connect a bot to the Slack Real Time Messaging API).
  3. Give the bot a name, ex: heyburrito, and obtain apiToken.
  4. Choose how to run it => See Docker or Node section .
  5. Invite the new bot to your slack channels ( where u want to be able to send burritos ).

Docker

  1. Open and edit docker-compose.yml.
  2. Set environment variables that you need / want. Check "Environment variables" for more details.
  3. docker-compose up -d.

( Dockerhub repo => https://hub.docker.com/r/chralp/heyburrito )

Node

  1. git clone [email protected]:chralp/heyburrito.git
  2. cd heyburrito
  3. npm install
  4. cp .env.example .env
  5. Set environment variables that you need / want. Check "Environment variables" for more details.
  6. npm run start

Environment Variables

ENV Variables Default Value Required Note
BOT_NAME Yes Same botname as in Get started section
DATABASE_DRIVER file No See database drivers section
DATABASE_PATH projectRoot/data/ No Only use if DATABASE_DRIVER is file and u want to change the path
MONGODB_URL Yes* Only requierd if DATABASE_DRIVER is mongodb
MONGODB_DATABASE Yes* Only requierd if DATABASE_DRIVER is mongodb
DATABASE_URI MONGODB_URL/MONGODB_DATABASE No Only in use when DATABASE_DRIVER is mongodb
SLACK_API_TOKEN Yes See Get started section
SLACK_EMOJI_INC ๐ŸŒฏ No Emoji to increment points. ex:( ๐ŸŒฏ )
SLACK_EMOJI_DEC :rottenburrito: No Emoji to decrement points. ex:( :rottenburrito: )
SLACK_DAILY_CAP 5 No Defaults to 5/day .
SLACK_DAILY_DEC_CAP 5 No separate cap ONLY IF env ENABLE_DECREMENT is set to false.
DISABLE_EMOJI_DEC false No Disable rottenburrito completely, set true to disable
ENABLE_DECREMENT true No Enable decrement of points, set false to disable
API_PATH /api/ No Must start and end with slash
WEB_PATH /heyburrito/ No Serving html from .
HTTP_PORT 3333 No For API and website
WSS_PORT 3334 No
THEME_URL https://github.com/chralp/heyburrito-theme No Pass git url to theme
THEME_LATEST false No Donwload latest from git repo on start
THEME_PATH No Pass local path to theme
LOG_LEVEL prod = info, dev = debug No levels = debug, log, warn

Database drivers

Name Recomended Note
mongodb Yes
file Yes Creates a fileDB under projectRoot/data/burrito-{ENV}.db
array No Used when testing, "memmoryDB"

Emojis

Rottenburrito and burrito emoji can be found under resources ( Burrito.png and Rottenburrito.png ). You can add the emojis in slack via the emoji toolbox => Add emoji. Its not possible to overwrite the standard burrito emoji in slack, so if you want to use heyburritos burrito emoji you can set a new name for it.

Note, set the ENV keys SLACK_EMOJI_INC and SLACK_EMOJI_DEC with the emojis that you want to use. If u want to use the standard burrito emoji and our burrito emoji you have to pass both emojis in SLACK_EMOJI_INC. ex: If you set our burrito with name :burre: . ENV SLACK_EMOJI_INC should look like this.

SLACK_EMOJI_INC :burrito:, :burre:

Theme

Defaults to heyburrito-theme. https://github.com/chralp/heyburrito-theme If you want link a theme from disk, check environment variables THEME_PATH .

Available third party themes

Name Author link
cardi-burrito tbleckert https://github.com/tbleckert/cardi-burrito

If you want your theme to be on the list, create a PR or issue!

API

Return object

{
  "error": boolean,
  "code": HTTP codes as number,
  "message": String or null,
  "data": Object or array
} 

Values

Param Value
userId slack userId
listType to / from
scoreType inc / dec

api/scoreboard

GET /api/scoreboard/<listType>/<scoreType> 

Example

GET /api/scoreboard/to/inc
{
  "error": false,
  "code": 200,
  "message": "ok",
  "data": [
    {
      "username": "USER3",
      "name": "User3",
      "avatar": "https://link.to.avatar.48.burrito",
      "memberType": "member",
      "score": 9
    },
    {
      "username": "USER5",
      "name": "User5",
      "avatar": "https://link.to.avatar.48.burrito",
      "memberType": "member",
      "score": 7
    }
  ]
}

api/userscore

GET /api/userscore/<userId>/<listType>/<scoreType> 

Example

GET /api/userscore/USER2/to/inc
{
  "error": false,
  "code": 200,
  "message": "ok",
  "data": {
    "username": "USER2",
    "name": "User2",
    "avatar": "https://link.to.avatar.48.burrito",
    "memberType": "member",
    "score": 5,
    "scoreType": "inc",
    "listType": "to"
  }
}

api/userstats

GET /api/userstats/<userId>

Example

GET /api/userstats/USER2
{
  "error": false,
  "code": 200,
  "message": "ok",
  "data": {
    "user": {
      "username": "USER2",
      "name": "User2",
      "avatar": "https://link.to.avatar.48.burrito",
      "memberType": "member",
      "receivedToday": 1,
      "givenToday": 0,
      "received": 2,
      "given": 2
    },
    "given": [
      {
        "username": "USER8",
        "name": "USER8",
        "avatar": "https://link.to.avatar.48.burrito",
        "memberType": "member",
        "scoreinc": 1,
        "scoredec": 0
      },
      {
        "username": "USER9",
        "name": "USER9",
        "avatar": "https://link.to.avatar.48.burrito",
        "memberType": "member",
        "scoreinc": 0,
        "scoredec": 1
      }
    ],
    "received": [
      {
        "username": "USER20",
        "name": "USER20",
        "avatar": "https://link.to.avatar.48.burrito",
        "memberType": "member",
        "scoreinc": 1,
        "scoredec": 0
      },
      {
        "username": "USER25",
        "name": "USER25",
        "avatar": "https://link.to.avatar.48.burrito",
        "memberType": "member",
        "scoreinc": 1,
        "scoredec": 0
      },
    ],
    "givenToday": [],
    "receivedToday": [
      {
        "username": "USER33",
        "name": "USER33",
        "avatar": "https://link.to.avatar.48.burrito",
        "memberType": "member",
        "scoreinc": 1,
        "scoredec": 0
      }
    ]
  }
}

api/userstats/today

GET api/userstats/today/<userId>

Example

GET api/userstats/today/USER2
{
   "error": false,
   "code": 200,
   "message": "ok",
   "data": {
     "givenToday": 0,
     "receivedToday": 1
  }
}

Scoreboard

Scoreboard is accessable via localhost or host on port 3333.

Showcase

From heyburrito-theme ( https://github.com/chralp/heyburrito-theme )

heyburrito's People

Contributors

chralp avatar dependabot[bot] avatar jamiewarb avatar tbleckert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heyburrito's Issues

Name change

We want to changing the name of the application from heyburrito to something else. Since the application is not bounden to burritos. It was more a fun way to get this project started.
Drop some names and star the good ones.

"Could not found bot heyburrito on slack account"

I just wanted to flag a small issue. With the BOT_NAME environment key set to heyburrito, and the options as shown in the below screenshot, the bot is unable to find the heyburrito bot on the slack account.

Changing Full Name from HeyBurrito to heyburrito fixes this. I would have expected that value to be anything, and not what is set in BOT_NAME, and instead BOT_NAME to relate to the bot account.

It may be worth clarification in the README to ensure these are the same value.

image

Level up system

New feature that enables level up / rank system.
The idea is when reach X amount of received burritos you level up and the your score starts over from 1.
Since its calculated in the code you will be able to jump between rank / level system or not without losing your total score.

Overdraw burritos

New feature to enable overdraw daily given burritos. Sometimes you maybe want to give more burritos then 5. But not increase the daily burrito cap and create a burrito inflation :) . The new idรฉ is to set up av new form of cap ( overdraw cap ), where u can set it to maybe 5 and the overdraw burritos will be draw from the users own points.
Which means that a user can send ( in this case ) up to 10 burritos per day, but 5 of those will be drawn from the users own score.

Bootscript

Script should:

  1. Check THEME env, and install theme if necessary
    EX: If you start heyburrito with env THEME=https://github.com/tbleckert/cardi-burrito,
    script should then check if theme is installed,
    if installed => pull repo to get last => set theme ENV correct so heyburrito can load it
    else => install => set theme ENV correct so heyburrito can load it

Install third party themes

config.ts should install linked git repo if THEME is provided.
ex: process.env.THEME=https://github.com/tbleckert/cardi-burrito
System should check if project folder( cardi-burrito ) exists in www/theme/.
If cardi-burrito exists under www/theme, then set THEMEpath to www/theme/cardi-burrito
Else, download theme and set THEMEpath to www/theme/cardi-burrito

General update of deps and code

  • - Change indent_size to 2, makes my eyes happier
  • - Update to node to Gallium
  • - Remove old deps and update deps
  • - Migrate to Jest from Mocha
  • - Fix test with mongodb as database
  • - Update Readme

Fail to register burritos

Issue sometimes to register several burritos.
ex: @user ๐ŸŒฏ ๐ŸŒฏ ๐ŸŒฏ ๐ŸŒฏ ๐ŸŒฏ
heyburrito registers only 3-4 sometimes.

Validation error

Validation crashes when updating / editing message sent.

/home/chralp/dev/chralp/heyburrito/app/lib/validator.ts:30
const selfMention = message.text.match(<@${message.user}>) ? true : false
^
TypeError: Cannot read property 'match' of undefined

negativ points

When received "too many" :rottenburrito: 's user gets negativ points.
Should always start and stop at 0.

Get user stats for given burritos to ?

Today we can get stats for who have been giving UserOne most burritos.
Can we to it the other way ? Do we want to do it the other way ?
Returning info of who UserOne have been giving must burritos / ruttenburritos to ?

docker-compose.yaml - wrong environment variable listed for Slack emoji decrement

Awesome App!

Mostly an FYI for others, in the sample docker-compose.yml, the rottenburrito environment variable has INC instead of DEC. We did not catch it right away and thought it wasn't working with slack.

  - "SLACK_EMOJI_INC=:rottenburrito:"   ---->       - "SLACK_EMOJI_DEC=:rottenburrito:"

Also, just curious if there would be a way to capture the comments with the burritos that are given? When/if you click on the name of the person that gave the burritos, it would show the individual comments? We will look into it too. Thanks.

Set endpoints for frontend.

Today these are accessible via socket io

on => getUserStats
emit => userStats
Result => Will return full user info with stats

2

on => getReceivedList
emit => receivedList
Result => Will return full list of all users with received stats ( orderd decending )
on => getGivenList
emit => GivenList
Result => Will return full list of all users with given stats ( orderd decending )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.