mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
- Renamed CustomReaction model to NadekoExpression
- Used structured logging everywhere
This commit is contained in:
@@ -86,7 +86,7 @@ public partial class Administration
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex.Message);
|
||||
Log.Warning(ex, "Exception occured while warning a user");
|
||||
var errorEmbed = _eb.Create().WithErrorColor().WithDescription(GetText(strs.cant_apply_punishment));
|
||||
|
||||
if (dmFailed) errorEmbed.WithFooter("⚠️ " + GetText(strs.unable_to_dm_user));
|
||||
@@ -565,7 +565,7 @@ public partial class Administration
|
||||
{
|
||||
var bans = await ctx.Guild.GetBansAsync();
|
||||
|
||||
var bun = bans.FirstOrDefault(x => x.User.ToString().ToLowerInvariant() == user.ToLowerInvariant());
|
||||
var bun = bans.FirstOrDefault(x => x.User.ToString()!.ToLowerInvariant() == user.ToLowerInvariant());
|
||||
|
||||
if (bun is null)
|
||||
{
|
||||
|
@@ -162,7 +162,9 @@ public class UserPunishService : INService
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warning($"Can't find role {roleId.Value} on server {guild.Id} to apply punishment.");
|
||||
Log.Warning("Can't find role {RoleId} on server {GuildId} to apply punishment",
|
||||
roleId.Value,
|
||||
guild.Id);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -217,7 +219,9 @@ WHERE GuildId in (SELECT GuildId FROM GuildConfigs WHERE WarnExpireHours > 0 AND
|
||||
AND DateAdded < datetime('now', (SELECT '-' || WarnExpireHours || ' hours' FROM GuildConfigs as gc WHERE gc.GuildId = Warnings.GuildId));");
|
||||
|
||||
if (cleared > 0 || deleted > 0)
|
||||
Log.Information($"Cleared {cleared} warnings and deleted {deleted} warnings due to expiry.");
|
||||
Log.Information("Cleared {ClearedWarnings} warnings and deleted {DeletedWarnings} warnings due to expiry",
|
||||
cleared,
|
||||
deleted);
|
||||
}
|
||||
|
||||
public async Task CheckWarnExpiresAsync(ulong guildId)
|
||||
@@ -305,7 +309,8 @@ WHERE GuildId={guildId}
|
||||
IRole role = null)
|
||||
{
|
||||
// these 3 don't make sense with time
|
||||
if (punish is PunishmentAction.Softban or PunishmentAction.Kick or PunishmentAction.RemoveRoles && time is not null)
|
||||
if (punish is PunishmentAction.Softban or PunishmentAction.Kick or PunishmentAction.RemoveRoles
|
||||
&& time is not null)
|
||||
return false;
|
||||
if (number <= 0 || (time is not null && time.Time > TimeSpan.FromDays(49)))
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user