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

brobot

v1.0.6

Published

Brobot is a modular, easy to extend bot, based on Microsofts BotConnectorBot

Downloads

13

Readme

Brobot

Build Status Deploy

Brobot is a modular, easy to extend bot, based on Microsofts BotConnectorBot. For more details you can read the documentation here.

Live preview

@brobot on Slack

@tele_brobot on Telegram

@brobot on GroupMe

@brobot on WebChat

See Brobot commands below or here.

Getting started

Install Brobot with this command:

npm install brobot

Examples

Check out the /example directory for more.

Like this:

var Brobot = require('brobot');
var restify = require('restify');

var appId = process.env.APP_ID || 'YourAppId';
var appSecret = process.env.APP_SECRET || 'YourAppSecret';

// Initialize brobot with appId and appSecret of BotConnector. Read more: http://docs.botframework.com/connector/getstarted/#navtitle
var brobot = new Brobot({ appId: appId, appSecret: appSecret }, function(session, returnArgs) {
  var response = '';

  // Store count of arguments brobot returned for this message
  var argCount = returnArgs.length;

  // Iterate throught every argument
  for (var i = 0; i < argCount; i++) {
    // Append every argument to 'str'
    response += returnArgs[i];
  }

  // Reply to our chat with result of message
  session.send(response);
});

// This is just the server which listens for new messages from botconnector
const server = restify.createServer();
server.post('/api/messages', brobot.verifyBotFramework(), brobot.listen());

server.listen(process.env.PORT || 8080, () => {
  console.log('%s listening to %s', server.name, server.url);
});

Add new modules

Brobot handles every .js file in /src/modules as a module. If you want to know how a module should look like, click here.

To add new modules to this repo you should fork, add a module and make a pull request. I'll review it as soon as possible.

Brobot commands/modules

Let's say you've installed brobot and want to try some commands. Here is a list of the current commands, keep in mind you can extend them easily:

| Command | Minimum arguments | Example | Result | Explaination | |---------|-------------------|---------------------|------------------------------------------|----------------------------------------------------| | / | 2 | / 5 2 | 2.5 | Simple division | | * | 2 | * 6 2 | 12 | Simple multiplication | | - | 2 | - 12 3 | 9 | Simple substraction | | + | 2 | + 3 8 | 11 | Simple addition | | morse | 2 | morse e hello world | .... . .-.. .-.. ---.-- --- .-. .-.. -.. | You can also write morse d to decrypt a morse code | | pi | 0 | pi | 3.141592653589793 | | | rev | 0 | rev hello world | world hello | Returns input in reversed word order | | rrev | 0 | rrev hello world | olleh dlrow | Returns every word reversed |

Keep in mind, you won't get any response until you write echo before your command. For example echo + 5 8 will return 13.

Command/Module chaining

Lets say we have the following command: echo + 1500 * 2 pi This would return: 1506.2831853071796

Why? You have to read from right to left. First there is pi which returns 3.141592653589793 and passes it's value to 2. Now passes itself (2) and it's argument (3.141592653589793) to module * which will multiply theese two values returning 6.283185307179586. This value and the next (1500) will finally passed to module + which results in 1506.2831853071796. echo will tell our bot to reply the result to the user. You can chain every other command too, just try it.