public async Task StartAntiAltAsync(ulong guildId, int minAgeMinutes, PunishmentAction action, int actionDurationMinutes = 0, ulong?roleId = null) { using var uow = _db.GetDbContext(); var gc = uow.GuildConfigs.ForId(guildId, set => set.Include(x => x.AntiAltSetting)); gc.AntiAltSetting = new AntiAltSetting() { Action = action, ActionDurationMinutes = actionDurationMinutes, MinAge = TimeSpan.FromMinutes(minAgeMinutes), RoleId = roleId, }; await uow.SaveChangesAsync(); _antiAltGuilds[guildId] = new AntiAltStats(gc.AntiAltSetting); }
private string GetAntiAltString(AntiAltStats alt) => GetText("anti_alt_status", Format.Bold(alt.MinAge.ToString(@"dd\d\ hh\h\ mm\m\ ")), Format.Bold(alt.Action.ToString()), Format.Bold(alt.Counter.ToString()));