Comparing version 0.1.3 to 0.1.4
@@ -1,2 +0,4 @@ | ||
var Slack = require('slack-client'); | ||
var RtmClient = require('@slack/client').RtmClient; | ||
var RTM_EVENTS = require('@slack/client').RTM_EVENTS; | ||
var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS; | ||
var doge = require('dogefy'); | ||
@@ -13,35 +15,26 @@ | ||
module.exports = function(key){ | ||
if(key){ | ||
var slack = new Slack(key, true, true); | ||
if(!key) throw new Error('You need to specify a Slack token'); | ||
slack.on('open', function(){ | ||
var channels = Object.keys(slack.channels) | ||
.map(function (k) { return slack.channels[k]; }) | ||
.filter(function (c) { return c.is_member; }) | ||
.map(function (c) { return c.name; }); | ||
var rtm = new RtmClient(key); | ||
console.log("Connected to " + slack.team.name + " as @" + slack.self.name); | ||
console.log("Joined channels: " + channels.join(', ')); | ||
}); | ||
rtm.on(CLIENT_EVENTS.RTM.RTM_CONNECTION_OPENED, function() { | ||
var team = rtm.dataStore.getTeamById(rtm.activeTeamId); | ||
var user = rtm.dataStore.getUserById(rtm.activeUserId); | ||
console.log('Connected to ' + team.name + ' as ' + user.name); | ||
}); | ||
slack.on('message', function(message) { | ||
var channel = slack.getChannelGroupOrDMByID(message.channel); | ||
rtm.on(RTM_EVENTS.MESSAGE, function(message){ | ||
var channel = rtm.dataStore.getChannelGroupOrDMById(message.channel); | ||
if(message.type === 'message' && isDirect(slack.self.id, message.text) || channel.is_im){ | ||
var cleanedMessage = message.text && message.text.replace(getTag(slack.self.id), '').replace(':', '').trim(); | ||
if(message.type === 'message' && message.text && (channel.is_im || isDirect(rtm.activeUserId, message.text))){ | ||
var cleanedMessage = message.text.replace(getTag(rtm.activeUserId), '').replace(':', '').substring(0, 2000).trim(); | ||
if(cleanedMessage){ | ||
channel.send('``` \n' + doge(cleanedMessage) + '\n ```'); | ||
} | ||
if(cleanedMessage){ | ||
console.log('Dogefied: ' + cleanedMessage); | ||
rtm.sendMessage('``` \n' + doge(cleanedMessage) + '\n ```', message.channel); | ||
} | ||
}); | ||
} | ||
}); | ||
slack.on('error', function(err){ | ||
return console.error("Error", err); | ||
}); | ||
slack.login(); | ||
}else{ | ||
throw "You need to specify a Slack token"; | ||
} | ||
rtm.start(); | ||
}; |
{ | ||
"name": "dogebot", | ||
"version": "0.1.3", | ||
"description": "Doge bot for Slack", | ||
"main": "dogebot.js", | ||
"keywords": [ | ||
"wow", | ||
"doge", | ||
"slack", | ||
"bot" | ||
], | ||
"author": "crisbeto", | ||
"license": "MIT", | ||
"dependencies": { | ||
"dogefy": "^0.1.4", | ||
"slack-client": "^1.4.1" | ||
}, | ||
"bin": { | ||
"dogebot": "cli" | ||
} | ||
"name": "dogebot", | ||
"version": "0.1.4", | ||
"description": "Doge bot for Slack", | ||
"main": "dogebot.js", | ||
"keywords": [ | ||
"wow", | ||
"doge", | ||
"slack", | ||
"bot" | ||
], | ||
"author": "crisbeto", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@slack/client": "^3.5.0", | ||
"dogefy": "^0.1.4" | ||
}, | ||
"bin": { | ||
"dogebot": "cli" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
511878
30
+ Added@slack/client@^3.5.0
+ Added@slack/client@3.16.0(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedasync@1.5.22.6.4(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addedcycle@1.0.3(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedeventemitter3@1.2.0(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedeyes@0.1.8(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.1.4(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedpkginfo@0.4.1(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.3.3(transitive)
+ Addedrequest@2.76.0(transitive)
+ Addedretry@0.9.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstack-trace@0.0.10(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtough-cookie@2.3.4(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedurl-join@0.0.1(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedwinston@2.4.7(transitive)
+ Addedws@1.1.5(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedslack-client@^1.4.1
- Removedbindings@1.2.1(transitive)
- Removedbufferutil@1.2.1(transitive)
- Removedcoffee-script@1.9.3(transitive)
- Removedlog@1.4.0(transitive)
- Removednan@2.22.02.4.0(transitive)
- Removedslack-client@1.5.1(transitive)
- Removedutf-8-validate@1.2.2(transitive)
- Removedws@0.8.1(transitive)