mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 10:18:27 -04:00
Fixed an issue with expression settings toggle, closes #353
This commit is contained in:
@@ -448,14 +448,15 @@ public sealed class NadekoExpressionsService : IEarlyBehavior, IReadyExecutor
|
||||
await UpdateInternalAsync(guildId, expr);
|
||||
}
|
||||
|
||||
public async Task<(bool Sucess, bool NewValue)> ToggleExprOptionAsync(int id, ExprField field)
|
||||
public async Task<(bool Sucess, bool NewValue)> ToggleExprOptionAsync(ulong? guildId, int id, ExprField field)
|
||||
{
|
||||
var newVal = false;
|
||||
NadekoExpression expr;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
expr = uow.Expressions.GetById(id);
|
||||
if (expr is null)
|
||||
|
||||
if (expr is null || expr.GuildId != guildId)
|
||||
return (false, false);
|
||||
if (field == ExprField.AutoDelete)
|
||||
newVal = expr.AutoDeleteTrigger = !expr.AutoDeleteTrigger;
|
||||
@@ -469,7 +470,7 @@ public sealed class NadekoExpressionsService : IEarlyBehavior, IReadyExecutor
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
|
||||
await UpdateInternalAsync(expr.GuildId, expr);
|
||||
await UpdateInternalAsync(guildId, expr);
|
||||
|
||||
return (true, newVal);
|
||||
}
|
||||
|
Reference in New Issue
Block a user