Beispiel #1
0
 exec(command.exec, function (error, stdout, stderr) {
   if (error) {
     bot.postMessageToChannel(config.get('slack.channel'), 'Docker webhook triggered with error 😢', params);
   } else {
     bot.postMessageToChannel(config.get('slack.channel'), 'Docker webhook triggered with success 🚀', params);
   }
 });
Beispiel #2
0
function punishUncomplete()
{
	//Temporary
	var shameString = "";

	if(users._value != undefined)
	{
		if(users._value.members.length == 0)
		{
			bot.postMessageToChannel(channelname,"Everybody answered!");
			return;
		}

		for (var i = users._value.members.length - 1; i >= 0; i--) 
		{
			shameString += " @"+users._value.members[i].name;
		}

		shameString += "\n You didn't answer or complete the daily survey. You are bad and you should feel bad.";
		bot.postMessageToChannel(channelname,shameString);
	}


	//Temporary
	delendaVar();
	emitQuestions();
}
Beispiel #3
0
bot.on('start', () => {
  bot.postMessageToChannel('testingtesting123', "We're up and running!")

  bot.on('message', (contents) => {
    if (contents.type === 'message' && contents.text.length > 1000) {
      let channel = contents.channel;

      let fullText = {
                      "title": "",
                      "text": contents.text
                     };

      let args = {
        data: {
          'summary_length': Math.floor(contents.text.length / 500),
          'articles': [fullText]
        },
        headers: {
          'Content-Type': 'application/json',
          'Ocp-Apim-Subscription-Key': process.env.AGOLO_TOKEN
        }
      };

      client.post('https://api.agolo.com/nlp/v0.2/summarize', args, function(data) {
        let summary = data.summary[0].sentences.join(' ');
        bot.postMessage(channel, summary);
      });
    }

  });
});
Beispiel #4
0
			Promise.all(asyncMessages).then((resolvedMessages) => {
				for(const m of resolvedMessages) {
					switch(m.type) {
						case 'USER': {
							bot.postMessageToUser(m.user, m.message, params);
							break;
						}

						case 'REPLY': {
							if(channel) {
								log(`> #${channel.name}: ${m.message}`);
								bot.postMessageToChannel(channel.name, m.message, params);
							}
							else if(group) {
								log(`> #${group.name}: ${m.message}`);
								bot.postMessageToGroup(group.name, m.message, params);
							}
							else {
								log(`> @${user.name}: ${m.message}`);
								bot.postMessageToUser(user.name, m.message, params);
							}

							break;
						}
					}
				}
			});
Beispiel #5
0
buss.on('POST_TO_SLACK_CHANNEL', function(args){
    var params = {
        icon_emoji: ':alien:'
    };

    bot.postMessageToChannel(args[0], args[1], params);
});
Beispiel #6
0
 bot.on("message", function(data) {
     if (data.type === "message" && data.channel && data.channel === "C0J591YCB") {
         if (data.text && data.text.indexOf("늦") > -1) {
             bot.postMessageToChannel("attendance", "흠....");
         }
     }
 });
Beispiel #7
0
 repo.exec('pull', null, function(err, stdout) {
   if (err) {
     console.log('Error: ' + err + '/n Stdout: ' + stdout);
   } else {
     console.log('Repo updated.');
     bot.postMessageToChannel(channel, 'Devpatch Updated With Latest Code', params);
   }
 });
Beispiel #8
0
bot.on(utils.types.MESSAGE, function(data) {
  console.log(data)
  console.log('-----------')

  if (data.type === utils.types.MESSAGE && data.subtype === utils.types.CHANNEL_JOIN) {
    bot.postMessageToChannel(getChannelName(this.channels, data.channel), 'hai joinato ma se poi te ne penti?', params);
    sePoiTeNePenti();
  }

  if( data.type === utils.types.MESSAGE && containsQuestion(data) && isMentioningMaccio(data, bot.self.id)) {
    cazzoMeneFrega();
    console.log(data);
    bot.postMessageToChannel(getChannelName(this.channels, data.channel), `<@${data.user}>: Ma amme che cazzo menefrega amme!!`, params);
  }

  if (data.type === utils.types.MESSAGE && data.username !== bot.name) {
    // bot.postMessageToChannel(getChannelName(this.channels, data.channel), `si molto bello "${data.text}" ma meglio SCOPARE!!!`, params);
  }

  if (data.type === utils.types.MESSAGE && data.bot_id === 'B1L961WGP') {
    // bot.postMessageToChannel(getChannelName(this.channels, data.channel), `si molto bello "${data.text}" ma meglio SCOPARE!!!`, params);
  }

  // if (data.type === utils.types.MESSAGE && haiDettoSpritz(data)) {
    // playSound('valori');
    // bot.postMessageToChannel(getChannelName(this.channels, data.channel), `si molto bello "${data.text}" ma meglio SCOPARE!!!`, params);
  // }

  if (data.type === utils.types.MESSAGE && haiDetto('valori', data)) {
    playSound('valori');
  }

  if (data.type === utils.types.MESSAGE && haiDetto('scopare', data)) {
    playSound('scopare');
    bot.postMessageToChannel(getChannelName(this.channels, data.channel), `https://www.youtube.com/watch?v=d_tc74PP7P8`, params);
  }

  if (data.type === utils.types.MESSAGE && haiDetto('suv', data)) {
    playSound('suv');
  }

  if (data.type === utils.types.MESSAGE && haiDetto(['bravo', 'mito'], data)) {
    playSound('seiUnMito');
  }

  });
Beispiel #9
0
function completeSurveyForUser(username)
{
	var surveyString = "Daily survey for @"+username+" has been completed.\n>>>";
	for (var i = 0; i < finalResults[username].length; i++) {
		surveyString += "_"+finalResults[username][i][0]+"_\n>"+finalResults[username][i][1]+"\n";
	}
	bot.postMessageToChannel(channelname,surveyString);
}
bot.on('start', function() {
	
	let params = {
		"icon_url": "https://apigateway-aidifycloud.herokuapp.com/images/logo.png",
		"username": "******"
	}
	bot.postMessageToChannel('general', "ai{D}fy is ready!!!", params);
});
function postMessage(message, room, type) {
    if(type == "g") {
        bot.postMessageToGroup(room, message, params);
    } else if(type == "c") {
        bot.postMessageToChannel(room, message, params);
    } else if(type == "d") {
        bot.postMessageToUser(room, message, params);
    }/*Implement direct messaging*/
}
bot.on('message', function(data) {

  console.log('message event fired', data.type);
  if(data.type === 'team_join'){
    console.log("Someone joined the team", data);

    console.log('***************** this is the users name', data.user.name);

    bot.postMessageToChannel('general', 'Welcome @'+ data.user.name + ' to the Junior Dev Jobs community! Go to the introductions channel and tell us about yourself! 1. Name 2. Location 3. Expertise', { as_user: true});
  }
});
Beispiel #13
0
 }).then(function() {
    console.log("posting message to "+original_message.channel);
    var channel = getChannelById(original_message.channel);
    console.log("channel "+channel);
    if(reactToStuff){
      postReactions(original_message.channel, original_message.ts, message_arr);
    }else{
      console.log(message_arr.join(" "));
      bot.postMessageToChannel(channel, message_arr.join(" "), params);
    }
 }, function(error) {
Beispiel #14
0
  bot.on('start', function() {

    console.log('Bot Started');
    // more information about additional params https://api.slack.com/methods/chat.postMessage
    var watcher = chokidar.watch(filePath, {awaitWriteFinish: {
      stabilityThreshold: 2000,
      pollInterval: 100
    }});

    bot.getChannelId(defaultChannel).then(function(id) {
      console.log('Channel id detected: ' + id);
      defaultChannelId = id;
    });

    bot.postMessageToChannel(defaultChannel, introduction, botParams).then(function() {
      console.log('Posted introduction');
    });

    watcher.on('change', function() {
      console.log('Change in coverage file detected');
      var newFileContent = '';

      fileInteraction.getCoverage()
        .then(function(_newFileContent) {
          newFileContent = _newFileContent;
          return bot.getUsers();
        })
        .then(function(usersList) {
          return blame.getLastCommiter(config.repositoryURL, usersList);
        })
        .then(function(lastCommitter) {
          return humanInteraction.doAction('ReportLastCommit', lastCommitter, originalContentOfFile, newFileContent);
        })
        .then(function(message) {
          bot.postMessageToChannel(defaultChannel, message, botParams).then(function() {
            console.log('Posted message after coverage report alert.');
          });
          originalContentOfFile = newFileContent;
        });

    });

  });
Beispiel #15
0
 provider.get(restaurant, function(data) {
   bot.postMessageToChannel('obed',
   // bot.postMessageToUser('daniel.rutkovsky',
     "Hi, it's *lunch time*. Why don't you try something new today. Look at:" + formatResponse(data, provider.name(restaurant)))
 });
botT.on('message',function(message){
    botS.postMessageToChannel('tests','['+message.from.first_name+' ' +message.from.last_name+'] '+ message.text);
})
Beispiel #17
0
	postMessage: function(text) {
		Railbot.postMessageToChannel(channelName, text, channelParams);
	},
Beispiel #18
0
Railbot.on('start', function(data) {
	var text = '*30 Rails bot ready to choo choo!*\n' +
		'Type `help` to see game options, or `start` to being a new game';
	Railbot.postMessageToChannel(channelName, text, channelParams);
});
Beispiel #19
0
 function sendMessageToSlackBot(text) {
   bot.postMessageToChannel('general', text, params);
 };
Beispiel #20
0
postMessage = exports.postMessage = function(message, channel) {
  elias.postMessageToChannel(channel, message, {
    as_user: '******'
  });
}
Beispiel #21
0
 bot.on('start', function() {
     var channel = "user-confirmation";
     var message = "O usuário " + userName + " <" + email + "> acabou de se cadastrar.\n" ;
     message += "Confirmar conta e liberer via: sistemauto.herokuapp.com/api/activate?hash=" + id;
     bot.postMessageToChannel(channel, message);
 });
botT.on(message,function(msg) {
    botS.postMessageToChannel('tests','['+msg.from.first_name+' ' +msg.from.last_name+'] '+ msg.text);
});
Beispiel #23
0
 .then(function(message) {
   bot.postMessageToChannel(defaultChannel, message, botParams).then(function() {
     console.log('Posted message after coverage report alert.');
   });
   originalContentOfFile = newFileContent;
 });
Beispiel #24
0
 humanInteraction.createInteraction(data.text).then(function(answer) {
   bot.postMessageToChannel(defaultChannel, answer, botParams);
 });
Beispiel #25
0
            client.get("https://api-na.myconnectwise.net/v4_6_release/apis/3.0/service/tickets/307", function (data, response) {
	            console.log(data);
                bot.postMessageToChannel('bot-testing', data.summary, params);
                });