mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Potential fix for option saving
This commit is contained in:
@@ -116,7 +116,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
|
||||
_logger.LogDebug("Saving receiver rep with value: {Value}", receiverRepCount);
|
||||
receiverRepOption.SetValue(receiverRepCount);
|
||||
Db.Update(receiverRepOption);
|
||||
Db.AddOrUpdate(receiverRepOption);
|
||||
_logger.LogDebug("Updated value: {Value}", receiverRepOption.GetValue<double>());
|
||||
|
||||
await Reply($"{From.ToHtml()}<code>({await GetUserReputation(From)}) " +
|
||||
@@ -141,7 +141,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
reputation = Math.Round(reputation, 2);
|
||||
var opt = await GetReputationOption(RepliedUser);
|
||||
opt.SetValue(reputation);
|
||||
Db.Update(opt);
|
||||
Db.AddOrUpdate(opt);
|
||||
|
||||
await Reply(
|
||||
new HtmlString()
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
|
||||
var opt = await Db.UserValues.FindOrCreateOption(Chat.Id, "rulesMsgId");
|
||||
opt.SetValue(replyToMessage.MessageId);
|
||||
Db.Update(opt);
|
||||
Db.AddOrUpdate(opt);
|
||||
}
|
||||
|
||||
[Command(InChat.Public, "rules", CommandParseMode.Both)]
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
var warnOption = await GetWarnOption(warnUser);
|
||||
var warnCount = warnOption!.GetValue<int>() + 1;
|
||||
warnOption.SetValue(warnCount);
|
||||
Db.Update(warnOption);
|
||||
Db.AddOrUpdate(warnOption);
|
||||
|
||||
await Bot.SendTextMessageAsync(Chat.Id, $"{warnUser.ToHtml()}<code>, Вам выдано предупреждение! " +
|
||||
$"Текущее кол-во: {warnCount}/3</code>",
|
||||
@@ -49,7 +49,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
|
||||
warnCount = Math.Max(warnCount - 1, 0);
|
||||
warnOption.SetValue(warnCount);
|
||||
Db.Update(warnOption);
|
||||
Db.AddOrUpdate(warnOption);
|
||||
|
||||
await Bot.SendTextMessageAsync(Chat.Id,
|
||||
$"{RepliedUser.ToHtml()}<code>, с Вас снято предупреждение! " +
|
||||
|
||||
Reference in New Issue
Block a user