-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathapi_event_callback_v1_add_user_to_chat.go
65 lines (58 loc) · 3.52 KB
/
api_event_callback_v1_add_user_to_chat.go
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
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// EventV1AddUserToChat 如果你希望订阅机器人进出群、群内有人@机器人事件, 请前往[机器人进群](https://open.feishu.cn/document/ukTMukTMukTM/ugzMugzMugzM/event/bot-added-to-group) 或 [机器人退群](https://open.feishu.cn/document/ukTMukTMukTM/ucDO04yN4QjL3gDN)。
//
// 为了更好地提升该事件的安全性, 我们对其进行了升级, 请尽快迁移至
// [新版本(用户进群)](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-member-user/events/added)
// 或[新版本(用户出群)>>](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-member-user/events/deleted)
// 用户进群、出群后触发此事件。
// * 特殊说明: 只有开启机器人能力并且机器人所在的群发生上述变化时才能触发此事件。
// 事件包括三个类型:
// - 用户进群 - add_user_to_chat
// - 用户出群 - remove_user_from_chat
// - 撤销加人 - revoke_add_user_from_chat
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uQDOwUjL0gDM14CN4ATN/event/user-joins-or-leave-group
func (r *EventCallbackService) HandlerEventV1AddUserToChat(f EventV1AddUserToChatHandler) {
r.cli.eventHandler.eventV1AddUserToChatHandler = f
}
// EventV1AddUserToChatHandler event EventV1AddUserToChat handler
type EventV1AddUserToChatHandler func(ctx context.Context, cli *Lark, schema string, header *EventHeaderV1, event *EventV1AddUserToChat) (string, error)
// EventV1AddUserToChat ...
type EventV1AddUserToChat struct {
AppID string `json:"app_id,omitempty"` // 如: cli_9c8609450f78d102
ChatID string `json:"chat_id,omitempty"` // 群聊的id. 如: oc_9e9619b938c9571c1c3165681cdaead5
Operator *EventV1AddUserToChatEventOperator `json:"operator,omitempty"` // 用户进出群的操作人。用户主动退群的话, operator 就是user自己
TenantKey string `json:"tenant_key,omitempty"` // 如: 736588c9260f175d
Type string `json:"type,omitempty"` // 事件类型, add_user_to_chat/remove_user_from_chat/revoke_add_user_from_chat. 如: add_user_to_chat
Users []*EventV1AddUserToChatEventUser `json:"users,omitempty"`
}
// EventV1AddUserToChatEventOperator ...
type EventV1AddUserToChatEventOperator struct {
OpenID string `json:"open_id,omitempty"` // 员工对此应用的唯一标识, 同一员工对不同应用的open_id不同. 如: ou_18eac85d35a26f989317ad4f02e8bbbb
UserID string `json:"user_id,omitempty"` // 即“用户ID”, 仅企业自建应用会返回. 如: ca51d83b
}
// EventV1AddUserToChatEventUser ...
type EventV1AddUserToChatEventUser struct {
Name string `json:"name,omitempty"` // 如: James
OpenID string `json:"open_id,omitempty"` // 如: ou_706adeb944ab1473b9fb3e7da2a40b68
UserID string `json:"user_id,omitempty"` // 如: 51g97a4g
}