Add class InviteLinkChatType.
This commit is contained in:
parent
d2a3dfccc3
commit
5f1b1f41fc
@ -902,10 +902,23 @@ chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_folder_invite
|
||||
//@description Contains a list of chat members joined a chat via an invite link @total_count Approximate total number of chat members found @members List of chat members, joined a chat via an invite link
|
||||
chatInviteLinkMembers total_count:int32 members:vector<chatInviteLinkMember> = ChatInviteLinkMembers;
|
||||
|
||||
|
||||
//@class InviteLinkChatType @description Describes the type of a chat to which points an invite link
|
||||
|
||||
//@description The link is an invite link for a basic group
|
||||
inviteLinkChatTypeBasicGroup = InviteLinkChatType;
|
||||
|
||||
//@description The link is an invite link for a supergroup
|
||||
inviteLinkChatTypeSupergroup = InviteLinkChatType;
|
||||
|
||||
//@description The link is an invite link for a channel
|
||||
inviteLinkChatTypeChannel = InviteLinkChatType;
|
||||
|
||||
|
||||
//@description Contains information about a chat invite link
|
||||
//@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining
|
||||
//@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds
|
||||
//@type Type of the chat; basic_group_id or supergroup_id can be 0 if the user has no access to the chat before joining
|
||||
//@type Type of the chat
|
||||
//@title Title of the chat
|
||||
//@photo Chat photo; may be null
|
||||
//@param_description Chat description
|
||||
@ -916,7 +929,8 @@ chatInviteLinkMembers total_count:int32 members:vector<chatInviteLinkMember> = C
|
||||
//@is_verified True, if the chat is verified
|
||||
//@is_scam True, if many users reported this chat as a scam
|
||||
//@is_fake True, if many users reported this chat as a fake account
|
||||
chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector<int53> creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo;
|
||||
chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector<int53> creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo;
|
||||
|
||||
|
||||
//@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user
|
||||
chatJoinRequest user_id:int53 date:int32 bio:string = ChatJoinRequest;
|
||||
|
@ -19526,6 +19526,8 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
CHECK(invite_link_info != nullptr);
|
||||
|
||||
DialogId dialog_id = invite_link_info->dialog_id;
|
||||
bool is_chat = false;
|
||||
bool is_megagroup = false;
|
||||
string title;
|
||||
const DialogPhoto *photo = nullptr;
|
||||
DialogPhoto invite_link_photo;
|
||||
@ -19535,7 +19537,6 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
bool creates_join_request = false;
|
||||
bool is_public = false;
|
||||
bool is_member = false;
|
||||
td_api::object_ptr<td_api::ChatType> chat_type;
|
||||
bool is_verified = false;
|
||||
bool is_scam = false;
|
||||
bool is_fake = false;
|
||||
@ -19545,6 +19546,7 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
case DialogType::Chat: {
|
||||
auto chat_id = dialog_id.get_chat_id();
|
||||
const Chat *c = get_chat_force(chat_id);
|
||||
is_chat = true;
|
||||
|
||||
if (c != nullptr) {
|
||||
title = c->title;
|
||||
@ -19554,15 +19556,12 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
} else {
|
||||
LOG(ERROR) << "Have no information about " << chat_id;
|
||||
}
|
||||
chat_type = td_api::make_object<td_api::chatTypeBasicGroup>(
|
||||
get_basic_group_id_object(chat_id, "get_chat_invite_link_info_object"));
|
||||
break;
|
||||
}
|
||||
case DialogType::Channel: {
|
||||
auto channel_id = dialog_id.get_channel_id();
|
||||
const Channel *c = get_channel_force(channel_id);
|
||||
|
||||
bool is_megagroup = false;
|
||||
if (c != nullptr) {
|
||||
title = c->title;
|
||||
photo = &c->photo;
|
||||
@ -19576,8 +19575,6 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
} else {
|
||||
LOG(ERROR) << "Have no information about " << channel_id;
|
||||
}
|
||||
chat_type = td_api::make_object<td_api::chatTypeSupergroup>(
|
||||
get_supergroup_id_object(channel_id, "get_chat_invite_link_info_object"), !is_megagroup);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -19585,6 +19582,8 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
}
|
||||
description = get_dialog_about(dialog_id);
|
||||
} else {
|
||||
is_chat = invite_link_info->is_chat;
|
||||
is_megagroup = invite_link_info->is_megagroup;
|
||||
title = invite_link_info->title;
|
||||
invite_link_photo = as_fake_dialog_photo(invite_link_info->photo, dialog_id, false);
|
||||
photo = &invite_link_photo;
|
||||
@ -19596,12 +19595,15 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
|
||||
is_verified = invite_link_info->is_verified;
|
||||
is_scam = invite_link_info->is_scam;
|
||||
is_fake = invite_link_info->is_fake;
|
||||
}
|
||||
|
||||
if (invite_link_info->is_chat) {
|
||||
chat_type = td_api::make_object<td_api::chatTypeBasicGroup>(0);
|
||||
} else {
|
||||
chat_type = td_api::make_object<td_api::chatTypeSupergroup>(0, !invite_link_info->is_megagroup);
|
||||
}
|
||||
td_api::object_ptr<td_api::InviteLinkChatType> chat_type;
|
||||
if (is_chat) {
|
||||
chat_type = td_api::make_object<td_api::inviteLinkChatTypeBasicGroup>();
|
||||
} else if (is_megagroup) {
|
||||
chat_type = td_api::make_object<td_api::inviteLinkChatTypeSupergroup>();
|
||||
} else {
|
||||
chat_type = td_api::make_object<td_api::inviteLinkChatTypeChannel>();
|
||||
}
|
||||
|
||||
if (dialog_id.is_valid()) {
|
||||
|
@ -267,8 +267,7 @@ td_api::object_ptr<td_api::messageSponsor> SponsoredMessageManager::get_message_
|
||||
LOG(ERROR) << "Failed to get invite link info for " << invite_link;
|
||||
return nullptr;
|
||||
}
|
||||
if (chat_invite_link_info->type_->get_id() != td_api::chatTypeSupergroup::ID ||
|
||||
!static_cast<const td_api::chatTypeSupergroup *>(chat_invite_link_info->type_.get())->is_channel_) {
|
||||
if (chat_invite_link_info->type_->get_id() != td_api::inviteLinkChatTypeChannel::ID) {
|
||||
LOG(ERROR) << "Receive sponsor chat of a wrong type " << to_string(chat_invite_link_info->type_);
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user