Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f078a0d84 | |||
| b1ea520fdf | |||
| 6d98c2cf19 | |||
| 7d8c6032c9 | |||
| 8596483721 | |||
| f54e124dba |
8
index.js
8
index.js
@@ -158,10 +158,10 @@ const Web3 = require('web3');
|
|||||||
getContributorByGithubUser(recipient).then(c => {
|
getContributorByGithubUser(recipient).then(c => {
|
||||||
kredits.addProposal(c.address, amount, url, '', (e/* , d */) => {
|
kredits.addProposal(c.address, amount, url, '', (e/* , d */) => {
|
||||||
if (e) { reject(); return; }
|
if (e) { reject(); return; }
|
||||||
messageRoom(`New proposal created: ${amount} for ${recipient}`);
|
messageRoom(`Let's give ${recipient} some kredits for ${url}! We just need two votes: https://kredits.kosmos.org`);
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
messageRoom(`Couldn\'t find contributor data for ${recipient}. Please add them first!`);
|
messageRoom(`I wanted to propose giving kredits to ${recipient} for ${url}, but I can't find their contact data. Please add them as a contributor: https://kredits.kosmos.org`);
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
@@ -246,6 +246,10 @@ 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;
|
||||||
|
// 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 = JSON.parse(data.payload); }
|
||||||
|
|
||||||
robot.logger.info(`Received GitHub hook. Event: ${evt}, action: ${data.action}`);
|
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') {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hubot-kredits",
|
"name": "hubot-kredits",
|
||||||
"version": "1.4.4",
|
"version": "1.5.0",
|
||||||
"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