From eab92df80d5a9eb77413c4d4b3def46ce31c3efe Mon Sep 17 00:00:00 2001 From: iyear Date: Thu, 2 Apr 2020 09:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0/task=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handle.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/handle.go b/handle.go index 9cb163f..5c0942c 100644 --- a/handle.go +++ b/handle.go @@ -18,19 +18,18 @@ const ( /bind 绑定新账户 /unbind 解绑账户 /help 帮助 - + /task 手动执行一次任务(管理员) 源码及使用方法:https://github.com/iyear/E5SubBot ` ) var ( UserStatus map[int64]int - UserSignOk map[int64]int UserCid map[int64]string UserCSecret map[int64]string BindMaxNum int notice string - admins []int64 + admin []int64 ) const ( @@ -48,11 +47,13 @@ func init() { BindMaxNum = viper.GetInt("bindmax") notice = viper.GetString("notice") + admin = GetAdmin() viper.WatchConfig() viper.OnConfigChange(func(e fsnotify.Event) { BindMaxNum = viper.GetInt("bindmax") notice = viper.GetString("notice") + admin = GetAdmin() }) UserStatus = make(map[int64]int) @@ -177,3 +178,12 @@ func bOnText(m *tb.Message) { } } } +func bTask(m *tb.Message) { + for _, a := range admin { + if a == m.Chat.ID { + SignTask() + return + } + } + +}