/// <summary> /// Изменить сообщение /// </summary> /// <param name="botMessage"></param> /// <returns></returns> protected async Task <Message> EditMessage(BotMessage botMessage) { IReplyMarkup replyMarkup; replyMarkup = botMessage.MessageReplyMarkup; try { if (botMessage != null && this.Update.CallbackQuery != null && this.CallBackQueryId != null) { await AnswerCallback(botMessage.CallBackTitleText); } if (botMessage != null) { return(await Telegram.EditMessageTextAsync(this.ChatId, this.MessageId, botMessage.TextMessage, ParseMode.Html, false, replyMarkup)); } else { return(null); } } catch { return(await Telegram.SendTextMessageAsync(this.ChatId, botMessage.TextMessage, ParseMode.Html, false, false, 0, replyMarkup)); } }
protected async Task <Message> SendMessage(BotMessage botMessage, int EditMessageId = 0, int ReplyToMessageId = 0) { IReplyMarkup replyMarkup; try { replyMarkup = botMessage.MessageReplyMarkup; if (botMessage != null && this.Update.CallbackQuery != null && this.CallBackQueryId != null) { await AnswerCallback(botMessage.CallBackTitleText); } if (botMessage != null && EditMessageId != 0) { return(await Telegram.EditMessageTextAsync(this.ChatId, EditMessageId, botMessage.TextMessage, ParseMode.Html, false, replyMarkup)); } if (botMessage != null && botMessage.TextMessage != null) { return(await Telegram.SendTextMessageAsync(this.ChatId, botMessage.TextMessage, ParseMode.Html, false, false, ReplyToMessageId, replyMarkup)); } else { return(null); } } catch { //await telegram.SendTextMessageAsync(this.ChatId, botMessage.Text, ParseMode.Html, false, false, ReplyToMessageId, botMessage.InlineKeyboard); return(null); } }