Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/bots/github.js
Original file line number Diff line number Diff line change
@@ -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/ 内のメッセージテンプレートを読み込む
Expand All @@ -20,4 +20,4 @@ module.exports = function (chabot) {
.fail(function (err) {
chabot.error(err);
});
};
};
3 changes: 2 additions & 1 deletion lib/bots.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},
Expand All @@ -42,4 +43,4 @@ fs.readdirSync(path.join(process.cwd(), 'bots')).forEach(function (botfile) {
};

console.log('loaded bot: '.green + botname);
});
});