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-bearychat

v0.7.2

Published

BearyChat adapter for hubot

Downloads

75

Readme

hubot-bearychat

This is a Hubot adapter to use with BearyChat.

@BearyChat Build Status npm version

中文文档

5 Minutes Setup

Step 1. get ya a "hubot token"

Go to your team robots page in bearychat.com (your-cool-team.bearychat.com/robots) and create a hubot. You will get your hubot token inside the bot settings form:

art/create_hubot.png

Step 2. bootstrap your secret hubot project with yeoman

  • npm install -g hubot coffee-script yo generator-hubot
  • mkdir -p /path/to/hubot
  • cd /path/to/hubot
  • yo hubot
  • npm install hubot-bearychat --save

Also check out the hubot docs for further guidance on how to build your bot.

Step 3. copy your hubot token and start it

$ export HUBOT_BEARYCHAT_TOKENS=token-token-token-here
$ export HUBOT_BEARYCHAT_MODE=rtm
$ ./bin/hubot -a bearychat

Step 4. start chatting with your bot!

art/bot_chat.png

You can also refer example/ for sample setup.

Mode

RTM mode

RTM mode uses BearyChat's RTM api and WebSocket as message transport protocol. In this mode, hubot can receive all messages in real time and hear any messages from channels it had joined.

To enable RTM mode, you should specify environment variable HUBOT_BEARYCHAT_MODE=rtm before running the hubot.

hubot-bearychat uses rtm mode by default.

HTTP mode

HTTP mode is the legacy message transport protocol. In this mode, hubot can only receive messages that himself was mentioned (e.g. @hubot how do you do), and you need to set the hubot hosted http service url in the hubot settings form.

To enable HTTP mode, you should specify environment variable HUBOT_BEARYCHAT_MODE=http before running the hubot.

Configuration

Available configurations are injected via environment variables:

| envvar | description | |:------:|:------------| | HUBOT_BEARYCHAT_MODE | running mode for the hubot, by default is rtm | | HUBOT_BEARYCHAT_TOKENS | hubot token, required for running hubot |

Hubot Interactions

Send

Hubot can response a message with res.send:

robot.hear /hello/, (res) ->
  res.send 'hello, world!'

art/res_send.png

Reply

If hubot want to response a message and refer the callers message, use res.reply`:

robot.hear /how old are you?/, (res) ->
  res.reply 'I am Five!'

art/res_reply.png

Send message to other room

If you want to send a message to other channel use robot.messageRoom with vchannel_id, and Channel Name support is coming soon:

robot.hear /voldemort/i, (res) ->
  robot.messageRoom(vchannel_id, "Somebody is talking about you, Voldemort!")

bearychat.attachment

If hubot want to response more than text, emit bearychat.attachment:

robot.respond /念两句诗/, (res) ->
  robot.emit 'bearychat.attachment',
    # required
    message: res.message
    # requried
    text: '当时我就念了...'
    attachments: [
      {
        color: '#cb3f20',
        text: '苟利国家生死以',
      },
      {
        text: '岂因祸福避趋之',
      },
      {
        images: [
          {url: 'http://example.com/excited.jpg'},
        ]
      }
    ]

art/res_reply.png

LICENSE

MIT