test shutdown
This commit is contained in:
parent
7fcbf15d51
commit
5cbca6d44c
5
bot.go
5
bot.go
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -1350,3 +1351,7 @@ func botGetItemId(m *tb.Message) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func botShutdown() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
@ -24,6 +24,11 @@
|
||||
"name": "Guild deposit chat",
|
||||
"obj_type": "msg"
|
||||
},
|
||||
{
|
||||
"intl_id": "msg_bot_shutdown",
|
||||
"name": "Request shutdown",
|
||||
"obj_type": "msg"
|
||||
},
|
||||
{
|
||||
"intl_id": "msg_shop_main_req",
|
||||
"name": "Shop main request",
|
||||
|
10
rules.go
10
rules.go
@ -30,6 +30,16 @@ func resetMsgParsingRules() error {
|
||||
}
|
||||
rules2 = append(rules2, r)
|
||||
|
||||
r = MessageParsingRule{
|
||||
Priority: 9999,
|
||||
Description: "Shutdown",
|
||||
Rule: "^/shutdown$",
|
||||
MsgTypeID64: cacheObjSubType[`msg_bot_shutdown`],
|
||||
ChatID64: cfg.Bot.Admin,
|
||||
SenderUserID64: 0,
|
||||
}
|
||||
rules2 = append(rules2, r)
|
||||
|
||||
chats := make([]int64, 0)
|
||||
users := make([]int64, 0)
|
||||
chats = append(chats, cfg.Bot.Mainchat)
|
||||
|
@ -548,6 +548,8 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
botUserConfigPillage(m, true)
|
||||
case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
|
||||
botUserConfigPillage(m, false)
|
||||
case cacheObjSubType[`msg_bot_shutdown`]:
|
||||
botShutdown()
|
||||
default:
|
||||
//log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID64, objId, m.Text)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user