コード例 #1
0
ファイル: Pictures.cs プロジェクト: Shoukox/ShiukkzBot
        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);
            }
        }
コード例 #2
0
        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) { }
        }