[Server] Fix bug

This commit is contained in:
syuilo 2017-02-12 06:44:16 +09:00
parent 085df917a1
commit 60eecb3770

View File

@ -29,16 +29,16 @@ module.exports = async (app: express.Application) => {
}); });
handler.on('push', event => { handler.on('push', event => {
const ref = event.payload.ref; const ref = event.ref;
if (ref != 'refs/heads/master') return; if (ref != 'refs/heads/master') return;
const pusher = event.payload.pusher; const pusher = event.pusher;
const compare = event.payload.compare; const compare = event.compare;
post(`Pushed! (Pusher: ${pusher.name})\nCompare changes: ${compare}`); post(`Pushed! (Pusher: ${pusher.name})\nCompare changes: ${compare}`);
}); });
handler.on('issues', event => { handler.on('issues', event => {
const issue = event.payload.issue; const issue = event.issue;
const action = event.payload.action; const action = event.action;
let title: string; let title: string;
switch (action) { switch (action) {
case 'opened': title = 'New Issue'; break; case 'opened': title = 'New Issue'; break;
@ -50,9 +50,9 @@ module.exports = async (app: express.Application) => {
}); });
handler.on('issue_comment', event => { handler.on('issue_comment', event => {
const issue = event.payload.issue; const issue = event.issue;
const comment = event.payload.comment; const comment = event.comment;
const action = event.payload.action; const action = event.action;
let text: string; let text: string;
switch (action) { switch (action) {
case 'created': text = `Comment to「${issue.title}」:${comment.user.login}${comment.body}\n${comment.html_url}`; break; case 'created': text = `Comment to「${issue.title}」:${comment.user.login}${comment.body}\n${comment.html_url}`; break;
@ -62,18 +62,18 @@ module.exports = async (app: express.Application) => {
}); });
handler.on('started', event => { handler.on('started', event => {
const sender = event.payload.sender; const sender = event.sender;
post(`Started by ${sender.login}`); post(`Started by ${sender.login}`);
}); });
handler.on('fork', event => { handler.on('fork', event => {
const repo = event.payload.forkee; const repo = event.forkee;
post(`🍴Forked:\n${repo.html_url}`); post(`🍴Forked:\n${repo.html_url}`);
}); });
handler.on('pull_request', event => { handler.on('pull_request', event => {
const pr = event.payload.pull_request; const pr = event.pull_request;
const action = event.payload.action; const action = event.action;
let text: string; let text: string;
switch (action) { switch (action) {
case 'opened': text = `New Pull Request:「${pr.title}\n${pr.html_url}`; break; case 'opened': text = `New Pull Request:「${pr.title}\n${pr.html_url}`; break;