Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
sphexator committed Jan 6, 2025
1 parent 6e5c711 commit 39a6ee7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Hanekawa.Bot/Services/Bot/DiscordEventRegister.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Disqord;
using System.Runtime.InteropServices;
using Disqord;
using Disqord.Bot.Hosting;
using Disqord.Gateway;
using Hanekawa.Application.Contracts.Discord.Services;
Expand Down Expand Up @@ -28,7 +29,7 @@ await service.GetRequiredService<IMediator>()
{
Guild = new Guild { GuildId = e.GuildId.Value },
Id = e.Member.Id,
RoleIds = ConvertRoles(e.Member.RoleIds.ToArray()),
RoleIds = ConvertRoles(e.Member.RoleIds),
Nickname = e.Member.Nick,
IsBot = e.Member.IsBot,
Username = e.Member.Name,
Expand Down Expand Up @@ -115,13 +116,12 @@ await service.GetRequiredService<IMediator>()
.ConfigureAwait(false);
}

private static ulong[] ConvertRoles(Snowflake[] roles)
private static ulong[] ConvertRoles(IReadOnlyList<Snowflake> roles)
{
var toReturn = new ulong[roles.Length];
var spans = roles.AsSpan();
for (var i = 0; i < spans.Length; i++)
var toReturn = new ulong[roles.Count];
for (var i = 0; i < roles.Count; i++)
{
var role = spans[i];
var role = roles[i];
toReturn[i] = role.RawValue;
}
return toReturn;
Expand Down

0 comments on commit 39a6ee7

Please sign in to comment.