tdlight/td/telegram/TranslationManager.h

44 lines
1.4 KiB
C
Raw Normal View History

2023-01-18 12:47:31 +01:00
//
2024-01-01 01:07:21 +01:00
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
2023-01-18 12:47:31 +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
2023-01-23 13:46:26 +01:00
#include "td/telegram/MessageEntity.h"
2023-01-18 12:47:31 +01:00
#include "td/telegram/td_api.h"
2023-01-18 14:34:49 +01:00
#include "td/telegram/telegram_api.h"
2023-01-18 12:47:31 +01:00
#include "td/actor/actor.h"
#include "td/utils/common.h"
#include "td/utils/Promise.h"
namespace td {
class Td;
class TranslationManager final : public Actor {
public:
TranslationManager(Td *td, ActorShared<> parent);
2023-01-18 14:34:49 +01:00
void translate_text(td_api::object_ptr<td_api::formattedText> &&text, const string &to_language_code,
Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
2023-01-18 12:47:31 +01:00
2023-01-23 13:46:26 +01:00
void translate_text(FormattedText text, bool skip_bot_commands, int32 max_media_timestamp,
const string &to_language_code, Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
2023-01-18 12:47:31 +01:00
private:
void tear_down() final;
2023-01-18 14:34:49 +01:00
void on_get_translated_texts(vector<telegram_api::object_ptr<telegram_api::textWithEntities>> texts,
bool skip_bot_commands, int32 max_media_timestamp,
2023-01-18 14:34:49 +01:00
Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
2023-01-18 12:47:31 +01:00
Td *td_;
ActorShared<> parent_;
};
} // namespace td