Commit ad7a99f3 by yexing

[yx] update

parents
node_modules
.vscode
pnpm-lock.yaml
tmp
test
__pycache__
[paths]
download_path =
tmp_path =
[chromium_options]
address = 127.0.0.1:9222
browser_path = chrome
arguments = ['--no-default-browser-check', '--disable-suggestions-ui', '--no-first-run', '--disable-infobars', '--disable-popup-blocking', '--hide-crash-restore-bubble', '--disable-features=PrivacySandboxSettings4']
extensions = []
prefs = {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}}
flags = {}
load_mode = normal
user = Default
auto_port = False
system_user_path = False
existing_only = False
new_env = False
[session_options]
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'connection': 'keep-alive', 'accept-charset': 'GB2312,utf-8;q=0.7,*;q=0.7'}
[timeouts]
base = 10
page_load = 30
script = 30
[proxies]
http =
https =
[others]
retry_times = 3
retry_interval = 2
const parser = require("@babel/parser");
const traverse = require("@babel/traverse").default;
const template = require("@babel/template").default;
const generator = require("@babel/generator");
const t = require("@babel/types");
const fs = require("fs");
const jsCode = fs.readFileSync("./src/protobufjs.js", { encoding: "utf8" });
const ast = parser.parse(jsCode);
let proto = [`syntax = "proto3";`, ''];
const check = (path, options) => {
let name, type, value = path.node.test?.value || 1;
let { seq = path.node.consequent } = options || {};
const seq0 = seq[0] || seq;
let exp = seq0?.expression;
if (t.isAssignmentExpression(exp)) {
name = exp.left.property?.name;
const callee = exp.right.callee;
type = callee.property.name;
type = type == 'decode' ? callee.object.property.name : type;
} else if (t.isSequenceExpression(exp)) {
name = exp.expressions[1].callee.object.property.name;
const callee = exp.expressions[1].arguments[0].callee;
// decode | string
type = callee.object.property?.name || callee.property.name;
type = `repeated ${type}`;
} else if (t.isIfStatement(seq0)) {
// int64
exp = seq0.alternate.expression;
name = exp.callee.object.property.name;
type = exp.arguments[0].callee.property.name;
type = `repeated ${type}`;
} else if (t.isForStatement(seq[2])) {
const cases = seq[2].body.body.at(-1).cases;
const [k, v] = [cases[0], cases[1]].map(
x => {
const callee = x.consequent[0].expression.right.callee;
return callee.object.property?.name || callee.property.name;
}
);
type = `map<${k}, ${v}>`;
name = exp.left.left.property.name;
}
if (!(name && type && value)) return;
// console.log(path.toString());
proto.push(`\t${type} ${name} = ${value};`);
}
traverse(ast, {
AssignmentExpression(path) {
const left = path.node.left;
if (!(left?.property?.name === 'decode' && left.object.name === 'e')) return;
let flag = false;
path.traverse({
ForStatement(path) {
const message = path.node.init.declarations?.at(-1).init.callee?.property.name;
if (!message) return;
proto.push(`message ${message} {`);
flag = !flag;
console.log(path.toString());
let seq = path.node.body.body[1].consequent;
seq = seq?.body || seq;
if (!seq) return;
check(path, { seq });
},
SwitchCase(path) {
check(path);
}
});
if (flag) proto.push('}');
}
})
fs.writeFileSync("./proto/decode.proto", proto.join('\r\n'));
This source diff could not be displayed because it is too large. You can view the blob instead.
javascript:(
function(){
const oInput = document.createElement('input');
const json = {}
document.cookie.split(';').forEach(x => {
const [k, v] = x.trim().split('=');
json[k] = v;
});
oInput.value = JSON.stringify(json);
document.body.appendChild(oInput);
oInput.select();
document.execCommand("Copy");
oInput.remove();
alert('复制成功');
}
)();
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"dependencies": {
"@babel/generator": "^7.26.9",
"@babel/parser": "^7.26.9",
"@babel/template": "^7.26.9",
"@babel/traverse": "^7.26.9",
"@babel/types": "^7.26.9"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
syntax = "proto3";
message Frame {
uint64 seqid = 1;
uint64 logid = 2;
int32 service = 3;
int32 method = 4;
repeated ExtendedEntry headers = 5;
string payload_encoding = 6;
string payload_type = 7;
bytes payload = 8;
}
message ExtendedEntry {
string key = 1;
string value = 2;
}
message MuteReadBadgeCountInfo {
int32 message_type = 1;
int32 read_badge_count = 2;
}
message PropertyItem {
int64 uid = 1;
string sec_uid = 2;
int64 create_time = 3;
string idempotent_id = 4;
string value = 5;
}
message PropertyItemList {
repeated PropertyItem Items = 1;
}
message MessageBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 server_message_id = 3;
int64 index_in_conversation = 4;
int64 conversation_short_id = 5;
int32 message_type = 6;
int64 sender = 7;
string content = 8;
map<string, string> ext = 9;
int64 create_time = 10;
int64 version = 11;
int32 status = 12;
int64 order_in_conversation = 13;
string sec_sender = 14;
map<string, PropertyItemList> property_list = 15;
map<string, string> user_profile = 16;
int64 index_in_conversation_v2 = 17;
ReferenceInfo reference_info = 18;
int64 index_in_conversation_v1 = 19;
int64 sub_conversation_short_id = 20;
}
message ReferenceInfo {
int64 referenced_message_id = 1;
string hint = 2;
int64 ref_message_type = 3;
int32 referenced_message_status = 4;
int64 root_message_id = 5;
int64 root_message_conv_index = 6;
}
message Participant {
int64 user_id = 1;
int64 sort_order = 2;
int32 role = 3;
string alias = 4;
string sec_uid = 5;
int32 blocked = 6;
int64 left_block_time = 7;
map<string, string> ext = 8;
int64 version = 9;
string biz_role = 10;
string group_symbol = 11;
int32 block_source = 20;
}
message ParticipantsPage {
repeated Participant participants = 1;
bool has_more = 2;
int64 cursor = 3;
}
message ConversationInfoV2 {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
string ticket = 4;
ParticipantsPage first_page_participants = 6;
int32 participants_count = 7;
bool is_participant = 8;
int32 inbox_type = 9;
int32 badge_count = 10;
repeated MuteBadgeCountInfo mute_badge_count_infos = 11;
int32 status = 12;
int64 version = 13;
Participant user_info = 20;
ConversationCoreInfo conversation_core_info = 50;
ConversationSettingInfo conversation_setting_info = 51;
int64 last_message_indexv2 = 52;
SubConversation current_sub_conv = 53;
repeated RobotInfo bots = 60;
ConvUnreadUnion conv_unread_union = 70;
}
message RobotInfo {
int64 user_id = 1;
string sec_uid = 2;
map<string, string> ext = 99;
}
message SubConversation {
int64 parent_con_short_id = 1;
int64 sub_con_short_id = 2;
string parent_con_id = 3;
string sub_con_id = 4;
int32 conversation_type = 5;
int32 inbox_type = 6;
int32 status = 7;
string biz_status = 8;
map<string, string> extra = 9;
int64 create_time = 10;
int64 modify_time = 11;
int64 version = 12;
ParticipantsPage first_page_participants = 100;
}
message ConversationCoreInfo {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 info_version = 4;
string name = 5;
string desc = 6;
string icon = 7;
int32 inbox_type = 8;
string notice = 9;
map<string, string> ext = 11;
int64 owner = 12;
string sec_owner = 13;
int32 block_status = 14;
bool block_normal_only = 15;
int32 mode = 16;
int64 creator_uid = 17;
int64 create_time = 18;
int32 block_source = 40;
int64 left_block_time = 41;
}
message ConversationSettingInfo {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 min_index = 4;
int64 read_index = 5;
int32 mute = 6;
int32 stick_on_top = 7;
int32 inbox_type = 8;
map<string, string> ext = 9;
int64 setting_version = 10;
int32 favorite = 11;
int64 set_top_time = 12;
int64 set_favorite_time = 13;
int64 read_index_v2 = 14;
int64 min_index_v2 = 15;
int32 read_badge_count = 16;
repeated MuteReadBadgeCountInfo mute_read_badge_count_infos = 17;
int64 version = 18;
int32 push_status = 30;
}
message MessagesPerUserRequestBody {
int64 cursor = 1;
int32 limit = 2;
int64 interval = 3;
int32 new_user = 4;
bool reverse = 5;
}
message GetOpenConvsRequestBody {
int64 open_conv_version = 1;
bool open_conv_reverse = 2;
int32 open_conv_limit = 3;
}
message GetUserConversationsByTagRequestBody {
int64 cursor = 1;
int32 conv_limit = 2;
bool reverse = 3;
int32 tag = 4;
}
message GetUserConversationsByTagResponseBody {
repeated ConversationInfoWithMsg conversations = 1;
int64 next_cursor = 2;
bool has_more = 3;
}
message ConversationInfoWithMsg {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
string ticket = 4;
ParticipantsPage first_page_participants = 6;
int32 participants_count = 7;
bool is_participant = 8;
int32 inbox_type = 9;
int32 badge_count = 10;
repeated MuteBadgeCountInfo mute_badge_count_infos = 11;
int32 status = 12;
int64 version = 13;
Participant user_info = 20;
int64 online_member_count = 30;
ConversationCoreInfo conversation_core_info = 50;
ConversationSettingInfo conversation_setting_info = 51;
int64 last_message_indexv2 = 52;
SubConversation current_sub_conv = 53;
repeated RobotInfo bots = 60;
ConvUnreadUnion conv_unread_union = 70;
MessageBody last_msg_body = 80;
}
message SetUserAllConversationsSettingsRequestBody {
int32 favorite_tag = 1;
}
message SetUserAllConversationsSettingsResponseBody {
int32 status = 1;
}
message GetMessagesByUserWithOpenConvsRequestBody {
int64 cursor = 1;
int32 limit = 2;
int64 interval = 3;
int32 new_user = 4;
bool reverse = 5;
int64 open_conv_version = 21;
bool open_conv_reverse = 22;
int32 open_conv_limit = 23;
}
message GetUserMessageWithOpenConvsRequestBody {
int64 version = 1;
int64 cmd_index = 2;
int64 stranger_version = 3;
int64 read_version = 4;
string source = 5;
int64 consult_version = 6;
int64 notify_version = 17;
GetRecentConvAndMsgRequestBody get_recent_conv_and_msg = 18;
int64 open_conv_version = 21;
bool open_conv_reverse = 22;
int32 open_conv_limit = 23;
}
message GetRecentConvAndMsgRequestBody {
int64 left_side = 1;
int64 right_side = 2;
int32 direction = 3;
}
message MessagesPerUserResponseBody {
repeated MessageBody messages = 1;
int64 next_cursor = 2;
bool has_more = 3;
int64 next_interval = 4;
int64 next_conversation_version = 5;
repeated ConversationBadgeCountInfo conversation_badge_count = 6;
int64 next_cmd_index = 7;
repeated int64 hasmore_message_conv_list = 8;
}
message GetOpenConvsResponseBody {
int64 next_openconv_version = 1;
bool open_conv_has_more = 2;
repeated OpenConvsBody open_convs = 3;
}
message GetMessagesByUserWithOpenConvsResponseBody {
repeated MessageBody messages = 1;
int64 next_cursor = 2;
bool has_more = 3;
int64 next_interval = 4;
int64 next_conversation_version = 5;
repeated ConversationBadgeCountInfo conversation_badge_count = 6;
int64 next_cmd_index = 7;
repeated int64 hasmore_message_conv_list = 8;
GetOpenConvsResponseBody open_convs_body = 21;
}
message GetUserMessageWithOpenConvsResponseBody {
GetRecentMessageRespBody messages = 1;
GetCmdMessageRespBody cmd_messages = 2;
bool has_stranger_message = 3;
ConversationReadInfoRespBody read_info = 4;
ConsultGetConversationListResponseBody consult_messages = 5;
NotifyGetConversationListResponseBody notify_messages = 16;
GetOpenConvsResponseBody open_convs_body = 21;
}
message OpenConvsBody {
int64 parent_con_short_id = 1;
int64 sub_con_short_id = 2;
int32 parent_conv_type = 3;
string parent_con_id = 4;
}
message ConversationBadgeCountInfo {
int64 conversation_short_id = 1;
int32 badge_count = 2;
int64 conversation_index_v2 = 3;
string conversation_id = 4;
repeated MuteBadgeCountInfo mute_badge_count_infos = 5;
}
message MessagesPerUserInitV2RequestBody {
int64 cursor = 1;
int32 new_user = 2;
int32 init_sub_type = 3;
string conv_group_symbol = 4;
}
message MessagesPerUserInitV2ResponseBody {
repeated MessageBody messages = 1;
repeated ConversationInfoV2 conversations = 2;
int64 per_user_cursor = 3;
int64 next_cursor = 4;
bool has_more = 5;
int32 init_type = 6;
int64 cmd_start_index = 7;
int64 next_conversation_version = 8;
int64 readconv_version = 9;
}
message MessagesInConversationRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
int32 direction = 4;
int64 anchor_index = 5;
int32 limit = 6;
int64 max_index = 7;
repeated IndexSkipRange index_skip_ranges = 8;
int64 sub_conversation_short_id = 9;
}
message MessagesInConversationResponseBody {
repeated MessageBody messages = 1;
int64 next_cursor = 2;
bool has_more = 3;
}
message ParticipantWithProperty {
int64 user_id = 1;
string biz_role = 2;
string group_symbol = 3;
}
message CreateConversationV2RequestBody {
int32 conversation_type = 1;
repeated int64 participants = 2;
bool persistent = 3;
string idempotent_id = 4;
string name = 6;
string avatar_url = 7;
string description = 8;
map<string, string> biz_ext = 11;
string unuse_field1 = 12;
repeated ParticipantWithProperty participants_obj = 20;
}
message CreateConversationV2ResponseBody {
ConversationInfoV2 conversation = 1;
int64 check_code = 2;
string check_message = 3;
string extra_info = 4;
int32 status = 5;
}
message SendUserActionRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
int32 action_type = 4;
map<string, string> extra = 5;
}
message SendUserActionResponseBody {
int32 action_type = 1;
repeated ImActionInfo actions = 2;
}
message ImActionInfo {
int32 type = 1;
int32 platform = 2;
string schema = 3;
map<string, string> ext_data = 4;
}
message SendInputStatusRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
int32 status = 4;
map<string, string> extra = 5;
}
message GetConfigsRequestBody {
}
message GetConfigsResponseBody {
int32 version = 1;
repeated Config configs = 2;
}
message Config {
string conf_name = 1;
string conf_value = 2;
}
message ConvCountReport {
int64 conv_short_id = 1;
int64 unread_count = 2;
int32 conversation_type = 3;
int32 customed_conversation_type = 4;
}
message UnReadCountReportRequestBody {
int64 total_unread_count = 1;
repeated ConvCountReport conv_unread_count = 2;
bool need_check = 3;
int64 total_display_unread_count = 4;
map<string, int64> group_symbol_unread_count = 10;
}
message UnReadCountReportResponseBody {
bool set_total_status = 1;
repeated int64 failed_conv_list = 2;
}
message GetUnreadCountRequestBody {
bool get_total = 1;
repeated int64 conv_short_id = 2;
}
message GetUnreadCountResponseBody {
int64 total_unread_count = 1;
map<int64, int64> conv_unread_count = 2;
repeated int64 failed_conv_list = 3;
}
message DeleteConversationRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 last_message_index = 4;
int64 last_message_index_v2 = 5;
int32 badge_count = 6;
repeated MuteBadgeCountInfo mute_badge_count_infos = 7;
}
message DissolveConversationRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
}
message DeleteMessageRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 message_id = 4;
}
message MarkConversationReadRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 read_message_index = 4;
int64 conv_unread_count = 5;
int64 total_unread_count = 6;
int64 read_message_index_v2 = 7;
int32 read_badge_count = 8;
string ticket = 9;
int64 server_message_id = 10;
repeated MuteReadBadgeCountInfo mute_read_badge_count_infos = 11;
int64 sub_conversation_short_id = 12;
}
message GetConversationParticipantsReadIndexV3RequestBody {
int64 conversation_short_id = 1;
int32 conversation_type = 2;
string conversation_id = 3;
repeated int64 user_ids = 4;
}
message GetConversationParticipantsReadIndexV3ResponseBody {
repeated ParticipantReadIndex indexes = 1;
}
message GetConversationParticipantsReadIndexRequestParam {
string conversation_id = 1;
int64 conversation_short_id = 2;
repeated int64 user_ids = 4;
}
message BatchGetConversationParticipantsReadIndexRequestBody {
repeated string conversation_id = 1;
repeated int64 conversation_short_id = 2;
string request_from = 3;
bool min_index_required = 4;
int32 conversation_type = 5;
repeated GetConversationParticipantsReadIndexRequestParam params = 6;
}
message ParticipantReadIndex {
int64 user_id = 1;
string sec_uid = 2;
int64 index = 3;
int64 index_v2 = 4;
int64 index_min = 5;
int64 group_index = 6;
}
message GetConversationParticipantsMinIndexV3RequestBody {
int64 conversation_short_id = 1;
int32 conversation_type = 2;
string conversation_id = 3;
}
message GetConversationParticipantsMinIndexV3ResponseBody {
repeated ParticipantMinIndex indexes = 1;
}
message ParticipantMinIndex {
int64 user_id = 1;
string sec_uid = 2;
int64 index = 3;
int64 index_v2 = 4;
}
message SendMessageP2PRequestBody {
int32 send_type = 1;
string conversation_id = 2;
int32 conversation_type = 3;
int64 conversation_short_id = 4;
repeated int64 visible_user = 5;
repeated int64 invisible_user = 6;
int32 message_type = 7;
string content = 8;
map<string, string> ext = 9;
string client_message_id = 10;
int64 sub_conversation_short_id = 11;
}
message SendMessageP2PResponseBody {
repeated int64 failed_user = 1;
}
message SendMessageRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
string content = 4;
map<string, string> ext = 5;
int32 message_type = 6;
string ticket = 7;
string client_message_id = 8;
repeated int64 mentioned_users = 9;
bool ignore_badge_count = 10;
ReferencedMessageInfo ref_msg_info = 11;
map<string, string> client_ext = 12;
string unuse_field1 = 13;
int64 sub_conversation_short_id = 14;
}
message ReferencedMessageInfo {
int64 referenced_message_id = 1;
string hint = 2;
int64 root_message_id = 3;
int64 root_message_conv_index = 4;
}
message SendMessageResponseBody {
int64 server_message_id = 1;
string extra_info = 2;
int32 status = 3;
string client_message_id = 4;
int64 check_code = 5;
string check_message = 6;
string filtered_content = 7;
bool is_async_send = 8;
string new_ticket = 9;
ConversationInfoV2 conversation = 10;
}
message ModifyMessageRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
string server_message_id = 4;
map<string, string> ext = 5;
string ticket = 6;
}
message ModifyMessageResponseBody {
}
message MsgTrace {
map<int32, int64> metrics = 1;
int32 path = 2;
}
message MuteBadgeCountInfo {
int32 message_type = 1;
int32 badge_count = 2;
}
message NewMessageNotify {
string conversation_id = 2;
int32 conversation_type = 3;
int32 notify_type = 4;
MessageBody message = 5;
int64 previous_cursor = 6;
int64 next_cursor = 7;
int64 index_in_conversation = 8;
int64 index_in_conversation_v2 = 9;
int64 conversation_version = 10;
int64 previous_conversation_version = 11;
int64 cmd_message_index = 12;
int32 badge_count = 13;
MsgTrace trace = 14;
ReferenceInfo ref_msg_info = 15;
int64 previous_msg_index_in_conv = 16;
int64 readconv_version = 17;
int64 pre_readconv_version = 18;
MuteBadgeCountInfo mute_badge_count_info = 19;
int64 sub_conversation_short_id = 20;
}
message NewP2PMessageNotify {
int32 send_type = 1;
int64 sender = 2;
string sec_sender = 3;
string conversation_id = 4;
int64 conversation_short_id = 5;
int32 conversation_type = 6;
int32 message_type = 7;
string content = 8;
map<string, string> ext = 9;
int64 create_time = 10;
}
message ConversationsPerUserByFavoriteV2RequestBody {
int64 cursor = 1;
int32 limit = 2;
}
message ConversationsPerUserByTopV2RequestBody {
int64 cursor = 1;
int32 limit = 2;
int32 conversation_type = 3;
}
message GetConversationInfoV2RequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
bool need_coreinfo_related = 4;
bool need_userinfo_related = 5;
repeated int64 user_ids = 6;
bool need_settinginfo_related = 7;
bool need_last_convindexV2 = 8;
}
message GetConversationInfoV2ResponseBody {
ConversationInfoV2 conversation_info = 1;
}
message GetConversationInfoListV2RequestBody {
repeated GetConversationInfoV2RequestBody conversation_info_list = 1;
}
message GetConversationInfoListV2ResponseBody {
repeated ConversationInfoV2 conversation_info_list = 1;
}
message GetConversationInfoListByFavoriteV2ResponseBody {
repeated ConversationInfoV2 conversation_info_list = 1;
bool has_more = 2;
int64 next_cursor = 3;
}
message GetConversationInfoListByTopV2ResponseBody {
repeated ConversationInfoV2 conversation_info_list = 1;
bool has_more = 2;
int64 next_cursor = 3;
}
message CreateSubConversationRequestBody {
int64 con_short_id = 1;
string con_id = 2;
string biz_status = 3;
map<string, string> extra = 4;
repeated ParticipantWithProperty participants_obj = 11;
}
message GetSubConversationRequestBody {
int64 con_short_id = 1;
string con_id = 2;
int64 sub_con_short_id = 3;
bool include_participants = 4;
repeated string biz_roles = 5;
}
message GetSubConversationListRequestParam {
int64 con_short_id = 1;
string con_id = 2;
repeated int64 sub_con_short_ids = 3;
repeated string biz_roles = 4;
}
message GetSubConversationListRequestBody {
repeated GetSubConversationListRequestParam sub_conv_list_req_params = 1;
bool include_participants = 2;
}
message ConversationCheckInfo {
int64 conversation_short_id = 1;
string conversation_id = 2;
int32 conversation_type = 3;
}
message CreateSubConversationResponseBody {
SubConversation sub_conversation = 1;
int64 check_code = 2;
string check_message = 3;
string extra_info = 4;
int32 status = 5;
}
message GetSubConversationResponseBody {
SubConversation sub_conversation = 1;
}
message GetSubConversationListResponseBody {
repeated SubConversation sub_conversation_list = 1;
}
message RecallMessageRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 server_message_id = 4;
int64 sub_conversation_short_id = 5;
}
message RecallMessageResponseBody {
string toast = 1;
}
message ConversationAddParticipantsRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
repeated int64 participants = 4;
map<string, string> biz_ext = 5;
}
message SecUidPair {
int64 uid = 1;
string sec_uid = 2;
}
message ConversationAddParticipantsResponseBody {
repeated int64 success_participants = 1;
repeated int64 failed_participants = 2;
int32 status = 3;
string extra_info = 4;
int64 check_code = 5;
string check_message = 6;
repeated SecUidPair sec_success_participants = 7;
repeated SecUidPair sec_failed_participants = 8;
}
message ConversationRemoveParticipantsRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
repeated int64 participants = 4;
map<string, string> biz_ext = 5;
}
message ConversationRemoveParticipantsResponseBody {
repeated int64 failed_participants = 1;
int32 status = 2;
string extra_info = 3;
int64 check_code = 4;
string check_message = 5;
repeated SecUidPair failed_sec_participants = 6;
}
message ConversationLeaveRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
}
message ConversationParticipantsListRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 cursor = 4;
int32 limit = 5;
repeated string biz_roles = 6;
}
message ConversationParticipantsListResponseBody {
ParticipantsPage participants_page = 1;
}
message UpdateConversationParticipantRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
int64 user_id = 4;
int32 role = 5;
string alias = 6;
bool is_alias_set = 7;
map<string, string> biz_ext = 11;
}
message UpdateConversationParticipantResponseBody {
Participant participant = 1;
int32 status = 2;
string extra_info = 3;
int64 check_code = 4;
string check_message = 5;
}
message GetConversationCoreInfoRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
}
message GetConversationCoreInfoResponseBody {
ConversationCoreInfo conversation_core_info = 1;
}
message SetConversationCoreInfoRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
string name = 4;
string desc = 5;
string icon = 6;
string notice = 7;
bool is_name_set = 8;
bool is_desc_set = 9;
bool is_icon_set = 10;
bool is_notice_set = 11;
map<string, string> ext = 12;
}
message SetConversationCoreInfoResponseBody {
ConversationCoreInfo conversation_core_info = 1;
int32 status = 2;
string extra_info = 3;
int64 check_code = 4;
string check_message = 5;
}
message UpsertConversationCoreExtInfoRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
map<string, string> ext = 4;
}
message UpsertConversationCoreExtInfoResponseBody {
ConversationCoreInfo core_info = 1;
int32 status = 2;
int64 check_code = 3;
string check_message = 4;
string extra_info = 5;
}
message SetConversationSettingInfoRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
bool set_stick_on_top = 4;
bool set_mute = 5;
bool set_favorite = 6;
int32 push_status = 7;
int32 favorite_tag = 8;
}
message SetConversationSettingInfoResponseBody {
ConversationSettingInfo setting_info = 1;
int32 status = 2;
int64 check_code = 3;
string check_message = 4;
string extra_info = 5;
}
message UpsertConversationSettingExtInfoRequestBody {
string conversation_id = 1;
int64 conversation_short_id = 2;
int32 conversation_type = 3;
map<string, string> ext = 4;
}
message UpsertConversationSettingExtInfoResponseBody {
ConversationSettingInfo setting_info = 1;
int32 status = 2;
int64 check_code = 3;
string check_message = 4;
string extra_info = 5;
}
message ModifyPropertyContent {
int32 operation = 1;
string key = 2;
string value = 3;
string idempotent_id = 4;
}
message ModifyPropertyBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
int64 server_message_id = 4;
string client_message_id = 5;
repeated ModifyPropertyContent modify_property_content = 6;
}
message ModifyMessagePropertyRequestBody {
ModifyPropertyBody property_list = 1;
string ticket = 2;
}
message ModifyMessagePropertyResponseBody {
int32 status = 1;
int64 version = 2;
}
message GetTicketRequestBody {
int32 ticket_type = 1;
int32 conversation_type = 2;
int64 to_id = 4;
int64 conversation_short_id = 5;
map<string, string> ext = 10;
int32 customed_conversation_type = 6;
}
message GetTicketResponseBody {
string ticket = 1;
}
message GetUserConversationListRequestBody {
int32 sort_type = 1;
int64 cursor = 2;
int32 con_type = 3;
int64 limit = 4;
int32 include_role = 5;
int32 exclude_role = 6;
bool include_removed_group = 7;
bool with_cold = 8;
int32 customed_con_type = 9;
int32 push_status = 10;
}
message GetUserConversationListResponseBody {
repeated ConversationInfoV2 list = 1;
bool has_more = 2;
int64 next_cursor = 3;
}
message ClientACKRequestBody {
int64 start_time_stamp = 1;
int32 cmd = 2;
int32 network_type = 3;
string logid = 4;
int64 client_time_stamp = 5;
int64 server_message_id = 6;
int32 type = 7;
}
message ClientACKResponseBody {
}
message ClientMetric {
int32 metric_type = 1;
string k = 2;
int64 v = 3;
map<string, string> tags = 4;
}
message IndexSkipRange {
int64 start_index = 1;
int64 end_index = 2;
}
message ReportClientMetricsRequestBody {
repeated ClientMetric report_metrics_list = 1;
}
message ReportClientMetricsResponseBody {
}
message ModifyMessageExtRequestBody {
int64 conversation_short_id = 1;
int64 message_id = 2;
string ticket = 3;
map<string, string> ext = 4;
}
message ModifyMessageExtResponseBody {
}
message MessageInfo {
int32 status = 1;
MessageBody body = 2;
}
message GetMessageInfoByIndexV2RequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
repeated int64 index_in_conversation_v2 = 4;
}
message GetMessageInfoByIndexV2ResponseBody {
map<int64, MessageInfo> infos = 1;
}
message ConversationReadInfo {
int64 read_index = 1;
int64 read_badge_count = 2;
int64 read_index_v2 = 3;
int64 ConversationShortId = 4;
string ConversationId = 5;
repeated MuteReadBadgeCountInfo mute_read_badge_count_infos = 6;
}
message ConversationReadInfoRespBody {
repeated ConversationReadInfo read_info = 1;
bool has_more = 2;
int64 next_version = 3;
}
message StrangerInfo {
repeated Participant participants = 1;
map<string, string> ext = 2;
ConversationReadInfo read_info = 3;
}
message HintInfo {
int32 hint_type = 1;
string hint_string = 2;
int64 end_time = 3;
}
message ConversationRecentMessage {
int64 conversation_short_id = 1;
repeated MessageBody messages = 2;
int64 version = 3;
int32 badge_count = 4;
string conversation_id = 5;
repeated MessageBody ext_messages = 6;
StrangerInfo stranger_info = 8;
repeated MuteBadgeCountInfo mute_badge_count_infos = 9;
repeated HintInfo hint_infos = 10;
}
message GetRecentMessageReqBody {
int64 conversation_version = 1;
string source = 2;
int32 new_user = 3;
map<string, string> ext = 4;
}
message GetCmdMessageReqBody {
int64 cmd_index = 1;
string source = 2;
int32 new_user = 3;
}
message GetRecentMessageRespBody {
int64 next_conversation_version = 1;
repeated ConversationRecentMessage messages = 2;
bool has_more = 3;
}
message GetCmdMessageRespBody {
repeated MessageBody messages = 1;
bool has_more = 2;
int64 next_cmd_index = 3;
int64 next_user_message_cursor = 4;
int64 readconv_version = 5;
}
message GetMessageInfoByIndexV2RangeRequestBody {
string conversation_id = 1;
int32 conversation_type = 2;
int64 conversation_short_id = 3;
int64 min_index_in_conversation_v2 = 4;
int64 max_index_in_conversation_v2 = 5;
int32 direction = 6;
}
message GetMessageInfoByIndexV2RangeResponseBody {
repeated MessageInfo infos = 1;
int64 next_index_in_conversation_v2 = 2;
bool has_more = 3;
}
message NotifyGetConversationListResponseBody {
int64 next_version = 1;
repeated ConversationRecentMessage messages = 2;
bool has_more = 3;
int32 inbox_type = 4;
}
message ConsultGetConversationListResponseBody {
int64 next_version = 1;
repeated ConversationRecentMessage messages = 2;
bool has_more = 3;
int32 inbox_type = 4;
}
message RequestBody {
SendMessageRequestBody send_message_body = 100;
MessagesPerUserRequestBody messages_per_user_body = 200;
MessagesPerUserInitV2RequestBody messages_per_user_init_v2_body = 203;
MessagesInConversationRequestBody messages_in_conversation_body = 301;
SendUserActionRequestBody send_user_action_body = 410;
SendInputStatusRequestBody send_input_status_body = 411;
DeleteConversationRequestBody delete_conversation_body = 603;
MarkConversationReadRequestBody mark_conversation_read_body = 604;
ConversationParticipantsListRequestBody conversation_participants_body = 605;
DissolveConversationRequestBody dissolve_conversation_body = 614;
CreateSubConversationRequestBody create_sub_conversation_body = 616;
GetSubConversationRequestBody get_sub_conversation_body = 617;
GetSubConversationListRequestBody get_sub_conversation_list_body = 618;
GetConversationInfoV2RequestBody get_conversation_info_v2_body = 608;
CreateConversationV2RequestBody create_conversation_v2_body = 609;
GetConversationInfoListV2RequestBody get_conversation_info_list_v2_body = 610;
ConversationsPerUserByFavoriteV2RequestBody get_conversation_info_list_by_favorite_v2_body = 611;
ConversationsPerUserByTopV2RequestBody get_conversation_info_list_by_top_v2_body = 612;
ConversationAddParticipantsRequestBody conversation_add_participants_body = 650;
ConversationRemoveParticipantsRequestBody conversation_remove_participants_body = 651;
ConversationLeaveRequestBody leave_conversation_body = 652;
UpdateConversationParticipantRequestBody update_conversation_participant_body = 655;
DeleteMessageRequestBody delete_message_body = 701;
RecallMessageRequestBody recall_message_body = 702;
ModifyMessagePropertyRequestBody modify_message_property_body = 705;
GetConversationCoreInfoRequestBody get_conversation_core_info_body = 901;
SetConversationCoreInfoRequestBody set_conversation_core_info_body = 902;
UpsertConversationCoreExtInfoRequestBody upsert_conversation_core_ext_info_body = 904;
SetConversationSettingInfoRequestBody set_conversation_setting_info_body = 921;
UpsertConversationSettingExtInfoRequestBody upsert_conversation_setting_ext_info_body = 922;
GetConversationParticipantsReadIndexV3RequestBody participants_read_index_body = 2000;
GetConversationParticipantsMinIndexV3RequestBody participants_min_index_body = 2001;
GetTicketRequestBody get_ticket_body = 2005;
GetUserConversationListRequestBody get_conversation_list_body = 2006;
ClientACKRequestBody client_ack_body = 2010;
ReportClientMetricsRequestBody report_client_metrics_body = 2016;
GetConfigsRequestBody get_configs_body = 2017;
UnReadCountReportRequestBody unread_count_report_body = 2018;
ModifyMessageExtRequestBody modify_message_ext_body = 2021;
GetUnreadCountRequestBody get_unread_count_body = 2030;
SendMessageP2PRequestBody send_message_p2p_body = 2031;
GetMessageInfoByIndexV2RequestBody get_message_info_by_index_v2_body = 2035;
BatchGetConversationParticipantsReadIndexRequestBody batch_get_conversation_participants_readindex = 2038;
GetMessageInfoByIndexV2RangeRequestBody get_message_info_by_index_v2_range_body = 2041;
GetOpenConvsRequestBody get_open_convs_body = 16001;
GetMessagesByUserWithOpenConvsRequestBody get_messages_by_user_with_open_convs_body = 16002;
GetUserMessageWithOpenConvsRequestBody get_user_message_with_open_convs_body = 16003;
GetUserConversationsByTagRequestBody get_user_conversations_by_tag_body = 17001;
SetUserAllConversationsSettingsRequestBody set_user_all_conversations_settings_body = 17002;
}
message Request {
int32 cmd = 1;
int64 sequence_id = 2;
string sdk_version = 3;
string token = 4;
int32 refer = 5;
int32 inbox_type = 6;
string build_number = 7;
RequestBody body = 8;
string device_id = 9;
string channel = 10;
string device_platform = 11;
string device_type = 12;
string os_version = 13;
string version_code = 14;
map<string, string> headers = 15;
int32 config_id = 16;
TokenInfo token_info = 17;
int32 auth_type = 18;
MsgTrace msg_trace = 19;
int32 retry_count = 20;
string biz = 21;
string access = 22;
}
message TokenInfo {
int32 mark_id = 1;
int32 type = 2;
int32 app_id = 3;
int64 user_id = 4;
int64 timestamp = 5;
}
message ResponseBody {
SendMessageResponseBody send_message_body = 100;
MessagesPerUserResponseBody messages_per_user_body = 200;
MessagesPerUserInitV2ResponseBody messages_per_user_init_v2_body = 203;
MessagesInConversationResponseBody messages_in_conversation_body = 301;
SendUserActionResponseBody send_user_action_body = 410;
NewMessageNotify has_new_message_notify = 500;
NewP2PMessageNotify has_new_p2p_message_notify = 504;
CreateSubConversationResponseBody create_sub_conversation_body = 616;
GetSubConversationResponseBody get_sub_conversation_body = 617;
GetSubConversationListResponseBody get_sub_conversation_list_body = 618;
GetConversationInfoV2ResponseBody get_conversation_info_v2_body = 608;
CreateConversationV2ResponseBody create_conversation_v2_body = 609;
GetConversationInfoListV2ResponseBody get_conversation_info_list_v2_body = 610;
GetConversationInfoListByFavoriteV2ResponseBody get_conversation_info_list_by_favorite_v2_body = 611;
GetConversationInfoListByTopV2ResponseBody get_conversation_info_list_by_top_v2_body = 612;
ConversationParticipantsListResponseBody conversation_participants_body = 605;
ConversationAddParticipantsResponseBody conversation_add_participants_body = 650;
ConversationRemoveParticipantsResponseBody conversation_remove_participants_body = 651;
UpdateConversationParticipantResponseBody update_conversation_participant_body = 655;
RecallMessageResponseBody recall_message_body = 702;
ModifyMessagePropertyResponseBody modify_message_property_body = 705;
GetConversationCoreInfoResponseBody get_conversation_core_info_body = 901;
SetConversationCoreInfoResponseBody set_conversation_core_info_body = 902;
UpsertConversationCoreExtInfoResponseBody upsert_conversation_core_ext_info_body = 904;
SetConversationSettingInfoResponseBody set_conversation_setting_info_body = 921;
UpsertConversationSettingExtInfoResponseBody upsert_conversation_setting_ext_info_body = 922;
GetConversationParticipantsReadIndexV3ResponseBody participants_read_index_body = 2000;
GetConversationParticipantsMinIndexV3ResponseBody participants_min_index_body = 2001;
GetTicketResponseBody get_ticket_body = 2005;
GetUserConversationListResponseBody get_conversation_list_body = 2006;
ClientACKResponseBody client_ack_body = 2010;
ReportClientMetricsResponseBody report_client_metrics_body = 2016;
GetConfigsResponseBody get_configs_body = 2017;
UnReadCountReportResponseBody unread_count_report_body = 2018;
ModifyMessageExtResponseBody modify_message_ext_body = 2021;
GetUnreadCountResponseBody get_unread_count_body = 2030;
SendMessageP2PResponseBody send_message_p2p_body = 2031;
GetMessageInfoByIndexV2ResponseBody get_message_info_by_index_v2_body = 2035;
GetMessageInfoByIndexV2RangeResponseBody get_message_info_by_index_v2_range_body = 2041;
GetOpenConvsResponseBody get_open_convs_body = 16001;
GetMessagesByUserWithOpenConvsResponseBody get_messages_by_user_with_open_convs_body = 16002;
GetUserMessageWithOpenConvsResponseBody get_user_message_with_open_convs_body = 16003;
GetUserConversationsByTagResponseBody get_user_conversations_by_tag_body = 17001;
SetUserAllConversationsSettingsResponseBody set_user_all_conversations_settings_body = 17002;
}
message Response {
int32 cmd = 1;
int64 sequence_id = 2;
int32 status_code = 3;
string error_desc = 4;
int32 inbox_type = 5;
ResponseBody body = 6;
string log_id = 7;
map<string, string> headers = 8;
int64 start_time_stamp = 9;
int64 request_arrived_time = 10;
int64 server_execution_end_time = 11;
int32 retry_count = 12;
int64 req_user_id = 13;
}
message ConvUnreadUnion {
map<int32, ConvUnread> ConvUnreadInfo = 1;
}
message ConvUnread {
int32 badge_count = 1;
int32 read_badge_count = 2;
}
\ No newline at end of file
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: proto/decode.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
@dataclass
class Frame(betterproto.Message):
seqid: int = betterproto.uint64_field(1)
logid: int = betterproto.uint64_field(2)
service: int = betterproto.int32_field(3)
method: int = betterproto.int32_field(4)
headers: List["ExtendedEntry"] = betterproto.message_field(5)
payload_encoding: str = betterproto.string_field(6)
payload_type: str = betterproto.string_field(7)
payload: bytes = betterproto.bytes_field(8)
@dataclass
class ExtendedEntry(betterproto.Message):
key: str = betterproto.string_field(1)
value: str = betterproto.string_field(2)
@dataclass
class MuteReadBadgeCountInfo(betterproto.Message):
message_type: int = betterproto.int32_field(1)
read_badge_count: int = betterproto.int32_field(2)
@dataclass
class PropertyItem(betterproto.Message):
uid: int = betterproto.int64_field(1)
sec_uid: str = betterproto.string_field(2)
create_time: int = betterproto.int64_field(3)
idempotent_id: str = betterproto.string_field(4)
value: str = betterproto.string_field(5)
@dataclass
class PropertyItemList(betterproto.Message):
items: List["PropertyItem"] = betterproto.message_field(1)
@dataclass
class MessageBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
server_message_id: int = betterproto.int64_field(3)
index_in_conversation: int = betterproto.int64_field(4)
conversation_short_id: int = betterproto.int64_field(5)
message_type: int = betterproto.int32_field(6)
sender: int = betterproto.int64_field(7)
content: str = betterproto.string_field(8)
ext: Dict[str, str] = betterproto.map_field(
9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
create_time: int = betterproto.int64_field(10)
version: int = betterproto.int64_field(11)
status: int = betterproto.int32_field(12)
order_in_conversation: int = betterproto.int64_field(13)
sec_sender: str = betterproto.string_field(14)
property_list: Dict[str, "PropertyItemList"] = betterproto.map_field(
15, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
)
user_profile: Dict[str, str] = betterproto.map_field(
16, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
index_in_conversation_v2: int = betterproto.int64_field(17)
reference_info: "ReferenceInfo" = betterproto.message_field(18)
index_in_conversation_v1: int = betterproto.int64_field(19)
sub_conversation_short_id: int = betterproto.int64_field(20)
@dataclass
class ReferenceInfo(betterproto.Message):
referenced_message_id: int = betterproto.int64_field(1)
hint: str = betterproto.string_field(2)
ref_message_type: int = betterproto.int64_field(3)
referenced_message_status: int = betterproto.int32_field(4)
root_message_id: int = betterproto.int64_field(5)
root_message_conv_index: int = betterproto.int64_field(6)
@dataclass
class Participant(betterproto.Message):
user_id: int = betterproto.int64_field(1)
sort_order: int = betterproto.int64_field(2)
role: int = betterproto.int32_field(3)
alias: str = betterproto.string_field(4)
sec_uid: str = betterproto.string_field(5)
blocked: int = betterproto.int32_field(6)
left_block_time: int = betterproto.int64_field(7)
ext: Dict[str, str] = betterproto.map_field(
8, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
version: int = betterproto.int64_field(9)
biz_role: str = betterproto.string_field(10)
group_symbol: str = betterproto.string_field(11)
block_source: int = betterproto.int32_field(20)
@dataclass
class ParticipantsPage(betterproto.Message):
participants: List["Participant"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
cursor: int = betterproto.int64_field(3)
@dataclass
class ConversationInfoV2(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
ticket: str = betterproto.string_field(4)
first_page_participants: "ParticipantsPage" = betterproto.message_field(6)
participants_count: int = betterproto.int32_field(7)
is_participant: bool = betterproto.bool_field(8)
inbox_type: int = betterproto.int32_field(9)
badge_count: int = betterproto.int32_field(10)
mute_badge_count_infos: List["MuteBadgeCountInfo"] = betterproto.message_field(11)
status: int = betterproto.int32_field(12)
version: int = betterproto.int64_field(13)
user_info: "Participant" = betterproto.message_field(20)
conversation_core_info: "ConversationCoreInfo" = betterproto.message_field(50)
conversation_setting_info: "ConversationSettingInfo" = betterproto.message_field(51)
last_message_indexv2: int = betterproto.int64_field(52)
current_sub_conv: "SubConversation" = betterproto.message_field(53)
bots: List["RobotInfo"] = betterproto.message_field(60)
conv_unread_union: "ConvUnreadUnion" = betterproto.message_field(70)
@dataclass
class RobotInfo(betterproto.Message):
user_id: int = betterproto.int64_field(1)
sec_uid: str = betterproto.string_field(2)
ext: Dict[str, str] = betterproto.map_field(
99, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class SubConversation(betterproto.Message):
parent_con_short_id: int = betterproto.int64_field(1)
sub_con_short_id: int = betterproto.int64_field(2)
parent_con_id: str = betterproto.string_field(3)
sub_con_id: str = betterproto.string_field(4)
conversation_type: int = betterproto.int32_field(5)
inbox_type: int = betterproto.int32_field(6)
status: int = betterproto.int32_field(7)
biz_status: str = betterproto.string_field(8)
extra: Dict[str, str] = betterproto.map_field(
9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
create_time: int = betterproto.int64_field(10)
modify_time: int = betterproto.int64_field(11)
version: int = betterproto.int64_field(12)
first_page_participants: "ParticipantsPage" = betterproto.message_field(100)
@dataclass
class ConversationCoreInfo(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
info_version: int = betterproto.int64_field(4)
name: str = betterproto.string_field(5)
desc: str = betterproto.string_field(6)
icon: str = betterproto.string_field(7)
inbox_type: int = betterproto.int32_field(8)
notice: str = betterproto.string_field(9)
ext: Dict[str, str] = betterproto.map_field(
11, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
owner: int = betterproto.int64_field(12)
sec_owner: str = betterproto.string_field(13)
block_status: int = betterproto.int32_field(14)
block_normal_only: bool = betterproto.bool_field(15)
mode: int = betterproto.int32_field(16)
creator_uid: int = betterproto.int64_field(17)
create_time: int = betterproto.int64_field(18)
block_source: int = betterproto.int32_field(40)
left_block_time: int = betterproto.int64_field(41)
@dataclass
class ConversationSettingInfo(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
min_index: int = betterproto.int64_field(4)
read_index: int = betterproto.int64_field(5)
mute: int = betterproto.int32_field(6)
stick_on_top: int = betterproto.int32_field(7)
inbox_type: int = betterproto.int32_field(8)
ext: Dict[str, str] = betterproto.map_field(
9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
setting_version: int = betterproto.int64_field(10)
favorite: int = betterproto.int32_field(11)
set_top_time: int = betterproto.int64_field(12)
set_favorite_time: int = betterproto.int64_field(13)
read_index_v2: int = betterproto.int64_field(14)
min_index_v2: int = betterproto.int64_field(15)
read_badge_count: int = betterproto.int32_field(16)
mute_read_badge_count_infos: List["MuteReadBadgeCountInfo"] = (
betterproto.message_field(17)
)
version: int = betterproto.int64_field(18)
push_status: int = betterproto.int32_field(30)
@dataclass
class MessagesPerUserRequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
limit: int = betterproto.int32_field(2)
interval: int = betterproto.int64_field(3)
new_user: int = betterproto.int32_field(4)
reverse: bool = betterproto.bool_field(5)
@dataclass
class GetOpenConvsRequestBody(betterproto.Message):
open_conv_version: int = betterproto.int64_field(1)
open_conv_reverse: bool = betterproto.bool_field(2)
open_conv_limit: int = betterproto.int32_field(3)
@dataclass
class GetUserConversationsByTagRequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
conv_limit: int = betterproto.int32_field(2)
reverse: bool = betterproto.bool_field(3)
tag: int = betterproto.int32_field(4)
@dataclass
class GetUserConversationsByTagResponseBody(betterproto.Message):
conversations: List["ConversationInfoWithMsg"] = betterproto.message_field(1)
next_cursor: int = betterproto.int64_field(2)
has_more: bool = betterproto.bool_field(3)
@dataclass
class ConversationInfoWithMsg(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
ticket: str = betterproto.string_field(4)
first_page_participants: "ParticipantsPage" = betterproto.message_field(6)
participants_count: int = betterproto.int32_field(7)
is_participant: bool = betterproto.bool_field(8)
inbox_type: int = betterproto.int32_field(9)
badge_count: int = betterproto.int32_field(10)
mute_badge_count_infos: List["MuteBadgeCountInfo"] = betterproto.message_field(11)
status: int = betterproto.int32_field(12)
version: int = betterproto.int64_field(13)
user_info: "Participant" = betterproto.message_field(20)
online_member_count: int = betterproto.int64_field(30)
conversation_core_info: "ConversationCoreInfo" = betterproto.message_field(50)
conversation_setting_info: "ConversationSettingInfo" = betterproto.message_field(51)
last_message_indexv2: int = betterproto.int64_field(52)
current_sub_conv: "SubConversation" = betterproto.message_field(53)
bots: List["RobotInfo"] = betterproto.message_field(60)
conv_unread_union: "ConvUnreadUnion" = betterproto.message_field(70)
last_msg_body: "MessageBody" = betterproto.message_field(80)
@dataclass
class SetUserAllConversationsSettingsRequestBody(betterproto.Message):
favorite_tag: int = betterproto.int32_field(1)
@dataclass
class SetUserAllConversationsSettingsResponseBody(betterproto.Message):
status: int = betterproto.int32_field(1)
@dataclass
class GetMessagesByUserWithOpenConvsRequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
limit: int = betterproto.int32_field(2)
interval: int = betterproto.int64_field(3)
new_user: int = betterproto.int32_field(4)
reverse: bool = betterproto.bool_field(5)
open_conv_version: int = betterproto.int64_field(21)
open_conv_reverse: bool = betterproto.bool_field(22)
open_conv_limit: int = betterproto.int32_field(23)
@dataclass
class GetUserMessageWithOpenConvsRequestBody(betterproto.Message):
version: int = betterproto.int64_field(1)
cmd_index: int = betterproto.int64_field(2)
stranger_version: int = betterproto.int64_field(3)
read_version: int = betterproto.int64_field(4)
source: str = betterproto.string_field(5)
consult_version: int = betterproto.int64_field(6)
notify_version: int = betterproto.int64_field(17)
get_recent_conv_and_msg: "GetRecentConvAndMsgRequestBody" = (
betterproto.message_field(18)
)
open_conv_version: int = betterproto.int64_field(21)
open_conv_reverse: bool = betterproto.bool_field(22)
open_conv_limit: int = betterproto.int32_field(23)
@dataclass
class GetRecentConvAndMsgRequestBody(betterproto.Message):
left_side: int = betterproto.int64_field(1)
right_side: int = betterproto.int64_field(2)
direction: int = betterproto.int32_field(3)
@dataclass
class MessagesPerUserResponseBody(betterproto.Message):
messages: List["MessageBody"] = betterproto.message_field(1)
next_cursor: int = betterproto.int64_field(2)
has_more: bool = betterproto.bool_field(3)
next_interval: int = betterproto.int64_field(4)
next_conversation_version: int = betterproto.int64_field(5)
conversation_badge_count: List["ConversationBadgeCountInfo"] = (
betterproto.message_field(6)
)
next_cmd_index: int = betterproto.int64_field(7)
hasmore_message_conv_list: List[int] = betterproto.int64_field(8)
@dataclass
class GetOpenConvsResponseBody(betterproto.Message):
next_openconv_version: int = betterproto.int64_field(1)
open_conv_has_more: bool = betterproto.bool_field(2)
open_convs: List["OpenConvsBody"] = betterproto.message_field(3)
@dataclass
class GetMessagesByUserWithOpenConvsResponseBody(betterproto.Message):
messages: List["MessageBody"] = betterproto.message_field(1)
next_cursor: int = betterproto.int64_field(2)
has_more: bool = betterproto.bool_field(3)
next_interval: int = betterproto.int64_field(4)
next_conversation_version: int = betterproto.int64_field(5)
conversation_badge_count: List["ConversationBadgeCountInfo"] = (
betterproto.message_field(6)
)
next_cmd_index: int = betterproto.int64_field(7)
hasmore_message_conv_list: List[int] = betterproto.int64_field(8)
open_convs_body: "GetOpenConvsResponseBody" = betterproto.message_field(21)
@dataclass
class GetUserMessageWithOpenConvsResponseBody(betterproto.Message):
messages: "GetRecentMessageRespBody" = betterproto.message_field(1)
cmd_messages: "GetCmdMessageRespBody" = betterproto.message_field(2)
has_stranger_message: bool = betterproto.bool_field(3)
read_info: "ConversationReadInfoRespBody" = betterproto.message_field(4)
consult_messages: "ConsultGetConversationListResponseBody" = (
betterproto.message_field(5)
)
notify_messages: "NotifyGetConversationListResponseBody" = (
betterproto.message_field(16)
)
open_convs_body: "GetOpenConvsResponseBody" = betterproto.message_field(21)
@dataclass
class OpenConvsBody(betterproto.Message):
parent_con_short_id: int = betterproto.int64_field(1)
sub_con_short_id: int = betterproto.int64_field(2)
parent_conv_type: int = betterproto.int32_field(3)
parent_con_id: str = betterproto.string_field(4)
@dataclass
class ConversationBadgeCountInfo(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
badge_count: int = betterproto.int32_field(2)
conversation_index_v2: int = betterproto.int64_field(3)
conversation_id: str = betterproto.string_field(4)
mute_badge_count_infos: List["MuteBadgeCountInfo"] = betterproto.message_field(5)
@dataclass
class MessagesPerUserInitV2RequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
new_user: int = betterproto.int32_field(2)
init_sub_type: int = betterproto.int32_field(3)
conv_group_symbol: str = betterproto.string_field(4)
@dataclass
class MessagesPerUserInitV2ResponseBody(betterproto.Message):
messages: List["MessageBody"] = betterproto.message_field(1)
conversations: List["ConversationInfoV2"] = betterproto.message_field(2)
per_user_cursor: int = betterproto.int64_field(3)
next_cursor: int = betterproto.int64_field(4)
has_more: bool = betterproto.bool_field(5)
init_type: int = betterproto.int32_field(6)
cmd_start_index: int = betterproto.int64_field(7)
next_conversation_version: int = betterproto.int64_field(8)
readconv_version: int = betterproto.int64_field(9)
@dataclass
class MessagesInConversationRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
direction: int = betterproto.int32_field(4)
anchor_index: int = betterproto.int64_field(5)
limit: int = betterproto.int32_field(6)
max_index: int = betterproto.int64_field(7)
index_skip_ranges: List["IndexSkipRange"] = betterproto.message_field(8)
sub_conversation_short_id: int = betterproto.int64_field(9)
@dataclass
class MessagesInConversationResponseBody(betterproto.Message):
messages: List["MessageBody"] = betterproto.message_field(1)
next_cursor: int = betterproto.int64_field(2)
has_more: bool = betterproto.bool_field(3)
@dataclass
class ParticipantWithProperty(betterproto.Message):
user_id: int = betterproto.int64_field(1)
biz_role: str = betterproto.string_field(2)
group_symbol: str = betterproto.string_field(3)
@dataclass
class CreateConversationV2RequestBody(betterproto.Message):
conversation_type: int = betterproto.int32_field(1)
participants: List[int] = betterproto.int64_field(2)
persistent: bool = betterproto.bool_field(3)
idempotent_id: str = betterproto.string_field(4)
name: str = betterproto.string_field(6)
avatar_url: str = betterproto.string_field(7)
description: str = betterproto.string_field(8)
biz_ext: Dict[str, str] = betterproto.map_field(
11, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
unuse_field1: str = betterproto.string_field(12)
participants_obj: List["ParticipantWithProperty"] = betterproto.message_field(20)
@dataclass
class CreateConversationV2ResponseBody(betterproto.Message):
conversation: "ConversationInfoV2" = betterproto.message_field(1)
check_code: int = betterproto.int64_field(2)
check_message: str = betterproto.string_field(3)
extra_info: str = betterproto.string_field(4)
status: int = betterproto.int32_field(5)
@dataclass
class SendUserActionRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
action_type: int = betterproto.int32_field(4)
extra: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class SendUserActionResponseBody(betterproto.Message):
action_type: int = betterproto.int32_field(1)
actions: List["ImActionInfo"] = betterproto.message_field(2)
@dataclass
class ImActionInfo(betterproto.Message):
type: int = betterproto.int32_field(1)
platform: int = betterproto.int32_field(2)
schema: str = betterproto.string_field(3)
ext_data: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class SendInputStatusRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
status: int = betterproto.int32_field(4)
extra: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class GetConfigsRequestBody(betterproto.Message):
pass
@dataclass
class GetConfigsResponseBody(betterproto.Message):
version: int = betterproto.int32_field(1)
configs: List["Config"] = betterproto.message_field(2)
@dataclass
class Config(betterproto.Message):
conf_name: str = betterproto.string_field(1)
conf_value: str = betterproto.string_field(2)
@dataclass
class ConvCountReport(betterproto.Message):
conv_short_id: int = betterproto.int64_field(1)
unread_count: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
customed_conversation_type: int = betterproto.int32_field(4)
@dataclass
class UnReadCountReportRequestBody(betterproto.Message):
total_unread_count: int = betterproto.int64_field(1)
conv_unread_count: List["ConvCountReport"] = betterproto.message_field(2)
need_check: bool = betterproto.bool_field(3)
total_display_unread_count: int = betterproto.int64_field(4)
group_symbol_unread_count: Dict[str, int] = betterproto.map_field(
10, betterproto.TYPE_STRING, betterproto.TYPE_INT64
)
@dataclass
class UnReadCountReportResponseBody(betterproto.Message):
set_total_status: bool = betterproto.bool_field(1)
failed_conv_list: List[int] = betterproto.int64_field(2)
@dataclass
class GetUnreadCountRequestBody(betterproto.Message):
get_total: bool = betterproto.bool_field(1)
conv_short_id: List[int] = betterproto.int64_field(2)
@dataclass
class GetUnreadCountResponseBody(betterproto.Message):
total_unread_count: int = betterproto.int64_field(1)
conv_unread_count: Dict[int, int] = betterproto.map_field(
2, betterproto.TYPE_INT64, betterproto.TYPE_INT64
)
failed_conv_list: List[int] = betterproto.int64_field(3)
@dataclass
class DeleteConversationRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
last_message_index: int = betterproto.int64_field(4)
last_message_index_v2: int = betterproto.int64_field(5)
badge_count: int = betterproto.int32_field(6)
mute_badge_count_infos: List["MuteBadgeCountInfo"] = betterproto.message_field(7)
@dataclass
class DissolveConversationRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
@dataclass
class DeleteMessageRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
message_id: int = betterproto.int64_field(4)
@dataclass
class MarkConversationReadRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
read_message_index: int = betterproto.int64_field(4)
conv_unread_count: int = betterproto.int64_field(5)
total_unread_count: int = betterproto.int64_field(6)
read_message_index_v2: int = betterproto.int64_field(7)
read_badge_count: int = betterproto.int32_field(8)
ticket: str = betterproto.string_field(9)
server_message_id: int = betterproto.int64_field(10)
mute_read_badge_count_infos: List["MuteReadBadgeCountInfo"] = (
betterproto.message_field(11)
)
sub_conversation_short_id: int = betterproto.int64_field(12)
@dataclass
class GetConversationParticipantsReadIndexV3RequestBody(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_id: str = betterproto.string_field(3)
user_ids: List[int] = betterproto.int64_field(4)
@dataclass
class GetConversationParticipantsReadIndexV3ResponseBody(betterproto.Message):
indexes: List["ParticipantReadIndex"] = betterproto.message_field(1)
@dataclass
class GetConversationParticipantsReadIndexRequestParam(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
user_ids: List[int] = betterproto.int64_field(4)
@dataclass
class BatchGetConversationParticipantsReadIndexRequestBody(betterproto.Message):
conversation_id: List[str] = betterproto.string_field(1)
conversation_short_id: List[int] = betterproto.int64_field(2)
request_from: str = betterproto.string_field(3)
min_index_required: bool = betterproto.bool_field(4)
conversation_type: int = betterproto.int32_field(5)
params: List["GetConversationParticipantsReadIndexRequestParam"] = (
betterproto.message_field(6)
)
@dataclass
class ParticipantReadIndex(betterproto.Message):
user_id: int = betterproto.int64_field(1)
sec_uid: str = betterproto.string_field(2)
index: int = betterproto.int64_field(3)
index_v2: int = betterproto.int64_field(4)
index_min: int = betterproto.int64_field(5)
group_index: int = betterproto.int64_field(6)
@dataclass
class GetConversationParticipantsMinIndexV3RequestBody(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_id: str = betterproto.string_field(3)
@dataclass
class GetConversationParticipantsMinIndexV3ResponseBody(betterproto.Message):
indexes: List["ParticipantMinIndex"] = betterproto.message_field(1)
@dataclass
class ParticipantMinIndex(betterproto.Message):
user_id: int = betterproto.int64_field(1)
sec_uid: str = betterproto.string_field(2)
index: int = betterproto.int64_field(3)
index_v2: int = betterproto.int64_field(4)
@dataclass
class SendMessageP2PRequestBody(betterproto.Message):
send_type: int = betterproto.int32_field(1)
conversation_id: str = betterproto.string_field(2)
conversation_type: int = betterproto.int32_field(3)
conversation_short_id: int = betterproto.int64_field(4)
visible_user: List[int] = betterproto.int64_field(5)
invisible_user: List[int] = betterproto.int64_field(6)
message_type: int = betterproto.int32_field(7)
content: str = betterproto.string_field(8)
ext: Dict[str, str] = betterproto.map_field(
9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
client_message_id: str = betterproto.string_field(10)
sub_conversation_short_id: int = betterproto.int64_field(11)
@dataclass
class SendMessageP2PResponseBody(betterproto.Message):
failed_user: List[int] = betterproto.int64_field(1)
@dataclass
class SendMessageRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
content: str = betterproto.string_field(4)
ext: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
message_type: int = betterproto.int32_field(6)
ticket: str = betterproto.string_field(7)
client_message_id: str = betterproto.string_field(8)
mentioned_users: List[int] = betterproto.int64_field(9)
ignore_badge_count: bool = betterproto.bool_field(10)
ref_msg_info: "ReferencedMessageInfo" = betterproto.message_field(11)
client_ext: Dict[str, str] = betterproto.map_field(
12, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
unuse_field1: str = betterproto.string_field(13)
sub_conversation_short_id: int = betterproto.int64_field(14)
@dataclass
class ReferencedMessageInfo(betterproto.Message):
referenced_message_id: int = betterproto.int64_field(1)
hint: str = betterproto.string_field(2)
root_message_id: int = betterproto.int64_field(3)
root_message_conv_index: int = betterproto.int64_field(4)
@dataclass
class SendMessageResponseBody(betterproto.Message):
server_message_id: int = betterproto.int64_field(1)
extra_info: str = betterproto.string_field(2)
status: int = betterproto.int32_field(3)
client_message_id: str = betterproto.string_field(4)
check_code: int = betterproto.int64_field(5)
check_message: str = betterproto.string_field(6)
filtered_content: str = betterproto.string_field(7)
is_async_send: bool = betterproto.bool_field(8)
new_ticket: str = betterproto.string_field(9)
conversation: "ConversationInfoV2" = betterproto.message_field(10)
@dataclass
class ModifyMessageRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
server_message_id: str = betterproto.string_field(4)
ext: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
ticket: str = betterproto.string_field(6)
@dataclass
class ModifyMessageResponseBody(betterproto.Message):
pass
@dataclass
class MsgTrace(betterproto.Message):
metrics: Dict[int, int] = betterproto.map_field(
1, betterproto.TYPE_INT32, betterproto.TYPE_INT64
)
path: int = betterproto.int32_field(2)
@dataclass
class MuteBadgeCountInfo(betterproto.Message):
message_type: int = betterproto.int32_field(1)
badge_count: int = betterproto.int32_field(2)
@dataclass
class NewMessageNotify(betterproto.Message):
conversation_id: str = betterproto.string_field(2)
conversation_type: int = betterproto.int32_field(3)
notify_type: int = betterproto.int32_field(4)
message: "MessageBody" = betterproto.message_field(5)
previous_cursor: int = betterproto.int64_field(6)
next_cursor: int = betterproto.int64_field(7)
index_in_conversation: int = betterproto.int64_field(8)
index_in_conversation_v2: int = betterproto.int64_field(9)
conversation_version: int = betterproto.int64_field(10)
previous_conversation_version: int = betterproto.int64_field(11)
cmd_message_index: int = betterproto.int64_field(12)
badge_count: int = betterproto.int32_field(13)
trace: "MsgTrace" = betterproto.message_field(14)
ref_msg_info: "ReferenceInfo" = betterproto.message_field(15)
previous_msg_index_in_conv: int = betterproto.int64_field(16)
readconv_version: int = betterproto.int64_field(17)
pre_readconv_version: int = betterproto.int64_field(18)
mute_badge_count_info: "MuteBadgeCountInfo" = betterproto.message_field(19)
sub_conversation_short_id: int = betterproto.int64_field(20)
@dataclass
class NewP2PMessageNotify(betterproto.Message):
send_type: int = betterproto.int32_field(1)
sender: int = betterproto.int64_field(2)
sec_sender: str = betterproto.string_field(3)
conversation_id: str = betterproto.string_field(4)
conversation_short_id: int = betterproto.int64_field(5)
conversation_type: int = betterproto.int32_field(6)
message_type: int = betterproto.int32_field(7)
content: str = betterproto.string_field(8)
ext: Dict[str, str] = betterproto.map_field(
9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
create_time: int = betterproto.int64_field(10)
@dataclass
class ConversationsPerUserByFavoriteV2RequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
limit: int = betterproto.int32_field(2)
@dataclass
class ConversationsPerUserByTopV2RequestBody(betterproto.Message):
cursor: int = betterproto.int64_field(1)
limit: int = betterproto.int32_field(2)
conversation_type: int = betterproto.int32_field(3)
@dataclass
class GetConversationInfoV2RequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
need_coreinfo_related: bool = betterproto.bool_field(4)
need_userinfo_related: bool = betterproto.bool_field(5)
user_ids: List[int] = betterproto.int64_field(6)
need_settinginfo_related: bool = betterproto.bool_field(7)
need_last_convindex_v2: bool = betterproto.bool_field(8)
@dataclass
class GetConversationInfoV2ResponseBody(betterproto.Message):
conversation_info: "ConversationInfoV2" = betterproto.message_field(1)
@dataclass
class GetConversationInfoListV2RequestBody(betterproto.Message):
conversation_info_list: List["GetConversationInfoV2RequestBody"] = (
betterproto.message_field(1)
)
@dataclass
class GetConversationInfoListV2ResponseBody(betterproto.Message):
conversation_info_list: List["ConversationInfoV2"] = betterproto.message_field(1)
@dataclass
class GetConversationInfoListByFavoriteV2ResponseBody(betterproto.Message):
conversation_info_list: List["ConversationInfoV2"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
next_cursor: int = betterproto.int64_field(3)
@dataclass
class GetConversationInfoListByTopV2ResponseBody(betterproto.Message):
conversation_info_list: List["ConversationInfoV2"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
next_cursor: int = betterproto.int64_field(3)
@dataclass
class CreateSubConversationRequestBody(betterproto.Message):
con_short_id: int = betterproto.int64_field(1)
con_id: str = betterproto.string_field(2)
biz_status: str = betterproto.string_field(3)
extra: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
participants_obj: List["ParticipantWithProperty"] = betterproto.message_field(11)
@dataclass
class GetSubConversationRequestBody(betterproto.Message):
con_short_id: int = betterproto.int64_field(1)
con_id: str = betterproto.string_field(2)
sub_con_short_id: int = betterproto.int64_field(3)
include_participants: bool = betterproto.bool_field(4)
biz_roles: List[str] = betterproto.string_field(5)
@dataclass
class GetSubConversationListRequestParam(betterproto.Message):
con_short_id: int = betterproto.int64_field(1)
con_id: str = betterproto.string_field(2)
sub_con_short_ids: List[int] = betterproto.int64_field(3)
biz_roles: List[str] = betterproto.string_field(4)
@dataclass
class GetSubConversationListRequestBody(betterproto.Message):
sub_conv_list_req_params: List["GetSubConversationListRequestParam"] = (
betterproto.message_field(1)
)
include_participants: bool = betterproto.bool_field(2)
@dataclass
class ConversationCheckInfo(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
conversation_id: str = betterproto.string_field(2)
conversation_type: int = betterproto.int32_field(3)
@dataclass
class CreateSubConversationResponseBody(betterproto.Message):
sub_conversation: "SubConversation" = betterproto.message_field(1)
check_code: int = betterproto.int64_field(2)
check_message: str = betterproto.string_field(3)
extra_info: str = betterproto.string_field(4)
status: int = betterproto.int32_field(5)
@dataclass
class GetSubConversationResponseBody(betterproto.Message):
sub_conversation: "SubConversation" = betterproto.message_field(1)
@dataclass
class GetSubConversationListResponseBody(betterproto.Message):
sub_conversation_list: List["SubConversation"] = betterproto.message_field(1)
@dataclass
class RecallMessageRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
server_message_id: int = betterproto.int64_field(4)
sub_conversation_short_id: int = betterproto.int64_field(5)
@dataclass
class RecallMessageResponseBody(betterproto.Message):
toast: str = betterproto.string_field(1)
@dataclass
class ConversationAddParticipantsRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
participants: List[int] = betterproto.int64_field(4)
biz_ext: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class SecUidPair(betterproto.Message):
uid: int = betterproto.int64_field(1)
sec_uid: str = betterproto.string_field(2)
@dataclass
class ConversationAddParticipantsResponseBody(betterproto.Message):
success_participants: List[int] = betterproto.int64_field(1)
failed_participants: List[int] = betterproto.int64_field(2)
status: int = betterproto.int32_field(3)
extra_info: str = betterproto.string_field(4)
check_code: int = betterproto.int64_field(5)
check_message: str = betterproto.string_field(6)
sec_success_participants: List["SecUidPair"] = betterproto.message_field(7)
sec_failed_participants: List["SecUidPair"] = betterproto.message_field(8)
@dataclass
class ConversationRemoveParticipantsRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
participants: List[int] = betterproto.int64_field(4)
biz_ext: Dict[str, str] = betterproto.map_field(
5, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class ConversationRemoveParticipantsResponseBody(betterproto.Message):
failed_participants: List[int] = betterproto.int64_field(1)
status: int = betterproto.int32_field(2)
extra_info: str = betterproto.string_field(3)
check_code: int = betterproto.int64_field(4)
check_message: str = betterproto.string_field(5)
failed_sec_participants: List["SecUidPair"] = betterproto.message_field(6)
@dataclass
class ConversationLeaveRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
@dataclass
class ConversationParticipantsListRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
cursor: int = betterproto.int64_field(4)
limit: int = betterproto.int32_field(5)
biz_roles: List[str] = betterproto.string_field(6)
@dataclass
class ConversationParticipantsListResponseBody(betterproto.Message):
participants_page: "ParticipantsPage" = betterproto.message_field(1)
@dataclass
class UpdateConversationParticipantRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
user_id: int = betterproto.int64_field(4)
role: int = betterproto.int32_field(5)
alias: str = betterproto.string_field(6)
is_alias_set: bool = betterproto.bool_field(7)
biz_ext: Dict[str, str] = betterproto.map_field(
11, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class UpdateConversationParticipantResponseBody(betterproto.Message):
participant: "Participant" = betterproto.message_field(1)
status: int = betterproto.int32_field(2)
extra_info: str = betterproto.string_field(3)
check_code: int = betterproto.int64_field(4)
check_message: str = betterproto.string_field(5)
@dataclass
class GetConversationCoreInfoRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
@dataclass
class GetConversationCoreInfoResponseBody(betterproto.Message):
conversation_core_info: "ConversationCoreInfo" = betterproto.message_field(1)
@dataclass
class SetConversationCoreInfoRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
name: str = betterproto.string_field(4)
desc: str = betterproto.string_field(5)
icon: str = betterproto.string_field(6)
notice: str = betterproto.string_field(7)
is_name_set: bool = betterproto.bool_field(8)
is_desc_set: bool = betterproto.bool_field(9)
is_icon_set: bool = betterproto.bool_field(10)
is_notice_set: bool = betterproto.bool_field(11)
ext: Dict[str, str] = betterproto.map_field(
12, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class SetConversationCoreInfoResponseBody(betterproto.Message):
conversation_core_info: "ConversationCoreInfo" = betterproto.message_field(1)
status: int = betterproto.int32_field(2)
extra_info: str = betterproto.string_field(3)
check_code: int = betterproto.int64_field(4)
check_message: str = betterproto.string_field(5)
@dataclass
class UpsertConversationCoreExtInfoRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
ext: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class UpsertConversationCoreExtInfoResponseBody(betterproto.Message):
core_info: "ConversationCoreInfo" = betterproto.message_field(1)
status: int = betterproto.int32_field(2)
check_code: int = betterproto.int64_field(3)
check_message: str = betterproto.string_field(4)
extra_info: str = betterproto.string_field(5)
@dataclass
class SetConversationSettingInfoRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
set_stick_on_top: bool = betterproto.bool_field(4)
set_mute: bool = betterproto.bool_field(5)
set_favorite: bool = betterproto.bool_field(6)
push_status: int = betterproto.int32_field(7)
favorite_tag: int = betterproto.int32_field(8)
@dataclass
class SetConversationSettingInfoResponseBody(betterproto.Message):
setting_info: "ConversationSettingInfo" = betterproto.message_field(1)
status: int = betterproto.int32_field(2)
check_code: int = betterproto.int64_field(3)
check_message: str = betterproto.string_field(4)
extra_info: str = betterproto.string_field(5)
@dataclass
class UpsertConversationSettingExtInfoRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_short_id: int = betterproto.int64_field(2)
conversation_type: int = betterproto.int32_field(3)
ext: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class UpsertConversationSettingExtInfoResponseBody(betterproto.Message):
setting_info: "ConversationSettingInfo" = betterproto.message_field(1)
status: int = betterproto.int32_field(2)
check_code: int = betterproto.int64_field(3)
check_message: str = betterproto.string_field(4)
extra_info: str = betterproto.string_field(5)
@dataclass
class ModifyPropertyContent(betterproto.Message):
operation: int = betterproto.int32_field(1)
key: str = betterproto.string_field(2)
value: str = betterproto.string_field(3)
idempotent_id: str = betterproto.string_field(4)
@dataclass
class ModifyPropertyBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
server_message_id: int = betterproto.int64_field(4)
client_message_id: str = betterproto.string_field(5)
modify_property_content: List["ModifyPropertyContent"] = betterproto.message_field(
6
)
@dataclass
class ModifyMessagePropertyRequestBody(betterproto.Message):
property_list: "ModifyPropertyBody" = betterproto.message_field(1)
ticket: str = betterproto.string_field(2)
@dataclass
class ModifyMessagePropertyResponseBody(betterproto.Message):
status: int = betterproto.int32_field(1)
version: int = betterproto.int64_field(2)
@dataclass
class GetTicketRequestBody(betterproto.Message):
ticket_type: int = betterproto.int32_field(1)
conversation_type: int = betterproto.int32_field(2)
to_id: int = betterproto.int64_field(4)
conversation_short_id: int = betterproto.int64_field(5)
ext: Dict[str, str] = betterproto.map_field(
10, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
customed_conversation_type: int = betterproto.int32_field(6)
@dataclass
class GetTicketResponseBody(betterproto.Message):
ticket: str = betterproto.string_field(1)
@dataclass
class GetUserConversationListRequestBody(betterproto.Message):
sort_type: int = betterproto.int32_field(1)
cursor: int = betterproto.int64_field(2)
con_type: int = betterproto.int32_field(3)
limit: int = betterproto.int64_field(4)
include_role: int = betterproto.int32_field(5)
exclude_role: int = betterproto.int32_field(6)
include_removed_group: bool = betterproto.bool_field(7)
with_cold: bool = betterproto.bool_field(8)
customed_con_type: int = betterproto.int32_field(9)
push_status: int = betterproto.int32_field(10)
@dataclass
class GetUserConversationListResponseBody(betterproto.Message):
list: List["ConversationInfoV2"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
next_cursor: int = betterproto.int64_field(3)
@dataclass
class ClientACKRequestBody(betterproto.Message):
start_time_stamp: int = betterproto.int64_field(1)
cmd: int = betterproto.int32_field(2)
network_type: int = betterproto.int32_field(3)
logid: str = betterproto.string_field(4)
client_time_stamp: int = betterproto.int64_field(5)
server_message_id: int = betterproto.int64_field(6)
type: int = betterproto.int32_field(7)
@dataclass
class ClientACKResponseBody(betterproto.Message):
pass
@dataclass
class ClientMetric(betterproto.Message):
metric_type: int = betterproto.int32_field(1)
k: str = betterproto.string_field(2)
v: int = betterproto.int64_field(3)
tags: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class IndexSkipRange(betterproto.Message):
start_index: int = betterproto.int64_field(1)
end_index: int = betterproto.int64_field(2)
@dataclass
class ReportClientMetricsRequestBody(betterproto.Message):
report_metrics_list: List["ClientMetric"] = betterproto.message_field(1)
@dataclass
class ReportClientMetricsResponseBody(betterproto.Message):
pass
@dataclass
class ModifyMessageExtRequestBody(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
message_id: int = betterproto.int64_field(2)
ticket: str = betterproto.string_field(3)
ext: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class ModifyMessageExtResponseBody(betterproto.Message):
pass
@dataclass
class MessageInfo(betterproto.Message):
status: int = betterproto.int32_field(1)
body: "MessageBody" = betterproto.message_field(2)
@dataclass
class GetMessageInfoByIndexV2RequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
index_in_conversation_v2: List[int] = betterproto.int64_field(4)
@dataclass
class GetMessageInfoByIndexV2ResponseBody(betterproto.Message):
infos: Dict[int, "MessageInfo"] = betterproto.map_field(
1, betterproto.TYPE_INT64, betterproto.TYPE_MESSAGE
)
@dataclass
class ConversationReadInfo(betterproto.Message):
read_index: int = betterproto.int64_field(1)
read_badge_count: int = betterproto.int64_field(2)
read_index_v2: int = betterproto.int64_field(3)
conversation_short_id: int = betterproto.int64_field(4)
conversation_id: str = betterproto.string_field(5)
mute_read_badge_count_infos: List["MuteReadBadgeCountInfo"] = (
betterproto.message_field(6)
)
@dataclass
class ConversationReadInfoRespBody(betterproto.Message):
read_info: List["ConversationReadInfo"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
next_version: int = betterproto.int64_field(3)
@dataclass
class StrangerInfo(betterproto.Message):
participants: List["Participant"] = betterproto.message_field(1)
ext: Dict[str, str] = betterproto.map_field(
2, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
read_info: "ConversationReadInfo" = betterproto.message_field(3)
@dataclass
class HintInfo(betterproto.Message):
hint_type: int = betterproto.int32_field(1)
hint_string: str = betterproto.string_field(2)
end_time: int = betterproto.int64_field(3)
@dataclass
class ConversationRecentMessage(betterproto.Message):
conversation_short_id: int = betterproto.int64_field(1)
messages: List["MessageBody"] = betterproto.message_field(2)
version: int = betterproto.int64_field(3)
badge_count: int = betterproto.int32_field(4)
conversation_id: str = betterproto.string_field(5)
ext_messages: List["MessageBody"] = betterproto.message_field(6)
stranger_info: "StrangerInfo" = betterproto.message_field(8)
mute_badge_count_infos: List["MuteBadgeCountInfo"] = betterproto.message_field(9)
hint_infos: List["HintInfo"] = betterproto.message_field(10)
@dataclass
class GetRecentMessageReqBody(betterproto.Message):
conversation_version: int = betterproto.int64_field(1)
source: str = betterproto.string_field(2)
new_user: int = betterproto.int32_field(3)
ext: Dict[str, str] = betterproto.map_field(
4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
@dataclass
class GetCmdMessageReqBody(betterproto.Message):
cmd_index: int = betterproto.int64_field(1)
source: str = betterproto.string_field(2)
new_user: int = betterproto.int32_field(3)
@dataclass
class GetRecentMessageRespBody(betterproto.Message):
next_conversation_version: int = betterproto.int64_field(1)
messages: List["ConversationRecentMessage"] = betterproto.message_field(2)
has_more: bool = betterproto.bool_field(3)
@dataclass
class GetCmdMessageRespBody(betterproto.Message):
messages: List["MessageBody"] = betterproto.message_field(1)
has_more: bool = betterproto.bool_field(2)
next_cmd_index: int = betterproto.int64_field(3)
next_user_message_cursor: int = betterproto.int64_field(4)
readconv_version: int = betterproto.int64_field(5)
@dataclass
class GetMessageInfoByIndexV2RangeRequestBody(betterproto.Message):
conversation_id: str = betterproto.string_field(1)
conversation_type: int = betterproto.int32_field(2)
conversation_short_id: int = betterproto.int64_field(3)
min_index_in_conversation_v2: int = betterproto.int64_field(4)
max_index_in_conversation_v2: int = betterproto.int64_field(5)
direction: int = betterproto.int32_field(6)
@dataclass
class GetMessageInfoByIndexV2RangeResponseBody(betterproto.Message):
infos: List["MessageInfo"] = betterproto.message_field(1)
next_index_in_conversation_v2: int = betterproto.int64_field(2)
has_more: bool = betterproto.bool_field(3)
@dataclass
class NotifyGetConversationListResponseBody(betterproto.Message):
next_version: int = betterproto.int64_field(1)
messages: List["ConversationRecentMessage"] = betterproto.message_field(2)
has_more: bool = betterproto.bool_field(3)
inbox_type: int = betterproto.int32_field(4)
@dataclass
class ConsultGetConversationListResponseBody(betterproto.Message):
next_version: int = betterproto.int64_field(1)
messages: List["ConversationRecentMessage"] = betterproto.message_field(2)
has_more: bool = betterproto.bool_field(3)
inbox_type: int = betterproto.int32_field(4)
@dataclass
class RequestBody(betterproto.Message):
send_message_body: "SendMessageRequestBody" = betterproto.message_field(100)
messages_per_user_body: "MessagesPerUserRequestBody" = betterproto.message_field(
200
)
messages_per_user_init_v2_body: "MessagesPerUserInitV2RequestBody" = (
betterproto.message_field(203)
)
messages_in_conversation_body: "MessagesInConversationRequestBody" = (
betterproto.message_field(301)
)
send_user_action_body: "SendUserActionRequestBody" = betterproto.message_field(410)
send_input_status_body: "SendInputStatusRequestBody" = betterproto.message_field(
411
)
delete_conversation_body: "DeleteConversationRequestBody" = (
betterproto.message_field(603)
)
mark_conversation_read_body: "MarkConversationReadRequestBody" = (
betterproto.message_field(604)
)
conversation_participants_body: "ConversationParticipantsListRequestBody" = (
betterproto.message_field(605)
)
dissolve_conversation_body: "DissolveConversationRequestBody" = (
betterproto.message_field(614)
)
create_sub_conversation_body: "CreateSubConversationRequestBody" = (
betterproto.message_field(616)
)
get_sub_conversation_body: "GetSubConversationRequestBody" = (
betterproto.message_field(617)
)
get_sub_conversation_list_body: "GetSubConversationListRequestBody" = (
betterproto.message_field(618)
)
get_conversation_info_v2_body: "GetConversationInfoV2RequestBody" = (
betterproto.message_field(608)
)
create_conversation_v2_body: "CreateConversationV2RequestBody" = (
betterproto.message_field(609)
)
get_conversation_info_list_v2_body: "GetConversationInfoListV2RequestBody" = (
betterproto.message_field(610)
)
get_conversation_info_list_by_favorite_v2_body: (
"ConversationsPerUserByFavoriteV2RequestBody"
) = betterproto.message_field(611)
get_conversation_info_list_by_top_v2_body: (
"ConversationsPerUserByTopV2RequestBody"
) = betterproto.message_field(612)
conversation_add_participants_body: "ConversationAddParticipantsRequestBody" = (
betterproto.message_field(650)
)
conversation_remove_participants_body: (
"ConversationRemoveParticipantsRequestBody"
) = betterproto.message_field(651)
leave_conversation_body: "ConversationLeaveRequestBody" = betterproto.message_field(
652
)
update_conversation_participant_body: "UpdateConversationParticipantRequestBody" = (
betterproto.message_field(655)
)
delete_message_body: "DeleteMessageRequestBody" = betterproto.message_field(701)
recall_message_body: "RecallMessageRequestBody" = betterproto.message_field(702)
modify_message_property_body: "ModifyMessagePropertyRequestBody" = (
betterproto.message_field(705)
)
get_conversation_core_info_body: "GetConversationCoreInfoRequestBody" = (
betterproto.message_field(901)
)
set_conversation_core_info_body: "SetConversationCoreInfoRequestBody" = (
betterproto.message_field(902)
)
upsert_conversation_core_ext_info_body: (
"UpsertConversationCoreExtInfoRequestBody"
) = betterproto.message_field(904)
set_conversation_setting_info_body: "SetConversationSettingInfoRequestBody" = (
betterproto.message_field(921)
)
upsert_conversation_setting_ext_info_body: (
"UpsertConversationSettingExtInfoRequestBody"
) = betterproto.message_field(922)
participants_read_index_body: (
"GetConversationParticipantsReadIndexV3RequestBody"
) = betterproto.message_field(2000)
participants_min_index_body: "GetConversationParticipantsMinIndexV3RequestBody" = (
betterproto.message_field(2001)
)
get_ticket_body: "GetTicketRequestBody" = betterproto.message_field(2005)
get_conversation_list_body: "GetUserConversationListRequestBody" = (
betterproto.message_field(2006)
)
client_ack_body: "ClientACKRequestBody" = betterproto.message_field(2010)
report_client_metrics_body: "ReportClientMetricsRequestBody" = (
betterproto.message_field(2016)
)
get_configs_body: "GetConfigsRequestBody" = betterproto.message_field(2017)
unread_count_report_body: "UnReadCountReportRequestBody" = (
betterproto.message_field(2018)
)
modify_message_ext_body: "ModifyMessageExtRequestBody" = betterproto.message_field(
2021
)
get_unread_count_body: "GetUnreadCountRequestBody" = betterproto.message_field(2030)
send_message_p2p_body: "SendMessageP2PRequestBody" = betterproto.message_field(2031)
get_message_info_by_index_v2_body: "GetMessageInfoByIndexV2RequestBody" = (
betterproto.message_field(2035)
)
batch_get_conversation_participants_readindex: (
"BatchGetConversationParticipantsReadIndexRequestBody"
) = betterproto.message_field(2038)
get_message_info_by_index_v2_range_body: (
"GetMessageInfoByIndexV2RangeRequestBody"
) = betterproto.message_field(2041)
get_open_convs_body: "GetOpenConvsRequestBody" = betterproto.message_field(16001)
get_messages_by_user_with_open_convs_body: (
"GetMessagesByUserWithOpenConvsRequestBody"
) = betterproto.message_field(16002)
get_user_message_with_open_convs_body: "GetUserMessageWithOpenConvsRequestBody" = (
betterproto.message_field(16003)
)
get_user_conversations_by_tag_body: "GetUserConversationsByTagRequestBody" = (
betterproto.message_field(17001)
)
set_user_all_conversations_settings_body: (
"SetUserAllConversationsSettingsRequestBody"
) = betterproto.message_field(17002)
@dataclass
class Request(betterproto.Message):
cmd: int = betterproto.int32_field(1)
sequence_id: int = betterproto.int64_field(2)
sdk_version: str = betterproto.string_field(3)
token: str = betterproto.string_field(4)
refer: int = betterproto.int32_field(5)
inbox_type: int = betterproto.int32_field(6)
build_number: str = betterproto.string_field(7)
body: "RequestBody" = betterproto.message_field(8)
device_id: str = betterproto.string_field(9)
channel: str = betterproto.string_field(10)
device_platform: str = betterproto.string_field(11)
device_type: str = betterproto.string_field(12)
os_version: str = betterproto.string_field(13)
version_code: str = betterproto.string_field(14)
headers: Dict[str, str] = betterproto.map_field(
15, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
config_id: int = betterproto.int32_field(16)
token_info: "TokenInfo" = betterproto.message_field(17)
auth_type: int = betterproto.int32_field(18)
msg_trace: "MsgTrace" = betterproto.message_field(19)
retry_count: int = betterproto.int32_field(20)
biz: str = betterproto.string_field(21)
access: str = betterproto.string_field(22)
@dataclass
class TokenInfo(betterproto.Message):
mark_id: int = betterproto.int32_field(1)
type: int = betterproto.int32_field(2)
app_id: int = betterproto.int32_field(3)
user_id: int = betterproto.int64_field(4)
timestamp: int = betterproto.int64_field(5)
@dataclass
class ResponseBody(betterproto.Message):
send_message_body: "SendMessageResponseBody" = betterproto.message_field(100)
messages_per_user_body: "MessagesPerUserResponseBody" = betterproto.message_field(
200
)
messages_per_user_init_v2_body: "MessagesPerUserInitV2ResponseBody" = (
betterproto.message_field(203)
)
messages_in_conversation_body: "MessagesInConversationResponseBody" = (
betterproto.message_field(301)
)
send_user_action_body: "SendUserActionResponseBody" = betterproto.message_field(410)
has_new_message_notify: "NewMessageNotify" = betterproto.message_field(500)
has_new_p2p_message_notify: "NewP2PMessageNotify" = betterproto.message_field(504)
create_sub_conversation_body: "CreateSubConversationResponseBody" = (
betterproto.message_field(616)
)
get_sub_conversation_body: "GetSubConversationResponseBody" = (
betterproto.message_field(617)
)
get_sub_conversation_list_body: "GetSubConversationListResponseBody" = (
betterproto.message_field(618)
)
get_conversation_info_v2_body: "GetConversationInfoV2ResponseBody" = (
betterproto.message_field(608)
)
create_conversation_v2_body: "CreateConversationV2ResponseBody" = (
betterproto.message_field(609)
)
get_conversation_info_list_v2_body: "GetConversationInfoListV2ResponseBody" = (
betterproto.message_field(610)
)
get_conversation_info_list_by_favorite_v2_body: (
"GetConversationInfoListByFavoriteV2ResponseBody"
) = betterproto.message_field(611)
get_conversation_info_list_by_top_v2_body: (
"GetConversationInfoListByTopV2ResponseBody"
) = betterproto.message_field(612)
conversation_participants_body: "ConversationParticipantsListResponseBody" = (
betterproto.message_field(605)
)
conversation_add_participants_body: "ConversationAddParticipantsResponseBody" = (
betterproto.message_field(650)
)
conversation_remove_participants_body: (
"ConversationRemoveParticipantsResponseBody"
) = betterproto.message_field(651)
update_conversation_participant_body: (
"UpdateConversationParticipantResponseBody"
) = betterproto.message_field(655)
recall_message_body: "RecallMessageResponseBody" = betterproto.message_field(702)
modify_message_property_body: "ModifyMessagePropertyResponseBody" = (
betterproto.message_field(705)
)
get_conversation_core_info_body: "GetConversationCoreInfoResponseBody" = (
betterproto.message_field(901)
)
set_conversation_core_info_body: "SetConversationCoreInfoResponseBody" = (
betterproto.message_field(902)
)
upsert_conversation_core_ext_info_body: (
"UpsertConversationCoreExtInfoResponseBody"
) = betterproto.message_field(904)
set_conversation_setting_info_body: "SetConversationSettingInfoResponseBody" = (
betterproto.message_field(921)
)
upsert_conversation_setting_ext_info_body: (
"UpsertConversationSettingExtInfoResponseBody"
) = betterproto.message_field(922)
participants_read_index_body: (
"GetConversationParticipantsReadIndexV3ResponseBody"
) = betterproto.message_field(2000)
participants_min_index_body: "GetConversationParticipantsMinIndexV3ResponseBody" = (
betterproto.message_field(2001)
)
get_ticket_body: "GetTicketResponseBody" = betterproto.message_field(2005)
get_conversation_list_body: "GetUserConversationListResponseBody" = (
betterproto.message_field(2006)
)
client_ack_body: "ClientACKResponseBody" = betterproto.message_field(2010)
report_client_metrics_body: "ReportClientMetricsResponseBody" = (
betterproto.message_field(2016)
)
get_configs_body: "GetConfigsResponseBody" = betterproto.message_field(2017)
unread_count_report_body: "UnReadCountReportResponseBody" = (
betterproto.message_field(2018)
)
modify_message_ext_body: "ModifyMessageExtResponseBody" = betterproto.message_field(
2021
)
get_unread_count_body: "GetUnreadCountResponseBody" = betterproto.message_field(
2030
)
send_message_p2p_body: "SendMessageP2PResponseBody" = betterproto.message_field(
2031
)
get_message_info_by_index_v2_body: "GetMessageInfoByIndexV2ResponseBody" = (
betterproto.message_field(2035)
)
get_message_info_by_index_v2_range_body: (
"GetMessageInfoByIndexV2RangeResponseBody"
) = betterproto.message_field(2041)
get_open_convs_body: "GetOpenConvsResponseBody" = betterproto.message_field(16001)
get_messages_by_user_with_open_convs_body: (
"GetMessagesByUserWithOpenConvsResponseBody"
) = betterproto.message_field(16002)
get_user_message_with_open_convs_body: "GetUserMessageWithOpenConvsResponseBody" = (
betterproto.message_field(16003)
)
get_user_conversations_by_tag_body: "GetUserConversationsByTagResponseBody" = (
betterproto.message_field(17001)
)
set_user_all_conversations_settings_body: (
"SetUserAllConversationsSettingsResponseBody"
) = betterproto.message_field(17002)
@dataclass
class Response(betterproto.Message):
cmd: int = betterproto.int32_field(1)
sequence_id: int = betterproto.int64_field(2)
status_code: int = betterproto.int32_field(3)
error_desc: str = betterproto.string_field(4)
inbox_type: int = betterproto.int32_field(5)
body: "ResponseBody" = betterproto.message_field(6)
log_id: str = betterproto.string_field(7)
headers: Dict[str, str] = betterproto.map_field(
8, betterproto.TYPE_STRING, betterproto.TYPE_STRING
)
start_time_stamp: int = betterproto.int64_field(9)
request_arrived_time: int = betterproto.int64_field(10)
server_execution_end_time: int = betterproto.int64_field(11)
retry_count: int = betterproto.int32_field(12)
req_user_id: int = betterproto.int64_field(13)
@dataclass
class ConvUnreadUnion(betterproto.Message):
conv_unread_info: Dict[int, "ConvUnread"] = betterproto.map_field(
1, betterproto.TYPE_INT32, betterproto.TYPE_MESSAGE
)
@dataclass
class ConvUnread(betterproto.Message):
badge_count: int = betterproto.int32_field(1)
read_badge_count: int = betterproto.int32_field(2)
from pathlib import Path
from DrissionPage import Chromium, ChromiumOptions
from DrissionPage.items import WebPageTab
from DrissionPage.common import Settings
from tool.io import w2json
Settings.set_raise_when_wait_failed(False)
class launcher:
def __init__(self, email: str, password: str):
self._email = email
self._password = password
self.driver = Chromium(ChromiumOptions().headless())
self.tab: WebPageTab = self.driver.latest_tab
self.tp = Path('./tmp')
def login(self):
self.tab.get("https://fxg.jinritemai.com/login/common")
if (not self.tab.wait.url_change("login", exclude=True, timeout=120)):
self.tab.ele('@text()=邮箱登录').click()
self.tab.ele('@placeholder=请输入邮箱').input(self._email)
self.tab.ele('@placeholder=密码').input(self._password)
self.tab.run_js('document.querySelector(".auxo-checkbox").click()', as_expr=True)
self.tab.run_js('document.querySelector("button").click()', as_expr=True)
if self.tab.wait.ele_displayed("#fxg-pc-header"):
self.tab.run_js('document.querySelector(".ecom-menu-badge").click()', as_expr=True)
self.tab = self.driver.latest_tab
cookie = self.tab.cookies().as_dict()
shop_id = cookie["SHOP_ID"] # ecom_gray_shop_id
w2json(self.tp / 'cookie' / f'{shop_id}.json', cookie)
def main():
pass
if __name__ == '__main__':
main()
from dataclasses import dataclass, fields
from typing import List
@dataclass
class Conversation:
con_id: str # 会话ID
con_short_id: str # 会话短ID
sub_con_short_id: str = None # 子会话短ID
ticket: str = None # 标签
def __post_init__(self):
self.shop_id, self.receiver_id = self.con_id.split(':', 2)[:2] # 商店ID, 顾客ID
def set_ctx(self, other) -> None:
for x in fields(self): setattr(other, x.name, getattr(self, x.name))
@dataclass
class Receiver:
nickname: str # 昵称
avatar_uri: str # 头像
messages: List[str] = [] # 消息列表
@dataclass
class EventState:
chat: bool = False # 准备对话
notify: bool = False # 处理新信息
active_chat: bool = False # 主动对话
refresh_msg: bool = False # 刷新信息
import base64
import hashlib
import asyncio
import json
import random
from pathlib import Path
from uuid import uuid4
from typing import Optional, List, Dict, Callable
import aiohttp
import lz4.block
import requests
from aioconsole import ainput
from loguru import logger
from proto import decode
from src.model import Conversation, Receiver, EventState
from tool.io import w2json, r2json, init_logger
from tool.time import get_ts, get_ws_key, USEC
class WSSClient:
"""
功能点:
1.主动发送消息
2.查询聊天消息
3.接收新消息
4.自动回复
"""
def __init__(self, shop_id: str):
self.tp = Path('./tmp') # 缓存路径
self.cookies = r2json(self.tp / 'cookie' / f'{shop_id}.json')
self.shop_id = shop_id # 商店ID
self.device_id = self.cookies["PIGEON_CID"] # 设备ID
self.logid = get_ts()
init_logger(self.tp / 'log' / f'{self.logid}.log')
self.info = info = self._get_link_info()
self.conf = info['frontierConfig']
self.token = info['token']
self.pigeon_sign = info['pigeon_sign']
self.aid = str(info['appId'])
self.session: Optional[aiohttp.ClientSession] = None
self.ws: Optional[aiohttp.ClientWebSocketResponse] = None
self.on_message: Optional[Callable[[dict], None]] = None
self._tasks: List[asyncio.Task] = [] # 异步任务
self._reces: Dict[str, Receiver] = {} # 顾客信息
self._convs: Dict[str, Conversation] = {} # 上下文缓存
self._es = EventState() # 事件状态
self._cmd = {
"sendMessageBody": 100, # 发送消息
"messagesPerUserBody": 200, # 用户消息
"messages_per_user_init_v2_body": 203, # 初始化消息列表
"messagesInConversationBody": 301, # 会话消息
"create_conversation_v2_body": 609, # 创建会话
"create_sub_conversation_body": 616, # 创建子会话
"get_conversation_info_list_v2_body": 610, # 获取子会话
"getTicketBody": 2005,
"get_message_info_by_index_v2_range_body": 2041 # 历史消息
}
self.seqid = 10001
self.build_number = "26ecd4c:feat/msg-del"
self.cursor = get_ts(6)
# 会话上下文属性
self.receiver_id: str = None
self.con_id: str = None
self.con_short_id: str = None
self.ticket: str = None
def _get_ctx(self, con_id: str = None) -> bool:
"""获取对话上下文信息"""
if con_id == self.con_id: return True
conv = self._convs.get(con_id)
if not conv: return False
conv.set_ctx(self)
return True
def _rid2cid(self, receiver_id: str = None, shop_id: str = None) -> bool:
"""角色ID转会话ID"""
self.receiver_id = receiver_id or self.receiver_id
self.shop_id = shop_id or self.shop_id
if not self.receiver_id or not self.shop_id: return False
self.con_id = f"{self.receiver_id}:{self.shop_id}::2:1:pigeon"
return True
def _cid2rid(self, con_id: str = None) -> bool:
"""会话ID转角色ID"""
self.con_id = con_id or self.con_id
if not self.con_id: return False
self.receiver_id, self.shop_id = self.con_id.split(':', 2)[:2]
return True
def _get_access_key(self) -> str:
return hashlib.md5(
''.join(map(str, (
self.conf['fpId'],
self.conf['appKey'],
self.device_id,
"f8a69f1719916z"
))).encode()
).hexdigest()
def _get_link_info(self) -> dict:
fp = self.tp / "link_info.json"
if fp.exists(): return r2json(fp)['data']
url = "https://pigeon.jinritemai.com/chat/api/backstage/conversation/get_link_info"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
}
params = {
"PIGEON_BIZ_TYPE": "2",
"biz_type": "4",
"_ts": get_ts(),
"_pms": "1",
"FUSION": "true"
}
response = requests.get(url, headers=headers, params=params, cookies=self.cookies)
logger.info(response)
logger.info(response.text)
data = response.json()
w2json(fp, data)
return data['data']
def _get_user_init(self):
url = "https://fxg.jinritemai.com/pigeon_im/v2/message/get_by_user_init"
a_bogus = ""
params = {
"pigeon_source": "web",
"PIGEON_BIZ_TYPE": "2",
"pigeon_sign": self.pigeon_sign,
"verifyFp": "verify_m7l9d396_WUH0LlFq_o168_4AJp_BLDP_rQ1EqpkS7h5c",
"fp": "verify_m7l9d396_WUH0LlFq_o168_4AJp_BLDP_rQ1EqpkS7h5c",
"msToken": "AYjBxVGesu-bgTQzoLhzn5utqdY0i7UGJcvTdiC1b5bCWml7-Fz7NrQ4mxHceL6I8UxGXBF7e5PYzue55mnfLE6sFi-kxPrNRDztsU2d-ViaeqktJS7gR_JgJQmLHvi8SkTrHNpSFvrMAj8WDdiqKbA3FP3cJUk%3D",
"a_bogus": a_bogus
}
headers = {
"accept": "application/x-protobuf",
"content-type": "application/x-protobuf",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
}
body = {"messages_per_user_init_v2_body": { "cursor": 0 }}
data = self._get_protobuf(body)
response = requests.post(url, data, params=params, cookies=self.cookies, headers=headers)
logger.info(response)
logger.info(response.text)
data = response.json()
w2json(self.tp, data)
return data
async def _create_conversation_v2(self):
body = {"create_conversation_v2_body": {
"conversation_type": 10,
"persistent": 1,
"idempotent_id": self.con_id,
"participants_obj": [{
"user_id": self.receiver_id,
"biz_role": "Buyer",
"group_symbol": "",
}, {
"user_id": self.shop_id,
"biz_role": "Shop",
"group_symbol": "",
}, {
"user_id": self.device_id,
"biz_role": "NormalServer",
"group_symbol": "",
}],
}}
data = self._get_protobuf(body)
logger.info("请求创建会话")
await self.ws.send_bytes(data)
async def _create_sub_conversation(self):
body = {"create_sub_conversation_body": {
"biz_status": "0",
"con_id": self.con_id,
"con_short_id": self.con_short_id,
"extra": {"uname": ""},
"participants_obj": [{
"user_id": self.receiver_id,
"biz_role": "Buyer",
"group_symbol": "",
}, {
"user_id": self.shop_id,
"biz_role": "Shop",
"group_symbol": "",
}, {
"user_id": self.device_id,
"biz_role": "CurrentServer",
"group_symbol": "",
}],
}}
data = self._get_protobuf(body)
logger.info("请求创建子会话")
await self.ws.send_bytes(data)
async def _get_conversation_info_list_v2(self):
body = {"get_conversation_info_list_v2_body": {
"conversation_info_list": [{
"conversation_id": self.con_id,
"conversation_short_id": self.con_short_id,
"conversation_type": 10
}]}}
data = self._get_protobuf(body)
logger.info("请求获取会话信息列表")
await self.ws.send_bytes(data)
async def _messages_per_user(self):
diff = self.cursor - get_ts(6)
if diff > 0: await asyncio.sleep(diff / USEC)
body = {"messagesPerUserBody": {
"cursor": self.cursor,
"limit": 50
}}
data = self._get_protobuf(body)
logger.info("请求用户消息")
await self.ws.send_bytes(data)
async def _messages_in_conversation(self, anchor_index: int = None):
body = {"messagesInConversationBody": {
"conversation_id": self.con_id,
"conversation_type": 10,
"conversation_short_id": self.con_short_id,
"direction": 1,
"anchor_index": anchor_index or get_ts(6),
"limit": 20,
}}
data = self._get_protobuf(body)
logger.info("请求会话消息")
await self.ws.send_bytes(data)
async def _get_message_info_by_index_v2_range(self, min_idx: int, max_idx: int):
body = {"get_message_info_by_index_v2_range_body": {
"conversationId": self.con_id,
"conversation_type": 10,
"conversation_short_id": self.con_short_id,
"min_index_in_conversation_v2": min_idx,
"max_index_in_conversation_v2": max_idx,
"direction": 1,
}}
data = self._get_protobuf(body)
logger.info(f"请求获取历史消息 {min_idx} - {max_idx}")
await self.ws.send_bytes(data)
async def _process_notify(self, notify: decode.NewMessageNotify):
message: decode.MessageBody = notify.message
message_type = message.message_type
if message_type == 50001:
if self._es.notify:
self._cid2rid(message.conversation_id)
self.con_short_id = message.conversation_short_id
logger.info(f"获取到 ${self.con_short_id=}")
await self._get_conversation_info_list_v2()
elif message_type == 50002:
self._reces[self.con_id] = Receiver(
message.ext.get("nickname"),
message.ext.get("avatar_uri"),
)
elif message_type == 1000:
logger.info(f"接受到新消息: {message.content}")
else:
logger.warning(f"未知类型`{message_type}`的信息: {message}")
async def _active_chat(self, receiver_id: str = None):
if not self._rid2cid(receiver_id): return
logger.info(f"主动对话: {receiver_id}")
self._es.active_chat = True
await self._create_conversation_v2()
async def _refresh_msg(self, receiver_id: str = None):
self._rid2cid(receiver_id)
self._get_ctx(receiver_id)
self._es.refresh_msg = True
logger.info(f"刷新对话: {receiver_id}")
if not self.con_short_id:
await self._create_conversation_v2()
else:
await self._messages_in_conversation()
async def chat(self, msg: str):
if not self._es.chat: return
client_message_id = str(uuid4())
track_info = json.dumps({
"send_time": str(get_ts()),
"_send_delta": str(-random.randint(1000, 9999)),
"_send_delta_2": str(-random.randint(1000, 9999))
}, separators=(',', ':'))
body = {"sendMessageBody": {
"conversationId": self.con_id,
"conversationType": 11,
"conversationShortId": self.con_short_id,
"content": msg,
"ext": {
"type": "text",
"shop_id": self.shop_id,
"sender_role": "2",
"PIGEON_BIZ_TYPE": "2",
"src": "pc",
"srcType": "1",
"source": "pc-web",
"receiver_id": self.receiver_id,
"hierarchical_dimension": "{\"dynamic_dimension\":\"4541_1131_9042_6599_9420_6832_3749_4050_3823_3994_8564_1528_0388_8667_2179_1521_1870_1948_0989_8012_6240_7898_7548_8852_6245_9393_3650_4026_4034_4057_6537_8632_2068_9626_2387_9033_3425_2239_0982_1935_2363_3817_8557_7931_3278_4065_1893_6049_6961_3814_4883_4401_6637_7282_3652_9354_0438_4769_4815_9572_7230_5054_4852_2188_5912_6813_2570_5394_0729\",\"goofy_id\":\"1.0.1.797\",\"desk_version\":\"0.0.0\",\"open_stores\":\"0\",\"memL\":\"\",\"cpuL\":\"\",\"session_throughput\":0,\"message_throughput_send\":0,\"message_throughput_revice\":0}",
"start_scene": "1",
"p:check_Send": str(uuid4()),
"track_info": track_info,
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
"sender_id": "",
"biz_ext": "{}",
"p:from_source": "web",
"s:mentioned_users": "",
"s:client_message_id": client_message_id
},
"messageType": 1000,
"ticket": self.ticket,
"clientMessageId": client_message_id,
"subConversationShortId": self.sub_con_short_id
}}
data = self._get_protobuf(body)
logger.info(f"请求发送消息 ${msg=}")
await self.ws.send_bytes(data)
async def _process_data(self, data: bytes):
try:
fr = decode.Frame().parse(data)
if fr.payload_encoding == '__lz4':
fr.payload = lz4.block.decompress(fr.payload, uncompressed_size=len(fr.payload) * 10)
if fr.payload_type != "pb":
logger.info(fr.payload)
return
resp = decode.Response().parse(fr.payload)
logger.debug(f"data: {resp.to_json(2)}")
if self.on_message: self.on_message(resp.to_dict())
# refresh msg
next_cursor = resp.body.messages_per_user_body.next_cursor
if next_cursor:
logger.info(f"获取到 ${next_cursor=}")
self.cursor = next_cursor + 10 * USEC # +10s
await self._messages_per_user()
# notify
notify = resp.body.has_new_message_notify
if notify.notify_type:
await self._process_notify(notify)
if self._es.refresh_msg:
await self._refresh_msg_chain(resp)
if self._es.active_chat:
await self._active_chat_chain(resp)
# 最后一步
info_list = resp.body.get_conversation_info_list_v2_body.conversation_info_list
for info in info_list:
con_short_id = info.conversation_short_id
sub_con_short_id = info.current_sub_conv.sub_con_short_id
ticket = info.ticket
logger.debug(f"获取到 ${sub_con_short_id=}")
logger.debug(f"获取到 ${ticket=}")
con_id = info.conversation_id
if con_id not in self._convs:
self._convs[con_id] = Conversation(
con_id=con_id,
con_short_id=con_short_id,
sub_con_short_id=sub_con_short_id,
ticket=ticket
)
logger.info(f"更新上下文缓存 {self._convs[con_id]}")
if con_short_id == self.con_short_id:
self.sub_con_short_id = sub_con_short_id
self.ticket = ticket
self._es.chat = True # to chat
# Test code
if self.receiver_id == "2752803464021095":
await self.chat("Test message")
except Exception as e:
logger.exception(e)
def _update_con_short_id(self, resp: decode.Response) -> bool:
con_short_id = resp.body.create_conversation_v2_body.conversation.conversation_short_id
if con_short_id:
logger.info(f"获取到 ${con_short_id=}")
self.con_short_id = con_short_id
return True
return False
async def _refresh_msg_chain(self, resp: decode.Response):
if self._update_con_short_id(resp):
await self._messages_in_conversation()
body = resp.body.messages_in_conversation_body
for message in body.messages:
role = message.ext.get("sender_role", 'b') # 系统提示或其他
if role in ['1', '2']: # 真人
logger.info(f"{role} - {message.content}")
else:
logger.debug(f"{role} - {message.content}")
if body.has_more:
await self._messages_in_conversation(body.next_cursor)
async def _active_chat_chain(self, resp: decode.Response):
# before chat
if self._update_con_short_id(resp):
await self._create_sub_conversation()
sub_con_short_id = resp.body.create_sub_conversation_body.sub_conversation.sub_con_short_id
if sub_con_short_id:
await self._get_conversation_info_list_v2()
async def _receive_msg(self):
try:
async for msg in self.ws:
logger.debug(f"raw: {base64.b64encode(msg.data)}")
if msg.type == aiohttp.WSMsgType.BINARY:
await self._process_data(msg.data)
elif msg.type == aiohttp.WSMsgType.CLOSED:
break
elif msg.type == aiohttp.WSMsgType.ERROR:
logger.error(self.ws.exception())
break
except ConnectionResetError:
logger.info("connection reset by peer")
finally:
await self.disconnect()
async def _send_msg(self):
try:
while True:
msg = await ainput("send (q to quit):\r\n")
if msg.lower() == 'q':
break
await self.chat(msg)
except asyncio.CancelledError:
logger.info("input cancelled")
async def connect(self):
url = self.info['websocketUrl']
params = {
"token": self.token,
"aid": self.aid,
"fpid": self.conf['fpId'],
"device_id": self.device_id,
"access_key": self._get_access_key(),
"device_platform": "web",
"version_code": "10000",
"pigeon_source": "web",
"PIGEON_BIZ_TYPE": "2",
"pigeon_sign": self.pigeon_sign,
}
headers = {
"Upgrade": "websocket",
"Connection": "Upgrade",
"Sec-WebSocket-Key": get_ws_key(),
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
"Sec-WebSocket-Version": "13",
"Sec-WebSocket-Protocol": "binary, base64, pbbp2",
"Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits"
}
self.session = aiohttp.ClientSession()
self.ws = await self.session.ws_connect(
url, protocols=("binary", "base64", "pbbp2"),
params=params, headers=headers
)
logger.info("wss connected")
async def disconnect(self):
try:
if self.ws and not self.ws.closed:
await self.ws.close()
if self.session and not self.session.closed:
await self.session.close()
except Exception as e:
logger.exception(e)
finally:
self._cancel_tasks()
logger.info("wss disconnect")
def _get_protobuf(self, body: dict):
body_type = next(iter(body.keys()))
frame = decode.Frame().from_dict({
"seqid": self.seqid,
"logid": self.logid,
"service": self.conf['msgServiceId'],
"method": 1,
"headers": [
{
"key": "pigeon_source",
"value": "web"
},
{
"key": "PIGEON_BIZ_TYPE",
"value": "2"
},
{
"key": "pigeon_sign",
"value": self.pigeon_sign
}
],
"payloadType": "pb",
})
ref = decode.Request().from_dict({
"cmd": self._cmd[body_type],
"sequenceId": self.seqid,
"sdkVersion": "1.0.0",
"token": self.token,
"refer": 3,
"inboxType": 3,
"buildNumber": self.build_number,
"body": body,
"deviceId": self.device_id,
"devicePlatform": "web",
"headers": {
"pigeon_source": "web",
"PIGEON_BIZ_TYPE": "2",
"pigeon_sign": self.pigeon_sign,
"session_aid": self.aid,
"session_did": self.device_id,
"app_name": "im",
"priority_region": "cn",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
"cookie_enabled": "true",
"browser_language": "zh-CN",
"browser_platform": "Win32",
"browser_name": "Mozilla",
"browser_version": "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
"browser_online": "true",
"screen_width": "1920",
"screen_height": "1080",
"referer": f"https://im.jinritemai.com/pc_seller/?selfId={self.device_id}",
"timezone_name": "Asia/Shanghai"
},
"authType": 2
})
frame.payload = ref.SerializeToString()
data = frame.SerializeToString()
logger.debug(ref.to_dict())
self.seqid += 1
return data
def _cancel_tasks(self):
for task in self._tasks:
if task and not task.done():
task.cancel()
async def run(self):
try:
await self.connect()
self._tasks = [
asyncio.create_task(self._receive_msg()),
asyncio.create_task(self._messages_per_user()), # 保持活跃状态
# asyncio.create_task(self._refresh_msg("2752803464021095")),
# asyncio.create_task(self._active_chat("2752803464021095")),
]
await asyncio.gather(*self._tasks)
except Exception as e:
logger.exception(e)
finally:
await self.disconnect()
import json
import sys
from pathlib import Path
from loguru import logger
from typing import Any, List
def endir(fp, limit: int = 2):
x = fp
tm: List[Path] = []
for _ in range(limit):
fr = Path(x).parent
tm.append(fr)
x = fr
for fr in reversed(tm):
if not fr.exists(): fr.mkdir()
return fp
def w2json(fp: str, data: Any):
with open(endir(fp), 'w', encoding='utf8') as f:
json.dump(data, f, ensure_ascii=False, indent=2)
def r2json(fp: str):
with open(endir(fp), 'r', encoding='utf8') as f:
return json.load(f)
def init_logger(log_path: str):
logger.remove()
logger.add(sys.stdout, level="INFO")
logger.add(
endir(log_path),
level="DEBUG",
backtrace=True,
diagnose=True
)
import time
import base64
import hashlib
USEC = 10 ** 6
def get_ts(unit: int = 3) -> int:
return int(time.time() * 10 ** unit) # 13
def get_ws_key() -> str:
return base64.b64encode(hashlib.md5(str(get_ts()).encode()).digest()).decode()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment