From 27a0785653cda4e0fcb2b0cd82bfaa6bab8288b8 Mon Sep 17 00:00:00 2001 From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:13:15 +0300 Subject: [PATCH] `.Distinct()` roles(ids) in `IGuildUser.ModifyAsync` (#2914) --- src/Discord.Net.Rest/Entities/Users/UserHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Users/UserHelper.cs b/src/Discord.Net.Rest/Entities/Users/UserHelper.cs index 64607b40d6..b0292adc90 100644 --- a/src/Discord.Net.Rest/Entities/Users/UserHelper.cs +++ b/src/Discord.Net.Rest/Entities/Users/UserHelper.cs @@ -50,9 +50,9 @@ public static async Task ModifyAsync(IGuildUser user, BaseD apiArgs.ChannelId = args.ChannelId.Value; if (args.Roles.IsSpecified) - apiArgs.RoleIds = args.Roles.Value.Select(x => x.Id).ToArray(); + apiArgs.RoleIds = args.Roles.Value.Select(x => x.Id).Distinct().ToArray(); else if (args.RoleIds.IsSpecified) - apiArgs.RoleIds = args.RoleIds.Value.ToArray(); + apiArgs.RoleIds = args.RoleIds.Value.Distinct().ToArray(); /* * Ensure that the nick passed in the params of the request is not null.