From eeeeb75c66ceeb4dfc2eef69f006a2665e1d66d8 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sat, 11 Oct 2025 20:21:13 -0400 Subject: [PATCH] perf(cmd): avoid extra strings.ToLower allocation --- cmd/message_input.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/message_input.go b/cmd/message_input.go index b32c9ce..c1415ef 100644 --- a/cmd/message_input.go +++ b/cmd/message_input.go @@ -236,9 +236,9 @@ func processText(cID discord.ChannelID, src []byte) string { func expandMentions(cID discord.ChannelID, src []byte) []byte { return mentionRegex.ReplaceAllFunc(src, func(input []byte) []byte { output := input - name := strings.ToLower(string(input[1:])) + name := string(input[1:]) discordState.MemberStore.Each(app.guildsTree.selectedGuildID, func(m *discord.Member) bool { - if strings.ToLower(m.User.Username) == name && channelHasUser(cID, m.User.ID) { + if strings.EqualFold(m.User.Username, name) && channelHasUser(cID, m.User.ID) { output = []byte(m.User.ID.Mention()) return true }