-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathnotification.service.ts
More file actions
29 lines (22 loc) · 1.08 KB
/
Copy pathnotification.service.ts
File metadata and controls
29 lines (22 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Injectable, OnModuleInit } from '@nestjs/common';
import { Block } from 'bitcoinjs-lib';
import { DiscordService } from './discord.service';
import { TelegramService } from './telegram.service';
@Injectable()
export class NotificationService implements OnModuleInit {
constructor(
private readonly telegramService: TelegramService,
private readonly discordService: DiscordService
) { }
async onModuleInit(): Promise<void> {
await this.discordService.notifyRestarted();
}
public async notifySubscribersBlockFound(address: string, height: number, block: Block, message: string) {
await this.discordService.notifySubscribersBlockFound(height, block, message);
await this.telegramService.notifySubscribersBlockFound(address, height, block, message);
}
public async notifySubscribersBestDiff(address: string, submissionDifficulty: number) {
await this.discordService.notifySubscribersBestDiff(submissionDifficulty);
await this.telegramService.notifySubscribersBestDiff(address, submissionDifficulty);
}
}