Compare commits

..

6 Commits

Author SHA1 Message Date
64a812247a Merge pull request '🐛 Fix a bug.' (#105) from hotfix into main
All checks were successful
BuildImage / build-image (push) Successful in 1m34s
Reviewed-on: #105
2024-08-30 10:07:35 +08:00
9e6d3fad5d 🐛 Fix a bug. 2024-08-30 10:07:03 +08:00
8e2663b85d Merge pull request '🎨 修改邀请入群消息默认响应消息为配置消息' (#104) from hotfix into main
All checks were successful
BuildImage / build-image (push) Successful in 1m39s
Reviewed-on: #104
2024-08-30 08:50:59 +08:00
98a6f1d026 🎨 修改邀请入群消息默认响应消息为配置消息 2024-08-30 08:49:33 +08:00
8968def643 Merge pull request '🎨 修改邀请入群消息默认响应消息为配置消息' (#103) from hotfix into main
Some checks failed
BuildImage / build-image (push) Has been cancelled
Reviewed-on: #103
2024-08-29 08:47:06 +08:00
99daff1938 🎨 修改邀请入群消息默认响应消息为配置消息 2024-08-29 08:46:33 +08:00
5 changed files with 49 additions and 15 deletions

View File

@ -31,7 +31,7 @@ system:
# 微信HOOK配置
wechat:
# 微信HOOK接口地址
host: 10.0.0.79:19088
host: 10.0.0.79:19098
# 微信容器映射出来的vnc页面地址没有就不填
# vncUrl: http://192.168.1.175:19087/vnc_lite.html
# 是否在启动的时候自动设置hook服务的回调
@ -81,7 +81,7 @@ mq:
enable: false
# RabbitMQ配置
rabbitmq:
host: 10.0.0.247
host: 10.0.0.31
port: 5672
user: wechat
password: wechat123
@ -140,3 +140,7 @@ resource:
wordcloud:
type: image
path: D:\Share\wordcloud\%s
# 邀请入群消息回复
invitation-join-group:
type: text
path: "您的邀请消息已收到啦,正在通知我的主人来同意请求。在我加群之后将会进行初始化操作,直到收到我主动发送的消息就是初始化完成咯,在那之前请耐心等待喔~"

View File

@ -250,7 +250,11 @@ func (m Message) IsJoinToGroup() (flag bool) {
if m.Type != types.MsgTypeSys {
return
}
return strings.Contains(m.Content, "\"邀请你加入了群聊,群聊参与人还有:")
flag = strings.Contains(m.Content, "\"邀请你加入了群聊,群聊参与人还有:")
if flag {
return
}
return strings.Contains(m.Content, "\"邀请你和\"") && strings.Contains(m.Content, "\"加入了群聊")
}
// IsRemoveFromChatroom
@ -263,3 +267,14 @@ func (m Message) IsRemoveFromChatroom() (flag bool) {
}
return strings.HasPrefix(m.Content, "你被\"") && strings.HasSuffix(m.Content, "\"移出群聊")
}
// IsChangeGroupName
// @description: 是否是修改群名称消息
// @receiver m
// @return flag
func (m Message) IsChangeGroupName() (flag bool) {
if m.Type != types.MsgTypeSys {
return
}
return strings.HasPrefix(m.Content, "\"修改群名为“")
}

View File

@ -14,17 +14,29 @@ import (
// @description: 通知邀请入群消息到配置用户
// @param m
func NotifyInvitationJoinGroup(m *plugin.MessageContext) {
// 先回复一条固定句子
_ = utils.SendMessage(m.FromUser, m.GroupUser, "您的邀请消息已收到啦,正在通知我的主人来同意请求。在我加群之后将会进行初始化操作,直到收到我主动发送的消息就是初始化完成咯,在那之前请耐心等待喔~", 0)
// 先回复一条固定消息
if conf, e := config.Conf.Resource["invitation-join-group"]; e {
// 发送一条新消息
switch conf.Type {
case "text":
// 文字类型
_ = utils.SendMessage(m.FromUser, "", conf.Path, 0)
case "image":
// 图片类型
utils.SendImage(m.FromUser, conf.Path, 0)
case "emotion":
// 表情类型
utils.SendEmotion(m.FromUser, conf.Path, 0)
}
}
// 如果是邀请进群,推送到配置的用户
if flag, dec := m.IsInvitationJoinGroup(); flag {
for _, user := range config.Conf.System.NewFriendNotify.ToUser {
if user != "" {
// 发送一条新消息
dec = fmt.Sprintf("#邀请入群提醒\n\n%s", dec)
utils.SendMessage(user, "", dec, 0)
}
// 推送到配置的用户
_, dec := m.IsInvitationJoinGroup()
for _, user := range config.Conf.System.NewFriendNotify.ToUser {
if user != "" {
// 发送一条新消息
dec = fmt.Sprintf("#邀请入群提醒\n\n%s", dec)
_ = utils.SendMessage(user, "", dec, 0)
}
}
}

View File

@ -4,6 +4,7 @@ import (
"go-wechat/plugin"
"go-wechat/service"
"go-wechat/utils"
"time"
)
// ReplyNewFriend
@ -14,10 +15,12 @@ func ReplyNewFriend(m *plugin.MessageContext) {
_ = utils.SendMessage(m.FromUser, m.GroupUser, "AI正在初始化请稍等几分钟初始化完成之后我将主动告知您。", 0)
}
if m.IsOldFriendBack() {
_ = utils.SendMessage(m.FromUser, m.GroupUser, "嘿,我的朋友,你为何要离我而去?又为何去而复返?", 0)
_ = utils.SendMessage(m.FromUser, "", "嘿,我的朋友,你为何要离我而去?又为何去而复返?", 0)
}
go func() {
// 等待5秒
time.Sleep(5 * time.Second)
// 刷新好友列表
service.SyncFriend()
// 如果是加入群,刷新群成员列表

View File

@ -237,7 +237,7 @@ func SyncGroupMembers(wxId string) {
// 新增的
// 新增
err = client.MySQL.Create(&entity.GroupUser{
GroupId: wxid,
GroupId: wxId,
Account: cp.Account,
HeadImage: cp.HeadImage,
Nickname: cp.Nickname,