- added another Edit Method for InlineKeyboardMarkup

- change Send method parameter ReplyKeyboardMarkup to ReplyMarkupBase to allow also RemoveKeyboard
This commit is contained in:
FlorianDahn 2019-09-26 20:51:30 +02:00
parent 256cac825f
commit 94195ec5bf

View File

@ -150,6 +150,38 @@ namespace TelegramBotBase.Sessions
return null;
}
/// <summary>
/// Edits the text message
/// </summary>
/// <param name="messageId"></param>
/// <param name="text"></param>
/// <param name="buttons"></param>
/// <returns></returns>
public async Task<Message> Edit(int messageId, String text, InlineKeyboardMarkup markup)
{
if (this.ActiveForm == null)
return null;
if (text.Length > Constants.Telegram.MaxMessageLength)
{
throw new MaxLengthException(text.Length);
}
try
{
var m = await this.Client.TelegramClient.EditMessageTextAsync(this.DeviceId, messageId, text, replyMarkup: markup);
return m;
}
catch
{
}
return null;
}
/// <summary>
/// Edits the text message
/// </summary>
@ -270,7 +302,7 @@ namespace TelegramBotBase.Sessions
/// <param name="replyTo"></param>
/// <param name="disableNotification"></param>
/// <returns></returns>
public async Task<Message> Send(String text, ReplyKeyboardMarkup markup, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default)
public async Task<Message> Send(String text, ReplyMarkupBase markup, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default)
{
if (this.ActiveForm == null)
return null;