npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-plusplus-expanded

v3.5.9

Published

A hubot script for micro praise

Downloads

90

Readme

hubot-plusplus-expanded


Known Vulnerabilities Node CI

Give or take away points. Keeps track and even prints out graphs.

API


  • <name>++ [<reason>] - Increment score for a name (for a reason)
  • <name>-- [<reason>] - Decrement score for a name (for a reason)
  • {name1, name2, name3}++ [<reason>] - Increment score for all names (for a reason)
  • {name1, name2, name3}-- [<reason>] - Decrement score for all names (for a reason)
  • <bot_name> score <name> - Display the score for a name and some of the reasons
  • bot_name top <amount> - Display the top scoring
  • bot_name bottom <amount> - Display the bottom scoring
  • bot_name erase <name> [<reason>] - Remove the score for a name (for a reason)
  • how much are bot_name points worth (how much point) - Shows how much hubot points are worth

Uses Hubot brain. Also exposes the following events, should you wish to hook into it to do things like print out funny gifs for point streaks:

PlusPlusEvent Class

robot.emit("plus-plus",
[
  {
    name: 'Jack'
    direction: '++' # (or --)
    room: 'chatRoomAlpha'
    reason: 'being awesome'
  }
]);

Installation

This is a plugin for Hubot and should be installed as a consumed package by a hubot.

Run the following command

npm install hubot-plusplus-expanded

Then to make sure the dependencies are installed:

npm install

To enable the script, add a hubot-plusplus-expanded entry to the external-scripts.json file (you may need to create this file).

["hubot-plusplus-expanded"]

Configuration

Some of the behavior of this plugin is configured in the environment:

HUBOT_PLUSPLUS_KEYWORD - the keyword that will make hubot give the score for a name and the reasons. For example you can set this to "score|karma" so hubot will answer to both keywords. If not provided will default to score

HUBOT_PLUSPLUS_REASONS - the text used for the word "reasons" when hubot lists the top-N report, default reasons.

HUBOT_PLUSPLUS_REASON_CONJUNCTIONS - a pipe separated list of conjunctions be used when specifying reasons. The default value is for|because|cause|cuz|as|porque. E.g. "foo++ for being awesome" or "foo++ cuz they are awesome".

MONGODB_URI | MONGO_URI | MONGODB_URL | MONGOLAB_URI | MONGOHQ_URL - the uri of the mongo instance that hubot will use to store data. (default: 'mongodb://localhost/plusPlus').

HUBOT_SPAM_MESSAGE - the text that will be used if a user hits the spam filter. (default: Looks like you hit the spam filter. Please slow your role.).

HUBOT_COMPANY_NAME - the name of the company that is using hubot (default: Company Name).

HUBOT_PEER_FEEDBACK_URL - this is the message that will be used if a user gives HUBOT_FURTHER_FEEDBACK_SCORE points to another user (default: 'Lattice' (https://${companyName}.latticehq.com/)).

HUBOT_FURTHER_FEEDBACK_SCORE - the score that would add a suggestion to provide the user with more feedback (default: 10).

Required There needs to be an index on the scoreLogs table for a TTL or the user will only be able to send one ++|-- before they will be spam blocked. db.scoreLog.createIndex( { "date": 1 }, { expireAfterSeconds: 5 } )

Mongo data Layout

scores: [
  {
    name: string,
    score: int,
    reasons: ReasonsObject,
    pointsGiven: PointsGivenObject
  }
]

scoreLog: [
  {
    from: string,
    to: string,
    date: datetime
  }
]

ReasonsObject:
{
  [reason]: int
}

PointsGivenObject:
{
  [to]: int
}

Testing

All the unit tests are run using jest

Individual run: npm run test

Tdd: npm run test:watch

You can use npm run test -- --testPathPattern=helpers.test.js to test a specific file or any other cli options that jest has available

Known issue

As of now there is an issue that has shown up a couple times without a root cause. The $setOnInsert excludes the reasons: {} object. The fix, currently, is to identify the bad document in mongo db.scores.find({ "reasons: null"}); and update them db.scores.updateMany({ "reasons: null"}, { $set: { "reasons": {} });