public async static void SendPicture(Message mess, string search) { try { DanbooruDonmai booru = new DanbooruDonmai(); BooruSharp.Search.Post.SearchResult result = await booru.GetRandomPostAsync(search); await BotMain.bot.SendPhotoAsync(mess.Chat.Id, new InputOnlineFile(result.FileUrl), $"Source: {result.FileUrl}"); } catch (Exception e) { LogsLevels.LogError(e.ToString()); SendPicture(mess, search); } }
public static async void OnReceivedError(Exception e, Message mess, string sendtext = "Чет не получилось :(") { try { LogsLevels.LogError(e.ToString()); await BotMain.bot.SendTextMessageAsync(BotMain.creatorId, e.ToString()); if (sendtext != "") { await BotMain.bot.SendTextMessageAsync(mess.Chat.Id, sendtext); await BotMain.bot.ForwardMessageAsync(BotMain.creatorId, mess.Chat.Id, mess.MessageId); } } catch (Exception) { } }