Skip to content

Commit

Permalink
Receive general errors from Telegram.Bot too
Browse files Browse the repository at this point in the history
  • Loading branch information
UAVXP committed Nov 27, 2020
1 parent ef0501d commit fd06fb0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MedocUpdates/MedocTelegram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public MedocTelegram()
botClient.OnInlineResultChosen += BotClient_OnInlineResultChosen;
botClient.OnMessage += OnMessageReceived;
botClient.OnReceiveError += BotClient_OnReceiveError;

botClient.OnReceiveGeneralError += BotClient_OnReceiveGeneralError;

try
{
Log.Write(LogLevel.NORMAL, "MedocTelegram: Client begins to receive updates...");
Expand Down Expand Up @@ -112,6 +113,12 @@ private void BotClient_OnReceiveError(object sender, ReceiveErrorEventArgs e)
Log.Write(LogLevel.NORMAL, "MedocTelegram: OnReceiveError()\r\n" + e.ApiRequestException.Message);
}

private void BotClient_OnReceiveGeneralError(object sender, ReceiveGeneralErrorEventArgs e)
{
//throw new NotImplementedException();
Log.Write(LogLevel.NORMAL, "MedocTelegram: OnReceiveGeneralError()\r\n" + e.Exception.Message + "\r\n" + e.Exception.StackTrace);
}

private bool IsSubscribed(long chatID)
{
return TelegramChatsStorage.TelegramChats.IndexOf(chatID) >= 0;
Expand Down

0 comments on commit fd06fb0

Please sign in to comment.