Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
slack-basebot
Advanced tools
npm install slack-basebot --save
"use strict";
const BaseBot = require('slack-basebot');
const MyBot = new BaseBot('xob-slacktoken','MyBotName', {debug:true});
MyBot.onDirectQuestion(/please help me/i, msg => {
//== Will trigger when someone says `MyBotName please help me` or with a mention like `please help me @MyBotName`;
//== We can react with an emoji
msg.react('heart');
//== We can auto-randomly react with an emoji
msg.react(['heart','black_heart','green_heart']);
//== And/or reply (as often as we like)
msg.reply(`What can I help you with ${msg.user.name}?`);
//== Randomize the output with an array:
msg.reply(['Sometimes I say foo','That other time I will say bar']);
//== Furthermore we have some more user, channel and message information
console.info('@User:', msg.user);
console.info('#Channel', msg.channel);
console.info('Is this a DM?', msg.isDirect);
console.info('Full message ', msg.message);
console.info('@user said: ', msg.text);
})
MyBot.onPhrase(/squirl/gi, msg => {
//== This will trigger everytime anyone says something containing squirl.
msg.react('squirrel');
//== Pretend we are typing for 3 seconds
msg.typing(3 * 1000).then(() => {
msg.reply('I took me 3 seconds to write this.');
});
});
MyBot.setHelpText(() => `Hi I'm ${MyBot.tag}. I can do stuff for you.`);
MyBot.always(msg => console.info('Triggered on every incoming message'));
MyBot.onNothing(msg => console.info('Triggered on DirectQuestion/mention when no rules are matched.'));
//== Any sub-event can be listened on (see https://api.slack.com/events/message)
MyBot.on('channel_leave', event => console.info('Event happened', event));
//== On ChannelJoin of this bot
this.onChannelJoin(event => this.sendMessage(`Thanks <@${event.inviter}> for inviting me to <#${event.channel}>. How can I help you?`, event.channel));
"use strict";
const BaseBot = require('slack-basebot');
class MyBot extends BaseBot {
constructor() {
super('xob-slacktoken','MyBotName', {debug:true});
this.start();
}
start() {
this.onDirectQuestion(/please help me/i, msg => { /* Same as example above */})
this.onPhrase(/squirl/gi, msg => { /* Same as example above */});
this.setHelpText(() => `Hi I'm ${MyBot.tag}. I can do stuff for you.`);
this.always(msg => console.info('Triggered on every incoming message'));
this.onNothing(msg => console.info('Triggered on DirectQuestion/mention when no rules are matched.'));
}
}
FAQs
BaseBot for Slack
We found that slack-basebot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.