drewfreyling / pockybot

A Webex Teams Bot that handles team recognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pockybot πŸ“πŸ‘πŸ†πŸ€–

Spark bot that handles team recognition. A chatbot for pegs & pocky.

What is Pegs & Pocky?

Pegs & Pocky was created within GlobalX as a merit-based system to encourage good behaviour and to continuously improve within our complex environment, so people are motivated to reach their full potential. It started out as a physical system of pegs and cups on everyone’s desk, however as our development team expanded interstate we needed an electronic system to include everyone. Here's how it works:

  1. Participating members acknowledge good work by giving virtual "pegs" to other members within a specified time period.
    • Each member has a maximum number of pegs they can give out within that time period.
    • If they do not give at least a minimum number of pegs then they are not eligible for winning.
  2. At the end of the time period the pegs are counted (an admin calls "finish" on the bot) and the winners are announced in the chat.
  3. The top three peg recipients get physical rewards (Pocky and/or other snacks).

Details

My name is:

How it works

  • Runs on express.js
  • Uses ciscospark client
  • Deployed only on PROD to be accessible by Cisco's Server
  • Results are stored in a postgres database
  • pegs are viewable via text file attached to spark message, txt file hosted localy on the node server, or html uploaded to google cloud

Setup

  1. npm install
  2. npm run build
  3. npm start

Usage

All commands related to PockyBot must begin with a mention of the bot. In this readme, mentions will be identified by @PockyBot.

Database

database/initial-setup includes a number of .sql files to build the database as required by PockyBot.

Table generalconfig is initialised with default values as follows:

Value Default Explanation
limit 10 The number of pegs each user is allowed to give out each cycle
minimum 5 The minimum number of pegs each user is required to give out to be eligible to win
winners 3 The number of winners displayed (using a dense ranking)
commentsRequired 1 Boolean value of whether a reason is required to give a peg
pegWithoutKeyword 0 Boolean value of whether the "peg" keyword is required to give a peg (if true, pegs can be given with @PockyBot @Person <reason>)
requireValues 1 Boolean value of whether a keyword is required in the reason for a peg to be given

Table stringconfig is used to define keywords. Name field is 'keyword' and 'value' is the value of the keyword desired. Default keywords are 'customer', 'brave', 'awesome', 'collaborative', and 'real', shorthands for the GlobalX company values.

Existing roles are 'ADMIN', 'UNMETERED', 'RESULTS', 'FINISH', 'RESET', 'UPDATE', and 'WINNERS'. Users can have more than one role. Any users with the 'ADMIN' role are considered to have all other roles except for 'UNMETERED'. 'UNMETERED' users are not restricted by the usual 'limit' value from generalconfig. All other roles relate to the commands of the same name displayed below.

Commands

  • @PockyBot welcome β€” display a welcome message.
  • @PockyBot ping β€” verify that the bot is alive.
  • @PockyBot help β€” display a list of available commands.
  • @PockyBot peg @OtherPerson <reason> β€” give a peg to @OtherPerson for <reason>.
    • If comments are required, a reason must be given. Otherwise, reasons are optional.
    • <reason> must include a keyword anywhere within it if keywords are required.
  • @PockyBot keywords β€” display the available keywords
  • @PockyBot unpeg @OtherPerson <reason> β€” pretend to remove a peg from @OtherPerson

Admin-only commands

  • @PockyBot winners β€” display the current winners
  • @PockyBot results β€” display the current full results
  • @PockyBot reset β€” remove all pegs from the database
  • @PockyBot update β€” update names stored in the database with users' current display names
  • @PockyBot finish β€” complete the cycle by displaying the winners and results before wiping the database

Contributing

Please install Editor Config for your editor of choice.

Here's a few links:

  1. Create a new branch
  2. Commit your branch
  3. And PR it

Testing

  1. npm install
  2. npm test

About

A Webex Teams Bot that handles team recognition

License:GNU General Public License v3.0


Languages

Language:TypeScript 99.9%Language:Dockerfile 0.1%