Skip to content

Commit

Permalink
Office hours topic (#290)
Browse files Browse the repository at this point in the history
* #228

* Resolve edge case with non text channel

* Fix linter on cron.ts

* Change case to "Last updated at"
  • Loading branch information
KevinBacabac authored Aug 14, 2022
1 parent ef40d2f commit cf4b766
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const createOfficeStatusCron = (): CronJob =>
//discord channel names don't accept :emoji: so we have to use actual unicode
(response['status'] == 1 ? '✅' : response['status'] == 0 ? '❌' : '❓');
(messageChannel as TextChannel).setName(curName);
const time = Math.floor(response['time']);
const topic = `Last updated at <t:${time}:F> for you (<t:${time}:R>)`;
(messageChannel as TextChannel).setTopic(topic).catch(console.error);
} else {
throw 'Bad channel type';
}
Expand Down

0 comments on commit cf4b766

Please sign in to comment.