Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Description: | ||
// Say hi to your bot and have it greet you back | ||
// | ||
// Configuration: | ||
// | ||
// Commands: | ||
// hubot hello - Greet your bot | ||
// | ||
// Author: | ||
// chambrid | ||
// | ||
/* | ||
* Licensed Materials - Property of IBM | ||
* (C) Copyright IBM Corp. 2016. All Rights Reserved. | ||
* US Government Users Restricted Rights - Use, duplication or | ||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. | ||
*/ | ||
'use strict'; | ||
|
||
const HI_REGEX = /(hi|hello|hey|hiya|sup|howdy|yo)/i; | ||
const HI_ID = 'hubot.hi'; | ||
|
||
const path = require('path'); | ||
const TAG = path.basename(__filename); | ||
|
||
const greetings = ['Hello', 'Hi', 'Hey', 'Hiya', 'Sup', 'Howdy', 'Yo']; | ||
|
||
module.exports = robot => { | ||
|
||
robot.respond(HI_REGEX, {id: HI_ID}, (res) => { | ||
robot.logger.debug(`${TAG}: hubot-hi`); | ||
let selection = Math.floor((Math.random() * 7)); | ||
res.reply(greetings[selection]); | ||
}); | ||
|
||
}; |