mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
优化
This commit is contained in:
parent
ca7ac08808
commit
4e78f43649
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user