MCPcopy
hub / github.com/eatmoreapple/openwechat / TestMessageHandle

Function TestMessageHandle

bot_test.go:41–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestMessageHandle(t *testing.T) {
42 bot := DefaultBot(Desktop)
43 bot.MessageHandler = func(msg *Message) {
44 if msg.IsText() && msg.Content == "ping" {
45 if _, err := msg.ReplyText("pong"); err != nil {
46 t.Error(err)
47 }
48 }
49 }
50 if err := bot.Login(); err != nil {
51 t.Error(err)
52 return
53 }
54 _ = bot.Block()
55}
56
57func TestFriends(t *testing.T) {
58 bot := DefaultBot(Desktop)

Callers

nothing calls this directly

Calls 6

DefaultBotFunction · 0.85
IsTextMethod · 0.80
ReplyTextMethod · 0.80
ErrorMethod · 0.80
BlockMethod · 0.80
LoginMethod · 0.65

Tested by

no test coverage detected