From a797561a97275817f5cd3638bd15a2f057ccf707 Mon Sep 17 00:00:00 2001 From: djbadders <34887832+djbadders@users.noreply.github.com> Date: Sun, 20 Jun 2021 18:19:30 +0100 Subject: [PATCH] Updated to work with latest Telegram library --- Core/Helper/TelegramHelper.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Core/Helper/TelegramHelper.cs b/Core/Helper/TelegramHelper.cs index 16754ac..cd7d391 100644 --- a/Core/Helper/TelegramHelper.cs +++ b/Core/Helper/TelegramHelper.cs @@ -8,19 +8,15 @@ namespace Core.Helper { public static class TelegramHelper { - public static void SendMessage(string botToken, Int64 chatId, string message, bool useSilentMode, LogHelper log) + public async static void SendMessage(string botToken, Int64 chatId, string message, bool useSilentMode, LogHelper log) { if (!botToken.Equals("") && chatId != 0) { try { TelegramBotClient botClient = new TelegramBotClient(botToken); - System.Threading.Tasks.Task sentMessage = botClient.SendTextMessageAsync(chatId, message, ParseMode.Markdown, false, useSilentMode); - - if (sentMessage.IsCompleted) - { - log.DoLogDebug("Telegram message sent to ChatId " + chatId.ToString() + " on Bot Token '" + botToken + "'"); - } + await botClient.SendTextMessageAsync(chatId: chatId, text: message, parseMode: ParseMode.Markdown,disableNotification: useSilentMode); + log.DoLogDebug("Telegram message sent to ChatId " + chatId.ToString() + " on Bot Token '" + botToken + "'"); } catch (Exception ex) {