Add updateChatMember.
This commit is contained in:
parent
d765c58d86
commit
62a4c0c58d
@ -3599,6 +3599,11 @@ updatePoll poll:poll = Update;
|
||||
//@description A user changed the answer to a poll; for bots only @poll_id Unique poll identifier @user_id The user, who changed the answer to the poll @option_ids 0-based identifiers of answer options, chosen by the user
|
||||
updatePollAnswer poll_id:int64 user_id:int32 option_ids:vector<int32> = Update;
|
||||
|
||||
//@description User rights changed in a chat; for bots only @chat_id Chat identifier @actor_user_id Identifier of the user, changing the rights
|
||||
//@date Point in time (Unix timestamp) when the user rights was changed @invite_link If user has joined the chat using an invite link, the invite link; may be null
|
||||
//@old_chat_member Previous chat member @new_chat_member New chat member
|
||||
updateChatMember chat_id:int53 actor_user_id:int32 date:int32 invite_link:chatInviteLink old_chat_member:chatMember new_chat_member:chatMember = Update;
|
||||
|
||||
|
||||
//@description Contains a list of updates @updates List of updates
|
||||
updates updates:vector<Update> = Updates;
|
||||
|
Binary file not shown.
@ -12832,6 +12832,19 @@ void ContactsManager::on_update_channel_default_permissions(ChannelId channel_id
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date,
|
||||
DialogInviteLink invite_link,
|
||||
const DialogParticipant &old_dialog_participant,
|
||||
const DialogParticipant &new_dialog_participant) {
|
||||
CHECK(td_->auth_manager_->is_bot());
|
||||
td_->messages_manager_->force_create_dialog(dialog_id, "send_update_chat_member", true);
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateChatMember>(
|
||||
dialog_id.get(), get_user_id_object(agent_user_id, "send_update_chat_member"), date,
|
||||
invite_link.get_chat_invite_link_object(this), get_chat_member_object(old_dialog_participant),
|
||||
get_chat_member_object(new_dialog_participant)));
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped) {
|
||||
if (!td_->auth_manager_->is_bot()) {
|
||||
LOG(ERROR) << "Receive updateBotStopped by non-bot";
|
||||
@ -12852,10 +12865,12 @@ void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_
|
||||
std::swap(old_dialog_participant.status, new_dialog_participant.status);
|
||||
}
|
||||
|
||||
// TODO send update
|
||||
send_update_chat_member(DialogId(user_id), user_id, date, DialogInviteLink(), old_dialog_participant,
|
||||
new_dialog_participant);
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date,
|
||||
DialogInviteLink invite_link,
|
||||
tl_object_ptr<telegram_api::ChatParticipant> old_participant,
|
||||
tl_object_ptr<telegram_api::ChatParticipant> new_participant) {
|
||||
if (!td_->auth_manager_->is_bot()) {
|
||||
@ -12895,10 +12910,12 @@ void ContactsManager::on_update_chat_participant(ChatId chat_id, UserId user_id,
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO send update
|
||||
send_update_chat_member(DialogId(chat_id), user_id, date, invite_link, old_dialog_participant,
|
||||
new_dialog_participant);
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date,
|
||||
DialogInviteLink invite_link,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> old_participant,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> new_participant) {
|
||||
if (!td_->auth_manager_->is_bot()) {
|
||||
@ -12932,7 +12949,8 @@ void ContactsManager::on_update_channel_participant(ChannelId channel_id, UserId
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO send update
|
||||
send_update_chat_member(DialogId(channel_id), user_id, date, invite_link, old_dialog_participant,
|
||||
new_dialog_participant);
|
||||
}
|
||||
|
||||
void ContactsManager::update_contacts_hints(const User *u, UserId user_id, bool from_database) {
|
||||
|
@ -212,10 +212,10 @@ class ContactsManager : public Actor {
|
||||
void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count);
|
||||
|
||||
void on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped);
|
||||
void on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date,
|
||||
void on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
||||
tl_object_ptr<telegram_api::ChatParticipant> old_participant,
|
||||
tl_object_ptr<telegram_api::ChatParticipant> new_participant);
|
||||
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date,
|
||||
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> old_participant,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> new_participant);
|
||||
|
||||
@ -1368,6 +1368,10 @@ class ContactsManager : public Actor {
|
||||
void on_clear_imported_contacts(vector<Contact> &&contacts, vector<size_t> contacts_unique_id,
|
||||
std::pair<vector<size_t>, vector<Contact>> &&to_add, Promise<Unit> &&promise);
|
||||
|
||||
void send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date, DialogInviteLink invite_link,
|
||||
const DialogParticipant &old_dialog_participant,
|
||||
const DialogParticipant &new_dialog_participant);
|
||||
|
||||
static vector<td_api::object_ptr<td_api::chatNearby>> get_chats_nearby_object(
|
||||
const vector<DialogNearby> &dialogs_nearby);
|
||||
|
||||
|
@ -1963,14 +1963,16 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
|
||||
case telegram_api::updateChatParticipant::ID: {
|
||||
auto update = move_tl_object_as<telegram_api::updateChatParticipant>(update_ptr);
|
||||
td_->contacts_manager_->on_update_chat_participant(ChatId(update->chat_id_), UserId(update->user_id_),
|
||||
update->date_, std::move(update->prev_participant_),
|
||||
update->date_, DialogInviteLink(std::move(update->invite_)),
|
||||
std::move(update->prev_participant_),
|
||||
std::move(update->new_participant_));
|
||||
break;
|
||||
}
|
||||
case telegram_api::updateChannelParticipant::ID: {
|
||||
auto update = move_tl_object_as<telegram_api::updateChannelParticipant>(update_ptr);
|
||||
td_->contacts_manager_->on_update_channel_participant(ChannelId(update->channel_id_), UserId(update->user_id_),
|
||||
update->date_, std::move(update->prev_participant_),
|
||||
update->date_, DialogInviteLink(std::move(update->invite_)),
|
||||
std::move(update->prev_participant_),
|
||||
std::move(update->new_participant_));
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user