Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function RocketChatBot (botkit, config) {
var controller = Botkit.core(config || {})
// transform the string value from .env to bool.
var SSL = (config.rocketchat_ssl === 'true')
controller.startBot = async () => {
// implicit call for bot.defineBot()
var bot = controller.spawn(config)
try {
// make the connection with RocketChat
await driver.connect({ host: config.rocketchat_host, useSsl: SSL })
await driver.login({ username: config.rocketchat_bot_user, password: config.rocketchat_bot_pass })
await utils.addToRooms(config.rocketchat_bot_rooms)
await driver.subscribeToMessages()
bot.connected = true
} catch (error) {
bot.connected = false
console.log(error)
const DiscordBot = (configuration) => {
const client = new Discord.Client({
token: configuration.token,
autorun: true
});
configuration.client = client;
const discordBotkit = Botkit.core(configuration || {});
discordBotkit.defineBot(botDefinition);
discordBotkit.api = require('./api')(client);
// Attach Handlers and Middlewares
discordBotkit.handleMessageRecieve = newMessageHandler;
discordBotkit.middleware.normalize.use(middleware.normalize.handler);
discordBotkit.middleware.categorize.use(middleware.categorize.handler);
discordBotkit.middleware.format.use(middleware.format.handler);
// discord.io forwarding and event handling
// may move this elsewhere
client.on('ready', event => {
// Add some additional data to make it easier to work with
const readyEvent = Object.assign({}, event, {
username: client.username,
id: client.id
});
function Botmock (configuration) {
// Create a core botkit bot
var botmock = Botkit.core(configuration);
//override default botkit startTicking
botmock.startTicking = function () {
if (!botmock.tickInterval) {
// set up a once a second tick to process messages
botmock.tickInterval = setInterval(function () {
botmock.tick();
}, 10);
}
};
botmock.on('message_received', function (bot, message) {
return botmock.trigger(message.type, [bot, message]);
});
botmock.defineBot(BotmockWorker);
function HubotBot(config) {
// Create a core botkit bot
var hubot_botkit = Botkit.core(Object.assign({}, config))
// customize the bot definition, which will be used when new connections
// spawn!
hubot_botkit.defineBot(function(botkit, config) {
var bot = {
botkit: botkit,
config: Object.assign({
name: 'pozi',
client: 'shell'
}, config || {}),
utterances: botkit.utterances,
};
var hubot = Hubot.loadBot(null, bot.config.client, true, bot.config.name, null)
function TwilioSMS(configuration) {
let twilioSMS = Botkit(configuration || {})
if (!configuration) {
throw Error(`Specify your 'account_sid', 'auth_token', and ` +
`'twilio_number' as properties of the 'configuration' object`)
}
if (configuration && !configuration.account_sid) {
throw Error(`Specify an 'account_sid' in your configuration object`)
}
if (configuration && !configuration.auth_token) {
throw Error(`Specify an 'auth_token'`)
}
if (configuration && !configuration.twilio_number) {
throw Error(`Specify a 'twilio_number'`)