Skip to content

Commit

Permalink
Fix mapfeed embed (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasi4K5 authored Nov 29, 2024
2 parents 343d3c8 + 3e8d117 commit 7455d21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Numerous.Bot/Osu/MapFeedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ private async Task CheckForNewBeatmapsetsAsync(CancellationToken ct)
.Where(id => osuUserDiscordIdDic.ContainsKey(id))
.Select(id => new { osuId = id, discordId = osuUserDiscordIdDic[id] });

var usernames = fullSet.RelatedUsers?.ToDictionary(u => u.Id, u => u.Username)
?? [];

var sendTasks = channelIds.Select(id => Task.Run(async () =>
{
var channel = (IMessageChannel)await discordClient.GetChannelAsync(id);
Expand All @@ -111,7 +114,7 @@ private async Task CheckForNewBeatmapsetsAsync(CancellationToken ct)

var gdMappersInGuild = verifiedGdMapperIds
.Where(ids => guildUserIds.Contains(ids.discordId))
.Select(ids => $"{MentionUtils.MentionUser(ids.discordId)} ({Link.OsuUser(ids.osuId)})")
.Select(ids => $"{MentionUtils.MentionUser(ids.discordId)} ({Link.OsuUser(ids.osuId, usernames[ids.osuId])})")
.ToArray();

var (eb, cb) = EmbedBuilders.BeatmapSetUpdate(fullSet, mapper, gdMappersInGuild);
Expand Down

0 comments on commit 7455d21

Please sign in to comment.