Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Jul 28, 2023
1 parent 94c1f5a commit 51692df
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Echo/Main/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Echo;
internal static class Program
{
/// <summary>
/// Telegram bot
/// Telegram bot
/// </summary>
private static TelegramBot? _telegramBot;

Expand All @@ -31,7 +31,7 @@ public static void Main(string[] args)
_telegramBot.Start(HandleUpdateAsync);
Wait.WaitForeverConsoleReadline();
}

/// <summary>
/// Handle updates
/// </summary>
Expand All @@ -43,21 +43,19 @@ private static async Task HandleUpdateAsync(ITelegramBotClient botClient, Update
{
if (_telegramBot == null)
return;

// Safe check to see if the bot we have is actually the one generating the update
if (botClient.BotId != _telegramBot.GetId())
return;

// Only process Message updates: https://core.telegram.org/bots/api#message
if (update.Message is not { } message)
return;

//Simply handle every message update with the "echo" method
await PoliNetwork.Telegram.Utils.Echo.EchoMethod(
message,
message,
_telegramBot, //we actually pass our bot object, not the one received from the caller
cancellationToken);
}


}

0 comments on commit 51692df

Please sign in to comment.