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

survey-bot

v0.2.2

Published

A simple survey bot, asks questions and remembers answers

Downloads

4

Readme

#!/usr/bin/env ruby

survey bot

Summary and Configuration

This bot asks up to ten questions of the inbound messager, then stores these answers. Questions are not validated, and do not trigger any particular behaviors. If a question is blank, it is not asked.

Survey bot flow chart

Installation

This bot can be installed on any GreenBot server through the web UI, or by through the command line at the greenbot-core root with a a 'npm install survey-bot'

This bot requires a ruby installation, 2.0 or older

Annoated Bot Code - Full source in repo

require './lib/greenbot.rb' # ./lib/greenbot.rb contains helper libraries

def handle(prompt, fieldName= nil)

If there's nothing to tell or ask, get out of here.

  return unless prompt

  if fieldName.nil?

No field name, so just say it.

    tell prompt if prompt
  else

If there's a field name, then we are asking for something. Ask and remember the answer

    answer = ask prompt
    answer.remember(fieldName)
  end
end

Ask the first two prompts.

handle ENV['PROMPT_1']
handle ENV['PROMPT_2']

Ask the guest for their name, if configured Don't use handle because we want to confirm their name

if ENV['NAME_PROMPT']
  name = confirmed_gets(ENV['NAME_PROMPT'])
  name.remember('name')
end

For each of the ten possible questions, ask them if they are configured and save the answer

%w( QUESTION_1 QUESTION_2 QUESTION_3
    QUESTION_4 QUESTION_5 QUESTION_6
    QUESTION_7 QUESTION_8 QUESTION_9
    QUESTION_10 ).each { |p| handle(ENV[p], p) }

handle ENV['SIGNATURE']