Skip to content

Commit 446816c

Browse files
committed
sanitize user display name
1 parent dc1b0a6 commit 446816c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

HighlightBot/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private static Task OnMessageCreatedAsync(DiscordClient discord, MessageCreateEv
222222
Name = (e.Author as DiscordMember)?.DisplayName ?? e.Author.Username
223223
},
224224
Color = new Optional<DiscordColor>(DiscordColor.Yellow),
225-
Description = string.Join('\n', lastMessages.Backwards().Select(message => $"{Formatter.Bold($"[{message.CreationTimestamp.ToUniversalTime():T}] {(message.Author as DiscordMember)?.DisplayName ?? message.Author.Username}:")} {message.Content.Ellipsis(500)}")),
225+
Description = string.Join('\n', lastMessages.Backwards().Select(message => $"{Formatter.Bold($"[{message.CreationTimestamp.ToUniversalTime():T}] {Formatter.Sanitize((message.Author as DiscordMember)?.DisplayName ?? message.Author.Username)}:")} {message.Content.Ellipsis(500)}")),
226226
Timestamp = DateTimeOffset.UtcNow,
227227
};
228228
notificationEmbed = notificationEmbed
@@ -244,7 +244,7 @@ private static Task OnMessageCreatedAsync(DiscordClient discord, MessageCreateEv
244244

245245
List<string> terms = grouping.ToList();
246246
var discordMessageBuilder = new DiscordMessageBuilder() {
247-
Content = $"In {Formatter.Bold(guild.Name)} {e.Channel.Mention}, you were mentioned with the highlighted word{(terms.Count > 1 ? "s" : "")} {Util.JoinOxfordComma(terms)}",
247+
Content = $"In {Formatter.Bold(Formatter.Sanitize(guild.Name))} {e.Channel.Mention}, you were mentioned with the highlighted word{(terms.Count > 1 ? "s" : "")} {Util.JoinOxfordComma(terms)}",
248248
Embed = notificationEmbed
249249
};
250250
await target.SendMessageAsync(discordMessageBuilder);

0 commit comments

Comments
 (0)