diff --git a/src/config/read_config.go b/src/config/read_config.go index f48a66e..953dbb7 100644 --- a/src/config/read_config.go +++ b/src/config/read_config.go @@ -14,6 +14,8 @@ var Pool = make(map[int]string) var RecruitMissing map[string]string +var RecruitTagMap map[string]string + func init() { // 设置配置文件的名字 viper.SetConfigName("arknights") @@ -46,8 +48,16 @@ func initData() { Pool[4] = viper.GetString("headhunt.pool_4") Pool[3] = viper.GetString("headhunt.pool_3") jpMissing := viper.GetString("recruit.missing.jp") + recruitTags := viper.GetString("recruit.tags") RecruitMissing = make(map[string]string) + RecruitTagMap = make(map[string]string) for _, missing := range strings.Split(jpMissing, "/") { RecruitMissing[missing] = missing } + if len(recruitTags) > 0 { + for _, tag := range strings.Split(recruitTags, "/") { + t := strings.Split(tag, "-") + RecruitTagMap[t[0]] = t[1] + } + } } diff --git a/src/plugins/system/recruit_handle.go b/src/plugins/system/recruit_handle.go index 44f218d..a6d7dfc 100644 --- a/src/plugins/system/recruit_handle.go +++ b/src/plugins/system/recruit_handle.go @@ -10,79 +10,6 @@ import ( "strings" ) -var tagMap = make(map[string]string) - -func init() { - tagMap["高级资深干员"] = "高资" - tagMap["资深干员"] = "资深" - tagMap["新手"] = "新手" - tagMap["近卫干员"] = "近卫干员" - tagMap["近卫千员"] = "近卫干员" - tagMap["狙击干员"] = "狙击干员" - tagMap["狙击千员"] = "狙击干员" - tagMap["重装干员"] = "重装干员" - tagMap["重装千员"] = "重装干员" - tagMap["医疗干员"] = "医疗干员" - tagMap["医疗千员"] = "医疗干员" - tagMap["辅助干员"] = "辅助干员" - tagMap["辅助千员"] = "辅助干员" - tagMap["术师干员"] = "术师干员" - tagMap["术师千员"] = "术师干员" - tagMap["特种干员"] = "特种干员" - tagMap["特种千员"] = "特种干员" - tagMap["先锋干员"] = "先锋干员" - tagMap["先锋千员"] = "先锋干员" - tagMap["近战位"] = "近战位" - tagMap["远程位"] = "远程位" - tagMap["支援机械"] = "机械" - tagMap["控场"] = "控场" - tagMap["爆发"] = "爆发" - tagMap["治疗"] = "治疗" - tagMap["支援"] = "支援" - tagMap["费用回复"] = "费用回复" - tagMap["發用回复"] = "费用回复" - tagMap["输出"] = "输出" - tagMap["生存"] = "生存" - tagMap["群攻"] = "群攻" - tagMap["防护"] = "防护" - tagMap["减速"] = "减速" - tagMap["削弱"] = "削弱" - tagMap["快速复活"] = "快速复活" - tagMap["位移"] = "位移" - tagMap["召唤"] = "召唤" - tagMap["元素"] = "元素" - - tagMap["上級エリート"] = "高资" - tagMap["上級工リート"] = "高资" - tagMap["エリート"] = "资深" - tagMap["工リート"] = "资深" - tagMap["初期"] = "新手" - tagMap["前衛タイプ"] = "近卫干员" - tagMap["狙撃タイプ"] = "狙击干员" - tagMap["重装タイプ"] = "重装干员" - tagMap["医療タイプ"] = "医疗干员" - tagMap["補助タイプ"] = "辅助干员" - tagMap["術師タイプ"] = "术师干员" - tagMap["特殊タイプ"] = "特种干员" - tagMap["先鋒タイプ"] = "先锋干员" - tagMap["近距離"] = "近战位" - tagMap["遠距離"] = "远程位" - tagMap["ロボット"] = "机械" - tagMap["ロポット"] = "机械" - tagMap["牽制"] = "控场" - tagMap["爆発力"] = "爆发" - tagMap["治療"] = "治疗" - tagMap["COST回復"] = "费用回复" - tagMap["火力"] = "输出" - tagMap["範囲攻撃"] = "群攻" - tagMap["防御"] = "防护" - tagMap["減速"] = "减速" - tagMap["弱化"] = "削弱" - tagMap["高速再配置"] = "快速复活" - tagMap["強制移動"] = "位移" - tagMap["召喚"] = "召唤" -} - func RecruitHandle(update tgbotapi.Update) error { chatId := update.Message.Chat.ID messageId := update.Message.MessageID @@ -119,8 +46,8 @@ func recruit(chatId int64, messageId int, param, fileId string) error { return nil } for _, result := range results { - if tagMap[result] != "" { - tags = append(tags, tagMap[result]) + if bot.RecruitTagMap[result] != "" { + tags = append(tags, bot.RecruitTagMap[result]) } } if len(tags) != 5 {