mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	Changed all == null to is null and all !(* == null) to * is not null
This commit is contained in:
		@@ -152,7 +152,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
 | 
			
		||||
        public static void ThrowIfNull<T>(this T o, string name) where T : class
 | 
			
		||||
        {
 | 
			
		||||
            if (o == null)
 | 
			
		||||
            if (o is null)
 | 
			
		||||
                throw new ArgumentNullException(nameof(name));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -194,7 +194,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
 | 
			
		||||
        public static ReactionEventWrapper OnReaction(this IUserMessage msg, DiscordSocketClient client, Func<SocketReaction, Task> reactionAdded, Func<SocketReaction, Task> reactionRemoved = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (reactionRemoved == null)
 | 
			
		||||
            if (reactionRemoved is null)
 | 
			
		||||
                reactionRemoved = _ => Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
            var wrap = new ReactionEventWrapper(client, msg);
 | 
			
		||||
@@ -348,7 +348,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
 | 
			
		||||
        public static long? GetImageSize(this HttpResponseMessage msg)
 | 
			
		||||
        {
 | 
			
		||||
            if (msg.Content.Headers.ContentLength == null)
 | 
			
		||||
            if (msg.Content.Headers.ContentLength is null)
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
@@ -381,7 +381,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
                    .Where(x => x.GetInterfaces().Contains(typeof(INService))
 | 
			
		||||
                        && !x.GetTypeInfo().IsInterface && !x.GetTypeInfo().IsAbstract
 | 
			
		||||
#if GLOBAL_NADEKO
 | 
			
		||||
                        && x.GetTypeInfo().GetCustomAttribute<NoPublicBotAttribute>() == null
 | 
			
		||||
                        && x.GetTypeInfo().GetCustomAttribute<NoPublicBotAttribute>() is null
 | 
			
		||||
#endif
 | 
			
		||||
                            )
 | 
			
		||||
                    .ToArray());
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
        /// </exception>
 | 
			
		||||
        public static IEnumerable<TSource[]> Chunk<TSource>(this IEnumerable<TSource> source, int size)
 | 
			
		||||
        {
 | 
			
		||||
            if (source == null)
 | 
			
		||||
            if (source is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(source));
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
            
 | 
			
		||||
            var canPaginate = true;
 | 
			
		||||
            var sg = ctx.Guild as SocketGuild;
 | 
			
		||||
            if (!(sg is null) && !sg.CurrentUser.GetPermissions((IGuildChannel) ctx.Channel).AddReactions)
 | 
			
		||||
            if (sg is not null && !sg.CurrentUser.GetPermissions((IGuildChannel) ctx.Channel).AddReactions)
 | 
			
		||||
                canPaginate = false;
 | 
			
		||||
            
 | 
			
		||||
            if (!canPaginate)
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
        // This method is used by everything that fetches the avatar from a user
 | 
			
		||||
        public static Uri RealAvatarUrl(this IUser usr, ushort size = 128)
 | 
			
		||||
        {
 | 
			
		||||
            return usr.AvatarId == null
 | 
			
		||||
            return usr.AvatarId is null
 | 
			
		||||
                ? new Uri(usr.GetDefaultAvatarUrl())
 | 
			
		||||
                : new Uri(usr.GetAvatarUrl(ImageFormat.Auto, size));
 | 
			
		||||
        }
 | 
			
		||||
@@ -54,7 +54,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
        // This method is only used for the xp card
 | 
			
		||||
        public static Uri RealAvatarUrl(this DiscordUser usr)
 | 
			
		||||
        {
 | 
			
		||||
            return usr.AvatarId == null
 | 
			
		||||
            return usr.AvatarId is null
 | 
			
		||||
                ? null
 | 
			
		||||
                : new Uri(usr.AvatarId.StartsWith("a_", StringComparison.InvariantCulture)
 | 
			
		||||
                    ? $"{DiscordConfig.CDNUrl}avatars/{usr.UserId}/{usr.AvatarId}.gif"
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
        public static LinkedListNode<T>? FindNode<T>(this LinkedList<T> list, Func<T, bool> predicate)
 | 
			
		||||
        {
 | 
			
		||||
            var node = list.First;
 | 
			
		||||
            while (!(node is null))
 | 
			
		||||
            while (node is not null)
 | 
			
		||||
            {
 | 
			
		||||
                if (predicate(node.Value))
 | 
			
		||||
                    return node;
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ namespace NadekoBot.Extensions
 | 
			
		||||
                    while (true)
 | 
			
		||||
                    {
 | 
			
		||||
                        var text = reader.ReadLine();
 | 
			
		||||
                        if (text == null)
 | 
			
		||||
                        if (text is null)
 | 
			
		||||
                        {
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
 
 | 
			
		||||
@@ -69,9 +69,9 @@ namespace NadekoBot.Extensions
 | 
			
		||||
        /// <returns>String with the correct singular/plural form</returns>
 | 
			
		||||
        public static string SnPl(this string str, int? num, bool es = false)
 | 
			
		||||
        {
 | 
			
		||||
            if (str == null)
 | 
			
		||||
            if (str is null)
 | 
			
		||||
                throw new ArgumentNullException(nameof(str));
 | 
			
		||||
            if (num == null)
 | 
			
		||||
            if (num is null)
 | 
			
		||||
                throw new ArgumentNullException(nameof(num));
 | 
			
		||||
            return num == 1 ? str.Remove(str.Length - 1, es ? 2 : 1) : str;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user