Skip to content

Commit

Permalink
Merge pull request #117 from GDSC-PKNU-21-22/dev
Browse files Browse the repository at this point in the history
부리미 0.22v 배포
  • Loading branch information
pp449 authored Sep 29, 2023
2 parents 8f12136 + 73a8c2e commit 03c8d30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/hooks/cronNoticeCrawling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const pushToUsers = async (majors: string[]) => {
const count = await pushNotification(major);
pushedUserCount += `${major} ${count}명 알림 완료\n`;
}
notificationToSlack(pushedUserCount);
if (pushedUserCount.length !== 0) notificationToSlack(pushedUserCount);
};

cron.schedule('0 0-9 * * 1-5', async () => {
Expand Down
16 changes: 10 additions & 6 deletions src/hooks/notificateToSlack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ const notificationToSlack = async (text: string): Promise<void> => {
console.error(text);
return;
}
await axios.post(env.SLACK_WEBHOOK_URL, {
Headers: {
'Content-type': 'application/json',
},
text,
});
try {
await axios.post(env.SLACK_WEBHOOK_URL, {
Headers: {
'Content-type': 'application/json',
},
text,
});
} catch (error) {
console.error(error);
}
return;
};

Expand Down

0 comments on commit 03c8d30

Please sign in to comment.