Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dogebot

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dogebot - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

47

dogebot.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc