Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8596483721 | |||
| f54e124dba | |||
| fb8fc88101 | |||
| 6ca1254c9a | |||
| 38483cbbeb | |||
| 0203cb1a62 |
10
index.js
10
index.js
@@ -49,7 +49,7 @@ const Web3 = require('web3');
|
|||||||
|
|
||||||
getBalance().then(balance => {
|
getBalance().then(balance => {
|
||||||
if (balance <= 0) {
|
if (balance <= 0) {
|
||||||
messageRoom(`Yo gang, I\m broke! Please drop me some ETH to ${hubotWalletAddress}. kthxbai.`);
|
messageRoom(`Yo gang, I\'m broke! Please drop me some ETH to ${hubotWalletAddress}. kthxbai.`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -246,13 +246,19 @@ const Web3 = require('web3');
|
|||||||
robot.router.post('/incoming/kredits/github/'+process.env.KREDITS_WEBHOOK_TOKEN, (req, res) => {
|
robot.router.post('/incoming/kredits/github/'+process.env.KREDITS_WEBHOOK_TOKEN, (req, res) => {
|
||||||
let evt = req.header('X-GitHub-Event');
|
let evt = req.header('X-GitHub-Event');
|
||||||
let data = req.body;
|
let data = req.body;
|
||||||
robot.logger.debug(`Received GitHub hook. Event: ${evt}, action: ${data.action}`);
|
// For some reason data is contained in a payload property on one
|
||||||
|
// machine, but directly in the root of the object on others
|
||||||
|
if (data.payload) { data = data.payload; }
|
||||||
|
|
||||||
|
robot.logger.info(`Received GitHub hook. Event: ${evt}, action: ${data.action}`);
|
||||||
|
|
||||||
if (evt === 'pull_request' && data.action === 'closed') {
|
if (evt === 'pull_request' && data.action === 'closed') {
|
||||||
handleGitHubPullRequestClosed(data).then(() => res.send(200));
|
handleGitHubPullRequestClosed(data).then(() => res.send(200));
|
||||||
}
|
}
|
||||||
else if (evt === 'issues' && data.action === 'closed') {
|
else if (evt === 'issues' && data.action === 'closed') {
|
||||||
handleGitHubIssueClosed(data).then(() => res.send(200));
|
handleGitHubIssueClosed(data).then(() => res.send(200));
|
||||||
|
} else {
|
||||||
|
res.send(200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hubot-kredits",
|
"name": "hubot-kredits",
|
||||||
"version": "1.4.2",
|
"version": "1.4.5",
|
||||||
"description": "Kosmos Kredits functionality for chat bots",
|
"description": "Kosmos Kredits functionality for chat bots",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user