Tdlib class

Cheatset

Tdlib tg = Tdlib(
  // https://github.com/tdlib/td
  pathTdl: "libtdjson.so",
  clientOption: {
    // https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1set_tdlib_parameters.html
    "api_id": 0,
    "api_hash": "a",
    'database_directory': Directory.current.path,
    'files_directory': Directory.current.path,
    "new_verbosity_level": 0,
    "database_key": "",
  },
);
tg.on(tg.event_update, (UpdateTd update) async {
  print(update.raw);
});
tg.ensureInitializedIsolate();
Inheritance
Available extensions

Constructors

Tdlib({String? pathTdl, TelegramClientLibraryTdlibOptionParameter? clientOption, int task_max_count = 10000, int task_min_cooldown = 10, Duration? invokeTimeOut, String event_invoke = "invoke", String event_update = "update", Duration? delayUpdate, double timeOutUpdate = 1.0, EventEmitter? eventEmitter, Duration? delayInvoke, bool isAutoGetChat = false, FutureOr<Map> on_get_invoke_data(String extra, int client_id, TdlibBase libTdJson)?, FutureOr<void> on_receive_update(dynamic update, TdlibBase libTdJson)?, FutureOr<String> on_generate_extra_invoke(int client_id, TdlibBase libTdJson)?, bool isInvokeThrowOnError = true})
Cheatset

Properties

client_option TelegramClientLibraryTdlibOptionParameter
finalinherited
clients Map<int, TdlibClient>
finalinherited
delay_invoke Duration
getter/setter pairinherited
delay_update Duration?
getter/setter pairinherited
event_emitter ↔ EventEmitter
latefinalinherited
event_invoke String
finalinherited
event_update String
finalinherited
first_client_id int
no setterinherited
getFormatLibrary String
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
invoke_time_out Duration
getter/setter pairinherited
is_auto_get_chat bool
getter/setter pairinherited
is_init_isolate bool
getter/setter pairinherited
is_invoke_throw_on_error bool
getter/setter pairinherited
isolate Isolate
getter/setter pairinherited
on_generate_extra_invoke FutureOr<String> Function(int client_id, TdlibBase libTdJson)?
getter/setter pairinherited
on_get_invoke_data FutureOr<Map> Function(String extra, int client_id, TdlibBase libTdJson)?
getter/setter pairinherited
on_receive_update FutureOr<void> Function(dynamic update, TdlibBase libTdJson)?
getter/setter pairinherited
path_tdlib String
getter/setter pairinherited
receivePort ReceivePort
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
task_count int
getter/setter pairinherited
task_max_count int
getter/setter pairinherited
task_min_cooldown int
getter/setter pairinherited
timeOutUpdate double
getter/setter pairinherited

Methods

answerCallbackQuery(dynamic callback_query_id, {String? text, bool show_alert = false, String? url, int? cache_time, required int clientId, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
answerCallbackQuery for bot only
createclient({required int clientId, int clientUserId = 0, TelegramClientLibraryTdlibOptionParameter? clientOption, bool isBot = false, bool isVoid = false, bool isAutoSetOptionIfEmpty = true}) Future<Map>
add this for multithread on flutter apps
inherited
editMessageCaption({dynamic chat_id, dynamic message_id, dynamic inline_message_id, required String caption, String? parse_mode = "html", List? entities, bool? disable_web_page_preview = false, Map? reply_markup, required int clientId, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
editMessageText({dynamic chat_id, dynamic message_id, dynamic inline_message_id, required String text, String? parse_mode = "html", List? entities, bool? disable_web_page_preview = false, Map? reply_markup, required int clientId, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
editMessage text return result
ensureInitialized() Future<void>
inherited
existClientId(int clientId) bool
ahis for handle update api add this for handle update api
inherited
exitClientById(int clientId, {bool isClose = false, String? extra, bool isInvokeThrowOnError = true}) Future<bool>
inherited
getAllClientIds() List<int>
get all client id
inherited
getChat(dynamic chat_id, {bool is_detail = false, bool is_skip_reply_message = true, bool is_super_detail = false, bool is_more_detail = false, required int clientId, bool? isUseCache, Duration? durationCacheExpire, String? extra}) Future<Map>
getChat return result like bot api:
getChatMember(dynamic chat_id, dynamic user_id, {required int clientId, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
getChatMember return result
getClientById(int clientId) TdlibClient?
inherited
getClientByUserId(int clientUserId) TdlibClient?
inherited
getMe({required int clientId, bool? isUseCache, Duration? durationCacheExpire, String? extra}) Future<Map>
call api getMe with return human api result:
getMeClient({required int clientId, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
getMeClient
getMeClients({bool? isUseCache, Duration? durationCacheExpire}) Stream<Map>
getMe all client
getMessage(dynamic chat_id, dynamic message_id, {required String methodName, bool is_detail = false, bool is_skip_reply_message = false, bool is_super_detail = false, required int clientId, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
getMessageDetail and convert to api: return example:
getUser(dynamic user_id, {required int clientId, bool? isUseCache, Duration? durationCacheExpire, String? extra}) Future<Map>
getUser return result;
init() Future<void>
inherited
initClient(UpdateTd update, {Map? tdlibParameters, required int clientId, bool isVoid = false, String? extra, bool? isUseCache, Duration? durationCacheExpire, bool isInvokeThrowOnError = true}) Future<Map?>
set up authorizationStateWaitTdlibParameters new client without more code
invoke(String method, {Map? parameters, required int clientId, Duration? functionTimeOut, bool isVoid = false, Duration? delayDuration, Duration? invokeTimeOut, bool? isUseCache = false, Duration? durationCacheExpire, String? extra, bool? isAutoGetChat, bool? isInvokeThrowOnError, FutureOr<String> onGenerateExtraInvoke(int client_id, TdlibBase libTdJson)?, FutureOr<Map> onGetInvokeData(String extra, int client_id, TdlibBase libTdJson)?}) Future<Map>
call api latest Tdlib-Methods example:
inherited
invokeAllClients(String method, {Map? parameters, bool isVoid = false, bool? isUseCache, Duration? durationCacheExpire, Duration? delayDuration, Duration? invokeTimeOut, String? extra}) Stream<TdlibInvokeResult>
invoke request all client
invokeRaw({required Map parameters, required int clientId, required bool isVoid, required Duration delayDuration, required Duration invokeTimeOut, required Duration functionTimeOut, required bool isUseCache, required Duration durationCacheExpire, required String extra, required bool isAutoGetChat, required bool isInvokeThrowOnError, required FutureOr<String> onGenerateExtraInvoke(int client_id, TdlibBase libTdJson)?, required FutureOr<Map> onGetInvokeData(String extra, int client_id, TdlibBase libTdJson)?}) Future<Map>
call api latest Tdlib-Methods example:
inherited
invokeSync({required Map parameters, bool isThrowOnError = true}) Map
call api latest Tdlib-Methods example:
inherited
invokeSyncAllClients({required Map parameters, bool isVoid = false, Duration? delayDuration, Duration? invokeTimeOut, String? extra}) Stream<TdlibInvokeResult>
invokeSync request all client
jsonMessage(Map update, {Map? from_data, Map? chat_data, bool? isUseCache, Duration? durationCacheExpire, bool is_detail = false, required bool is_skip_reply_message, bool is_super_detail = false, bool is_more_detail = false, bool is_from_send_message = false, required int clientId}) Future<Map>
convert tdlib update to bot api for more humanize
makeParametersApi(Map<String, dynamic> parameters) Map<String, dynamic>
getRandom uuid for parameters @ convert api json method bot api to tdlib
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on(String type_update, FutureOr callback(UpdateTd update), {Map? stateData, void onError(Object data)?}) → EventEmitterListener
receive all update data
inherited
parseMode(String text, String? parse_mode, List? entities) Map
parse text to html or markdown
platformType() String
create client id for multi client
inherited
replyMarkup(dynamic keyboard) Map?
convert reply markup from bot api to tdlib only support bot
request(String method, {Map? parameters, required int clientId, bool isVoid = false, Duration? delayDuration, Duration? invokeTimeOut, String? extra, bool? isAutoGetChat, FutureOr<String> onGenerateExtraInvoke(int client_id, TdlibBase libTdJson)?, FutureOr<Map> onGetInvokeData(String extra, int client_id, TdlibBase libTdJson)?, bool? isInvokeThrowOnError, bool isAutoExtendMessage = false, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
call api more pretty use https://core.telegram.org/bots/api#available-methods not all methods are here example:
override
requestAllClients(String method, {Map? parameters, bool isVoid = false, String? extra, bool? isUseCache, Duration? durationCacheExpire}) Stream<TdlibInvokeResult>
invoke request all client
requestInvoke(String method, {Map? parameters, required int clientId, bool isVoid = false, Duration? delayDuration, Duration? invokeTimeOut, String? extra, bool? isAutoGetChat, FutureOr<String> onGenerateExtraInvoke(int client_id, TdlibBase libTdJson)?, FutureOr<Map> onGetInvokeData(String extra, int client_id, TdlibBase libTdJson)?, bool? isInvokeThrowOnError, bool isAutoExtendMessage = false, bool? isUseCache, Duration? durationCacheExpire}) Future<Map>
task_decrease() → void
inherited
task_increase() → void
inherited
td_create_client_id() int
inherited
td_execute(Map parameters) Map<String, dynamic>
td_send client_execute
inherited
td_send(int clientId, Map parameters) → void
td_send
inherited
toString() String
A string representation of this object.
inherited
typeFile(dynamic content) Map
auto set parameters input file
updateClientById(int clientId, {required TdlibClient newTdlibClient, String? extra, bool isInvokeThrowOnError = true}) Future<bool>
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited