From 386e0dd6d31089ab4d1e168387f563eb975a89fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Tue, 14 May 2024 11:50:27 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E5=8F=91=E7=BB=99?= =?UTF-8?q?=E6=96=B0=E6=88=90=E5=91=98=E7=9A=84=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 4 ++++ tasks/friends/friends.go | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 2153fd4..e4505ba 100644 --- a/config.yaml +++ b/config.yaml @@ -87,6 +87,10 @@ resource: welcome-new: type: emotion path: 58e4150be2bba8f7b71974b10391f9e9 + # 给新好友或者群的自我介绍,不配置就不发送 + introduce: + type: text + path: "大家好,我是一个AI机器人,可以直接@我询问你想问的问题。" # 水群排行榜词云,只能是图片,末尾的`\%s`也是必须的 wordcloud: type: image diff --git a/tasks/friends/friends.go b/tasks/friends/friends.go index 6ab5b11..a58eeb2 100644 --- a/tasks/friends/friends.go +++ b/tasks/friends/friends.go @@ -73,8 +73,20 @@ func Sync() { log.Printf("新增好友失败: %s", err.Error()) continue } - // 发送一条新消息 - utils.SendMessage(friend.Wxid, "", "大家好,我是一个AI机器人,可以直接@我询问你想问的问题。该功能默认未启用,请群主艾特我并发送 /ai enable 指令启用", 0) + if conf, ok := config.Conf.Resource["introduce"]; ok { + // 发送一条新消息 + switch conf.Type { + case "text": + // 文字类型 + utils.SendMessage(friend.Wxid, "", conf.Path, 0) + case "image": + // 图片类型 + utils.SendImage(friend.Wxid, conf.Path, 0) + case "emotion": + // 表情类型 + utils.SendEmotion(friend.Wxid, conf.Path, 0) + } + } } else { pm := map[string]any{ "nickname": friend.Nickname,