better autocomplete

This commit is contained in:
2026-01-22 22:24:24 -05:00
parent 950662e0b9
commit f3698f0fc6
4 changed files with 33 additions and 14 deletions

View File

@@ -3,8 +3,11 @@ package main
import (
"fmt"
"strings"
"sync"
"git.sunturtle.xyz/zephyr/horse/horse"
"git.sunturtle.xyz/zephyr/horse/horse/global"
"git.sunturtle.xyz/zephyr/horsebot/autocomplete"
"github.com/disgoorg/disgo/discord"
)
@@ -115,6 +118,11 @@ func isDebuff(s horse.Skill) bool {
return false
}
// TODO(zeph): autocomplete
// if we want to backgroundify construction of an autocomplete map,
// use sync.OnceValue and launch a goroutine in main to get the value and discard it
var skillGlobalAuto = sync.OnceValue(func() *autocomplete.Set {
var set autocomplete.Set
for _, id := range global.OrderedSkills {
s := global.AllSkills[id]
set.Add(s.Name, s.Name)
}
return &set
})