test shutdown
This commit is contained in:
parent
7fcbf15d51
commit
5cbca6d44c
5
bot.go
5
bot.go
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@ -1350,3 +1351,7 @@ func botGetItemId(m *tb.Message) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func botShutdown() {
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
"name": "Guild deposit chat",
|
"name": "Guild deposit chat",
|
||||||
"obj_type": "msg"
|
"obj_type": "msg"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"intl_id": "msg_bot_shutdown",
|
||||||
|
"name": "Request shutdown",
|
||||||
|
"obj_type": "msg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"intl_id": "msg_shop_main_req",
|
"intl_id": "msg_shop_main_req",
|
||||||
"name": "Shop main request",
|
"name": "Shop main request",
|
||||||
|
10
rules.go
10
rules.go
@ -30,6 +30,16 @@ func resetMsgParsingRules() error {
|
|||||||
}
|
}
|
||||||
rules2 = append(rules2, r)
|
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)
|
chats := make([]int64, 0)
|
||||||
users := make([]int64, 0)
|
users := make([]int64, 0)
|
||||||
chats = append(chats, cfg.Bot.Mainchat)
|
chats = append(chats, cfg.Bot.Mainchat)
|
||||||
|
@ -548,6 +548,8 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
botUserConfigPillage(m, true)
|
botUserConfigPillage(m, true)
|
||||||
case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
|
case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
|
||||||
botUserConfigPillage(m, false)
|
botUserConfigPillage(m, false)
|
||||||
|
case cacheObjSubType[`msg_bot_shutdown`]:
|
||||||
|
botShutdown()
|
||||||
default:
|
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)
|
//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