fixed expire settings not returned on api
This commit is contained in:
parent
1038576ff4
commit
746ffda946
3 changed files with 5 additions and 3 deletions
|
@ -118,7 +118,7 @@ public partial class Administration
|
|||
[Priority(1)]
|
||||
public async Task WarnExpire()
|
||||
{
|
||||
var expireDays = await _service.GetWarnExpire(ctx.Guild.Id);
|
||||
var (expireDays, _) = await _service.GetWarnExpire(ctx.Guild.Id);
|
||||
|
||||
if (expireDays == 0)
|
||||
await Response().Confirm(strs.warns_dont_expire).SendAsync();
|
||||
|
|
|
@ -330,11 +330,11 @@ public class UserPunishService : IEService, IReadyExecutor
|
|||
await uow.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public Task<int> GetWarnExpire(ulong guildId)
|
||||
public Task<(int, bool)> GetWarnExpire(ulong guildId)
|
||||
{
|
||||
using var uow = _db.GetDbContext();
|
||||
var config = uow.GuildConfigsForId(guildId, set => set);
|
||||
return Task.FromResult(config.WarnExpireHours / 24);
|
||||
return Task.FromResult((config.WarnExpireHours / 24, config.WarnExpireAction == WarnExpireAction.Delete));
|
||||
}
|
||||
|
||||
public async Task WarnExpireAsync(ulong guildId, int days, bool delete)
|
||||
|
|
|
@ -27,6 +27,8 @@ public sealed class WarnSvc : GrpcWarn.GrpcWarnBase, IGrpcSvc, IEService
|
|||
|
||||
var wsr = new WarnSettingsReply();
|
||||
|
||||
(wsr.ExpiryDays, wsr.DeleteOnExpire) = await _ups.GetWarnExpire(request.GuildId);
|
||||
|
||||
wsr.Punishments.AddRange(list.Select(x => new WarnPunishment()
|
||||
{
|
||||
Action = x.Punishment.ToString(),
|
||||
|
|
Loading…
Reference in a new issue