Don't lose ignored channels if updating .antiraid #1402
This commit is contained in:
parent
6f12ad1478
commit
2ab4274c22
@ -29,21 +29,22 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
private string GetAntiSpamString(AntiSpamStats stats)
|
private string GetAntiSpamString(AntiSpamStats stats)
|
||||||
{
|
{
|
||||||
var ignoredString = string.Join(", ", stats.AntiSpamSettings.IgnoredChannels.Select(c => $"<#{c.ChannelId}>"));
|
var settings = stats.AntiSpamSettings;
|
||||||
|
var ignoredString = string.Join(", ", settings.IgnoredChannels.Select(c => $"<#{c.ChannelId}>"));
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(ignoredString))
|
if (string.IsNullOrWhiteSpace(ignoredString))
|
||||||
ignoredString = "none";
|
ignoredString = "none";
|
||||||
|
|
||||||
string add = "";
|
string add = "";
|
||||||
if (stats.AntiSpamSettings.Action == PunishmentAction.Mute
|
if (settings.Action == PunishmentAction.Mute
|
||||||
&& stats.AntiSpamSettings.MuteTime > 0)
|
&& settings.MuteTime > 0)
|
||||||
{
|
{
|
||||||
add = " (" + stats.AntiSpamSettings.MuteTime + "s)";
|
add = " (" + settings.MuteTime + "s)";
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetText("spam_stats",
|
return GetText("spam_stats",
|
||||||
Format.Bold(stats.AntiSpamSettings.MessageThreshold.ToString()),
|
Format.Bold(settings.MessageThreshold.ToString()),
|
||||||
Format.Bold(stats.AntiSpamSettings.Action.ToString() + add),
|
Format.Bold(settings.Action.ToString() + add),
|
||||||
ignoredString);
|
ignoredString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,11 +175,9 @@ namespace NadekoBot.Modules.Administration
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_service.AntiSpamGuilds.AddOrUpdate(Context.Guild.Id, stats, (key, old) =>
|
stats = _service.AntiSpamGuilds.AddOrUpdate(Context.Guild.Id, stats, (key, old) =>
|
||||||
{
|
{
|
||||||
stats.AntiSpamSettings.MessageThreshold = messageCount;
|
stats.AntiSpamSettings.IgnoredChannels = old.AntiSpamSettings.IgnoredChannels;
|
||||||
stats.AntiSpamSettings.Action = action;
|
|
||||||
stats.AntiSpamSettings.MuteTime = time;
|
|
||||||
return stats;
|
return stats;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user