Ejemplo n.º 1
0
        public async void SendNotifyFileLoadSuccess(StorageItemInfo item)
        {
            TelegramContext.WithFileHash(item.Hash);
            if (!Subscribers.ContainsKey(item.Owner))
            {
                return;
            }
            var ChatId = Subscribers[item.Owner];

            try
            {
                try
                {
                    using (MemoryStream imageStream = FFTools.CreateThumbnail(item.FullPath))
                    {
                        Message result = await Bot.SendPhotoAsync(
                            ChatId,
                            imageStream,
                            string.Format("{0} ({1}) done", item.Name, item.GetFormatSize()), replyMarkup : Keyboards.CommonFileActions());

                        MessagesHystory.Push(result);
                    }
                }
                catch (Exception)
                {
                    await Bot.SendTextMessageAsync(ChatId, string.Format("{0} ({1}) done", item.Name, item.GetFormatSize()));
                }
            }
            catch (Exception)
            {
                await Task.Delay(3000).ContinueWith(async(a) =>
                {
                    await Bot.SendTextMessageAsync(ChatId, string.Format("{0} ({1}) done", item.Name, item.GetFormatSize()));
                });
            }
        }
Ejemplo n.º 2
0
 public override Task Handle()
 {
     return(Owner.SendTextMessageAsync(ChatID, "Main menu", ParseMode.Default, true, false, 0, Keyboards.MainMenu(), default));
 }
Ejemplo n.º 3
0
 public override Task Handle()
 {
     return(Owner.EditMessageReplyMarkupAsync(ChatID, MessageID, Keyboards.Navigation(), default));
 }
Ejemplo n.º 4
0
 public static Task SendMainMenu(this TelegramBotClient client, long chatId)
 {
     return(client.SendTextMessageAsync(chatId, "Main menu", ParseMode.Default, false, false, 0, Keyboards.MainMenu(), default));
 }