This commit is contained in:
源文雨 2022-09-10 13:29:04 +08:00
parent ca7ac08808
commit 4e78f43649

View File

@ -18,7 +18,12 @@ import (
) )
var ( var (
namelist = []string{"伊織弓鶴", "紲星あかり", "結月ゆかり", "京町セイカ", "東北きりたん", "東北イタコ", "ついなちゃん標準語", "ついなちゃん関西弁", "音街ウナ", "琴葉茜", "吉田くん", "民安ともえ", "桜乃そら", "月読アイ", "琴葉葵", "東北ずん子", "月読ショウタ", "水奈瀬コウ"} namelist = [...]string{"伊織弓鶴", "紲星あかり", "結月ゆかり", "京町セイカ", "東北きりたん", "東北イタコ", "ついなちゃん標準語", "ついなちゃん関西弁", "音街ウナ", "琴葉茜", "吉田くん", "民安ともえ", "桜乃そら", "月読アイ", "琴葉葵", "東北ずん子", "月読ショウタ", "水奈瀬コウ"}
namesort = func() []string {
nl := namelist[:]
sort.Strings(nl)
return nl
}()
) )
func init() { func init() {
@ -59,9 +64,8 @@ func selectName(ctx *zero.Ctx) bool {
regexMatched := ctx.State["regex_matched"].([]string) regexMatched := ctx.State["regex_matched"].([]string)
ctx.State["ahsaitext"] = regexMatched[2] ctx.State["ahsaitext"] = regexMatched[2]
name := regexMatched[1] name := regexMatched[1]
sort.Strings(namelist) index := sort.SearchStrings(namesort, name)
index := sort.SearchStrings(namelist, name) if index < len(namelist) && namesort[index] == name {
if index < len(namelist) && namelist[index] == name {
ctx.State["ahsainame"] = name ctx.State["ahsainame"] = name
return true return true
} }