Update layer 122. Add updateNewInlineQuery.chat_type (can be sent by the server in the distant future).
This commit is contained in:
parent
a426105129
commit
6a38d219f0
@ -3444,8 +3444,8 @@ updateAnimationSearchParameters provider:string emojis:vector<string> = Update;
|
||||
updateSuggestedActions added_actions:vector<SuggestedAction> removed_actions:vector<SuggestedAction> = Update;
|
||||
|
||||
//@description A new incoming inline query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @user_location User location; may be null
|
||||
//@query Text of the query @offset Offset of the first entry to return
|
||||
updateNewInlineQuery id:int64 sender_user_id:int32 user_location:location query:string offset:string = Update;
|
||||
//@chat_type Contains information about the type of the chat, from which the query originated; may be null if unknown @query Text of the query @offset Offset of the first entry to return
|
||||
updateNewInlineQuery id:int64 sender_user_id:int32 user_location:location chat_type:ChatType query:string offset:string = Update;
|
||||
|
||||
//@description The user has chosen a result of an inline query; for bots only @sender_user_id Identifier of the user who sent the query @user_location User location; may be null
|
||||
//@query Text of the query @result_id Identifier of the chosen result @inline_message_id Identifier of the sent inline message, if known
|
||||
|
Binary file not shown.
@ -302,7 +302,7 @@ updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
|
||||
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
|
||||
updateStickerSets#43ae3dec = Update;
|
||||
updateSavedGifs#9375341e = Update;
|
||||
updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update;
|
||||
updateBotInlineQuery#3f2038db flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
|
||||
updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
|
||||
updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
|
||||
updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
|
||||
@ -1182,6 +1182,12 @@ phone.groupCall#66ab0bfc call:GroupCall participants:Vector<GroupCallParticipant
|
||||
|
||||
phone.groupParticipants#9cfeb92d count:int participants:Vector<GroupCallParticipant> next_offset:string users:Vector<User> version:int = phone.GroupParticipants;
|
||||
|
||||
inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;
|
||||
inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;
|
||||
inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;
|
||||
inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;
|
||||
inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
|
Binary file not shown.
@ -215,7 +215,7 @@ tl_object_ptr<telegram_api::inputBotInlineMessageID> InlineQueriesManager::get_i
|
||||
string InlineQueriesManager::get_inline_message_id(
|
||||
tl_object_ptr<telegram_api::inputBotInlineMessageID> &&input_bot_inline_message_id) {
|
||||
if (input_bot_inline_message_id == nullptr) {
|
||||
return "";
|
||||
return string();
|
||||
}
|
||||
LOG(INFO) << "Got inline message id: " << to_string(input_bot_inline_message_id);
|
||||
|
||||
@ -1734,7 +1734,8 @@ tl_object_ptr<td_api::inlineQueryResults> InlineQueriesManager::get_inline_query
|
||||
}
|
||||
|
||||
void InlineQueriesManager::on_new_query(int64 query_id, UserId sender_user_id, Location user_location,
|
||||
const string &query, const string &offset) {
|
||||
tl_object_ptr<telegram_api::InlineQueryPeerType> peer_type, const string &query,
|
||||
const string &offset) {
|
||||
if (!sender_user_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive new inline query from invalid " << sender_user_id;
|
||||
return;
|
||||
@ -1744,10 +1745,31 @@ void InlineQueriesManager::on_new_query(int64 query_id, UserId sender_user_id, L
|
||||
LOG(ERROR) << "Receive new inline query";
|
||||
return;
|
||||
}
|
||||
auto chat_type = [&]() -> td_api::object_ptr<td_api::ChatType> {
|
||||
if (peer_type == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (peer_type->get_id()) {
|
||||
case telegram_api::inlineQueryPeerTypeSameBotPM::ID:
|
||||
return td_api::make_object<td_api::chatTypePrivate>(sender_user_id.get());
|
||||
case telegram_api::inlineQueryPeerTypePM::ID:
|
||||
return td_api::make_object<td_api::chatTypePrivate>(0);
|
||||
case telegram_api::inlineQueryPeerTypeChat::ID:
|
||||
return td_api::make_object<td_api::chatTypeBasicGroup>(0);
|
||||
case telegram_api::inlineQueryPeerTypeMegagroup::ID:
|
||||
return td_api::make_object<td_api::chatTypeSupergroup>(0, false);
|
||||
case telegram_api::inlineQueryPeerTypeBroadcast::ID:
|
||||
return td_api::make_object<td_api::chatTypeSupergroup>(0, true);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}();
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
make_tl_object<td_api::updateNewInlineQuery>(
|
||||
query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewInlineQuery"),
|
||||
user_location.get_location_object(), query, offset));
|
||||
user_location.get_location_object(), std::move(chat_type), query, offset));
|
||||
}
|
||||
|
||||
void InlineQueriesManager::on_chosen_result(
|
||||
|
@ -62,7 +62,8 @@ class InlineQueriesManager : public Actor {
|
||||
|
||||
tl_object_ptr<td_api::inlineQueryResults> get_inline_query_results_object(uint64 query_hash);
|
||||
|
||||
void on_new_query(int64 query_id, UserId sender_user_id, Location user_location, const string &query,
|
||||
void on_new_query(int64 query_id, UserId sender_user_id, Location user_location,
|
||||
tl_object_ptr<telegram_api::InlineQueryPeerType> peer_type, const string &query,
|
||||
const string &offset);
|
||||
|
||||
void on_chosen_result(UserId user_id, Location user_location, const string &query, const string &result_id,
|
||||
|
@ -2018,7 +2018,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDcOptions> upda
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotInlineQuery> update, bool /*force_apply*/) {
|
||||
td_->inline_queries_manager_->on_new_query(update->query_id_, UserId(update->user_id_), Location(update->geo_),
|
||||
update->query_, update->offset_);
|
||||
std::move(update->peer_type_), update->query_, update->offset_);
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotInlineSend> update, bool /*force_apply*/) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user