mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Changed all == null to is null and all !(* == null) to * is not null
This commit is contained in:
		@@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
        public async Task Slowmode(StoopidTime time = null)
 | 
			
		||||
        {
 | 
			
		||||
            var seconds = (int?)time?.Time.TotalSeconds ?? 0;
 | 
			
		||||
            if (!(time is null) && (time.Time < TimeSpan.FromSeconds(0) || time.Time > TimeSpan.FromHours(6)))
 | 
			
		||||
            if (time is not null && (time.Time < TimeSpan.FromSeconds(0) || time.Time > TimeSpan.FromHours(6)))
 | 
			
		||||
                return;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
@@ -305,13 +305,13 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            var msg = await channel.GetMessageAsync(messageId).ConfigureAwait(false);
 | 
			
		||||
            if (msg == null)
 | 
			
		||||
            if (msg is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("msg_not_found").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (time == null)
 | 
			
		||||
            if (time is null)
 | 
			
		||||
            {
 | 
			
		||||
                await msg.DeleteAsync().ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                var existing = roles.Select(rid => ctx.Guild.GetRole(rid)).Where(r => !(r is null))
 | 
			
		||||
                var existing = roles.Select(rid => ctx.Guild.GetRole(rid)).Where(r => r is not null)
 | 
			
		||||
                    .ToList();
 | 
			
		||||
 | 
			
		||||
                if (existing.Count != roles.Count)
 | 
			
		||||
 
 | 
			
		||||
@@ -19,14 +19,14 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
            {
 | 
			
		||||
                var vch = ((IGuildUser)ctx.User).VoiceChannel;
 | 
			
		||||
 | 
			
		||||
                if (vch == null)
 | 
			
		||||
                if (vch is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("not_in_voice").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                var id = _service.ToggleGameVoiceChannel(ctx.Guild.Id, vch.Id);
 | 
			
		||||
 | 
			
		||||
                if (id == null)
 | 
			
		||||
                if (id is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("gvc_disabled").ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                var str = string.Join("\n", Enum.GetNames(typeof(LogType))
 | 
			
		||||
                    .Select(x =>
 | 
			
		||||
                    {
 | 
			
		||||
                        var val = l == null ? null : GetLogProperty(l, Enum.Parse<LogType>(x));
 | 
			
		||||
                        var val = l is null ? null : GetLogProperty(l, Enum.Parse<LogType>(x));
 | 
			
		||||
                        if (val != null)
 | 
			
		||||
                            return $"{Format.Bold(x)} <#{val}>";
 | 
			
		||||
                        return Format.Bold(x);
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                var msg = await _service.RemovePlayingAsync(index).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                if (msg == null)
 | 
			
		||||
                if (msg is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                await ReplyConfirmLocalizedAsync("reprm", msg).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                if (!(punishTime is null))
 | 
			
		||||
                if (punishTime is not null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (!_service.IsDurationAllowed(action))
 | 
			
		||||
                    {
 | 
			
		||||
@@ -128,7 +128,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                var stats = await _service.StartAntiRaidAsync(ctx.Guild.Id, userThreshold, seconds,
 | 
			
		||||
                    action, time).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                if (stats == null)
 | 
			
		||||
                if (stats is null)
 | 
			
		||||
                {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
@@ -185,7 +185,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                if (messageCount < 2 || messageCount > 10)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                if (!(timeData is null))
 | 
			
		||||
                if (timeData is not null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (!_service.IsDurationAllowed(action))
 | 
			
		||||
                    {
 | 
			
		||||
@@ -244,7 +244,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                        .WithValue(GetAntiRaidString(raid).TrimTo(1024))
 | 
			
		||||
                        .WithIsInline(true));
 | 
			
		||||
 | 
			
		||||
                if (!(alt is null))
 | 
			
		||||
                if (alt is not null)
 | 
			
		||||
                    embed.AddField("Anti-Alt", GetAntiAltString(alt), true);
 | 
			
		||||
 | 
			
		||||
                await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                var msgs = await ((SocketTextChannel)ctx.Channel).GetMessagesAsync().FlattenAsync().ConfigureAwait(false);
 | 
			
		||||
                var prev = (IUserMessage)msgs.FirstOrDefault(x => x is IUserMessage && x.Id != ctx.Message.Id);
 | 
			
		||||
 | 
			
		||||
                if (prev == null)
 | 
			
		||||
                if (prev is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                if (input.Length % 2 != 0)
 | 
			
		||||
@@ -144,7 +144,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                    {
 | 
			
		||||
                        var ch = g.GetTextChannel(rr.ChannelId);
 | 
			
		||||
                        IUserMessage msg = null;
 | 
			
		||||
                        if (!(ch is null))
 | 
			
		||||
                        if (ch is not null)
 | 
			
		||||
                        {
 | 
			
		||||
                            msg = await ch.GetMessageAsync(rr.MessageId).ConfigureAwait(false) as IUserMessage;
 | 
			
		||||
                        }
 | 
			
		||||
 
 | 
			
		||||
@@ -138,7 +138,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                        rolesStr.AppendLine("\t\t\t\t ⟪" + groupNameText + "⟫");
 | 
			
		||||
                        foreach (var (Model, Role) in kvp.AsEnumerable())
 | 
			
		||||
                        {
 | 
			
		||||
                            if (Role == null)
 | 
			
		||||
                            if (Role is null)
 | 
			
		||||
                            {
 | 
			
		||||
                                continue;
 | 
			
		||||
                            }
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
 | 
			
		||||
                    .WithTitle(GetText("scadd"))
 | 
			
		||||
                    .AddField(efb => efb.WithName(GetText("server"))
 | 
			
		||||
                        .WithValue(cmd.GuildId == null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}").WithIsInline(true))
 | 
			
		||||
                        .WithValue(cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}").WithIsInline(true))
 | 
			
		||||
                    .AddField(efb => efb.WithName(GetText("channel"))
 | 
			
		||||
                        .WithValue($"{cmd.ChannelName}/{cmd.ChannelId}").WithIsInline(true))
 | 
			
		||||
                    .AddField(efb => efb.WithName(GetText("command_text"))
 | 
			
		||||
@@ -419,7 +419,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                    .WithDefault(Context)
 | 
			
		||||
                    .Build();
 | 
			
		||||
 | 
			
		||||
                await _bot.SetGameAsync(game == null ? game : rep.Replace(game), type).ConfigureAwait(false);
 | 
			
		||||
                await _bot.SetGameAsync(game is null ? game : rep.Replace(game), type).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                await ReplyConfirmLocalizedAsync("set_game").ConfigureAwait(false);
 | 
			
		||||
            }
 | 
			
		||||
@@ -448,7 +448,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                var sid = ulong.Parse(ids[0]);
 | 
			
		||||
                var server = _client.Guilds.FirstOrDefault(s => s.Id == sid);
 | 
			
		||||
 | 
			
		||||
                if (server == null)
 | 
			
		||||
                if (server is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                var rep = new ReplacementBuilder()
 | 
			
		||||
@@ -459,7 +459,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                {
 | 
			
		||||
                    var cid = ulong.Parse(ids[1].Substring(2));
 | 
			
		||||
                    var ch = server.TextChannels.FirstOrDefault(c => c.Id == cid);
 | 
			
		||||
                    if (ch == null)
 | 
			
		||||
                    if (ch is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -477,7 +477,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                {
 | 
			
		||||
                    var uid = ulong.Parse(ids[1].Substring(2));
 | 
			
		||||
                    var user = server.Users.FirstOrDefault(u => u.Id == uid);
 | 
			
		||||
                    if (user == null)
 | 
			
		||||
                    if (user is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                var old = conf.DelMsgOnCmdChannels.FirstOrDefault(x => x.ChannelId == chId);
 | 
			
		||||
                if (newState == Administration.State.Inherit)
 | 
			
		||||
                {
 | 
			
		||||
                    if (!(old is null))
 | 
			
		||||
                    if (old is not null)
 | 
			
		||||
                    {
 | 
			
		||||
                        conf.DelMsgOnCmdChannels.Remove(old);
 | 
			
		||||
                        uow.Remove(old);
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    {
 | 
			
		||||
                        var roleIds = savedRoleIds
 | 
			
		||||
                            .Select(roleId => user.Guild.GetRole(roleId))
 | 
			
		||||
                            .Where(x => !(x is null))
 | 
			
		||||
                            .Where(x => x is not null)
 | 
			
		||||
                            .ToList();
 | 
			
		||||
                        
 | 
			
		||||
                        if (roleIds.Any())
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ DELETE FROM Clubs;";
 | 
			
		||||
                .FirstOrDefaultAsyncEF(x => x.Waifu.UserId == userId);
 | 
			
		||||
 | 
			
		||||
            // if it exists, delete waifu related things
 | 
			
		||||
            if (!(wi is null))
 | 
			
		||||
            if (wi is not null)
 | 
			
		||||
            {
 | 
			
		||||
                // remove updates which have new or old as this waifu
 | 
			
		||||
                await uow
 | 
			
		||||
 
 | 
			
		||||
@@ -145,7 +145,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
        public async Task<bool> TryBlockLate(DiscordSocketClient client, ICommandContext context, string moduleName,
 | 
			
		||||
            CommandInfo command)
 | 
			
		||||
        {
 | 
			
		||||
            if (TryGetOverrides(context.Guild?.Id ?? 0, command.Name, out var perm) && !(perm is null))
 | 
			
		||||
            if (TryGetOverrides(context.Guild?.Id ?? 0, command.Name, out var perm) && perm is not null)
 | 
			
		||||
            {
 | 
			
		||||
                var result = await new RequireUserPermissionAttribute((GuildPermission) perm)
 | 
			
		||||
                    .CheckPermissionsAsync(context, command, _services);
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                {
 | 
			
		||||
                    //if the user is in the voice channel and that voice channel is gvc
 | 
			
		||||
                    var vc = after.VoiceChannel;
 | 
			
		||||
                    if (vc == null || !GameVoiceChannels.Contains(vc.Id))
 | 
			
		||||
                    if (vc is null || !GameVoiceChannels.Contains(vc.Id))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    //if the activity has changed, and is a playing activity
 | 
			
		||||
@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    var game = gUser.Activity?.Name;
 | 
			
		||||
 | 
			
		||||
                    if (oldState.VoiceChannel == newState.VoiceChannel ||
 | 
			
		||||
                        newState.VoiceChannel == null)
 | 
			
		||||
                        newState.VoiceChannel is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GameVoiceChannels.Contains(newState.VoiceChannel.Id) ||
 | 
			
		||||
@@ -123,7 +123,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            var vch = gUser.Guild.VoiceChannels
 | 
			
		||||
                .FirstOrDefault(x => x.Name.ToLowerInvariant() == game);
 | 
			
		||||
 | 
			
		||||
            if (vch == null)
 | 
			
		||||
            if (vch is null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            await Task.Delay(1000).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            TimeZoneInfo tz;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if (x.TimeZoneId == null)
 | 
			
		||||
                if (x.TimeZoneId is null)
 | 
			
		||||
                    tz = null;
 | 
			
		||||
                else
 | 
			
		||||
                    tz = TimeZoneInfo.FindSystemTimeZoneById(x.TimeZoneId);
 | 
			
		||||
@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                gc.TimeZoneId = tz?.Id;
 | 
			
		||||
                uow.SaveChanges();
 | 
			
		||||
 | 
			
		||||
                if (tz == null)
 | 
			
		||||
                if (tz is null)
 | 
			
		||||
                    _timezones.TryRemove(guildId, out tz);
 | 
			
		||||
                else
 | 
			
		||||
                    _timezones.AddOrUpdate(guildId, tz, (key, old) => tz);
 | 
			
		||||
 
 | 
			
		||||
@@ -203,12 +203,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    var g = after.Guild;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(g.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserUpdatedId == null))
 | 
			
		||||
                        || (logSetting.UserUpdatedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel =
 | 
			
		||||
                        await TryGetLogChannel(g, logSetting, LogType.UserUpdated).ConfigureAwait(false)) == null)
 | 
			
		||||
                        await TryGetLogChannel(g, logSetting, LogType.UserUpdated).ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var embed = new EmbedBuilder();
 | 
			
		||||
@@ -262,54 +262,54 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                switch (type)
 | 
			
		||||
                {
 | 
			
		||||
                    case LogType.Other:
 | 
			
		||||
                        channelId = logSetting.LogOtherId = (logSetting.LogOtherId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.LogOtherId = (logSetting.LogOtherId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.MessageUpdated:
 | 
			
		||||
                        channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.MessageDeleted:
 | 
			
		||||
                        channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId is null ? cid : default);
 | 
			
		||||
                        //logSetting.DontLogBotMessageDeleted = (options == "nobot");
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserJoined:
 | 
			
		||||
                        channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserLeft:
 | 
			
		||||
                        channelId = logSetting.UserLeftId = (logSetting.UserLeftId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserLeftId = (logSetting.UserLeftId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserBanned:
 | 
			
		||||
                        channelId = logSetting.UserBannedId = (logSetting.UserBannedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserBannedId = (logSetting.UserBannedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserUnbanned:
 | 
			
		||||
                        channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserUpdated:
 | 
			
		||||
                        channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserMuted:
 | 
			
		||||
                        channelId = logSetting.UserMutedId = (logSetting.UserMutedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.UserMutedId = (logSetting.UserMutedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.ChannelCreated:
 | 
			
		||||
                        channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.ChannelDestroyed:
 | 
			
		||||
                        channelId = logSetting.ChannelDestroyedId =
 | 
			
		||||
                            (logSetting.ChannelDestroyedId == null ? cid : default);
 | 
			
		||||
                            (logSetting.ChannelDestroyedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.ChannelUpdated:
 | 
			
		||||
                        channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId == null ? cid : default);
 | 
			
		||||
                        channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.UserPresence:
 | 
			
		||||
                        channelId = logSetting.LogUserPresenceId =
 | 
			
		||||
                            (logSetting.LogUserPresenceId == null ? cid : default);
 | 
			
		||||
                            (logSetting.LogUserPresenceId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.VoicePresence:
 | 
			
		||||
                        channelId = logSetting.LogVoicePresenceId =
 | 
			
		||||
                            (logSetting.LogVoicePresenceId == null ? cid : default);
 | 
			
		||||
                            (logSetting.LogVoicePresenceId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                    case LogType.VoicePresenceTTS:
 | 
			
		||||
                        channelId = logSetting.LogVoicePresenceTTSId =
 | 
			
		||||
                            (logSetting.LogVoicePresenceTTSId == null ? cid : default);
 | 
			
		||||
                            (logSetting.LogVoicePresenceTTSId is null ? cid : default);
 | 
			
		||||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@@ -335,12 +335,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.LogVoicePresenceTTSId == null))
 | 
			
		||||
                        || (logSetting.LogVoicePresenceTTSId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresenceTTS)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var str = "";
 | 
			
		||||
@@ -348,11 +348,11 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    {
 | 
			
		||||
                        str = GetText(logChannel.Guild, "log_vc_moved", usr.Username, beforeVch?.Name, afterVch?.Name);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (beforeVch == null)
 | 
			
		||||
                    else if (beforeVch is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        str = GetText(logChannel.Guild, "log_vc_joined", usr.Username, afterVch.Name);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (afterVch == null)
 | 
			
		||||
                    else if (afterVch is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        str = GetText(logChannel.Guild, "log_vc_left", usr.Username, beforeVch.Name);
 | 
			
		||||
                    }
 | 
			
		||||
@@ -375,12 +375,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserMutedId == null))
 | 
			
		||||
                        || (logSetting.UserMutedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    var mutes = "";
 | 
			
		||||
                    var mutedLocalized = GetText(logChannel.Guild, "muted_sn");
 | 
			
		||||
@@ -419,12 +419,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserMutedId == null))
 | 
			
		||||
                        || (logSetting.UserMutedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserMuted)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var mutes = "";
 | 
			
		||||
@@ -471,11 +471,11 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(users.First().Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.LogOtherId == null))
 | 
			
		||||
                        || (logSetting.LogOtherId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(users.First().Guild, logSetting, LogType.Other)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var punishment = "";
 | 
			
		||||
@@ -642,13 +642,13 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    var after = (IGuildChannel) cafter;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(before.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.ChannelUpdatedId == null)
 | 
			
		||||
                        || (logSetting.ChannelUpdatedId is null)
 | 
			
		||||
                        || logSetting.IgnoredChannels.Any(ilc => ilc.ChannelId == after.Id))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(before.Guild, logSetting, LogType.ChannelUpdated)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var embed = new EmbedBuilder().WithOkColor()
 | 
			
		||||
@@ -698,13 +698,13 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.ChannelDestroyedId == null)
 | 
			
		||||
                        || (logSetting.ChannelDestroyedId is null)
 | 
			
		||||
                        || logSetting.IgnoredChannels.Any(ilc => ilc.ChannelId == ch.Id))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelDestroyed)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    string title;
 | 
			
		||||
                    if (ch is IVoiceChannel)
 | 
			
		||||
@@ -738,12 +738,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.ChannelCreatedId == null))
 | 
			
		||||
                        || (logSetting.ChannelCreatedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(ch.Guild, logSetting, LogType.ChannelCreated)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    string title;
 | 
			
		||||
                    if (ch is IVoiceChannel)
 | 
			
		||||
@@ -783,12 +783,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.LogVoicePresenceId == null))
 | 
			
		||||
                        || (logSetting.LogVoicePresenceId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.VoicePresence)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    string str = null;
 | 
			
		||||
@@ -799,14 +799,14 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                            "👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
 | 
			
		||||
                            Format.Bold(beforeVch?.Name ?? ""), Format.Bold(afterVch?.Name ?? ""));
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (beforeVch == null)
 | 
			
		||||
                    else if (beforeVch is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild,
 | 
			
		||||
                            "user_vjoined",
 | 
			
		||||
                            "👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
 | 
			
		||||
                            Format.Bold(afterVch.Name ?? ""));
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (afterVch == null)
 | 
			
		||||
                    else if (afterVch is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        str = "🎙" + Format.Code(PrettyCurrentTime(usr.Guild)) + GetText(logChannel.Guild, "user_vleft",
 | 
			
		||||
                            "👤" + Format.Bold(usr.Username + "#" + usr.Discriminator),
 | 
			
		||||
@@ -836,16 +836,16 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
        //        {
 | 
			
		||||
        //            var guild = optGuild.GetValueOrDefault() ?? (usr as SocketGuildUser)?.Guild;
 | 
			
		||||
 | 
			
		||||
        //            if (guild == null)
 | 
			
		||||
        //            if (guild is null)
 | 
			
		||||
        //                return;
 | 
			
		||||
 | 
			
		||||
        //            if (!GuildLogSettings.TryGetValue(guild.Id, out LogSetting logSetting)
 | 
			
		||||
        //                || (logSetting.LogUserPresenceId == null)
 | 
			
		||||
        //                || (logSetting.LogUserPresenceId is null)
 | 
			
		||||
        //                || before.Status == after.Status)
 | 
			
		||||
        //                return;
 | 
			
		||||
 | 
			
		||||
        //            ITextChannel logChannel;
 | 
			
		||||
        //            if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserPresence)) == null)
 | 
			
		||||
        //            if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserPresence)) is null)
 | 
			
		||||
        //                return;
 | 
			
		||||
        //            string str = "";
 | 
			
		||||
        //            if (before.Status != after.Status)
 | 
			
		||||
@@ -878,12 +878,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserLeftId == null))
 | 
			
		||||
                        || (logSetting.UserLeftId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserLeft)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    var embed = new EmbedBuilder()
 | 
			
		||||
                        .WithOkColor()
 | 
			
		||||
@@ -912,12 +912,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserJoinedId == null))
 | 
			
		||||
                        || (logSetting.UserJoinedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(usr.Guild, logSetting, LogType.UserJoined)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var embed = new EmbedBuilder()
 | 
			
		||||
@@ -953,12 +953,12 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserUnbannedId == null))
 | 
			
		||||
                        || (logSetting.UserUnbannedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(guild, logSetting, LogType.UserUnbanned)
 | 
			
		||||
                        .ConfigureAwait(false)) == null)
 | 
			
		||||
                        .ConfigureAwait(false)) is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    var embed = new EmbedBuilder()
 | 
			
		||||
                        .WithOkColor()
 | 
			
		||||
@@ -987,7 +987,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.UserBannedId == null))
 | 
			
		||||
                        || (logSetting.UserBannedId is null))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
@@ -1024,7 +1024,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    var msg = (optMsg.HasValue ? optMsg.Value : null) as IUserMessage;
 | 
			
		||||
                    if (msg == null || msg.IsAuthor(_client))
 | 
			
		||||
                    if (msg is null || msg.IsAuthor(_client))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (_ignoreMessageIds.Contains(msg.Id))
 | 
			
		||||
@@ -1034,13 +1034,13 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.MessageDeletedId == null)
 | 
			
		||||
                        || (logSetting.MessageDeletedId is null)
 | 
			
		||||
                        || logSetting.IgnoredChannels.Any(ilc => ilc.ChannelId == channel.Id))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageDeleted)
 | 
			
		||||
                        .ConfigureAwait(false)) == null || logChannel.Id == msg.Id)
 | 
			
		||||
                        .ConfigureAwait(false)) is null || logChannel.Id == msg.Id)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var resolvedMessage = msg.Resolve(userHandling: TagHandling.FullName);
 | 
			
		||||
@@ -1080,7 +1080,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var before = (optmsg.HasValue ? optmsg.Value : null) as IUserMessage;
 | 
			
		||||
                    if (before == null)
 | 
			
		||||
                    if (before is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!(ch is ITextChannel channel))
 | 
			
		||||
@@ -1093,13 +1093,13 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out LogSetting logSetting)
 | 
			
		||||
                        || (logSetting.MessageUpdatedId == null)
 | 
			
		||||
                        || (logSetting.MessageUpdatedId is null)
 | 
			
		||||
                        || logSetting.IgnoredChannels.Any(ilc => ilc.ChannelId == channel.Id))
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    ITextChannel logChannel;
 | 
			
		||||
                    if ((logChannel = await TryGetLogChannel(channel.Guild, logSetting, LogType.MessageUpdated)
 | 
			
		||||
                        .ConfigureAwait(false)) == null || logChannel.Id == after.Channel.Id)
 | 
			
		||||
                        .ConfigureAwait(false)) is null || logChannel.Id == after.Channel.Id)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var embed = new EmbedBuilder()
 | 
			
		||||
@@ -1208,7 +1208,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
 | 
			
		||||
            var channel = await guild.GetTextChannelAsync(id.Value).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (channel == null)
 | 
			
		||||
            if (channel is null)
 | 
			
		||||
            {
 | 
			
		||||
                UnsetLogSetting(guild.Id, logChannelType);
 | 
			
		||||
                return null;
 | 
			
		||||
 
 | 
			
		||||
@@ -159,7 +159,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            {
 | 
			
		||||
                MutedUsers.TryGetValue(usr.Guild.Id, out ConcurrentHashSet<ulong> muted);
 | 
			
		||||
 | 
			
		||||
                if (muted == null || !muted.Contains(usr.Id))
 | 
			
		||||
                if (muted is null || !muted.Contains(usr.Id))
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
                var _ = Task.Run(() => MuteUser(usr, _client.CurrentUser, reason: "Sticky mute").ConfigureAwait(false));
 | 
			
		||||
            }
 | 
			
		||||
@@ -259,7 +259,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            }
 | 
			
		||||
            else if (type == MuteType.Voice)
 | 
			
		||||
            {
 | 
			
		||||
                if (usr == null)
 | 
			
		||||
                if (usr is null)
 | 
			
		||||
                    return;
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
@@ -270,7 +270,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            }
 | 
			
		||||
            else if (type == MuteType.Chat)
 | 
			
		||||
            {
 | 
			
		||||
                if (usr == null)
 | 
			
		||||
                if (usr is null)
 | 
			
		||||
                    return;
 | 
			
		||||
                await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild).ConfigureAwait(false)).ConfigureAwait(false);
 | 
			
		||||
                UserUnmuted(usr, mod, MuteType.Chat, reason);
 | 
			
		||||
@@ -279,7 +279,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
 | 
			
		||||
        public async Task<IRole> GetMuteRole(IGuild guild)
 | 
			
		||||
        {
 | 
			
		||||
            if (guild == null)
 | 
			
		||||
            if (guild is null)
 | 
			
		||||
                throw new ArgumentNullException(nameof(guild));
 | 
			
		||||
 | 
			
		||||
            const string defaultMuteRoleName = "nadeko-mute";
 | 
			
		||||
@@ -287,7 +287,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            var muteRoleName = GuildMuteRoles.GetOrAdd(guild.Id, defaultMuteRoleName);
 | 
			
		||||
 | 
			
		||||
            var muteRole = guild.Roles.FirstOrDefault(r => r.Name == muteRoleName);
 | 
			
		||||
            if (muteRole == null)
 | 
			
		||||
            if (muteRole is null)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                //if it doesn't exist, create it
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                _antiSpamGuilds[gc.GuildId] = new AntiSpamStats() { AntiSpamSettings = spam };
 | 
			
		||||
 | 
			
		||||
            var alt = gc.AntiAltSetting;
 | 
			
		||||
            if (!(alt is null))
 | 
			
		||||
            if (alt is not null)
 | 
			
		||||
                _antiAltGuilds[gc.GuildId] = new AntiAltStats(alt);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
 | 
			
		||||
                    var conf = confs.FirstOrDefault(x => x.MessageId == msg.Id);
 | 
			
		||||
 | 
			
		||||
                    if (conf == null)
 | 
			
		||||
                    if (conf is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    // compare emote names for backwards compatibility :facepalm:
 | 
			
		||||
@@ -129,7 +129,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
 | 
			
		||||
                    var conf = confs.FirstOrDefault(x => x.MessageId == msg.Id);
 | 
			
		||||
 | 
			
		||||
                    if (conf == null)
 | 
			
		||||
                    if (conf is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var reactionRole = conf.ReactionRoles.FirstOrDefault(x => x.EmoteName == reaction.Emote.Name || x.EmoteName == reaction.Emote.ToString());
 | 
			
		||||
@@ -137,7 +137,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    if (reactionRole != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        var role = gusr.Guild.GetRole(reactionRole.RoleId);
 | 
			
		||||
                        if (role == null)
 | 
			
		||||
                        if (role is null)
 | 
			
		||||
                            return;
 | 
			
		||||
                        await gusr.RemoveRoleAsync(role).ConfigureAwait(false);
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            var (autoDelete, exclusive, roles) = GetAdAndRoles(guildUser.Guild.Id);
 | 
			
		||||
 | 
			
		||||
            var theRoleYouWant = roles.FirstOrDefault(r => r.RoleId == role.Id);
 | 
			
		||||
            if (theRoleYouWant == null)
 | 
			
		||||
            if (theRoleYouWant is null)
 | 
			
		||||
            {
 | 
			
		||||
                return (AssignResult.Err_Not_Assignable, autoDelete, null);
 | 
			
		||||
            }
 | 
			
		||||
@@ -145,7 +145,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    if (toUpdate != null)
 | 
			
		||||
                        gc.SelfAssignableRoleGroupNames.Remove(toUpdate);
 | 
			
		||||
                }
 | 
			
		||||
                else if (toUpdate == null)
 | 
			
		||||
                else if (toUpdate is null)
 | 
			
		||||
                {
 | 
			
		||||
                    gc.SelfAssignableRoleGroupNames.Add(new GroupName
 | 
			
		||||
                    {
 | 
			
		||||
@@ -170,7 +170,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
        {
 | 
			
		||||
            var (autoDelete, _, roles) = GetAdAndRoles(guildUser.Guild.Id);
 | 
			
		||||
 | 
			
		||||
            if (roles.FirstOrDefault(r => r.RoleId == role.Id) == null)
 | 
			
		||||
            if (roles.FirstOrDefault(r => r.RoleId == role.Id) is null)
 | 
			
		||||
            {
 | 
			
		||||
                return (RemoveResult.Err_Not_Assignable, autoDelete);
 | 
			
		||||
            }
 | 
			
		||||
@@ -261,7 +261,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                var roleModels = uow.SelfAssignableRoles.GetFromGuild(guild.Id);
 | 
			
		||||
                roles = roleModels
 | 
			
		||||
                    .Select(x => (Model: x, Role: guild.GetRole(x.RoleId)));
 | 
			
		||||
                uow.SelfAssignableRoles.RemoveRange(roles.Where(x => x.Role == null).Select(x => x.Model).ToArray());
 | 
			
		||||
                uow.SelfAssignableRoles.RemoveRange(roles.Where(x => x.Role is null).Select(x => x.Model).ToArray());
 | 
			
		||||
                uow.SaveChanges();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    var server = _client.Guilds.FirstOrDefault(g => g.Id.ToString() == guildStr) ??
 | 
			
		||||
                                 _client.Guilds.FirstOrDefault(g => g.Name.Trim().ToUpperInvariant() == guildStr);
 | 
			
		||||
 | 
			
		||||
                    if (server == null)
 | 
			
		||||
                    if (server is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -205,7 +205,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            var channels = await Task.WhenAll(_creds.OwnerIds.Select(id =>
 | 
			
		||||
            {
 | 
			
		||||
                var user = _client.GetUser(id);
 | 
			
		||||
                if (user == null)
 | 
			
		||||
                if (user is null)
 | 
			
		||||
                    return Task.FromResult<IDMChannel>(null);
 | 
			
		||||
 | 
			
		||||
                return user.GetOrCreateDMChannelAsync();
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            if (p != null)
 | 
			
		||||
            {
 | 
			
		||||
                var user = await guild.GetUserAsync(userId).ConfigureAwait(false);
 | 
			
		||||
                if (user == null)
 | 
			
		||||
                if (user is null)
 | 
			
		||||
                    return null;
 | 
			
		||||
 | 
			
		||||
                await ApplyPunishment(guild, user, mod, p.Punishment, p.Time, p.RoleId, "Warned too many times.");
 | 
			
		||||
@@ -146,7 +146,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
                    if (roleId is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    var role = guild.GetRole(roleId.Value);
 | 
			
		||||
                    if (!(role is null))
 | 
			
		||||
                    if (role is not null)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (minutes == 0)
 | 
			
		||||
                            await user.AddRoleAsync(role).ConfigureAwait(false);
 | 
			
		||||
@@ -389,14 +389,14 @@ WHERE GuildId={guildId}
 | 
			
		||||
                    .AsQueryable()
 | 
			
		||||
                    .FirstOrDefault(x => x.GuildId == guildId);
 | 
			
		||||
 | 
			
		||||
                if (text == null)
 | 
			
		||||
                if (text is null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (template is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    
 | 
			
		||||
                    uow.Remove(template);
 | 
			
		||||
                }
 | 
			
		||||
                else if (template == null)
 | 
			
		||||
                else if (template is null)
 | 
			
		||||
                {
 | 
			
		||||
                    uow.BanTemplates.Add(new BanTemplate()
 | 
			
		||||
                    {
 | 
			
		||||
 
 | 
			
		||||
@@ -106,7 +106,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            var g = _client.GetGuild(gconf.GuildId);
 | 
			
		||||
            if (g == null)
 | 
			
		||||
            if (g is null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            var infos = new ConcurrentDictionary<ulong, IRole>();
 | 
			
		||||
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
            foreach (var ri in gconf.VcRoleInfos)
 | 
			
		||||
            {
 | 
			
		||||
                var role = g.GetRole(ri.RoleId);
 | 
			
		||||
                if (role == null)
 | 
			
		||||
                if (role is null)
 | 
			
		||||
                {
 | 
			
		||||
                    missingRoles.Add(ri);
 | 
			
		||||
                    continue;
 | 
			
		||||
@@ -137,7 +137,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
 | 
			
		||||
        public void AddVcRole(ulong guildId, IRole role, ulong vcId)
 | 
			
		||||
        {
 | 
			
		||||
            if (role == null)
 | 
			
		||||
            if (role is null)
 | 
			
		||||
                throw new ArgumentNullException(nameof(role));
 | 
			
		||||
 | 
			
		||||
            var guildVcRoles = VcRoles.GetOrAdd(guildId, new ConcurrentDictionary<ulong, IRole>());
 | 
			
		||||
@@ -184,7 +184,7 @@ namespace NadekoBot.Modules.Administration.Services
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            var gusr = usr as SocketGuildUser;
 | 
			
		||||
            if (gusr == null)
 | 
			
		||||
            if (gusr is null)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            var oldVc = oldState.VoiceChannel;
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                try { tz = TimeZoneInfo.FindSystemTimeZoneById(id); } catch { tz = null; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                if (tz == null)
 | 
			
		||||
                if (tz is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("timezone_not_found").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                var embed = new EmbedBuilder()
 | 
			
		||||
                    .WithOkColor();
 | 
			
		||||
                if (punishment == null)
 | 
			
		||||
                if (punishment is null)
 | 
			
		||||
                {
 | 
			
		||||
                    embed.WithDescription(GetText("user_warned",
 | 
			
		||||
                        Format.Bold(user.ToString())));
 | 
			
		||||
@@ -430,7 +430,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                    {
 | 
			
		||||
                        var defaultMessage = GetText("bandm", Format.Bold(ctx.Guild.Name), msg);
 | 
			
		||||
                        var embed = _service.GetBanUserDmEmbed(Context, guildUser, defaultMessage, msg, time.Time);
 | 
			
		||||
                        if (!(embed is null))
 | 
			
		||||
                        if (embed is not null)
 | 
			
		||||
                        {
 | 
			
		||||
                            var userChannel = await guildUser.GetOrCreateDMChannelAsync();
 | 
			
		||||
                            await userChannel.EmbedAsync(embed);
 | 
			
		||||
@@ -497,7 +497,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
                {
 | 
			
		||||
                    var defaultMessage = GetText("bandm", Format.Bold(ctx.Guild.Name), msg);
 | 
			
		||||
                    var embed = _service.GetBanUserDmEmbed(Context, user, defaultMessage, msg, null);
 | 
			
		||||
                    if (!(embed is null))
 | 
			
		||||
                    if (embed is not null)
 | 
			
		||||
                    {
 | 
			
		||||
                        var userChannel = await user.GetOrCreateDMChannelAsync();
 | 
			
		||||
                        await userChannel.EmbedAsync(embed);
 | 
			
		||||
@@ -613,7 +613,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                var bun = bans.FirstOrDefault(x => x.User.ToString().ToLowerInvariant() == user.ToLowerInvariant());
 | 
			
		||||
 | 
			
		||||
                if (bun == null)
 | 
			
		||||
                if (bun is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("user_not_found").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -632,7 +632,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                var bun = bans.FirstOrDefault(x => x.User.Id == userId);
 | 
			
		||||
 | 
			
		||||
                if (bun == null)
 | 
			
		||||
                if (bun is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("user_not_found").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,13 +41,13 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
 | 
			
		||||
                var vc = user.VoiceChannel;
 | 
			
		||||
 | 
			
		||||
                if (vc == null || vc.GuildId != user.GuildId)
 | 
			
		||||
                if (vc is null || vc.GuildId != user.GuildId)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("must_be_in_voice").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (role == null)
 | 
			
		||||
                if (role is null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (_service.RemoveVcRole(ctx.Guild.Id, vc.Id))
 | 
			
		||||
                    {
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ namespace NadekoBot.Modules.CustomReactions
 | 
			
		||||
            _clientFactory = clientFactory;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool AdminInGuildOrOwnerInDm() => (ctx.Guild == null && _creds.IsOwner(ctx.User))
 | 
			
		||||
        private bool AdminInGuildOrOwnerInDm() => (ctx.Guild is null && _creds.IsOwner(ctx.User))
 | 
			
		||||
                                                  || (ctx.Guild != null && ((IGuildUser)ctx.User).GuildPermissions.Administrator);
 | 
			
		||||
 | 
			
		||||
        [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
@@ -56,7 +56,7 @@ namespace NadekoBot.Modules.CustomReactions
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(message) || id < 0)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if ((channel == null && !_creds.IsOwner(ctx.User)) || (channel != null && !((IGuildUser)ctx.User).GuildPermissions.Administrator))
 | 
			
		||||
            if ((channel is null && !_creds.IsOwner(ctx.User)) || (channel != null && !((IGuildUser)ctx.User).GuildPermissions.Administrator))
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("insuff_perms").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -87,7 +87,7 @@ namespace NadekoBot.Modules.CustomReactions
 | 
			
		||||
 | 
			
		||||
            var customReactions = _service.GetCustomReactionsFor(ctx.Guild?.Id);
 | 
			
		||||
 | 
			
		||||
            if (customReactions == null || !customReactions.Any())
 | 
			
		||||
            if (customReactions is null || !customReactions.Any())
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("no_found").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -139,7 +139,7 @@ namespace NadekoBot.Modules.CustomReactions
 | 
			
		||||
        {
 | 
			
		||||
            var found = _service.GetCustomReaction(ctx.Guild?.Id, (int)id);
 | 
			
		||||
 | 
			
		||||
            if (found == null)
 | 
			
		||||
            if (found is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("no_found_id").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ namespace NadekoBot.Modules.CustomReactions.Extensions
 | 
			
		||||
 | 
			
		||||
                    var img = (elems.ElementAtOrDefault(new NadekoRandom().Next(0, elems.Length))?.Children?.FirstOrDefault() as IHtmlImageElement);
 | 
			
		||||
 | 
			
		||||
                    if (img?.Source == null)
 | 
			
		||||
                    if (img?.Source is null)
 | 
			
		||||
                        return "";
 | 
			
		||||
 | 
			
		||||
                    return " " + img.Source.Replace("b.", ".", StringComparison.InvariantCulture) + " ";
 | 
			
		||||
 
 | 
			
		||||
@@ -237,7 +237,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
            using var uow = _db.GetDbContext();
 | 
			
		||||
            var cr = uow.CustomReactions.GetById(id);
 | 
			
		||||
 | 
			
		||||
            if (cr == null || cr.GuildId != guildId)
 | 
			
		||||
            if (cr is null || cr.GuildId != guildId)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            // disable allowtarget if message had target, but it was removed from it
 | 
			
		||||
@@ -268,7 +268,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
            if (toDelete is null)
 | 
			
		||||
                return null;
 | 
			
		||||
            
 | 
			
		||||
            if ((toDelete.IsGlobal() && guildId == null) || (guildId == toDelete.GuildId))
 | 
			
		||||
            if ((toDelete.IsGlobal() && guildId is null) || (guildId == toDelete.GuildId))
 | 
			
		||||
            {
 | 
			
		||||
                uow.CustomReactions.Remove(toDelete);
 | 
			
		||||
                await uow.SaveChangesAsync();
 | 
			
		||||
@@ -309,7 +309,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
            if (_newGuildReactions.TryGetValue(channel.Guild.Id, out var reactions) && reactions.Length > 0)
 | 
			
		||||
            {
 | 
			
		||||
                var cr = MatchCustomReactions(content, reactions);
 | 
			
		||||
                if (!(cr is null))
 | 
			
		||||
                if (cr is not null)
 | 
			
		||||
                    return cr;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -375,7 +375,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            var cancelled = result.FirstOrDefault(x => x.Response == "-");
 | 
			
		||||
            if (!(cancelled is null))
 | 
			
		||||
            if (cancelled is not null)
 | 
			
		||||
                return cancelled;
 | 
			
		||||
            
 | 
			
		||||
            return result[_rng.Next(0, result.Count)];
 | 
			
		||||
@@ -551,7 +551,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
            lock (_gcrWriteLock)
 | 
			
		||||
            {
 | 
			
		||||
                var cr = Array.Find(_globalReactions, item => item.Id == id);
 | 
			
		||||
                if (!(cr is null))
 | 
			
		||||
                if (cr is not null)
 | 
			
		||||
                {
 | 
			
		||||
                    return _pubSub.Pub(_gcrDeletedkey, cr.Id);
 | 
			
		||||
                }
 | 
			
		||||
@@ -629,7 +629,7 @@ namespace NadekoBot.Modules.CustomReactions.Services
 | 
			
		||||
        {
 | 
			
		||||
            using var uow = _db.GetDbContext();
 | 
			
		||||
            var cr = uow.CustomReactions.GetById(id);
 | 
			
		||||
            if (cr == null || cr.GuildId != guildId)
 | 
			
		||||
            if (cr is null || cr.GuildId != guildId)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            return cr;
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
 | 
			
		||||
                var msg = raceMessage;
 | 
			
		||||
 | 
			
		||||
                if (msg == null)
 | 
			
		||||
                if (msg is null)
 | 
			
		||||
                    raceMessage = await ctx.Channel.SendConfirmAsync(text)
 | 
			
		||||
                        .ConfigureAwait(false);
 | 
			
		||||
                else
 | 
			
		||||
 
 | 
			
		||||
@@ -345,7 +345,7 @@ namespace NadekoBot.Modules.Gambling.Common.Blackjack
 | 
			
		||||
 | 
			
		||||
        public Task PrintState()
 | 
			
		||||
        {
 | 
			
		||||
            if (StateUpdated == null)
 | 
			
		||||
            if (StateUpdated is null)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            return StateUpdated.Invoke(this);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Gambling.Common
 | 
			
		||||
 | 
			
		||||
        public static string GetHandValue(List<Card> cards)
 | 
			
		||||
        {
 | 
			
		||||
            if (handValues == null)
 | 
			
		||||
            if (handValues is null)
 | 
			
		||||
                InitHandValues();
 | 
			
		||||
            foreach (var kvp in handValues.Where(x => x.Value(cards)))
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -169,12 +169,12 @@ namespace NadekoBot.Modules.Gambling.Common.Events
 | 
			
		||||
                if (_emote.Name != r.Emote.Name)
 | 
			
		||||
                    return;
 | 
			
		||||
                var gu = (r.User.IsSpecified ? r.User.Value : null) as IGuildUser;
 | 
			
		||||
                if (gu == null // no unknown users, as they could be bots, or alts
 | 
			
		||||
                if (gu is null // no unknown users, as they could be bots, or alts
 | 
			
		||||
                    || msg.Id != _msg.Id // same message
 | 
			
		||||
                    || gu.IsBot // no bots
 | 
			
		||||
                    || (DateTime.UtcNow - gu.CreatedAt).TotalDays <= 5 // no recently created accounts
 | 
			
		||||
                    || (_noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
 | 
			
		||||
                        (gu.JoinedAt == null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1)))  // and no users for who we don't know when they joined
 | 
			
		||||
                        (gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1)))  // and no users for who we don't know when they joined
 | 
			
		||||
                {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ namespace NadekoBot.Modules.Gambling.Common.Connect4
 | 
			
		||||
                await _locker.WaitAsync().ConfigureAwait(false);
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (_players[1] == null)
 | 
			
		||||
                    if (_players[1] is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        var __ = OnGameFailedToStart?.Invoke(this);
 | 
			
		||||
                        CurrentPhase = Phase.Ended;
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    .WithOkColor();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                if (msg == null)
 | 
			
		||||
                if (msg is null)
 | 
			
		||||
                    msg = await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
 | 
			
		||||
                else
 | 
			
		||||
                    await msg.ModifyAsync(x => x.Embed = embed.Build()).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                if (num < 1 || num > 10)
 | 
			
		||||
                    throw new ArgumentOutOfRangeException(nameof(num));
 | 
			
		||||
 | 
			
		||||
                Deck cards = guildId == null ? new Deck() : _allDecks.GetOrAdd(ctx.Guild, (s) => new Deck());
 | 
			
		||||
                Deck cards = guildId is null ? new Deck() : _allDecks.GetOrAdd(ctx.Guild, (s) => new Deck());
 | 
			
		||||
                var images = new List<Image<Rgba32>>();
 | 
			
		||||
                var cardObjects = new List<Deck.Card>();
 | 
			
		||||
                for (var i = 0; i < num; i++)
 | 
			
		||||
 
 | 
			
		||||
@@ -413,7 +413,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
--
 | 
			
		||||
";
 | 
			
		||||
 | 
			
		||||
                if (rdMsg == null)
 | 
			
		||||
                if (rdMsg is null)
 | 
			
		||||
                {
 | 
			
		||||
                    rdMsg = await ctx.Channel.EmbedAsync(embed)
 | 
			
		||||
                        .ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
        {
 | 
			
		||||
            SocketGuild g = _client.GetGuild(guildId);
 | 
			
		||||
            SocketTextChannel ch = g?.GetChannel(channelId) as SocketTextChannel;
 | 
			
		||||
            if (ch == null)
 | 
			
		||||
            if (ch is null)
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
            ICurrencyEvent ce;
 | 
			
		||||
 
 | 
			
		||||
@@ -182,7 +182,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
        private Task PotentialFlowerGeneration(IUserMessage imsg)
 | 
			
		||||
        {
 | 
			
		||||
            var msg = imsg as SocketUserMessage;
 | 
			
		||||
            if (msg == null || msg.Author.IsBot)
 | 
			
		||||
            if (msg is null || msg.Author.IsBot)
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            if (!(imsg.Channel is ITextChannel channel))
 | 
			
		||||
@@ -351,7 +351,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
            {
 | 
			
		||||
                // try to send the message with the currency image
 | 
			
		||||
                var msgId = await SendPlantMessageAsync(gid, ch, user, amount, pass).ConfigureAwait(false);
 | 
			
		||||
                if (msgId == null)
 | 
			
		||||
                if (msgId is null)
 | 
			
		||||
                {
 | 
			
		||||
                    // if it fails it will return null, if it returns null, refund
 | 
			
		||||
                    await _cs.AddAsync(uid, "Planted currency refund", amount, gamble: false);
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
                var ownerUser = uow.GetOrCreateUser(owner);
 | 
			
		||||
 | 
			
		||||
                // owner has to be the owner of the waifu
 | 
			
		||||
                if (waifu == null || waifu.ClaimerId != ownerUser.Id)
 | 
			
		||||
                if (waifu is null || waifu.ClaimerId != ownerUser.Id)
 | 
			
		||||
                    return false;
 | 
			
		||||
                
 | 
			
		||||
                // if waifu likes the person, gotta pay the penalty
 | 
			
		||||
@@ -97,7 +97,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
            {
 | 
			
		||||
                var waifu = uow.WaifuInfo.ByWaifuUserId(user.Id);
 | 
			
		||||
 | 
			
		||||
                if (waifu == null)
 | 
			
		||||
                if (waifu is null)
 | 
			
		||||
                    return settings.Waifu.MinPrice;
 | 
			
		||||
 | 
			
		||||
                var divorces = uow.WaifuUpdates.Count(x => x.Old != null &&
 | 
			
		||||
@@ -168,7 +168,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
            {
 | 
			
		||||
                w = uow.WaifuInfo.ByWaifuUserId(target.Id);
 | 
			
		||||
                isAffinity = (w?.Affinity?.UserId == user.Id);
 | 
			
		||||
                if (w == null)
 | 
			
		||||
                if (w is null)
 | 
			
		||||
                {
 | 
			
		||||
                    var claimer = uow.GetOrCreateUser(user);
 | 
			
		||||
                    var waifu = uow.GetOrCreateUser(target);
 | 
			
		||||
@@ -257,14 +257,14 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var w = uow.WaifuInfo.ByWaifuUserId(user.Id);
 | 
			
		||||
                var newAff = target == null ? null : uow.GetOrCreateUser(target);
 | 
			
		||||
                var newAff = target is null ? null : uow.GetOrCreateUser(target);
 | 
			
		||||
                if (w?.Affinity?.UserId == target?.Id)
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
                else if (!_cache.TryAddAffinityCooldown(user.Id, out remaining))
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
                else if (w == null)
 | 
			
		||||
                else if (w is null)
 | 
			
		||||
                {
 | 
			
		||||
                    var thisUser = uow.GetOrCreateUser(user);
 | 
			
		||||
                    uow.WaifuInfo.Add(new WaifuInfo()
 | 
			
		||||
@@ -330,7 +330,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
            {
 | 
			
		||||
                w = uow.WaifuInfo.ByWaifuUserId(targetId);
 | 
			
		||||
                var now = DateTime.UtcNow;
 | 
			
		||||
                if (w?.Claimer == null || w.Claimer.UserId != user.Id)
 | 
			
		||||
                if (w?.Claimer is null || w.Claimer.UserId != user.Id)
 | 
			
		||||
                    result = DivorceResult.NotYourWife;
 | 
			
		||||
                else if (!_cache.TryAddDivorceCooldown(user.Id, out remaining))
 | 
			
		||||
                {
 | 
			
		||||
@@ -383,7 +383,7 @@ namespace NadekoBot.Modules.Gambling.Services
 | 
			
		||||
                var w = uow.WaifuInfo.ByWaifuUserId(giftedWaifu.Id, 
 | 
			
		||||
                    set => set.Include(x => x.Items)
 | 
			
		||||
                        .Include(x => x.Claimer));
 | 
			
		||||
                if (w == null)
 | 
			
		||||
                if (w is null)
 | 
			
		||||
                {
 | 
			
		||||
                    uow.WaifuInfo.Add(w = new WaifuInfo()
 | 
			
		||||
                    {
 | 
			
		||||
 
 | 
			
		||||
@@ -104,7 +104,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    uow.SaveChanges();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (entry == null)
 | 
			
		||||
                if (entry is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    var guser = (IGuildUser)ctx.User;
 | 
			
		||||
                    var role = ctx.Guild.GetRole(entry.RoleId);
 | 
			
		||||
 | 
			
		||||
                    if (role == null)
 | 
			
		||||
                    if (role is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await ReplyErrorLocalizedAsync("shop_role_not_found").ConfigureAwait(false);
 | 
			
		||||
                        return;
 | 
			
		||||
@@ -306,7 +306,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if (entry == null)
 | 
			
		||||
                if (entry is null)
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
 | 
			
		||||
                else if (!rightType)
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("shop_item_wrong_type").ConfigureAwait(false);
 | 
			
		||||
@@ -341,7 +341,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (removed == null)
 | 
			
		||||
                if (removed is null)
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("shop_item_not_found").ConfigureAwait(false);
 | 
			
		||||
                else
 | 
			
		||||
                    await ctx.Channel.EmbedAsync(EntryToEmbed(removed)
 | 
			
		||||
 
 | 
			
		||||
@@ -187,11 +187,11 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
                    }
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (u == null)
 | 
			
		||||
                if (u is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("waifu_affinity_reset");
 | 
			
		||||
                }
 | 
			
		||||
                else if (oldAff == null)
 | 
			
		||||
                else if (oldAff is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("waifu_affinity_set", Format.Bold(u.ToString()));
 | 
			
		||||
                }
 | 
			
		||||
@@ -240,7 +240,7 @@ namespace NadekoBot.Modules.Gambling
 | 
			
		||||
            [Priority(1)]
 | 
			
		||||
            public Task WaifuInfo([Leftover]IUser target = null)
 | 
			
		||||
            {
 | 
			
		||||
                if (target == null)
 | 
			
		||||
                if (target is null)
 | 
			
		||||
                    target = ctx.User;
 | 
			
		||||
 | 
			
		||||
                return InternalWaifuInfo(target.Id, target.ToString());
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
            {
 | 
			
		||||
                // has to be a user message
 | 
			
		||||
                // channel must be the same the poll started in
 | 
			
		||||
                if (msg == null || msg.Author.IsBot || msg.Channel.Id != Poll.ChannelId)
 | 
			
		||||
                if (msg is null || msg.Author.IsBot || msg.Channel.Id != Poll.ChannelId)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                // has to be an integer
 | 
			
		||||
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var usr = msg.Author as IGuildUser;
 | 
			
		||||
                if (usr == null)
 | 
			
		||||
                if (usr is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                voteObj = new PollVote()
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
            {
 | 
			
		||||
                for (var j = 0; j < _state.GetLength(1); j++)
 | 
			
		||||
                {
 | 
			
		||||
                    sb.Append(_state[i, j] == null ? _numbers[i * 3 + j] : GetIcon(_state[i, j]));
 | 
			
		||||
                    sb.Append(_state[i, j] is null ? _numbers[i * 3 + j] : GetIcon(_state[i, j]));
 | 
			
		||||
                    if (j < _state.GetLength(1) - 1)
 | 
			
		||||
                        sb.Append("┃");
 | 
			
		||||
                }
 | 
			
		||||
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
            if (!string.IsNullOrWhiteSpace(title))
 | 
			
		||||
                embed.WithTitle(title);
 | 
			
		||||
 | 
			
		||||
            if (_winner == null)
 | 
			
		||||
            if (_winner is null)
 | 
			
		||||
            {
 | 
			
		||||
                if (_phase == Phase.Ended)
 | 
			
		||||
                    embed.WithFooter(efb => efb.WithText(GetText("ttt_no_moves")));
 | 
			
		||||
@@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
            {
 | 
			
		||||
                for (var j = 0; j < 3; j++)
 | 
			
		||||
                {
 | 
			
		||||
                    if (_state[i, j] == null)
 | 
			
		||||
                    if (_state[i, j] is null)
 | 
			
		||||
                        return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -213,7 +213,7 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
                    if (int.TryParse(msg.Content, out var index) &&
 | 
			
		||||
                        --index >= 0 &&
 | 
			
		||||
                        index <= 9 &&
 | 
			
		||||
                        _state[index / 3, index % 3] == null)
 | 
			
		||||
                        _state[index / 3, index % 3] is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        _state[index / 3, index % 3] = _curUserIndex;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
 | 
			
		||||
                    var umsg = imsg as SocketUserMessage;
 | 
			
		||||
 | 
			
		||||
                    var textChannel = umsg?.Channel as ITextChannel;
 | 
			
		||||
                    if (textChannel == null || textChannel.Guild != Guild)
 | 
			
		||||
                    if (textChannel is null || textChannel.Guild != Guild)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var guildUser = (IGuildUser)umsg.Author;
 | 
			
		||||
 
 | 
			
		||||
@@ -143,10 +143,10 @@ namespace NadekoBot.Modules.Games.Common
 | 
			
		||||
                    if (imsg.Author.IsBot)
 | 
			
		||||
                        return;
 | 
			
		||||
                    var msg = imsg as SocketUserMessage;
 | 
			
		||||
                    if (msg == null)
 | 
			
		||||
                    if (msg is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    if (this.Channel == null || this.Channel.Id != msg.Channel.Id) return;
 | 
			
		||||
                    if (this.Channel is null || this.Channel.Id != msg.Channel.Id) return;
 | 
			
		||||
 | 
			
		||||
                    var guess = msg.Content;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
            var gr = _service.GirlRatings.GetOrAdd(usr.Id, GetGirl);
 | 
			
		||||
            var originalStream = await gr.Stream;
 | 
			
		||||
 | 
			
		||||
            if (originalStream == null)
 | 
			
		||||
            if (originalStream is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("something_went_wrong").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
 | 
			
		||||
            Task Hm_OnGameEnded(Hangman game, string winner)
 | 
			
		||||
            {
 | 
			
		||||
                if (winner == null)
 | 
			
		||||
                if (winner is null)
 | 
			
		||||
                {
 | 
			
		||||
                    var loseEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended")
 | 
			
		||||
                                             .WithDescription(Format.Bold("You lose."))
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
                        game.Dispose();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (arg2 == null)
 | 
			
		||||
                    if (arg2 is null)
 | 
			
		||||
                        return ConfirmLocalizedAsync("nunchi_ended_no_winner", Format.Bold(arg2));
 | 
			
		||||
                    else
 | 
			
		||||
                        return ConfirmLocalizedAsync("nunchi_ended", Format.Bold(arg2));
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
 | 
			
		||||
                var poll = _service.CreatePoll(ctx.Guild.Id,
 | 
			
		||||
                    ctx.Channel.Id, arg);
 | 
			
		||||
                if(poll == null)
 | 
			
		||||
                if(poll is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("poll_invalid_input").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Games
 | 
			
		||||
                var channel = (ITextChannel)ctx.Channel;
 | 
			
		||||
 | 
			
		||||
                Poll p;
 | 
			
		||||
                if ((p = _service.StopPoll(ctx.Guild.Id)) == null)
 | 
			
		||||
                if ((p = _service.StopPoll(ctx.Guild.Id)) is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                var embed = GetStats(p, GetText("poll_closed"));
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Games.Services
 | 
			
		||||
            var channel = msg.Channel as ITextChannel;
 | 
			
		||||
            cleverbot = null;
 | 
			
		||||
 | 
			
		||||
            if (channel == null)
 | 
			
		||||
            if (channel is null)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            if (!ChatterBotGuilds.TryGetValue(channel.Guild.Id, out Lazy<IChatterBotSession> lazyCleverbot))
 | 
			
		||||
@@ -110,7 +110,7 @@ namespace NadekoBot.Modules.Games.Services
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var message = PrepareMessage(usrMsg, out IChatterBotSession cbs);
 | 
			
		||||
                if (message == null || cbs == null)
 | 
			
		||||
                if (message is null || cbs is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var pc = _perms.GetCacheFor(guild.Id);
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ namespace NadekoBot.Modules.Games.Services
 | 
			
		||||
 | 
			
		||||
        public async Task<bool> RunBehavior(DiscordSocketClient client, IGuild guild, IUserMessage msg)
 | 
			
		||||
        {
 | 
			
		||||
            if (guild == null)
 | 
			
		||||
            if (guild is null)
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
            if (!ActivePolls.TryGetValue(guild.Id, out var poll))
 | 
			
		||||
 
 | 
			
		||||
@@ -268,7 +268,7 @@ namespace NadekoBot.Modules.Help
 | 
			
		||||
        {
 | 
			
		||||
            var channel = ctx.Channel;
 | 
			
		||||
 | 
			
		||||
            if (com == null)
 | 
			
		||||
            if (com is null)
 | 
			
		||||
            {
 | 
			
		||||
                IMessageChannel ch = channel is ITextChannel
 | 
			
		||||
                    ? await ((IGuildUser)ctx.User).GetOrCreateDMChannelAsync().ConfigureAwait(false)
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Help.Services
 | 
			
		||||
        public Task LateExecute(DiscordSocketClient client, IGuild guild, IUserMessage msg)
 | 
			
		||||
        {
 | 
			
		||||
            var settings = _bss.Data;
 | 
			
		||||
            if (guild == null)
 | 
			
		||||
            if (guild is null)
 | 
			
		||||
            {
 | 
			
		||||
                if (string.IsNullOrWhiteSpace(settings.DmHelpText) || settings.DmHelpText == "-")
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Help.Services
 | 
			
		||||
                .FirstOrDefault(ca => ca is UserPermAttribute);
 | 
			
		||||
 | 
			
		||||
            string userPermString = string.Empty;
 | 
			
		||||
            if (!(userPerm is null))
 | 
			
		||||
            if (userPerm is not null)
 | 
			
		||||
            {
 | 
			
		||||
                if (userPerm.UserPermissionAttribute.ChannelPermission is ChannelPermission cPerm)
 | 
			
		||||
                    userPermString = GetPreconditionString((ChannelPerm) cPerm);
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Music.Resolvers
 | 
			
		||||
                yield break;
 | 
			
		||||
            
 | 
			
		||||
            var firstData = await ResolveByQueryAsync(firstFile);
 | 
			
		||||
            if (!(firstData is null))
 | 
			
		||||
            if (firstData is not null)
 | 
			
		||||
                yield return firstData;
 | 
			
		||||
 | 
			
		||||
            var fileChunks = files.Skip(1).Chunk(10);
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Music.Resolvers
 | 
			
		||||
        public async Task<ITrackInfo?> ResolveByQueryAsync(string query)
 | 
			
		||||
        {
 | 
			
		||||
            var cached = await _trackCacher.GetCachedDataByQueryAsync(query, MusicPlatform.SoundCloud);
 | 
			
		||||
            if (!(cached is null))
 | 
			
		||||
            if (cached is not null)
 | 
			
		||||
                return CachableDataToTrackInfo(cached);
 | 
			
		||||
            
 | 
			
		||||
            var svideo = !IsSoundCloudLink(query)
 | 
			
		||||
 
 | 
			
		||||
@@ -199,7 +199,7 @@
 | 
			
		||||
//                         //Log.Information("Buffered. Getting audio client...");
 | 
			
		||||
//                         var ac = await GetAudioClient().ConfigureAwait(false);
 | 
			
		||||
//                         Log.Information("Got Audio client");
 | 
			
		||||
//                         if (ac == null)
 | 
			
		||||
//                         if (ac is null)
 | 
			
		||||
//                         {
 | 
			
		||||
//                             Log.Information("Can't join");
 | 
			
		||||
//                             await Task.Delay(900, cancelToken).ConfigureAwait(false);
 | 
			
		||||
@@ -371,7 +371,7 @@
 | 
			
		||||
//
 | 
			
		||||
//         private async Task<IAudioClient> GetAudioClient(bool reconnect = false)
 | 
			
		||||
//         {
 | 
			
		||||
//             if (_audioClient == null ||
 | 
			
		||||
//             if (_audioClient is null ||
 | 
			
		||||
//                 _audioClient.ConnectionState != ConnectionState.Connected ||
 | 
			
		||||
//                 reconnect ||
 | 
			
		||||
//                 newVoiceChannel)
 | 
			
		||||
@@ -529,7 +529,7 @@
 | 
			
		||||
//         {
 | 
			
		||||
//             lock (locker)
 | 
			
		||||
//             {
 | 
			
		||||
//                 if (PauseTaskSource == null)
 | 
			
		||||
//                 if (PauseTaskSource is null)
 | 
			
		||||
//                     PauseTaskSource = new TaskCompletionSource<bool>();
 | 
			
		||||
//                 else
 | 
			
		||||
//                 {
 | 
			
		||||
 
 | 
			
		||||
@@ -86,7 +86,7 @@
 | 
			
		||||
//                 if (MaxQueueSize != 0 && Songs.Count >= MaxQueueSize)
 | 
			
		||||
//                     throw new QueueFullException();
 | 
			
		||||
//                 var curSong = Current.Song;
 | 
			
		||||
//                 if (curSong == null)
 | 
			
		||||
//                 if (curSong is null)
 | 
			
		||||
//                 {
 | 
			
		||||
//                     Songs.AddLast(song);
 | 
			
		||||
//                     return Songs.Count;
 | 
			
		||||
 
 | 
			
		||||
@@ -285,7 +285,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
            {
 | 
			
		||||
                string desc = string.Empty;
 | 
			
		||||
                var current = mp.GetCurrentTrack(out var currentIndex);
 | 
			
		||||
                if (!(current is null))
 | 
			
		||||
                if (current is not null)
 | 
			
		||||
                {
 | 
			
		||||
                    desc = $"`🔊` {current.PrettyFullName()}\n\n" + desc;
 | 
			
		||||
                }
 | 
			
		||||
@@ -371,7 +371,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id).ConfigureAwait(false);
 | 
			
		||||
                if (input == null
 | 
			
		||||
                if (input is null
 | 
			
		||||
                    || !int.TryParse(input, out var index)
 | 
			
		||||
                    || (index -= 1) < 0
 | 
			
		||||
                    || index >= videos.Count)
 | 
			
		||||
@@ -699,7 +699,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
             }
 | 
			
		||||
 | 
			
		||||
             var currentTrack = mp.GetCurrentTrack(out _);
 | 
			
		||||
             if (currentTrack == null)
 | 
			
		||||
             if (currentTrack is null)
 | 
			
		||||
                 return;
 | 
			
		||||
 | 
			
		||||
             var embed = new EmbedBuilder().WithOkColor()
 | 
			
		||||
 
 | 
			
		||||
@@ -213,7 +213,7 @@ namespace NadekoBot.Modules.Music
 | 
			
		||||
                        mpl = uow.MusicPlaylists.GetWithSongs(id);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (mpl == null)
 | 
			
		||||
                    if (mpl is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await ReplyErrorLocalizedAsync("playlist_id_not_found").ConfigureAwait(false);
 | 
			
		||||
                        return;
 | 
			
		||||
 
 | 
			
		||||
@@ -313,7 +313,7 @@ namespace NadekoBot.Modules.Music.Services
 | 
			
		||||
            {
 | 
			
		||||
                var randomPlayingTrack = _players
 | 
			
		||||
                    .Select(x => x.Value.GetCurrentTrack(out _))
 | 
			
		||||
                    .Where(x => !(x is null))
 | 
			
		||||
                    .Where(x => x is not null)
 | 
			
		||||
                    .Shuffle()
 | 
			
		||||
                    .FirstOrDefault();
 | 
			
		||||
 | 
			
		||||
@@ -328,7 +328,7 @@ namespace NadekoBot.Modules.Music.Services
 | 
			
		||||
            {
 | 
			
		||||
                var count = _players
 | 
			
		||||
                    .Select(x => x.Value.GetCurrentTrack(out _))
 | 
			
		||||
                    .Count(x => !(x is null));
 | 
			
		||||
                    .Count(x => x is not null);
 | 
			
		||||
 | 
			
		||||
                return count.ToString();
 | 
			
		||||
            });
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@
 | 
			
		||||
//             string GetText(string text, params object[] replacements) =>
 | 
			
		||||
//                 _strings.GetText(text, textCh.Guild.Id, replacements);
 | 
			
		||||
//             
 | 
			
		||||
//             if (voiceCh == null || voiceCh.Guild != textCh.Guild)
 | 
			
		||||
//             if (voiceCh is null || voiceCh.Guild != textCh.Guild)
 | 
			
		||||
//             {
 | 
			
		||||
//                 if (textCh != null)
 | 
			
		||||
//                 {
 | 
			
		||||
@@ -139,7 +139,7 @@
 | 
			
		||||
//                         }
 | 
			
		||||
//
 | 
			
		||||
//                         var (Index, Current) = mp.Current;
 | 
			
		||||
//                         if (Current == null
 | 
			
		||||
//                         if (Current is null
 | 
			
		||||
//                             && !mp.RepeatCurrentSong
 | 
			
		||||
//                             && !mp.RepeatPlaylist
 | 
			
		||||
//                             && !mp.FairPlay
 | 
			
		||||
@@ -161,7 +161,7 @@
 | 
			
		||||
//                     //    // ignored
 | 
			
		||||
//                     //}
 | 
			
		||||
//                     var sender = player;
 | 
			
		||||
//                     if (sender == null)
 | 
			
		||||
//                     if (sender is null)
 | 
			
		||||
//                         return;
 | 
			
		||||
//                     try
 | 
			
		||||
//                     {
 | 
			
		||||
@@ -215,7 +215,7 @@
 | 
			
		||||
//                 return;
 | 
			
		||||
//
 | 
			
		||||
//             var si = await ResolveSong(related[new NadekoRandom().Next(related.Length)], _client.CurrentUser.ToString(), MusicType.YouTube).ConfigureAwait(false);
 | 
			
		||||
//             if (si == null)
 | 
			
		||||
//             if (si is null)
 | 
			
		||||
//                 throw new SongNotFoundException();
 | 
			
		||||
//             var mp = await GetOrCreatePlayer(txtCh.GuildId, vch, txtCh).ConfigureAwait(false);
 | 
			
		||||
//             mp.Enqueue(si);
 | 
			
		||||
@@ -229,7 +229,7 @@
 | 
			
		||||
//             var strategy = await resolverFactory.GetResolveStrategy(query, musicType).ConfigureAwait(false);
 | 
			
		||||
//             var sinfo = await strategy.ResolveSong(query).ConfigureAwait(false);
 | 
			
		||||
//
 | 
			
		||||
//             if (sinfo == null)
 | 
			
		||||
//             if (sinfo is null)
 | 
			
		||||
//                 return null;
 | 
			
		||||
//
 | 
			
		||||
//             sinfo.QueuerName = queuerName;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,13 +51,13 @@
 | 
			
		||||
//         //    var t = Task.Run(() =>
 | 
			
		||||
//         //    {
 | 
			
		||||
//         //        var usr = iusr as SocketGuildUser;
 | 
			
		||||
//         //        if (usr == null ||
 | 
			
		||||
//         //        if (usr is null ||
 | 
			
		||||
//         //            oldState.VoiceChannel == newState.VoiceChannel)
 | 
			
		||||
//         //            return;
 | 
			
		||||
//
 | 
			
		||||
//         //        var player = _music.GetPlayerOrDefault(usr.Guild.Id);
 | 
			
		||||
//
 | 
			
		||||
//         //        if (player == null)
 | 
			
		||||
//         //        if (player is null)
 | 
			
		||||
//         //            return;
 | 
			
		||||
//
 | 
			
		||||
//         //        try
 | 
			
		||||
@@ -97,7 +97,7 @@
 | 
			
		||||
//
 | 
			
		||||
//         private async Task InternalQueue(MusicPlayer mp, SongInfo songInfo, bool silent, bool queueFirst = false, bool forcePlay = false)
 | 
			
		||||
//         {
 | 
			
		||||
//             if (songInfo == null)
 | 
			
		||||
//             if (songInfo is null)
 | 
			
		||||
//             {
 | 
			
		||||
//                 if (!silent)
 | 
			
		||||
//                     await ReplyErrorLocalizedAsync("song_not_found").ConfigureAwait(false);
 | 
			
		||||
@@ -216,7 +216,7 @@
 | 
			
		||||
//             try
 | 
			
		||||
//             {
 | 
			
		||||
//                 var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id).ConfigureAwait(false);
 | 
			
		||||
//                 if (input == null
 | 
			
		||||
//                 if (input is null
 | 
			
		||||
//                     || !int.TryParse(input, out var index)
 | 
			
		||||
//                     || (index -= 1) < 0
 | 
			
		||||
//                     || index >= videos.Length)
 | 
			
		||||
@@ -436,7 +436,7 @@
 | 
			
		||||
//         public async Task SongRemove(All _)
 | 
			
		||||
//         {
 | 
			
		||||
//             var mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
 | 
			
		||||
//             if (mp == null)
 | 
			
		||||
//             if (mp is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//             mp.Stop(true);
 | 
			
		||||
//             await ReplyConfirmLocalizedAsync("queue_cleared").ConfigureAwait(false);
 | 
			
		||||
@@ -576,7 +576,7 @@
 | 
			
		||||
//                     mpl = uow.MusicPlaylists.GetWithSongs(id);
 | 
			
		||||
//                 }
 | 
			
		||||
//
 | 
			
		||||
//                 if (mpl == null)
 | 
			
		||||
//                 if (mpl is null)
 | 
			
		||||
//                 {
 | 
			
		||||
//                     await ReplyErrorLocalizedAsync("playlist_id_not_found").ConfigureAwait(false);
 | 
			
		||||
//                     return;
 | 
			
		||||
@@ -700,7 +700,7 @@
 | 
			
		||||
//         {
 | 
			
		||||
//             var mp = await _service.GetOrCreatePlayer(Context).ConfigureAwait(false);
 | 
			
		||||
//             var (_, currentSong) = mp.Current;
 | 
			
		||||
//             if (currentSong == null)
 | 
			
		||||
//             if (currentSong is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//             try { await mp.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
 | 
			
		||||
//
 | 
			
		||||
@@ -744,7 +744,7 @@
 | 
			
		||||
//                 Log.Warning(ex.Message);
 | 
			
		||||
//             }
 | 
			
		||||
//
 | 
			
		||||
//             if (plId == null)
 | 
			
		||||
//             if (plId is null)
 | 
			
		||||
//             {
 | 
			
		||||
//                 await ReplyErrorLocalizedAsync("no_search_results").ConfigureAwait(false);
 | 
			
		||||
//                 return;
 | 
			
		||||
@@ -834,12 +834,12 @@
 | 
			
		||||
//         {
 | 
			
		||||
//             var vch = ((IGuildUser)ctx.User).VoiceChannel;
 | 
			
		||||
//
 | 
			
		||||
//             if (vch == null)
 | 
			
		||||
//             if (vch is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//
 | 
			
		||||
//             var mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
 | 
			
		||||
//
 | 
			
		||||
//             if (mp == null)
 | 
			
		||||
//             if (mp is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//
 | 
			
		||||
//             await mp.SetVoiceChannel(vch).ConfigureAwait(false);
 | 
			
		||||
@@ -853,7 +853,7 @@
 | 
			
		||||
//                 return;
 | 
			
		||||
//
 | 
			
		||||
//             MusicPlayer mp = _service.GetPlayerOrDefault(ctx.Guild.Id);
 | 
			
		||||
//             if (mp == null)
 | 
			
		||||
//             if (mp is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//
 | 
			
		||||
//             fromto = fromto?.Trim();
 | 
			
		||||
@@ -862,7 +862,7 @@
 | 
			
		||||
//             SongInfo s;
 | 
			
		||||
//             if (fromtoArr.Length != 2 || !int.TryParse(fromtoArr[0], out var n1) ||
 | 
			
		||||
//                 !int.TryParse(fromtoArr[1], out var n2) || n1 < 1 || n2 < 1 || n1 == n2
 | 
			
		||||
//                 || (s = mp.MoveSong(--n1, --n2)) == null)
 | 
			
		||||
//                 || (s = mp.MoveSong(--n1, --n2)) is null)
 | 
			
		||||
//             {
 | 
			
		||||
//                 await ReplyConfirmLocalizedAsync("invalid_input").ConfigureAwait(false);
 | 
			
		||||
//                 return;
 | 
			
		||||
@@ -916,7 +916,7 @@
 | 
			
		||||
//         {
 | 
			
		||||
//             var mp = await _service.GetOrCreatePlayer(Context).ConfigureAwait(false);
 | 
			
		||||
//             var (_, currentSong) = mp.Current;
 | 
			
		||||
//             if (currentSong == null)
 | 
			
		||||
//             if (currentSong is null)
 | 
			
		||||
//                 return;
 | 
			
		||||
//             var currentValue = mp.ToggleRepeatSong();
 | 
			
		||||
//
 | 
			
		||||
 
 | 
			
		||||
@@ -55,13 +55,13 @@ namespace NadekoBot.Modules.NSFW
 | 
			
		||||
                img = await _service.DapiSearch(tag, type, ctx.Guild?.Id, true).ConfigureAwait(false);
 | 
			
		||||
                // if i can't find the image, ran out of providers, or tag is blacklisted
 | 
			
		||||
                // return the error
 | 
			
		||||
                if (img == null && !listOfProviders.Any())
 | 
			
		||||
                if (img is null && !listOfProviders.Any())
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            } while (img == null);
 | 
			
		||||
            } while (img is null);
 | 
			
		||||
 | 
			
		||||
            await channel.EmbedAsync(new EmbedBuilder().WithOkColor()
 | 
			
		||||
                .WithImageUrl(img.FileUrl)
 | 
			
		||||
@@ -129,7 +129,7 @@ namespace NadekoBot.Modules.NSFW
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (tagsArr == null || tagsArr.Length == 0)
 | 
			
		||||
                    if (tagsArr is null || tagsArr.Length == 0)
 | 
			
		||||
                        await InternalHentai(ctx.Channel, null).ConfigureAwait(false);
 | 
			
		||||
                    else
 | 
			
		||||
                        await InternalHentai(ctx.Channel, tagsArr[new NadekoRandom().Next(0, tagsArr.Length)]).ConfigureAwait(false);
 | 
			
		||||
@@ -252,7 +252,7 @@ namespace NadekoBot.Modules.NSFW
 | 
			
		||||
                                                _service.DapiSearch(tag, DapiSearchType.Yandere, ctx.Guild?.Id, true)).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                var linksEnum = images?.Where(l => l != null).ToArray();
 | 
			
		||||
                if (images == null || !linksEnum.Any())
 | 
			
		||||
                if (images is null || !linksEnum.Any())
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -439,7 +439,7 @@ namespace NadekoBot.Modules.NSFW
 | 
			
		||||
 | 
			
		||||
            imgObj = await _service.DapiSearch(tag, type, ctx.Guild?.Id, forceExplicit).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (imgObj == null)
 | 
			
		||||
            if (imgObj is null)
 | 
			
		||||
                await ReplyErrorLocalizedAsync("no_results").ConfigureAwait(false);
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ namespace NadekoBot.Modules.Permissions.Common
 | 
			
		||||
 | 
			
		||||
                var result = perm.CheckPermission(message, commandName, moduleName);
 | 
			
		||||
 | 
			
		||||
                if (result == null)
 | 
			
		||||
                if (result is null)
 | 
			
		||||
                {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
@@ -55,13 +55,13 @@ namespace NadekoBot.Modules.Permissions.Common
 | 
			
		||||
                        return perm.State;
 | 
			
		||||
                    break;
 | 
			
		||||
                case PrimaryPermissionType.Role:        
 | 
			
		||||
                    if (guildUser == null)
 | 
			
		||||
                    if (guildUser is null)
 | 
			
		||||
                        break;
 | 
			
		||||
                    if (guildUser.RoleIds.Contains(perm.PrimaryTargetId))
 | 
			
		||||
                        return perm.State;
 | 
			
		||||
                    break;
 | 
			
		||||
                case PrimaryPermissionType.Server:
 | 
			
		||||
                    if (guildUser == null)
 | 
			
		||||
                    if (guildUser is null)
 | 
			
		||||
                        break;
 | 
			
		||||
                    return perm.State;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    };
 | 
			
		||||
                    removed = config.FilterInvitesChannelIds.FirstOrDefault(fc => fc.Equals(match));
 | 
			
		||||
 | 
			
		||||
                    if (removed == null)
 | 
			
		||||
                    if (removed is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        config.FilterInvitesChannelIds.Add(match);
 | 
			
		||||
                    }
 | 
			
		||||
@@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    await uow.SaveChangesAsync();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (removed == null)
 | 
			
		||||
                if (removed is null)
 | 
			
		||||
                {
 | 
			
		||||
                    _service.InviteFilteringChannels.Add(channel.Id);
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("invite_filter_channel_on").ConfigureAwait(false);
 | 
			
		||||
@@ -142,7 +142,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    };
 | 
			
		||||
                    removed = config.FilterLinksChannelIds.FirstOrDefault(fc => fc.Equals(match));
 | 
			
		||||
 | 
			
		||||
                    if (removed == null)
 | 
			
		||||
                    if (removed is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        config.FilterLinksChannelIds.Add(match);
 | 
			
		||||
                    }
 | 
			
		||||
@@ -153,7 +153,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    await uow.SaveChangesAsync();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (removed == null)
 | 
			
		||||
                if (removed is null)
 | 
			
		||||
                {
 | 
			
		||||
                    _service.LinkFilteringChannels.Add(channel.Id);
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("link_filter_channel_on").ConfigureAwait(false);
 | 
			
		||||
@@ -207,7 +207,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                        ChannelId = channel.Id
 | 
			
		||||
                    };
 | 
			
		||||
                    removed = config.FilterWordsChannelIds.FirstOrDefault(fc => fc.Equals(match));
 | 
			
		||||
                    if (removed == null)
 | 
			
		||||
                    if (removed is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        config.FilterWordsChannelIds.Add(match);
 | 
			
		||||
                    }
 | 
			
		||||
@@ -218,7 +218,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
                    await uow.SaveChangesAsync();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (removed == null)
 | 
			
		||||
                if (removed is null)
 | 
			
		||||
                {
 | 
			
		||||
                    _service.WordFilteringChannels.Add(channel.Id);
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("word_filter_channel_on").ConfigureAwait(false);
 | 
			
		||||
@@ -248,7 +248,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
 | 
			
		||||
                    removed = config.FilteredWords.FirstOrDefault(fw => fw.Word.Trim().ToLowerInvariant() == word);
 | 
			
		||||
 | 
			
		||||
                    if (removed == null)
 | 
			
		||||
                    if (removed is null)
 | 
			
		||||
                        config.FilteredWords.Add(new FilteredWord() { Word = word });
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
@@ -260,7 +260,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
 | 
			
		||||
                var filteredWords = _service.ServerFilteredWords.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<string>());
 | 
			
		||||
 | 
			
		||||
                if (removed == null)
 | 
			
		||||
                if (removed is null)
 | 
			
		||||
                {
 | 
			
		||||
                    filteredWords.Add(word);
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("filter_word_add", Format.Code(word)).ConfigureAwait(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
 | 
			
		||||
                if (action == null) action = new PermissionAction(!config.VerbosePermissions); // New behaviour, can toggle.
 | 
			
		||||
                if (action is null) action = new PermissionAction(!config.VerbosePermissions); // New behaviour, can toggle.
 | 
			
		||||
                config.VerbosePermissions = action.Value;
 | 
			
		||||
                await uow.SaveChangesAsync();
 | 
			
		||||
                _service.UpdateCache(config);
 | 
			
		||||
@@ -57,11 +57,11 @@ namespace NadekoBot.Modules.Permissions
 | 
			
		||||
            if (role != null && role == role.Guild.EveryoneRole)
 | 
			
		||||
                return;
 | 
			
		||||
            
 | 
			
		||||
            if (role == null)
 | 
			
		||||
            if (role is null)
 | 
			
		||||
            {
 | 
			
		||||
                var cache = _service.GetCacheFor(ctx.Guild.Id);
 | 
			
		||||
                if (!ulong.TryParse(cache.PermRole, out var roleId) ||
 | 
			
		||||
                    (role = ((SocketGuild)ctx.Guild).GetRole(roleId)) == null)
 | 
			
		||||
                    (role = ((SocketGuild)ctx.Guild).GetRole(roleId)) is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyConfirmLocalizedAsync("permrole_not_set", Format.Bold(cache.PermRole)).ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Permissions.Services
 | 
			
		||||
            var toRemove = uow.Blacklist
 | 
			
		||||
                .FirstOrDefault(bi => bi.ItemId == id && bi.Type == type);
 | 
			
		||||
            
 | 
			
		||||
            if (!(toRemove is null))
 | 
			
		||||
            if (toRemove is not null)
 | 
			
		||||
                uow.Blacklist.Remove(toRemove);
 | 
			
		||||
            
 | 
			
		||||
            uow.SaveChanges();
 | 
			
		||||
 
 | 
			
		||||
@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.Permissions.Services
 | 
			
		||||
                    var guild = (channel as ITextChannel)?.Guild;
 | 
			
		||||
                    var usrMsg = newMsg as IUserMessage;
 | 
			
		||||
 | 
			
		||||
                    if (guild == null || usrMsg == null)
 | 
			
		||||
                    if (guild is null || usrMsg is null)
 | 
			
		||||
                        return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
                    return RunBehavior(null, guild, usrMsg);
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Permissions.Services
 | 
			
		||||
                    UpdateCache(config);
 | 
			
		||||
                }
 | 
			
		||||
                Cache.TryGetValue(guildId, out pc);
 | 
			
		||||
                if (pc == null)
 | 
			
		||||
                if (pc is null)
 | 
			
		||||
                    throw new Exception("Cache is null.");
 | 
			
		||||
            }
 | 
			
		||||
            return pc;
 | 
			
		||||
@@ -108,7 +108,7 @@ namespace NadekoBot.Modules.Permissions.Services
 | 
			
		||||
            var commandName = command.Name.ToLowerInvariant();
 | 
			
		||||
            
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
            if (guild == null)
 | 
			
		||||
            if (guild is null)
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
@@ -149,7 +149,7 @@ namespace NadekoBot.Modules.Permissions.Services
 | 
			
		||||
                        rid = 0;
 | 
			
		||||
                    string returnMsg;
 | 
			
		||||
                    IRole role;
 | 
			
		||||
                    if (string.IsNullOrWhiteSpace(permRole) || (role = guild.GetRole(rid)) == null)
 | 
			
		||||
                    if (string.IsNullOrWhiteSpace(permRole) || (role = guild.GetRole(rid)) is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        returnMsg = $"You need Admin permissions in order to use permission commands.";
 | 
			
		||||
                        if (pc.Verbose)
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
 | 
			
		||||
                var novelData = await _service.GetNovelData(query).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                if (novelData == null)
 | 
			
		||||
                if (novelData is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("failed_finding_novel").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
                    var favorites = document.QuerySelectorAll("div.user-favorites > div.di-tc");
 | 
			
		||||
 | 
			
		||||
                    var favAnime = GetText("anime_no_fav");
 | 
			
		||||
                    if (favorites.Length > 0 && favorites[0].QuerySelector("p") == null)
 | 
			
		||||
                    if (favorites.Length > 0 && favorites[0].QuerySelector("p") is null)
 | 
			
		||||
                        favAnime = string.Join("\n", favorites[0].QuerySelectorAll("ul > li > div.di-tc.va-t > a")
 | 
			
		||||
                           .Shuffle()
 | 
			
		||||
                           .Take(3)
 | 
			
		||||
@@ -144,7 +144,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
 | 
			
		||||
                var animeData = await _service.GetAnimeData(query).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                if (animeData == null)
 | 
			
		||||
                if (animeData is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("failed_finding_anime").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -172,7 +172,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
 | 
			
		||||
                var mangaData = await _service.GetMangaData(query).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                if (mangaData == null)
 | 
			
		||||
                if (mangaData is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("failed_finding_manga").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (crypto == null)
 | 
			
		||||
                if (crypto is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("crypto_not_found").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
        public async Task Rip([Leftover] IGuildUser usr)
 | 
			
		||||
        {
 | 
			
		||||
            var av = usr.RealAvatarUrl(128);
 | 
			
		||||
            if (av == null)
 | 
			
		||||
            if (av is null)
 | 
			
		||||
                return;
 | 
			
		||||
            using (var picStream = await _service.GetRipPictureAsync(usr.Nickname ?? usr.Username, av).ConfigureAwait(false))
 | 
			
		||||
            {
 | 
			
		||||
@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            var embed = new EmbedBuilder();
 | 
			
		||||
            var data = await _service.GetWeatherDataAsync(query).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (data == null)
 | 
			
		||||
            if (data is null)
 | 
			
		||||
            {
 | 
			
		||||
                embed.WithDescription(GetText("city_not_found"))
 | 
			
		||||
                    .WithErrorColor();
 | 
			
		||||
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            var (data, err) = await _service.GetTimeDataAsync(query).ConfigureAwait(false);
 | 
			
		||||
            if (!(err is null))
 | 
			
		||||
            if (err is not null)
 | 
			
		||||
            {
 | 
			
		||||
                string errorKey;
 | 
			
		||||
                switch (err)
 | 
			
		||||
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            var movie = await _service.GetMovieDataAsync(query).ConfigureAwait(false);
 | 
			
		||||
            if (movie == null)
 | 
			
		||||
            if (movie is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("imdb_fail").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -247,7 +247,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
 | 
			
		||||
                    var img = (elems.ElementAtOrDefault(new NadekoRandom().Next(0, elems.Count))?.Children?.FirstOrDefault() as IHtmlImageElement);
 | 
			
		||||
 | 
			
		||||
                    if (img?.Source == null)
 | 
			
		||||
                    if (img?.Source is null)
 | 
			
		||||
                        return;
 | 
			
		||||
 | 
			
		||||
                    var source = img.Source.Replace("b.", ".", StringComparison.InvariantCulture);
 | 
			
		||||
@@ -406,7 +406,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
 | 
			
		||||
            var card = await _service.GetMtgCardAsync(search).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (card == null)
 | 
			
		||||
            if (card is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("card_not_found").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -439,7 +439,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            await ctx.Channel.TriggerTypingAsync().ConfigureAwait(false);
 | 
			
		||||
            var card = await _service.GetHearthstoneCardDataAsync(name).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (card == null)
 | 
			
		||||
            if (card is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("card_not_found").ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -560,7 +560,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            using (var http = _httpFactory.CreateClient())
 | 
			
		||||
            {
 | 
			
		||||
                var response = await http.GetStringAsync("https://catfact.ninja/fact").ConfigureAwait(false);
 | 
			
		||||
                if (response == null)
 | 
			
		||||
                if (response is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                var fact = JObject.Parse(response)["fact"].ToString();
 | 
			
		||||
@@ -573,11 +573,11 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
        [RequireContext(ContextType.Guild)]
 | 
			
		||||
        public async Task Revav([Leftover] IGuildUser usr = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (usr == null)
 | 
			
		||||
            if (usr is null)
 | 
			
		||||
                usr = (IGuildUser)ctx.User;
 | 
			
		||||
 | 
			
		||||
            var av = usr.RealAvatarUrl();
 | 
			
		||||
            if (av == null)
 | 
			
		||||
            if (av is null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            await ctx.Channel.SendConfirmAsync($"https://images.google.com/searchbyimage?image_url={av}").ConfigureAwait(false);
 | 
			
		||||
@@ -649,12 +649,12 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
        [RequireContext(ContextType.Guild)]
 | 
			
		||||
        public async Task Avatar([Leftover] IGuildUser usr = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (usr == null)
 | 
			
		||||
            if (usr is null)
 | 
			
		||||
                usr = (IGuildUser)ctx.User;
 | 
			
		||||
 | 
			
		||||
            var avatarUrl = usr.RealAvatarUrl(2048);
 | 
			
		||||
 | 
			
		||||
            if (avatarUrl == null)
 | 
			
		||||
            if (avatarUrl is null)
 | 
			
		||||
            {
 | 
			
		||||
                await ReplyErrorLocalizedAsync("avatar_none", usr.ToString()).ConfigureAwait(false);
 | 
			
		||||
                return;
 | 
			
		||||
@@ -725,7 +725,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
            }
 | 
			
		||||
            if (obj.Error != null || obj.Verses == null || obj.Verses.Length == 0)
 | 
			
		||||
            if (obj.Error != null || obj.Verses is null || obj.Verses.Length == 0)
 | 
			
		||||
                await ctx.Channel.SendErrorAsync(obj.Error ?? "No verse found.").ConfigureAwait(false);
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
@@ -773,7 +773,7 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
 | 
			
		||||
            var imgObj = await _service.DapiSearch(tag, type, ctx.Guild?.Id).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (imgObj == null)
 | 
			
		||||
            if (imgObj is null)
 | 
			
		||||
                await channel.SendErrorAsync(umsg.Author.Mention + " " + GetText("no_results")).ConfigureAwait(false);
 | 
			
		||||
            else
 | 
			
		||||
                await channel.EmbedAsync(new EmbedBuilder().WithOkColor()
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                    using (var document = await BrowsingContext.New(config).OpenAsync(link).ConfigureAwait(false))
 | 
			
		||||
                    {
 | 
			
		||||
                        var imageElem = document.QuerySelector("div.seriesimg > img");
 | 
			
		||||
                        if (imageElem == null)
 | 
			
		||||
                        if (imageElem is null)
 | 
			
		||||
                            return null;
 | 
			
		||||
                        var imageUrl = ((IHtmlImageElement)imageElem).Source;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                    || x.Symbol.ToUpperInvariant() == name);
 | 
			
		||||
 | 
			
		||||
            (CryptoResponseData Elem, int Distance)? nearest = null;
 | 
			
		||||
            if (crypto == null)
 | 
			
		||||
            if (crypto is null)
 | 
			
		||||
            {
 | 
			
		||||
                nearest = cryptos.Select(x => (x, Distance: x.Name.ToUpperInvariant().LevenshteinDistance(name)))
 | 
			
		||||
                    .OrderBy(x => x.Distance)
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                                var previewElement = afi.Element.Elements()
 | 
			
		||||
                                    .FirstOrDefault(x => x.Name.LocalName == "preview");
 | 
			
		||||
 | 
			
		||||
                                if (previewElement == null)
 | 
			
		||||
                                if (previewElement is null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    previewElement = afi.Element.Elements()
 | 
			
		||||
                                        .FirstOrDefault(x => x.Name.LocalName == "thumbnail");
 | 
			
		||||
 
 | 
			
		||||
@@ -226,7 +226,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                        $"appid=42cd627dd60debf25a5739e50a217d74&" +
 | 
			
		||||
                        $"units=metric").ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                    if (data == null)
 | 
			
		||||
                    if (data is null)
 | 
			
		||||
                        return null;
 | 
			
		||||
 | 
			
		||||
                    return JsonConvert.DeserializeObject<WeatherData>(data);
 | 
			
		||||
@@ -504,7 +504,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                search,
 | 
			
		||||
                TimeSpan.FromDays(1)).ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
            if (data == null || data.Length == 0)
 | 
			
		||||
            if (data is null || data.Length == 0)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            return data[_rng.Next(0, data.Length)];
 | 
			
		||||
@@ -543,7 +543,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                    .ConfigureAwait(false);
 | 
			
		||||
 | 
			
		||||
                var responseObject = JsonConvert.DeserializeObject<MtgResponse>(response);
 | 
			
		||||
                if (responseObject == null)
 | 
			
		||||
                if (responseObject is null)
 | 
			
		||||
                    return new MtgData[0];
 | 
			
		||||
 | 
			
		||||
                var cards = responseObject.Cards.Take(5).ToArray();
 | 
			
		||||
@@ -582,12 +582,12 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                    var response = await http.GetStringAsync($"https://omgvamp-hearthstone-v1.p.rapidapi.com/" +
 | 
			
		||||
                        $"cards/search/{Uri.EscapeUriString(name)}").ConfigureAwait(false);
 | 
			
		||||
                    var objs = JsonConvert.DeserializeObject<HearthstoneCardData[]>(response);
 | 
			
		||||
                    if (objs == null || objs.Length == 0)
 | 
			
		||||
                    if (objs is null || objs.Length == 0)
 | 
			
		||||
                        return null;
 | 
			
		||||
                    var data = objs.FirstOrDefault(x => x.Collectible)
 | 
			
		||||
                        ?? objs.FirstOrDefault(x => !string.IsNullOrEmpty(x.PlayerClass))
 | 
			
		||||
                        ?? objs.FirstOrDefault();
 | 
			
		||||
                    if (data == null)
 | 
			
		||||
                    if (data is null)
 | 
			
		||||
                        return null;
 | 
			
		||||
                    if (!string.IsNullOrWhiteSpace(data.Img))
 | 
			
		||||
                    {
 | 
			
		||||
@@ -624,7 +624,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                var res = await http.GetStringAsync(string.Format("https://omdbapi.nadeko.bot/?t={0}&y=&plot=full&r=json",
 | 
			
		||||
                    name.Trim().Replace(' ', '+'))).ConfigureAwait(false);
 | 
			
		||||
                var movie = JsonConvert.DeserializeObject<OmdbMovie>(res);
 | 
			
		||||
                if (movie?.Title == null)
 | 
			
		||||
                if (movie?.Title is null)
 | 
			
		||||
                    return null;
 | 
			
		||||
                movie.Poster = await _google.ShortenUrl(movie.Poster).ConfigureAwait(false);
 | 
			
		||||
                return movie;
 | 
			
		||||
@@ -671,7 +671,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                }
 | 
			
		||||
            }, default(string), TimeSpan.FromHours(24));
 | 
			
		||||
 | 
			
		||||
            if (gamesMap == null)
 | 
			
		||||
            if (gamesMap is null)
 | 
			
		||||
                return -1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -780,7 +780,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                    var href = (children[0].QuerySelector("a") as IHtmlAnchorElement)?.Href;
 | 
			
		||||
                    var name = children[0].QuerySelector("h3")?.TextContent;
 | 
			
		||||
                    
 | 
			
		||||
                    if (href == null || name == null)
 | 
			
		||||
                    if (href is null || name is null)
 | 
			
		||||
                        return null;
 | 
			
		||||
 | 
			
		||||
                    var txt = children[1].TextContent;
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
        //         var oldObj = gc.YtFollowedChannels
 | 
			
		||||
        //             .FirstOrDefault(x => x.ChannelId == channelId && x.YtChannelId == ytChannelId);
 | 
			
		||||
        //
 | 
			
		||||
        //         if(!(oldObj is null))
 | 
			
		||||
        //         if(oldObj is not null)
 | 
			
		||||
        //         {
 | 
			
		||||
        //             return false;
 | 
			
		||||
        //         }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                    guild = (SocketGuild)channel.Guild;
 | 
			
		||||
                else
 | 
			
		||||
                    guild = _client.Guilds.FirstOrDefault(g => g.Name.ToUpperInvariant() == guildName.ToUpperInvariant());
 | 
			
		||||
                if (guild == null)
 | 
			
		||||
                if (guild is null)
 | 
			
		||||
                    return;
 | 
			
		||||
                var ownername = guild.GetUser(guild.OwnerId);
 | 
			
		||||
                var textchn = guild.TextChannels.Count();
 | 
			
		||||
@@ -79,7 +79,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
            public async Task ChannelInfo(ITextChannel channel = null)
 | 
			
		||||
            {
 | 
			
		||||
                var ch = channel ?? (ITextChannel)ctx.Channel;
 | 
			
		||||
                if (ch == null)
 | 
			
		||||
                if (ch is null)
 | 
			
		||||
                    return;
 | 
			
		||||
                var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ch.Id >> 22);
 | 
			
		||||
                var usercount = (await ch.GetUsersAsync().FlattenAsync().ConfigureAwait(false)).Count();
 | 
			
		||||
@@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
            {
 | 
			
		||||
                var user = usr ?? ctx.User as IGuildUser;
 | 
			
		||||
 | 
			
		||||
                if (user == null)
 | 
			
		||||
                if (user is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                var embed = new EmbedBuilder()
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                    //}
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (quote == null)
 | 
			
		||||
                if (quote is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                var rep = new ReplacementBuilder()
 | 
			
		||||
@@ -141,7 +141,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                    keywordquote = await uow.Quotes.SearchQuoteKeywordTextAsync(ctx.Guild.Id, keyword, text);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (keywordquote == null)
 | 
			
		||||
                if (keywordquote is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                await ctx.Channel.SendMessageAsync($"`#{keywordquote.Id}` 💬 " + keyword.ToLowerInvariant() + ":  " +
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                
 | 
			
		||||
                ulong target;
 | 
			
		||||
                target = meorhere == MeOrHere.Me ? ctx.User.Id : ctx.Channel.Id;
 | 
			
		||||
                if (!await RemindInternal(target, meorhere == MeOrHere.Me || ctx.Guild == null, remindData.Time, remindData.What)
 | 
			
		||||
                if (!await RemindInternal(target, meorhere == MeOrHere.Me || ctx.Guild is null, remindData.Time, remindData.What)
 | 
			
		||||
                    .ConfigureAwait(false))
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("remind_too_long").ConfigureAwait(false);
 | 
			
		||||
@@ -144,7 +144,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (rem == null)
 | 
			
		||||
                if (rem is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("reminder_not_exist").ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
@@ -186,7 +186,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
                    await uow.SaveChangesAsync();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var gTime = ctx.Guild == null
 | 
			
		||||
                var gTime = ctx.Guild is null
 | 
			
		||||
                    ? time
 | 
			
		||||
                    : TimeZoneInfo.ConvertTime(time, _tz.GetTimeZoneOrUtc(ctx.Guild.Id));
 | 
			
		||||
                try
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
        {
 | 
			
		||||
            await Task.Yield();
 | 
			
		||||
 | 
			
		||||
            if (guild == null || string.IsNullOrWhiteSpace(input))
 | 
			
		||||
            if (guild is null || string.IsNullOrWhiteSpace(input))
 | 
			
		||||
                return input;
 | 
			
		||||
 | 
			
		||||
            if (guild != null)
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                        data = JsonConvert.DeserializeObject<PatreonData>(res);
 | 
			
		||||
                        var pledgers = data.Data.Where(x => x["type"].ToString() == "pledge");
 | 
			
		||||
                        rewards.AddRange(pledgers.Select(x => JsonConvert.DeserializeObject<PatreonPledge>(x.ToString()))
 | 
			
		||||
                            .Where(x => x.attributes.declined_since == null));
 | 
			
		||||
                            .Where(x => x.attributes.declined_since is null));
 | 
			
		||||
                        if (data.Included != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            users.AddRange(data.Included
 | 
			
		||||
@@ -141,7 +141,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                        var users = uow.Set<RewardedUser>();
 | 
			
		||||
                        var usr = users.FirstOrDefault(x => x.PatreonUserId == data.User.id);
 | 
			
		||||
 | 
			
		||||
                        if (usr == null)
 | 
			
		||||
                        if (usr is null)
 | 
			
		||||
                        {
 | 
			
		||||
                            users.Add(new RewardedUser()
 | 
			
		||||
                            {
 | 
			
		||||
 
 | 
			
		||||
@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                if (r.IsPrivate)
 | 
			
		||||
                {
 | 
			
		||||
                    var user = _client.GetUser(r.ChannelId);
 | 
			
		||||
                    if (user == null)
 | 
			
		||||
                    if (user is null)
 | 
			
		||||
                        return;
 | 
			
		||||
                    ch = await user.GetOrCreateDMChannelAsync().ConfigureAwait(false);
 | 
			
		||||
                }
 | 
			
		||||
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                {
 | 
			
		||||
                    ch = _client.GetGuild(r.ServerId)?.GetTextChannel(r.ChannelId);
 | 
			
		||||
                }
 | 
			
		||||
                if (ch == null)
 | 
			
		||||
                if (ch is null)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                await ch.EmbedAsync(new EmbedBuilder()
 | 
			
		||||
 
 | 
			
		||||
@@ -165,7 +165,7 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};")
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                while (!(current is null) && current.Value.NextTime < rep.NextTime)
 | 
			
		||||
                while (current is not null && current.Value.NextTime < rep.NextTime)
 | 
			
		||||
                    current = current.Next;
 | 
			
		||||
 | 
			
		||||
                if (current is null)
 | 
			
		||||
 
 | 
			
		||||
@@ -239,7 +239,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                        || a.Name.ToUpperInvariant().Contains(setting.Keyword.ToUpperInvariant())
 | 
			
		||||
                        || setting.Whitelist.Any(x => x.UserId == user.Id)));
 | 
			
		||||
            
 | 
			
		||||
            if (!(g is null)
 | 
			
		||||
            if (g is not null
 | 
			
		||||
                && setting.Enabled
 | 
			
		||||
                && setting.Blacklist.All(x => x.UserId != user.Id)
 | 
			
		||||
                && user.RoleIds.Contains(setting.FromRoleId))
 | 
			
		||||
@@ -247,7 +247,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
 | 
			
		||||
                    if (addRole == null)
 | 
			
		||||
                    if (addRole is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await StopStreamRole(user.Guild).ConfigureAwait(false);
 | 
			
		||||
                        Log.Warning("Stream role in server {0} no longer exists. Stopping.", setting.AddRoleId);
 | 
			
		||||
@@ -278,7 +278,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
 | 
			
		||||
                        if (addRole == null)
 | 
			
		||||
                        if (addRole is null)
 | 
			
		||||
                            throw new StreamRoleNotFoundException();
 | 
			
		||||
 | 
			
		||||
                        await user.RemoveRoleAsync(addRole).ConfigureAwait(false);
 | 
			
		||||
@@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            var addRole = guild.GetRole(setting.AddRoleId);
 | 
			
		||||
            if (addRole == null)
 | 
			
		||||
            if (addRole is null)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            if (setting.Enabled)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Utility.Services
 | 
			
		||||
 | 
			
		||||
        private async Task LogVerboseError(CommandInfo cmd, ITextChannel channel, string reason)
 | 
			
		||||
        {
 | 
			
		||||
            if (channel == null || !guildsEnabled.Contains(channel.GuildId))
 | 
			
		||||
            if (channel is null || !guildsEnabled.Contains(channel.GuildId))
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
            {
 | 
			
		||||
                var originUnit = _service.Units.FirstOrDefault(x => x.Triggers.Select(y => y.ToUpperInvariant()).Contains(origin.ToUpperInvariant()));
 | 
			
		||||
                var targetUnit = _service.Units.FirstOrDefault(x => x.Triggers.Select(y => y.ToUpperInvariant()).Contains(target.ToUpperInvariant()));
 | 
			
		||||
                if (originUnit == null || targetUnit == null)
 | 
			
		||||
                if (originUnit is null || targetUnit is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("convert_not_found", Format.Bold(origin), Format.Bold(target)).ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -244,7 +244,7 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
        [RequireContext(ContextType.Guild)]
 | 
			
		||||
        public async Task ChannelTopic([Leftover]ITextChannel channel = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (channel == null)
 | 
			
		||||
            if (channel is null)
 | 
			
		||||
                channel = (ITextChannel)ctx.Channel;
 | 
			
		||||
 | 
			
		||||
            var topic = channel.Topic;
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Xp
 | 
			
		||||
            public async Task ClubIcon([Leftover] string url = null)
 | 
			
		||||
            {
 | 
			
		||||
                if ((!Uri.IsWellFormedUriString(url, UriKind.Absolute) && url != null)
 | 
			
		||||
                    || !await _service.SetClubIcon(ctx.User.Id, url == null ? null : new Uri(url)))
 | 
			
		||||
                    || !await _service.SetClubIcon(ctx.User.Id, url is null ? null : new Uri(url)))
 | 
			
		||||
                {
 | 
			
		||||
                    await ReplyErrorLocalizedAsync("club_icon_error").ConfigureAwait(false);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -95,7 +95,7 @@ namespace NadekoBot.Modules.Xp
 | 
			
		||||
            {
 | 
			
		||||
                user = user ?? ctx.User;
 | 
			
		||||
                var club = _service.GetClubByMember(user);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                {
 | 
			
		||||
                    await ErrorLocalizedAsync("club_user_not_in_club", Format.Bold(user.ToString()));
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -171,7 +171,7 @@ namespace NadekoBot.Modules.Xp
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
                var club = _service.GetClubWithBansAndApplications(ctx.User.Id);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return ReplyErrorLocalizedAsync("club_not_exists_owner");
 | 
			
		||||
 | 
			
		||||
                var bans = club
 | 
			
		||||
@@ -202,7 +202,7 @@ namespace NadekoBot.Modules.Xp
 | 
			
		||||
                    return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
                var club = _service.GetClubWithBansAndApplications(ctx.User.Id);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return ReplyErrorLocalizedAsync("club_not_exists_owner");
 | 
			
		||||
 | 
			
		||||
                var apps = club
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            uow.SaveChanges();
 | 
			
		||||
            var xp = new LevelStats(du.TotalXp);
 | 
			
		||||
 | 
			
		||||
            if (xp.Level >= 5 && du.Club == null)
 | 
			
		||||
            if (xp.Level >= 5 && du.Club is null)
 | 
			
		||||
            {
 | 
			
		||||
                du.IsClubAdmin = true;
 | 
			
		||||
                du.Club = new ClubInfo()
 | 
			
		||||
@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
                club = uow.Clubs.GetByOwner(from.Id);
 | 
			
		||||
                var newOwnerUser = uow.GetOrCreateUser(newOwner);
 | 
			
		||||
 | 
			
		||||
                if (club == null ||
 | 
			
		||||
                if (club is null ||
 | 
			
		||||
                    club.Owner.UserId != from.Id ||
 | 
			
		||||
                    !club.Users.Contains(newOwnerUser))
 | 
			
		||||
                    return null;
 | 
			
		||||
@@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
                var club = uow.Clubs.GetByOwner(owner.Id);
 | 
			
		||||
                var adminUser = uow.GetOrCreateUser(toAdmin);
 | 
			
		||||
 | 
			
		||||
                if (club == null || club.Owner.UserId != owner.Id ||
 | 
			
		||||
                if (club is null || club.Owner.UserId != owner.Id ||
 | 
			
		||||
                    !club.Users.Contains(adminUser))
 | 
			
		||||
                    throw new InvalidOperationException();
 | 
			
		||||
 | 
			
		||||
@@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            {
 | 
			
		||||
                var club = uow.Clubs.GetByOwner(ownerUserId);
 | 
			
		||||
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                club.ImageUrl = url.ToString();
 | 
			
		||||
@@ -148,7 +148,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                club = uow.Clubs.GetByName(name, discrim);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
                else
 | 
			
		||||
                    return true;
 | 
			
		||||
@@ -191,11 +191,11 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var club = uow.Clubs.GetByOwnerOrAdmin(clubOwnerUserId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var applicant = club.Applicants.FirstOrDefault(x => x.User.ToString().ToUpperInvariant() == userName.ToUpperInvariant());
 | 
			
		||||
                if (applicant == null)
 | 
			
		||||
                if (applicant is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                applicant.User.Club = club;
 | 
			
		||||
@@ -227,7 +227,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var du = uow.GetOrCreateUser(user);
 | 
			
		||||
                if (du.Club == null || du.Club.OwnerId == du.Id)
 | 
			
		||||
                if (du.Club is null || du.Club.OwnerId == du.Id)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                du.Club = null;
 | 
			
		||||
@@ -245,7 +245,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var club = uow.Clubs.GetByOwner(userId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                club.MinimumLevelReq = level;
 | 
			
		||||
@@ -260,7 +260,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                var club = uow.Clubs.GetByOwner(userId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                club.Description = desc?.TrimTo(150, true);
 | 
			
		||||
@@ -275,7 +275,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                club = uow.Clubs.GetByOwner(userId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                uow.Clubs.Remove(club);
 | 
			
		||||
@@ -289,12 +289,12 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                club = uow.Clubs.GetByOwnerOrAdmin(bannerId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var usr = club.Users.FirstOrDefault(x => x.ToString().ToUpperInvariant() == userName.ToUpperInvariant())
 | 
			
		||||
                    ?? club.Applicants.FirstOrDefault(x => x.User.ToString().ToUpperInvariant() == userName.ToUpperInvariant())?.User;
 | 
			
		||||
                if (usr == null)
 | 
			
		||||
                if (usr is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                if (club.OwnerId == usr.Id || (usr.IsClubAdmin && club.Owner.UserId != bannerId)) // can't ban the owner kek, whew
 | 
			
		||||
@@ -322,11 +322,11 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                club = uow.Clubs.GetByOwnerOrAdmin(ownerUserId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var ban = club.Bans.FirstOrDefault(x => x.User.ToString().ToUpperInvariant() == userName.ToUpperInvariant());
 | 
			
		||||
                if (ban == null)
 | 
			
		||||
                if (ban is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                club.Bans.Remove(ban);
 | 
			
		||||
@@ -341,11 +341,11 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
            using (var uow = _db.GetDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                club = uow.Clubs.GetByOwnerOrAdmin(kickerId);
 | 
			
		||||
                if (club == null)
 | 
			
		||||
                if (club is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                var usr = club.Users.FirstOrDefault(x => x.ToString().ToUpperInvariant() == userName.ToUpperInvariant());
 | 
			
		||||
                if (usr == null)
 | 
			
		||||
                if (usr is null)
 | 
			
		||||
                    return false;
 | 
			
		||||
 | 
			
		||||
                if (club.OwnerId == usr.Id || (usr.IsClubAdmin && club.Owner.UserId != kickerId))
 | 
			
		||||
 
 | 
			
		||||
@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
                                if (rrew != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    var role = first.User.Guild.GetRole(rrew.RoleId);
 | 
			
		||||
                                    if (!(role is null))
 | 
			
		||||
                                    if (role is not null)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        if (rrew.Remove)
 | 
			
		||||
                                        {
 | 
			
		||||
@@ -490,7 +490,7 @@ namespace NadekoBot.Modules.Xp.Services
 | 
			
		||||
                {
 | 
			
		||||
                    ScanChannelForVoiceXp(after.VoiceChannel);
 | 
			
		||||
                }
 | 
			
		||||
                else if (after.VoiceChannel == null)
 | 
			
		||||
                else if (after.VoiceChannel is null)
 | 
			
		||||
                {
 | 
			
		||||
                    // In this case, the user left the channel and the previous for loops didn't catch
 | 
			
		||||
                    // it because it wasn't in any new channel. So we need to get rid of it.
 | 
			
		||||
 
 | 
			
		||||
@@ -251,7 +251,7 @@ namespace NadekoBot.Modules.Xp
 | 
			
		||||
        [RequireContext(ContextType.Guild)]
 | 
			
		||||
        public async Task XpExclude(Channel _, [Leftover] IChannel channel = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (channel == null)
 | 
			
		||||
            if (channel is null)
 | 
			
		||||
                channel = ctx.Channel;
 | 
			
		||||
 | 
			
		||||
            var ex = _service.ToggleExcludeChannel(ctx.Guild.Id, channel.Id);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user