@dhedge/backend-flatcoin-core 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,8 @@ import { Logger } from '@nestjs/common';
|
|
|
2
2
|
export declare class NotificationService {
|
|
3
3
|
private readonly logger;
|
|
4
4
|
private readonly slackUri;
|
|
5
|
+
private readonly telegramUri;
|
|
5
6
|
constructor(logger: Logger);
|
|
6
7
|
sendNotification(message: string): Promise<void>;
|
|
8
|
+
sendTelegramNotification(message: string): Promise<void>;
|
|
7
9
|
}
|
|
@@ -24,6 +24,9 @@ let NotificationService = class NotificationService {
|
|
|
24
24
|
else {
|
|
25
25
|
throw new Error('NotificationService -> env property SLACK_CHANNEL is not provided');
|
|
26
26
|
}
|
|
27
|
+
if (process.env.TELEGRAM_CHANNEL) {
|
|
28
|
+
this.telegramUri = process.env.TELEGRAM_CHANNEL;
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
async sendNotification(message) {
|
|
29
32
|
try {
|
|
@@ -33,6 +36,19 @@ let NotificationService = class NotificationService {
|
|
|
33
36
|
this.logger.error(`Error sending notification '${message}' to slack channel ${process.env.SLACK_CHANNEL}`, error);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
39
|
+
async sendTelegramNotification(message) {
|
|
40
|
+
if (this.telegramUri) {
|
|
41
|
+
try {
|
|
42
|
+
await axios_1.default.get(`${process.env.TELEGRAM_CHANNEL}${message}`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.logger.error(`Error sending notification '${message}' to telegram ${process.env.TELEGRAM_CHANNEL}`, error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.logger.error(`Error sending notification '${message}' to telegram, TELEGRAM_CHANNEL env property not provided`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
36
52
|
};
|
|
37
53
|
exports.NotificationService = NotificationService;
|
|
38
54
|
exports.NotificationService = NotificationService = __decorate([
|