Skip to content

Commit d8712f1

Browse files
committed
change Discord message
1 parent 6d63935 commit d8712f1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/services/checker/HttpChecker.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ const check = async (service, status) => {
2121
if (!resp.ok) {
2222
throw new Error(`${resp.status} ${resp.statusText}`)
2323
}
24-
if (myStatus.status === 'down') {
25-
NotifierService.notify(service, 'up')
24+
if (myStatus.status === 'offline') {
25+
NotifierService.notify(service, 'online')
2626
myStatus.message = undefined
2727
}
28-
myStatus.status = 'up'
28+
myStatus.status = 'online'
2929
} catch (error) {
3030
myStatus.message = error.message
31-
if (status.status === 'up') {
32-
NotifierService.notify(service, 'down', status.message)
31+
if (status.status === 'online') {
32+
NotifierService.notify(service, 'offline', status.message)
3333
}
34-
myStatus.status = 'down'
34+
myStatus.status = 'offline'
3535
} finally {
3636
myStatus.date = new Date()
3737
clearTimeout(timeout)

src/services/notifier/NotifierService.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('NotifierService', () => {
5252

5353
describe('notify', () => {
5454
it('should call notify for each notifier', () => {
55-
NotifierService.notify(services[0], 'UP')
55+
NotifierService.notify(services[0], 'online')
5656
expect(mockNotify).toHaveBeenCalledTimes(1)
5757
})
5858
})

src/services/notifier/providers/DiscordNotifierProvider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const { error } = console
1212
const notify = (name, status, notifier, desc) => {
1313
const hook = new Webhook(notifier.webhook)
1414
const message = new MessageBuilder()
15-
.setTitle(`${name} status changed`)
15+
.setTitle(`${name} is ${status}`)
1616
.addField('Service', name, true)
1717
.addField('Status', status)
18-
.setColor(status === 'down' ? '#b71717' : '#17b75c')
19-
.setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
18+
.setColor(status === 'offline' ? '#b71717' : '#17b75c')
19+
.setThumbnail('https://cdn-icons-png.flaticon.com/512/3004/3004458.png')
2020
.setDescription(desc ?? '')
2121

2222
hook.setUsername('eMusk')
@@ -35,7 +35,7 @@ const hello = (name, notifier, version) => {
3535
const message = new MessageBuilder()
3636
.setTitle(`'${name}' is protected by eMusk v${version}`)
3737
.setColor('#5d0bda')
38-
.setDescription('Hi, I\'m eMusk, I\'m here to notify you when your service is down')
38+
.setDescription('Hi, I\'m eMusk, I\'m here to notify you when your service is offline')
3939

4040
hook.setUsername('eMusk')
4141
hook.send(message)

types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ServiceStatus = {
2222
message?: string;
2323
}
2424

25-
type Status = 'down' | 'up' | 'unknown'
25+
type Status = 'offline' | 'online' | 'unknown'
2626

2727
type ServiceNotifier = {
2828
webhook?: string;

0 commit comments

Comments
 (0)