推送邀请加群消息到配置的用户

This commit is contained in:
李寻欢
2024-07-05 09:16:43 +08:00
parent c881a1c395
commit a905c3ca99
3 changed files with 74 additions and 0 deletions

View File

@@ -3,8 +3,10 @@ package mq
import (
"encoding/json"
"go-wechat/common/current"
"go-wechat/config"
"go-wechat/model"
"go-wechat/types"
"go-wechat/utils"
"log"
"strings"
)
@@ -37,6 +39,16 @@ func parse(msg []byte) {
}
log.Printf("收到新微信消息\n消息来源: %s\n群成员: %s\n消息类型: %v\n消息内容: %s", m.FromUser, m.GroupUser, m.Type, m.Content)
// 如果是邀请进群,推送到配置的用户
if flag, dec := m.IsInvitationJoinGroup(); flag {
for _, user := range config.Conf.System.NewFriendNotify.ToUser {
if user != "" {
// 发送一条新消息
utils.SendMessage(user, "", dec, 0)
}
}
}
// 插件不为空,开始执行
if p := current.GetRobotMessageHandler(); p != nil {
p(&m)