1
0
forked from lxh/go-wxhelper

Merge pull request '🎨 优化发给新成员的消息' (#45) from hotfix into main

Reviewed-on: lxh/go-wxhelper#45
This commit is contained in:
李寻欢 2024-05-14 11:51:31 +08:00
commit 1c55900291
2 changed files with 18 additions and 2 deletions

View File

@ -87,6 +87,10 @@ resource:
welcome-new: welcome-new:
type: emotion type: emotion
path: 58e4150be2bba8f7b71974b10391f9e9 path: 58e4150be2bba8f7b71974b10391f9e9
# 给新好友或者群的自我介绍,不配置就不发送
introduce:
type: text
path: "大家好我是一个AI机器人可以直接@我询问你想问的问题。"
# 水群排行榜词云,只能是图片,末尾的`\%s`也是必须的 # 水群排行榜词云,只能是图片,末尾的`\%s`也是必须的
wordcloud: wordcloud:
type: image type: image

View File

@ -73,8 +73,20 @@ func Sync() {
log.Printf("新增好友失败: %s", err.Error()) log.Printf("新增好友失败: %s", err.Error())
continue continue
} }
// 发送一条新消息 if conf, ok := config.Conf.Resource["introduce"]; ok {
utils.SendMessage(friend.Wxid, "", "大家好我是一个AI机器人可以直接@我询问你想问的问题。该功能默认未启用,请群主艾特我并发送 /ai enable 指令启用", 0) // 发送一条新消息
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 { } else {
pm := map[string]any{ pm := map[string]any{
"nickname": friend.Nickname, "nickname": friend.Nickname,