mirror of
https://github.com/tdlib/telegram-bot-api
synced 2025-08-28 12:57:53 +00:00
Add update "my_chat_member".
This commit is contained in:
parent
93158f05a7
commit
778c155b5c
@ -8254,6 +8254,8 @@ Client::Slice Client::get_update_type_name(UpdateType update_type) {
|
|||||||
return Slice("poll");
|
return Slice("poll");
|
||||||
case UpdateType::PollAnswer:
|
case UpdateType::PollAnswer:
|
||||||
return Slice("poll_answer");
|
return Slice("poll_answer");
|
||||||
|
case UpdateType::MyChatMember:
|
||||||
|
return Slice("my_chat_member");
|
||||||
case UpdateType::ChatMember:
|
case UpdateType::ChatMember:
|
||||||
return Slice("chat_member");
|
return Slice("chat_member");
|
||||||
default:
|
default:
|
||||||
@ -8531,8 +8533,10 @@ void Client::add_update_chat_member(object_ptr<td_api::updateChatMember> &&updat
|
|||||||
CHECK(update != nullptr);
|
CHECK(update != nullptr);
|
||||||
auto left_time = update->date_ + 86400 - get_unix_time();
|
auto left_time = update->date_ + 86400 - get_unix_time();
|
||||||
if (left_time > 0) {
|
if (left_time > 0) {
|
||||||
auto webhook_queue_id = update->chat_id_ + (static_cast<int64>(5) << 33);
|
bool is_my = (update->old_chat_member_->user_id_ == my_id_);
|
||||||
add_update(UpdateType::ChatMember, JsonChatMemberUpdated(update.get(), this), left_time, webhook_queue_id);
|
auto webhook_queue_id = update->chat_id_ + (static_cast<int64>(is_my ? 5 : 6) << 33);
|
||||||
|
auto update_type = is_my ? UpdateType::MyChatMember : UpdateType::ChatMember;
|
||||||
|
add_update(update_type, JsonChatMemberUpdated(update.get(), this), left_time, webhook_queue_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,6 +768,7 @@ class Client : public WebhookActor::Callback {
|
|||||||
PreCheckoutQuery,
|
PreCheckoutQuery,
|
||||||
Poll,
|
Poll,
|
||||||
PollAnswer,
|
PollAnswer,
|
||||||
|
MyChatMember,
|
||||||
ChatMember,
|
ChatMember,
|
||||||
Size
|
Size
|
||||||
};
|
};
|
||||||
@ -796,8 +797,9 @@ class Client : public WebhookActor::Callback {
|
|||||||
|
|
||||||
bool have_message_access(int64 chat_id) const;
|
bool have_message_access(int64 chat_id) const;
|
||||||
|
|
||||||
// by default all 14 update types up to ChatMember are allowed
|
// by default ChatMember updates are disabled
|
||||||
static constexpr td::uint32 DEFAULT_ALLOWED_UPDATE_TYPES = ((1 << 14) - 1);
|
static constexpr td::uint32 DEFAULT_ALLOWED_UPDATE_TYPES =
|
||||||
|
(1 << static_cast<int32>(UpdateType::Size)) - 1 - (1 << static_cast<int32>(UpdateType::ChatMember));
|
||||||
|
|
||||||
object_ptr<td_api::AuthorizationState> authorization_state_;
|
object_ptr<td_api::AuthorizationState> authorization_state_;
|
||||||
bool was_authorized_ = false;
|
bool was_authorized_ = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user