test
This commit is contained in:
parent
20dad80d73
commit
27be28618a
36
bot.go
36
bot.go
@ -33,7 +33,9 @@ func BotHandlers(b *tb.Bot) {
|
||||
|
||||
b.Handle("/g_stock", botGStock)
|
||||
|
||||
b.Handle("/msg_export_all", botMsgExportAll)
|
||||
b.Handle("/msg_export", botMsgExport)
|
||||
|
||||
b.Handle("/help", botHelp)
|
||||
|
||||
b.Handle(tb.OnPhoto, botPhoto)
|
||||
b.Handle(tb.OnChannelPost, botChannelPost)
|
||||
@ -83,6 +85,28 @@ func botText(m *tb.Message) {
|
||||
// captured by existing handlers
|
||||
}
|
||||
|
||||
func botHelp(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
}
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: `/help - this help\n` +
|
||||
`/msg_rescan <id> - rescan one message\n` +
|
||||
`/msg_rescan_all - rescan all messages\n` +
|
||||
`/parse_rules - list parsing rules\n` +
|
||||
`/parse_rule <id> - detail for one rule\n` +
|
||||
`/timer <ETA> "msg" - schedule msg for client in ETA\n` +
|
||||
`/g_stock - check guild's vault\n` +
|
||||
`/msg_export - export message database\n` +
|
||||
`/msg_load - import message database`,
|
||||
FromMsgID64: int64(m.ID),
|
||||
FromChatID64: m.Chat.ID,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
return
|
||||
}
|
||||
|
||||
func botTest(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
@ -182,7 +206,7 @@ func botMsgRescanAll(m *tb.Message) {
|
||||
return
|
||||
}
|
||||
|
||||
func botMsgExportAll(m *tb.Message) {
|
||||
func botMsgExport(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
}
|
||||
@ -223,6 +247,7 @@ func botMsgExportAll(m *tb.Message) {
|
||||
d.File = tb.FromReader(bytes.NewReader(b))
|
||||
d.FileName = fmt.Sprintf("%s.backup.zip", time.Now().Format("20060102150405"))
|
||||
d.Caption = d.FileName
|
||||
d.MIME = `application/zip`
|
||||
|
||||
c = TGCommand{
|
||||
Type: commandSendDocument,
|
||||
@ -234,6 +259,13 @@ func botMsgExportAll(m *tb.Message) {
|
||||
return
|
||||
}
|
||||
|
||||
func botMsgLoad(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func botMsgDump(m *tb.Message) {
|
||||
var res string
|
||||
r := regexp.MustCompile("^[0-9]+$")
|
||||
|
9
obj.go
9
obj.go
@ -10,10 +10,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
cacheObjCastle *sync.Map
|
||||
cacheObjGuild *sync.Map
|
||||
cacheObjUser *sync.Map
|
||||
cacheObjItem *sync.Map
|
||||
cacheObjCastle *sync.Map
|
||||
cacheObjGuild *sync.Map
|
||||
cacheObjUser *sync.Map
|
||||
cacheObjItem *sync.Map
|
||||
cacheOjbMessage *sync.Map
|
||||
)
|
||||
|
||||
func getObjTypeId(objId int64) (int64, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user