refactor: replace explicit fields with tag-based property system

This commit is contained in:
2026-03-27 02:11:46 +01:00
parent 2d4cff717b
commit b2225cff7b
17 changed files with 485 additions and 825 deletions

View File

@@ -6,11 +6,11 @@ import (
"slices"
)
var mentionRegex = regexp.MustCompile(`@([a-z0-9_]+)`)
var r = regexp.MustCompile(`@([a-z0-9_]+)`)
func Mentions(text string) []string {
func Mentions(t string) []string {
seen := make(map[string]bool)
for _, m := range mentionRegex.FindAllStringSubmatch(text, -1) {
for _, m := range r.FindAllStringSubmatch(t, -1) {
seen[m[1]] = true
}
return slices.Collect(maps.Keys(seen))