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:
		@@ -27,7 +27,7 @@ namespace NadekoBot.Core.Common.Attributes
 | 
			
		||||
            var cache = services.GetService<IDataCache>();
 | 
			
		||||
            var rem = cache.TryAddRatelimit(context.User.Id, command.Name, Seconds);
 | 
			
		||||
 | 
			
		||||
            if(rem == null)
 | 
			
		||||
            if(rem is null)
 | 
			
		||||
                return Task.FromResult(PreconditionResult.FromSuccess());
 | 
			
		||||
 | 
			
		||||
            var msgContent = $"You can use this command again in {rem.Value.TotalSeconds:F1}s.";
 | 
			
		||||
 
 | 
			
		||||
@@ -176,7 +176,7 @@ namespace NadekoBot.Common.Collections
 | 
			
		||||
        public ConcurrentHashSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
 | 
			
		||||
            : this(comparer)
 | 
			
		||||
        {
 | 
			
		||||
            if (collection == null) throw new ArgumentNullException(nameof(collection));
 | 
			
		||||
            if (collection is null) throw new ArgumentNullException(nameof(collection));
 | 
			
		||||
 | 
			
		||||
            InitializeFromCollection(collection);
 | 
			
		||||
        }
 | 
			
		||||
@@ -205,8 +205,8 @@ namespace NadekoBot.Common.Collections
 | 
			
		||||
        public ConcurrentHashSet(int concurrencyLevel, IEnumerable<T> collection, IEqualityComparer<T> comparer)
 | 
			
		||||
            : this(concurrencyLevel, DefaultCapacity, false, comparer)
 | 
			
		||||
        {
 | 
			
		||||
            if (collection == null) throw new ArgumentNullException(nameof(collection));
 | 
			
		||||
            if (comparer == null) throw new ArgumentNullException(nameof(comparer));
 | 
			
		||||
            if (collection is null) throw new ArgumentNullException(nameof(collection));
 | 
			
		||||
            if (comparer is null) throw new ArgumentNullException(nameof(comparer));
 | 
			
		||||
 | 
			
		||||
            InitializeFromCollection(collection);
 | 
			
		||||
        }
 | 
			
		||||
@@ -348,11 +348,11 @@ namespace NadekoBot.Common.Collections
 | 
			
		||||
                    Node previous = null;
 | 
			
		||||
                    for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
 | 
			
		||||
                    {
 | 
			
		||||
                        Debug.Assert((previous == null && current == tables.Buckets[bucketNo]) || previous.Next == current);
 | 
			
		||||
                        Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
 | 
			
		||||
 | 
			
		||||
                        if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
 | 
			
		||||
                        {
 | 
			
		||||
                            if (previous == null)
 | 
			
		||||
                            if (previous is null)
 | 
			
		||||
                            {
 | 
			
		||||
                                Volatile.Write(ref tables.Buckets[bucketNo], current.Next);
 | 
			
		||||
                            }
 | 
			
		||||
@@ -406,7 +406,7 @@ namespace NadekoBot.Common.Collections
 | 
			
		||||
 | 
			
		||||
        void ICollection<T>.CopyTo(T[] array, int arrayIndex)
 | 
			
		||||
        {
 | 
			
		||||
            if (array == null) throw new ArgumentNullException(nameof(array));
 | 
			
		||||
            if (array is null) throw new ArgumentNullException(nameof(array));
 | 
			
		||||
            if (arrayIndex < 0) throw new ArgumentOutOfRangeException(nameof(arrayIndex));
 | 
			
		||||
 | 
			
		||||
            var locksAcquired = 0;
 | 
			
		||||
@@ -474,7 +474,7 @@ namespace NadekoBot.Common.Collections
 | 
			
		||||
                    Node previous = null;
 | 
			
		||||
                    for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
 | 
			
		||||
                    {
 | 
			
		||||
                        Debug.Assert((previous == null && current == tables.Buckets[bucketNo]) || previous.Next == current);
 | 
			
		||||
                        Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
 | 
			
		||||
                        if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
 | 
			
		||||
                        {
 | 
			
		||||
                            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -69,8 +69,8 @@ namespace NadekoBot.Common.Replacements
 | 
			
		||||
        public ReplacementBuilder WithServer(DiscordSocketClient client, SocketGuild g)
 | 
			
		||||
        {
 | 
			
		||||
            /*OBSOLETE*/
 | 
			
		||||
            _reps.TryAdd("%sid%", () => g == null ? "DM" : g.Id.ToString());
 | 
			
		||||
            _reps.TryAdd("%server%", () => g == null ? "DM" : g.Name);
 | 
			
		||||
            _reps.TryAdd("%sid%", () => g is null ? "DM" : g.Id.ToString());
 | 
			
		||||
            _reps.TryAdd("%server%", () => g is null ? "DM" : g.Name);
 | 
			
		||||
            _reps.TryAdd("%members%", () => g != null && g is SocketGuild sg ? sg.MemberCount.ToString() : "?");
 | 
			
		||||
            _reps.TryAdd("%server_time%", () =>
 | 
			
		||||
            {
 | 
			
		||||
@@ -86,8 +86,8 @@ namespace NadekoBot.Common.Replacements
 | 
			
		||||
                    to).ToString("HH:mm ") + to.StandardName.GetInitials();
 | 
			
		||||
            });
 | 
			
		||||
            /*NEW*/
 | 
			
		||||
            _reps.TryAdd("%server.id%", () => g == null ? "DM" : g.Id.ToString());
 | 
			
		||||
            _reps.TryAdd("%server.name%", () => g == null ? "DM" : g.Name);
 | 
			
		||||
            _reps.TryAdd("%server.id%", () => g is null ? "DM" : g.Id.ToString());
 | 
			
		||||
            _reps.TryAdd("%server.name%", () => g is null ? "DM" : g.Name);
 | 
			
		||||
            _reps.TryAdd("%server.members%", () => g != null && g is SocketGuild sg ? sg.MemberCount.ToString() : "?");
 | 
			
		||||
            _reps.TryAdd("%server.time%", () =>
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ namespace NadekoBot.Common.TypeReaders
 | 
			
		||||
 | 
			
		||||
            var cmd = _cmds.Commands.FirstOrDefault(c =>
 | 
			
		||||
                c.Aliases.Select(a => a.ToUpperInvariant()).Contains(input));
 | 
			
		||||
            if (cmd == null)
 | 
			
		||||
            if (cmd is null)
 | 
			
		||||
                return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such command found."));
 | 
			
		||||
 | 
			
		||||
            return Task.FromResult(TypeReaderResult.FromSuccess(cmd));
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ namespace NadekoBot.Common.TypeReaders
 | 
			
		||||
        public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
 | 
			
		||||
        {
 | 
			
		||||
            var gdt = Parse(services, context.Guild.Id, input);
 | 
			
		||||
            if(gdt == null)
 | 
			
		||||
            if(gdt is null)
 | 
			
		||||
                return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "Input string is in an incorrect format."));
 | 
			
		||||
 | 
			
		||||
            return Task.FromResult(TypeReaderResult.FromSuccess(gdt));
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
        public override bool Equals(object obj)
 | 
			
		||||
        {
 | 
			
		||||
            if (obj == null || GetType() != obj.GetType())
 | 
			
		||||
            if (obj is null || GetType() != obj.GetType())
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ namespace NadekoBot.Common.TypeReaders
 | 
			
		||||
        {
 | 
			
		||||
            input = input.ToUpperInvariant();
 | 
			
		||||
            var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule()).FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)?.Key;
 | 
			
		||||
            if (module == null)
 | 
			
		||||
            if (module is null)
 | 
			
		||||
                return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such module found."));
 | 
			
		||||
 | 
			
		||||
            return Task.FromResult(TypeReaderResult.FromSuccess(module));
 | 
			
		||||
@@ -41,7 +41,7 @@ namespace NadekoBot.Common.TypeReaders
 | 
			
		||||
        {
 | 
			
		||||
            input = input.ToUpperInvariant();
 | 
			
		||||
            var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule()).FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)?.Key;
 | 
			
		||||
            if (module == null && input != "ACTUALCUSTOMREACTIONS")
 | 
			
		||||
            if (module is null && input != "ACTUALCUSTOMREACTIONS")
 | 
			
		||||
                return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such module found."));
 | 
			
		||||
 | 
			
		||||
            return Task.FromResult(TypeReaderResult.FromSuccess(new ModuleOrCrInfo
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user