Skip to content

Commit c8fed4b

Browse files
committed
fix ding/dong (#11)
1 parent 13c3102 commit c8fed4b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

examples/ding-dong-bot.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ package main
2020

2121
import (
2222
"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"
2623
"log"
2724
"os"
2825
"os/signal"
2926
"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"
3031
)
3132

3233
func main() {
3334
var bot = wechaty.NewWechaty()
3435

3536
bot.OnScan(func(qrCode string, status schemas.ScanStatus, data string) {
36-
fmt.Printf("Scan QR Code to login: %v\nhttps://wechaty.github.io/qrcode/%s\n", status, qrCode)
37+
fmt.Printf("Scan QR Code to login: %v\nhttps://wechaty.js.org/qrcode/%s\n", status, qrCode)
3738
}).OnLogin(func(user *user.ContactSelf) {
3839
fmt.Printf("User %s logined\n", user.Name())
3940
}).OnMessage(onMessage).OnLogout(func(user *user.ContactSelf, reason string) {
@@ -65,8 +66,8 @@ func onMessage(message *user.Message) {
6566
log.Println("Message discarded because its TOO OLD(than 2 minutes)")
6667
}
6768

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'")
7071
return
7172
}
7273

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ module github.com/wechaty/go-wechaty-getting-started
22

33
go 1.14
44

5-
require github.com/wechaty/go-wechaty v0.1.2
5+
require (
6+
github.com/wechaty/go-wechaty v0.1.2
7+
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
8+
golang.org/x/tools v0.1.0 // indirect
9+
)

0 commit comments

Comments
 (0)