-
Notifications
You must be signed in to change notification settings - Fork 25
/
blaze.go
37 lines (30 loc) · 856 Bytes
/
blaze.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"context"
"log"
"github.com/MixinNetwork/bot-api-go-client/v3"
)
type mixinBlazeHandler func(ctx context.Context, msg bot.MessageView, clientID string) error
func (f mixinBlazeHandler) OnMessage(ctx context.Context, msg bot.MessageView, clientID string) error {
return f(ctx, msg, clientID)
}
func (f mixinBlazeHandler) OnAckReceipt(ctx context.Context, msg bot.MessageView, clientID string) error {
log.Println("ack Message...", msg)
return nil
}
func (f mixinBlazeHandler) SyncAck() bool {
return false
}
func main() {
var ctx context.Context
h := func(ctx context.Context, botMsg bot.MessageView, clientID string) error {
log.Println(botMsg)
return nil
}
for {
client := bot.NewBlazeClient("", "", "")
if err := client.Loop(ctx, mixinBlazeHandler(h)); err != nil {
log.Println("test...", err)
}
}
}