testtest
This commit is contained in:
parent
41413bd3ca
commit
720a1c2fb5
23
bot.go
23
bot.go
@ -28,6 +28,8 @@ func BotHandlers(b *tb.Bot) {
|
|||||||
b.Handle("/parse_rules", botListParsingRules)
|
b.Handle("/parse_rules", botListParsingRules)
|
||||||
b.Handle("/parse_rule", botListParsingRule)
|
b.Handle("/parse_rule", botListParsingRule)
|
||||||
|
|
||||||
|
b.Handle("/timer", botTimer)
|
||||||
|
|
||||||
b.Handle(tb.OnPhoto, botPhoto)
|
b.Handle(tb.OnPhoto, botPhoto)
|
||||||
b.Handle(tb.OnChannelPost, botChannelPost)
|
b.Handle(tb.OnChannelPost, botChannelPost)
|
||||||
b.Handle(tb.OnQuery, botQuery)
|
b.Handle(tb.OnQuery, botQuery)
|
||||||
@ -43,7 +45,7 @@ func botPhoto(m *tb.Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func botDocument(m *tb.Message) {
|
func botDocument(m *tb.Message) {
|
||||||
fmt.Printf("botDocument : %s (%d - %s)", m.Document.FileName, m.Document.File.FileSize, m.Document.File.FilePath)
|
fmt.Printf("botDocument : %s (%d bytes)", m.Document.FileName, m.Document.File.FileSize)
|
||||||
// documents only
|
// documents only
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,3 +268,22 @@ func botListParsingRule(m *tb.Message) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func botTimer(m *tb.Message) {
|
||||||
|
var res string
|
||||||
|
r := regexp.MustCompile("^(?P<Delay>([0-9]{2}h){0,1}([0-9]{2}m){0,1}([0-9]{2}s){0,1}) \"(?<Msg>(.*))\"$")
|
||||||
|
if r.MatchString(m.Payload) {
|
||||||
|
log.Printf("Timer : Delay : %s\n", r.ReplaceAllString(m.Payload, "${Delay}"))
|
||||||
|
log.Printf("Timer : Msg : %s\n", r.ReplaceAllString(m.Payload, "${Msg}"))
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
c := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: res,
|
||||||
|
FromMsgID64: int64(m.ID),
|
||||||
|
FromChatID64: m.Chat.ID,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- c
|
||||||
|
*/
|
||||||
|
return
|
||||||
|
}
|
||||||
|
2
msg.go
2
msg.go
@ -28,6 +28,8 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseSubTypeMessageUnionWar(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageUnionWar, error) {
|
func parseSubTypeMessageUnionWar(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageUnionWar, error) {
|
||||||
|
//re := regexp.MustCompile('^(🏠Trade union news:\\n)(?P<Union>(?s:[^(🎪State of exclusive rights)]*))(🎪State of exclusive rights:)(?P<Fair>(?s:.*))$')
|
||||||
|
|
||||||
/*
|
/*
|
||||||
"^(🏠Trade union news:\\n){0,1}` +
|
"^(🏠Trade union news:\\n){0,1}` +
|
||||||
`(((?P<Union>[A-Z][a-z]+ [A-Z][a-z]+) was (?P<Status>(easily defended|defended successfully|breached.|easily breached.|closely breached.))(Attackers have pillage union for (?<Loot>[0-9]+) stock):\\n` +
|
`(((?P<Union>[A-Z][a-z]+ [A-Z][a-z]+) was (?P<Status>(easily defended|defended successfully|breached.|easily breached.|closely breached.))(Attackers have pillage union for (?<Loot>[0-9]+) stock):\\n` +
|
||||||
|
Loading…
Reference in New Issue
Block a user