mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
8c5d7d0c49
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
21 lines
512 B
TypeScript
21 lines
512 B
TypeScript
import {Config} from '../config';
|
|
import {Logger} from '../logger';
|
|
import {TelegramClient} from 'messaging-api-telegram';
|
|
|
|
const telegram = Config.notifications.telegram;
|
|
|
|
const client = new TelegramClient({
|
|
accessToken: telegram.accessToken
|
|
});
|
|
|
|
export function sendTelegramMessage(text: string) {
|
|
(async () => {
|
|
try {
|
|
await client.sendMessage(telegram.chatId, text);
|
|
Logger.info(`✔ telegram message sent to '${telegram.chatId}': ${text}`);
|
|
} catch (error) {
|
|
Logger.error(error);
|
|
}
|
|
})();
|
|
}
|