Socket
Socket
Sign inDemoInstall

tinybot

Package Overview
Dependencies
108
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

4

package.json
{
"name": "tinybot",
"version": "1.0.1",
"version": "1.0.2",
"description": "A tiny wrapper around the Slack RTM API that provides methods to listen for and send slack messages.",

@@ -27,3 +27,2 @@ "main": "index.js",

"expect": "^1.20.2",
"express": "^4.14.0",
"mocha": "^3.0.2"

@@ -33,2 +32,3 @@ },

"debug": "^2.2.0",
"express": "^4.14.0",
"request": "^2.75.0",

@@ -35,0 +35,0 @@ "ws": "^1.1.1"

@@ -6,41 +6,42 @@ // A [sl]ack st[ub] server

var debug = require('debug')('tinybot:slub');
app.get('*', function(req, res) {
res.json({
ok: true,
users: [
{ name: 'neil', id: 'n0'},
{ name: 'thebigdog', id: 's1'}
],
channels: [
{ name: 'general', id: 'CG0'}
],
url: 'ws://localhost:6970'
module.exports.serve = function(port, cb) {
app.get('*', function(req, res) {
res.json({
ok: true,
users: [
{ name: 'neil', id: 'n0'},
{ name: 'thebigdog', id: 's1'}
],
channels: [
{ name: 'general', id: 'CG0'}
],
url: 'ws://localhost:6970'
})
})
})
var wss = new WebSocketServer({port: 6970});
wss.on('connection', function(ws) {
module.exports.socket = {
send: function(message) {
if( message.text && !message.type ) { message.type = 'message'; }
ws.send(JSON.stringify(message), {mask: true});
},
shouldReceive: function(text, cb) {
ws.on('message', listener);
app.listen(port || 6969, cb);
function listener(message) {
if( JSON.parse(message).text.match(text) ) {
cb();
ws.removeListener('message', listener);
debug(message, "Received expected message");
return;
var wss = new WebSocketServer({port: 6970});
wss.on('connection', function(ws) {
module.exports.socket = {
send: function(message) {
if( message.text && !message.type ) { message.type = 'message'; }
ws.send(JSON.stringify(message), {mask: true});
},
shouldReceive: function(text, cb) {
ws.on('message', listener);
function listener(message) {
if( JSON.parse(message).text.match(text) ) {
cb();
ws.removeListener('message', listener);
debug(message, "Received expected message");
return;
}
debug(message, "unknown message");
}
debug(message, "unknown message");
}
}
}
});
module.exports.serve = function(port, cb) {
app.listen(port || 6969, cb);
});
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc