From 8d0822020c8385d663a3013e6e3cab10a7ad796a Mon Sep 17 00:00:00 2001 From: BynariStar Date: Wed, 29 Nov 2017 00:03:31 +0200 Subject: [PATCH] Change CitraBot GitHub message by comment type --- src/triggers/github.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/triggers/github.js b/src/triggers/github.js index 9411b36..c295e5b 100644 --- a/src/triggers/github.js +++ b/src/triggers/github.js @@ -24,11 +24,18 @@ exports.execute = function (message) { // in general conversation. // ex: You're #1! if (match[1] <= 2000) { return; } + + // Map domain path to type + let map = {'pull': 'Pull Request', 'issues': 'Issue'}; let url = `https://github.com/citra-emu/citra/pull/${match[1]}`; request(url, function (error, response, body) { if (!error && response.statusCode === 200) { - message.channel.sendMessage(`Github Pull Request: ${url}`); + + // Set path to type of comment (issues/pull) + let path = response.request.uri.pathname.split('/')[3]; + + message.channel.sendMessage(`Github ${map[path]}: ${url}`); } });