添加消息处理

This commit is contained in:
Noth Amor
2022-07-18 20:10:54 +08:00
parent 974ceb5b3d
commit fcc221ff42
3 changed files with 15 additions and 4 deletions

View File

@@ -2,17 +2,19 @@ package main
import (
"fmt"
"go-bot/bot/controller"
"github.com/eatmoreapple/openwechat"
)
func main() {
bot := openwechat.DefaultBot(openwechat.Desktop)
// bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式,上面登录不上的可以尝试切换这种模式
// 注册消息处理函数
bot.MessageHandler = func(msg *openwechat.Message) {
if msg.IsText() && msg.Content == "ping" {
msg.ReplyText("pong")
if msg.IsText() && msg.Content == "专升本英语选择题" {
controller.SingleChoice(msg)
}
}
// 注册登陆二维码回调