@@ -20,20 +20,21 @@ package main
20
20
21
21
import (
22
22
"fmt"
23
- "github.com/wechaty/go-wechaty/wechaty"
24
- "github.com/wechaty/go-wechaty/wechaty-puppet/schemas"
25
- "github.com/wechaty/go-wechaty/wechaty/user"
26
23
"log"
27
24
"os"
28
25
"os/signal"
29
26
"time"
27
+
28
+ "github.com/wechaty/go-wechaty/wechaty"
29
+ "github.com/wechaty/go-wechaty/wechaty-puppet/schemas"
30
+ "github.com/wechaty/go-wechaty/wechaty/user"
30
31
)
31
32
32
33
func main () {
33
34
var bot = wechaty .NewWechaty ()
34
35
35
36
bot .OnScan (func (qrCode string , status schemas.ScanStatus , data string ) {
36
- fmt .Printf ("Scan QR Code to login: %v\n https://wechaty.github.io /qrcode/%s\n " , status , qrCode )
37
+ fmt .Printf ("Scan QR Code to login: %v\n https://wechaty.js.org /qrcode/%s\n " , status , qrCode )
37
38
}).OnLogin (func (user * user.ContactSelf ) {
38
39
fmt .Printf ("User %s logined\n " , user .Name ())
39
40
}).OnMessage (onMessage ).OnLogout (func (user * user.ContactSelf , reason string ) {
@@ -65,8 +66,8 @@ func onMessage(message *user.Message) {
65
66
log .Println ("Message discarded because its TOO OLD(than 2 minutes)" )
66
67
}
67
68
68
- if message .Type () != schemas .MessageTypeText || message .Text () != "# ding" {
69
- log .Println ("Message discarded because it does not match # ding" )
69
+ if message .Type () != schemas .MessageTypeText || message .Text () != "ding" {
70
+ log .Println ("Message discarded because it does not match ' ding' " )
70
71
return
71
72
}
72
73
0 commit comments