forked from riba2534/feishu-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.go
More file actions
92 lines (74 loc) · 2.19 KB
/
msg.go
File metadata and controls
92 lines (74 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package cmd
import (
"github.com/spf13/cobra"
)
var msgCmd = &cobra.Command{
Use: "msg",
Short: "消息操作命令",
Long: `消息操作命令,用于向用户或群组发送、管理消息。
子命令:
send 发送消息
reply 回复消息
delete 删除消息
list 获取消息列表
get 获取消息详情
forward 转发消息
merge-forward 合并转发消息
read-users 查询消息已读用户
reaction 表情回复管理(add/remove/list)
pin 置顶消息
unpin 取消置顶消息
pins 获取群内置顶消息列表
接收者类型:
email 邮箱
open_id Open ID
user_id 用户 ID
union_id Union ID
chat_id 群组 ID
消息类型:
text 文本消息
post 富文本消息
interactive 卡片消息
image 图片消息
file 文件消息
示例:
# 发送文本消息
feishu-cli msg send \
--receive-id-type email \
--receive-id user@example.com \
--text "你好,这是一条测试消息"
# 直接发送本地文件(自动上传)
feishu-cli msg send \
--receive-id-type chat_id \
--receive-id oc_xxx \
--file /path/to/report.pdf
# 直接发送本地图片(自动上传)
feishu-cli msg send \
--receive-id-type chat_id \
--receive-id oc_xxx \
--image /path/to/screenshot.png
# 回复消息
feishu-cli msg reply om_xxx --text "收到!"
# 获取消息详情
feishu-cli msg get om_xxx
# 获取会话消息列表
feishu-cli msg list --container-id oc_xxx
# 转发消息
feishu-cli msg forward om_xxx --receive-id user@example.com --receive-id-type email
# 合并转发消息
feishu-cli msg merge-forward --receive-id user@example.com --message-ids om_xxx,om_yyy
# 删除消息
feishu-cli msg delete om_xxx
# 查询消息已读用户
feishu-cli msg read-users om_xxx
# 表情回复
feishu-cli msg reaction add om_xxx --emoji-type THUMBSUP
feishu-cli msg reaction list om_xxx
# 置顶消息
feishu-cli msg pin om_xxx
feishu-cli msg unpin om_xxx
feishu-cli msg pins --chat-id oc_xxx`,
}
func init() {
rootCmd.AddCommand(msgCmd)
}