This commit is contained in:
shoopea 2019-05-03 11:33:06 +08:00
parent 307435a0f8
commit 108fa3332d

18
bot.go
View File

@ -20,14 +20,7 @@ func StartBot() {
return return
} }
b.Handle("/hello", func(m *tb.Message) { b.Handle("/hello", botHello)
if !m.Private() {
return
}
// fmt.Println("Hello payload :", m.Payload) // <PAYLOAD>
PrintText(m)
b.Send(m.Sender, "hello world")
})
b.Handle(tb.OnPhoto, func(m *tb.Message) { b.Handle(tb.OnPhoto, func(m *tb.Message) {
fmt.Println("OnPhoto :", m.Text) fmt.Println("OnPhoto :", m.Text)
@ -53,3 +46,12 @@ func StartBot() {
b.Start() b.Start()
} }
func botHello(m *tb.Message) {
if !m.Private() {
return
}
// fmt.Println("Hello payload :", m.Payload) // <PAYLOAD>
PrintText(m)
b.Send(m.Sender, "hello world")
}