diff --git a/example/bots/github.js b/example/bots/github.js index e065295..be1de3b 100644 --- a/example/bots/github.js +++ b/example/bots/github.js @@ -1,7 +1,7 @@ module.exports = function (chabot) { // WebHook で受けたデータをセット - var payload = JSON.parse(chabot.data.payload); + var payload = chabot.data; // ChatWork API の endpoint をセット var endpoint = '/rooms/' + chabot.roomid + '/messages'; // templats/ 内のメッセージテンプレートを読み込む @@ -20,4 +20,4 @@ module.exports = function (chabot) { .fail(function (err) { chabot.error(err); }); -}; \ No newline at end of file +}; diff --git a/lib/bots.js b/lib/bots.js index c67e462..e55251f 100644 --- a/lib/bots.js +++ b/lib/bots.js @@ -31,6 +31,7 @@ fs.readdirSync(path.join(process.cwd(), 'bots')).forEach(function (botfile) { roomid: req.params.roomid, data: req.body, render: ejs.render, + headers: req.headers, readTemplate: function (filepath) { return fs.readFileSync(path.join('./templates/', filepath), 'utf8'); }, @@ -42,4 +43,4 @@ fs.readdirSync(path.join(process.cwd(), 'bots')).forEach(function (botfile) { }; console.log('loaded bot: '.green + botname); -}); \ No newline at end of file +});