This commit is contained in:
shoopea 2019-05-10 10:58:28 +08:00
parent 9d423386b1
commit 90a5e23400

13
bot.go
View File

@ -28,7 +28,14 @@ func StartBot() {
}
})
b.Handle("/rescan_msg", botRescanMsg)
b.Handle("/msg_rescan", func(m *tb.Message) {
s, err := botMsgRescan(m)
logOnError(err, "/msg_rescan")
if err == nil {
b.Send(m.Sender, s)
}
})
b.Handle(tb.OnPhoto, botPhoto)
b.Handle(tb.OnChannelPost, botChannelPost)
b.Handle(tb.OnQuery, botQuery)
@ -71,13 +78,13 @@ func botText(m *tb.Message) {
// captured by existing handlers
}
func botRescanMsg(m *tb.Message) {
func botMsgRescan(m *tb.Message) (string, error) {
fmt.Println("botRescanMsg :", m.Text)
if !m.Private() {
fmt.Println("botRescanMsg : !m.Private()")
return
}
// fmt.Println("Hello payload :", m.Payload) // <PAYLOAD>
fmt.Println("botRescanMsg payload :", m.Payload) // <PAYLOAD>
PrintText(m)
m, err := b.Send(m.Sender, "rescan")
logOnError(err, "botRescanMsg")