diff --git a/utils.go b/utils.go index 94d9e08..b9f4aac 100644 --- a/utils.go +++ b/utils.go @@ -253,15 +253,15 @@ func replaceNostrURLsWithTags(matcher *regexp.Regexp, input string) string { // match and replace npup1, nprofile1, note1, nevent1, etc return matcher.ReplaceAllStringFunc(input, func(match string) string { nip19 := match[len("nostr:"):] - first_chars := nip19[:8] - last_chars := nip19[len(nip19)-4:] + firstChars := nip19[:8] + lastChars := nip19[len(nip19)-4:] if strings.HasPrefix(nip19, "npub1") || strings.HasPrefix(nip19, "nprofile1") { ctx, cancel := context.WithTimeout(context.Background(), time.Second*4) defer cancel() name, _ := getNameFromNip19(ctx, nip19) - return fmt.Sprintf(`%s (%s)`, nip19, name, first_chars+"…"+last_chars) + return fmt.Sprintf(`%s (%s)`, nip19, name, firstChars+"…"+lastChars) } else { - return fmt.Sprintf(`%s`, nip19, first_chars+"…"+last_chars) + return fmt.Sprintf(`%s`, nip19, firstChars+"…"+lastChars) } }) } @@ -270,12 +270,12 @@ func shortenNostrURLs(input string) string { // match and replace npup1, nprofile1, note1, nevent1, etc return nostrEveryMatcher.ReplaceAllStringFunc(input, func(match string) string { nip19 := match[len("nostr:"):] - first_chars := nip19[:8] - last_chars := nip19[len(nip19)-4:] + firstChars := nip19[:8] + lastChars := nip19[len(nip19)-4:] if strings.HasPrefix(nip19, "npub1") || strings.HasPrefix(nip19, "nprofile1") { - return "@" + first_chars + "…" + last_chars + return "@" + firstChars + "…" + lastChars } else { - return "#" + first_chars + "…" + last_chars + return "#" + firstChars + "…" + lastChars } }) } @@ -342,9 +342,9 @@ func renderQuotesAsHTML(ctx context.Context, input string, usingTelegramInstantV func linkQuotes(input string) string { return nostrNoteNeventMatcher.ReplaceAllStringFunc(input, func(match string) string { nip19 := match[len("nostr:"):] - first_chars := nip19[:8] - last_chars := nip19[len(nip19)-4:] - return fmt.Sprintf(`%s`, nip19, first_chars+"…"+last_chars) + firstChars := nip19[:8] + lastChars := nip19[len(nip19)-4:] + return fmt.Sprintf(`%s`, nip19, firstChars+"…"+lastChars) }) }