From 71a21c32bdaf3c72cff29ce128459389a6133180 Mon Sep 17 00:00:00 2001 From: Ronny Gunawan <3048897+ronnygunawan@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:04:56 +0700 Subject: [PATCH] Change AI parse mode to MarkdownV2 --- BotNet.Services/BotCommands/OpenAI.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BotNet.Services/BotCommands/OpenAI.cs b/BotNet.Services/BotCommands/OpenAI.cs index 5311c5f..b631091 100644 --- a/BotNet.Services/BotCommands/OpenAI.cs +++ b/BotNet.Services/BotCommands/OpenAI.cs @@ -386,23 +386,23 @@ await botClient.SendTextMessageAsync( if (attachments.Count == 0) { return await botClient.SendTextMessageAsync( chatId: message.Chat.Id, - text: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + text: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); } else if (attachments.Count == 1) { return await botClient.SendPhotoAsync( chatId: message.Chat.Id, photo: new InputOnlineFile(attachments[0]), - caption: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + caption: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); } else { Message sentMessage = await botClient.SendTextMessageAsync( chatId: message.Chat.Id, - text: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + text: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); await botClient.SendMediaGroupAsync( @@ -458,23 +458,23 @@ await botClient.SendTextMessageAsync( if (attachments.Count == 0) { return await botClient.SendTextMessageAsync( chatId: message.Chat.Id, - text: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + text: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); } else if (attachments.Count == 1) { return await botClient.SendPhotoAsync( chatId: message.Chat.Id, photo: new InputOnlineFile(attachments[0]), - caption: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + caption: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); } else { Message sentMessage = await botClient.SendTextMessageAsync( chatId: message.Chat.Id, - text: WebUtility.HtmlEncode(result), - parseMode: ParseMode.Html, + text: result, + parseMode: ParseMode.MarkdownV2, replyToMessageId: message.MessageId, cancellationToken: cancellationToken); await botClient.SendMediaGroupAsync(