Skip to content

Commit

Permalink
Add new repo location command (#84)
Browse files Browse the repository at this point in the history
* Add BOT_REPO_URL variable to example.env file
  • Loading branch information
silentworks committed Jul 11, 2018
1 parent 0f704e8 commit d8f4fdc
Show file tree
Hide file tree
Showing 5 changed files with 7,006 additions and 1 deletion.
10 changes: 10 additions & 0 deletions commands/bot_repo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Whoami
* @author Andrew Smith <a.smith@silentworks.co.uk>
*/
module.exports = (botRepoUrl) => {
return (bot, message) => {
bot.startTyping(message);
bot.reply(message, 'You can contribute to me at ' + botRepoUrl);
}
};
7 changes: 7 additions & 0 deletions commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
const { isObject } = require('../helpers');
const morningConvoCommand = require('./morning_conversation');
const jokeCommand = require('./joke');
const botRepo = require('./bot_repo');
const config = require('../config');

// Load apiai init here
Expand Down Expand Up @@ -89,6 +90,12 @@ module.exports = (controller) => {
['joke', 'lighten\s+the\s+mood', 'laugh'], ['direct_message', 'direct_mention', 'mention'],
jokeCommand
);

// Bot Repo
controller.hears(
['Where can I find you?', 'repo', 'git', 'whoareyou'], ['direct_message', 'direct_mention', 'mention'],
botRepo(config.BOT_REPO_URL)
);

// reply to a direct mention - @anansi
controller.on(['direct_message', 'direct_mention'], (bot, message) => runNLPResponse(apiAI, bot, message));
Expand Down
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ module.exports = {
WORD_DEFINITION: 'define-word',
GHS_CONVERSION: 'convert-to-ghana-cedis',
CONVERT_FROM_X_TO_Y: 'convert-from-x-to-y'
}
},
BOT_REPO_URL: process.env.BOT_REPO_URL,
};
1 change: 1 addition & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ ICON_URL=
API_AI_TOKEN=
GCAL_API_KEY=
GHANA_TECH_CAL_ID=
BOT_REPO_URL=
NODE_ENV=development
Loading

0 comments on commit d8f4fdc

Please sign in to comment.