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

v1.0.8

Published

A Skype Bot Api Adapter for Hubot

Downloads

23

Readme

A Skype Bot Api Adapter for Hubot

Build Status npm version

Installation

  • Signup to the Skype Bot Platform preview program: https://www.skype.com/en/developer/signup/
  • Follow https://developer.microsoft.com/en-us/skype/bots/docs to create a new bot and obtain an Application ID and a Microsoft Application Secret
  • (optional) Generate a new hubot using official instruction https://hubot.github.com/docs/
  • Install a SkypeBots adapter npm install --save hubot-skypebots

Configuration

  • SKYPE_BOTS_APP_ID - the Application ID generated in a Microsoft portal
  • SKYPE_BOTS_APP_SECRET - the Application Secret generated in the Microsoft portal
  • SKYPE_BOTS_BOT_ID - a Skype bot ID
  • SKYPE_BOTS_LISTEN_PATH - a web path on your server to listen chat responses/outgoing webhooks. The url should be accessable from the internet.
export SKYPE_BOTS_APP_ID=111111111-aaaa-bbbb-cccc-222222222222
export SKYPE_BOTS_APP_SECRET=secret_secret
export SKYPE_BOTS_BOT_ID=28:xxxxxxx-aaaa-bbbb-cccc-zzzzzzzzzzzz
export SKYPE_BOTS_LISTEN_PATH=/skype
`bin/hubot -a skypebots`

Encoding html entities

By default html entities "<",">" and "&" are escaped. To disable this behaviour you can set a property 'envelope.escape' to false. Bear in mind that Skype doesn't allow some html tags and silently ignores messages with unclosed tags.

  robot.respond /small/i, (res) ->
    html = "<font size=\"15\">It's small</font>"
    res.send html
  robot.respond /big/i, (res) ->
    res.envelope.escape = false
    html = "<font size=\"15\">It's big</font>"
    res.send html

Send files

Attachments can be send using Skype Bot Api. Supported types 'Images', 'Videos' and 'Files'. To send attachment you need to emit a 'skype:sendAttachment' event with params:

  • user - a User object
  • attachmentName - File/Image/Video name
  • attachmentType - a type of a data content (File, Image or Video)
  • originalStream - a nodejs stream of the data content
  • thumbnailStream - (optional) nodejs stream of a video thumbnail content. Used only by Video type. Videos thumbnails should be JPEG

Send File

robot.respond /get settings/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/settings.json")
    robot.emit 'skype:sendAttachment', user, 'settings.json', 'FILE',  originalStream

Send Image

robot.respond /get image with funny cats/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/funny_cats.jpg")
    robot.emit 'skype:sendAttachment', user, 'funny_cats.jpg', 'Image',  originalStream

Send Video

robot.respond /get epic fail video/i, (res) ->
    user = res.envelope.user
    originalStream = fs.createReadStream("files/epic_fail.mp4")
    thumbnailStream = fs.createReadStream("files/thumbnail-epic_fail.jpg")
    robot.emit 'skype:sendAttachment', user, 'epic_fail.mp4', 'Video',  originalStream, thumbnailStream

Receive File

Attachments can be received using Skype Bot Api. When SkypeBots adapter receive a new attachment it emit a 'skype:attachment' with params

  • user - a User object
  • attachmentName - File/Image/Video name
  • attachmentType - a type of a data content (File, Image or Video)
  • attachmentStream - a nodejs stream of a data content
robot.on 'skype:attachment', (user, attachmentName, attachmentType, attachmentStream) ->
    robot.logger.info "Revceived attachment #{attachmentName} of type #{attachmentType} from #{user.id} in room #{user.room}"
    attachmentStream.pipe(fs.createWriteStream("files/#{attachmentName}"))