2018-12-31 20:04:05 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/DialogId.h"
|
2023-09-21 18:11:17 +02:00
|
|
|
#include "td/telegram/MessageFullId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/MessageId.h"
|
2021-10-27 16:32:09 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/UserId.h"
|
|
|
|
|
|
|
|
#include "td/utils/buffer.h"
|
|
|
|
#include "td/utils/common.h"
|
2022-06-27 12:30:18 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class CallbackQueriesManager {
|
|
|
|
public:
|
|
|
|
explicit CallbackQueriesManager(Td *td);
|
|
|
|
|
|
|
|
void answer_callback_query(int64 callback_query_id, const string &text, bool show_alert, const string &url,
|
|
|
|
int32 cache_time, Promise<Unit> &&promise) const;
|
|
|
|
|
|
|
|
void on_new_query(int32 flags, int64 callback_query_id, UserId sender_user_id, DialogId dialog_id,
|
|
|
|
MessageId message_id, BufferSlice &&data, int64 chat_instance, string &&game_short_name);
|
|
|
|
|
|
|
|
void on_new_inline_query(int32 flags, int64 callback_query_id, UserId sender_user_id,
|
2021-09-03 11:27:59 +02:00
|
|
|
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
|
2018-12-31 20:04:05 +01:00
|
|
|
int64 chat_instance, string &&game_short_name);
|
|
|
|
|
2024-06-07 12:06:25 +02:00
|
|
|
void on_new_business_query(int64 callback_query_id, UserId sender_user_id, string &&connection_id,
|
|
|
|
telegram_api::object_ptr<telegram_api::Message> &&message,
|
|
|
|
telegram_api::object_ptr<telegram_api::Message> &&reply_to_message, BufferSlice &&data,
|
|
|
|
int64 chat_instance);
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void send_callback_query(MessageFullId message_full_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
2021-09-27 22:22:10 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_HAS_MESSAGE = 1 << 0;
|
|
|
|
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_NEED_SHOW_ALERT = 1 << 1;
|
|
|
|
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_HAS_URL = 1 << 2;
|
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
static tl_object_ptr<td_api::CallbackQueryPayload> get_query_payload(int32 flags, BufferSlice &&data,
|
|
|
|
string &&game_short_name);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void send_get_callback_answer_query(MessageFullId message_full_id,
|
2020-08-18 08:32:37 +02:00
|
|
|
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
2021-09-27 22:22:10 +02:00
|
|
|
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
|
|
|
|
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
Td *td_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|