mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
Using pattern matching for nulls where applicable, discarded unused lambda parameters, cleaned up some classes. Unignored ServerLog commands which was mistakenly ignored due to a .gitignore rule
This commit is contained in:
@@ -392,12 +392,12 @@ public partial class Administration
|
||||
|
||||
var guildUser = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, user.Id);
|
||||
|
||||
if (guildUser != null && !await CheckRoleHierarchy(guildUser))
|
||||
if (guildUser is not null && !await CheckRoleHierarchy(guildUser))
|
||||
return;
|
||||
|
||||
var dmFailed = false;
|
||||
|
||||
if (guildUser != null)
|
||||
if (guildUser is not null)
|
||||
try
|
||||
{
|
||||
var defaultMessage = GetText(strs.bandm(Format.Bold(ctx.Guild.Name), msg));
|
||||
|
@@ -80,7 +80,7 @@ public class UserPunishService : INService
|
||||
|
||||
var p = ps.FirstOrDefault(x => x.Count == warnings);
|
||||
|
||||
if (p != null)
|
||||
if (p is not null)
|
||||
{
|
||||
var user = await guild.GetUserAsync(userId);
|
||||
if (user is null)
|
||||
@@ -305,9 +305,9 @@ 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 != null)
|
||||
if (punish is PunishmentAction.Softban or PunishmentAction.Kick or PunishmentAction.RemoveRoles && time is not null)
|
||||
return false;
|
||||
if (number <= 0 || (time != null && time.Time > TimeSpan.FromDays(49)))
|
||||
if (number <= 0 || (time is not null && time.Time > TimeSpan.FromDays(49)))
|
||||
return false;
|
||||
|
||||
using var uow = _db.GetDbContext();
|
||||
@@ -336,7 +336,7 @@ WHERE GuildId={guildId}
|
||||
var ps = uow.GuildConfigsForId(guildId, set => set.Include(x => x.WarnPunishments)).WarnPunishments;
|
||||
var p = ps.FirstOrDefault(x => x.Count == number);
|
||||
|
||||
if (p != null)
|
||||
if (p is not null)
|
||||
{
|
||||
uow.Remove(p);
|
||||
uow.SaveChanges();
|
||||
|
Reference in New Issue
Block a user