🎨 优化发给新成员的消息 #45

Merged
李寻欢 merged 1 commits from hotfix into main 2024-05-14 11:51:31 +08:00
2 changed files with 18 additions and 2 deletions
Showing only changes of commit 386e0dd6d3 - Show all commits

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,