При попытке перерисовать кнопки выдаёт такую ошибку: Telegram.Bot.Exceptions.MessageIsNotModifiedException: "message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message"
Сам код:
postData = UpdatePostData(conn, e.CallbackQuery.Message.MessageId, true);
await _bot.EditMessageReplyMarkupAsync(
channelId,
e.CallbackQuery.Message.MessageId,
new InlineKeyboardMarkup(new[]
{
new [] {
new InlineKeyboardButton{Text = $" {postData.Likes}" , CallbackData = "post_id like"},
new InlineKeyboardButton{Text = $" {postData.DisLikes}",CallbackData = "post_id dislike"},
},
}),
default);
UpdatePostData:
public static PostData UpdatePostData(SQLiteConnection conn, int messageId, bool isLiked)
{
PostData postData;
if (isLiked)
{
var likesCount = conn.ExecuteReader("SELECT (Likes) FROM PostData AS pd WHERE pd.MessageId = @MessageId", new { messageId }).Parse<int>().FirstOrDefault();
var temp = 1;
if (likesCount > 0)
{
temp = likesCount++;
}
//conn.Execute("UPDATE PostData SET Likes = @Likes WHERE MessageId = @MessageId", new { Likes = temp, messageId });
using (SQLiteCommand cmd = new SQLiteCommand($"UPDATE PostData SET Likes = '{likesCount}' WHERE MessageId = '{messageId}'", conn))
{
cmd.ExecuteNonQuery();
}
}
else
{
var disLikesCount = conn.ExecuteReader("SELECT (DisLikes) FROM PostData AS pd WHERE pd.MessageId = @MessageId", new { messageId }).Parse<int>().FirstOrDefault();
var temp = 1;
if (disLikesCount > 0)
{
temp = disLikesCount++;
}
//conn.Execute("UPDATE PostData SET DisLikes = @DisLikes WHERE MessageId = @MessageId", new { DisLikes = temp, messageId });
using (SQLiteCommand cmd = new SQLiteCommand($"UPDATE PostData SET DisLikes = '{disLikesCount}' WHERE MessageId = '{messageId}'", conn))
{
cmd.ExecuteNonQuery();
}
}
postData = conn.ExecuteReader("SELECT * FROM PostData AS pd WHERE pd.MessageId = @MessageId", new { messageId }).Parse<PostData>().FirstOrDefault();
return postData;
}