mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-12-23 13:05:27 +00:00
25 lines
667 B
JavaScript
25 lines
667 B
JavaScript
var request = require('request');
|
|
var app = require('../app.js');
|
|
var logger = require('../logging.js');
|
|
|
|
var regex = /[^\<]\#\d+[^\>]/;
|
|
|
|
exports.trigger = function(message) {
|
|
return regex.test(message.content);
|
|
}
|
|
|
|
exports.execute = function(message) {
|
|
let match = regex.exec(message.content);
|
|
if (match) {
|
|
let url = `https://github.com/citra-emu/citra/pull/${match[0].trim().substring(1)}`
|
|
logger.info(url);
|
|
request(url, function (error, response, body) {
|
|
if (!error && response.statusCode == 200) {
|
|
message.channel.sendMessage(`Github Pull Request: ${url}`);
|
|
} else {
|
|
// Github PR does not exist.
|
|
}
|
|
});
|
|
}
|
|
}
|