diff --git a/Telegram bots/Telegram bots.csproj b/Telegram bots/Telegram bots.csproj
index ac89232..845e29a 100644
--- a/Telegram bots/Telegram bots.csproj
+++ b/Telegram bots/Telegram bots.csproj
@@ -7,7 +7,7 @@
enable
True
False
- Library
+ Exe
diff --git a/Telegram bots/TelegramBot.cs b/Telegram bots/TelegramBot.cs
index 4101b9c..feefe83 100644
--- a/Telegram bots/TelegramBot.cs
+++ b/Telegram bots/TelegramBot.cs
@@ -137,6 +137,8 @@ public async Task SendMessage(object messageText,
///
/// Identifier of the message to delete
/// Unique identifier for the target chat
+ /// It is thrown if one of the arguments is null
+ /// It is thrown if an incorrect request was made
/// True on success
public async Task DeleteMessage(long messageId, long? chatId = null)
{
@@ -164,6 +166,52 @@ public async Task DeleteMessage(long messageId, long? chatId = null)
}
#endregion
+ #region EditMessageText
+ ///
+ /// Use this method to edit text messages
+ ///
+ /// New text of the message
+ /// Identifier of the message to edit
+ /// Unique identifier for the target chat
+ /// Inline keyboard
+ /// It is thrown if one of the arguments is null
+ /// It is thrown if an incorrect request was made
+ ///
+ public async Task EditMessageText(object messageText,
+ long messageId,
+ long? chatId = null,
+ Keyboards.InlineKeyboard? keyboard = null)
+ {
+ ArgumentNullException.ThrowIfNull(messageText);
+ ArgumentNullException.ThrowIfNull(messageId);
+
+ chatId ??= lastChatId;
+
+ Dictionary contentData = [];
+
+ contentData["text"] = messageText.ToString();
+ contentData["message_id"] = messageId.ToString();
+ contentData["chat_id"] = chatId.ToString();
+ if (keyboard != null)
+ {
+ contentData["reply_markup"] = JsonSerializer.Serialize(keyboard, typeof(Keyboards.InlineKeyboard));
+ }
+
+ HttpContent content = new FormUrlEncodedContent(contentData);
+
+ HttpResponseMessage response = await httpClient.PostAsync("editMessageText", content);
+ string jsonString = await response.Content.ReadAsStringAsync();
+
+ JsonDocument json = JsonDocument.Parse(jsonString);
+
+ Exceptions.IncorrectRequestException.ThrowIfNotOk(json);
+
+ Message message = Message.FromJSON(json.RootElement.GetProperty("result"));
+
+ return message;
+ }
+ #endregion
+
#region AnswerCallbackQuery
///
/// This method must be called after receiving the callback query request.