Skip to content

Instantly share code, notes, and snippets.

@voipnorm
Created September 28, 2016 21:59
Show Gist options
  • Save voipnorm/be7c9a2b80c31c0f5af59da9939ec518 to your computer and use it in GitHub Desktop.
Save voipnorm/be7c9a2b80c31c0f5af59da9939ec518 to your computer and use it in GitHub Desktop.
flint.hears(/\/broadcast( |.|$)/i, function(bot, trigger){
var request = trigger.text.replace("/broadcast ",'');
if(trigger.personEmail.match(/youremail@example\.com|yourotheremail@example\.com/i)){
_.forEach(flint.bots, function(bot) { bot.say(request); });
}else{
bot.say("Sorry but your are not authorised for this command. The authoritities have been notified.");
bot.dm('youremail@example.com','Unauthorised attempt by this person: '+trigger.personEmail);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment