tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.07k stars 1.44k forks source link

Setting api_id and and api_hash in tdlib #575

Closed Kia-Pashang closed 5 years ago

Kia-Pashang commented 5 years ago

hi , where should i set api_id and api_hash in tdlib ?

MattNguyen commented 5 years ago

You have to pass the api_id and api_hash to the setTdlibParameters method.

Here's an example using the json interface in python: https://github.com/tdlib/td/blob/fca3eacf4bff9b3f1bc270aadbbd32bc99735a26/example/python/tdjson_example.py#L101

Kia-Pashang commented 5 years ago

@MattNguyen i used https://github.com/rizaumami/tdbot to build telegram-bot for Lua scripts but now for tdlib 1.4.0 its not working and i face some errors , now i wanna use this way to build telegram-bot with tdlib 1.4.0 for Lua and i have problem with setting api_id , api_hash and the directory for telegram-bot , can you help me about this please ?

levlam commented 5 years ago

@Kia-Pashang This is a fork of https://github.com/vysheng/tdbot, You need to merge last commit from that reporitory to make it compatible with TDLib 1.4.0.

Kia-Pashang commented 5 years ago

@Kia-Pashang This is a fork of https://github.com/vysheng/tdbot, You need to merge last commit from that reporitory to make it compatible with TDLib 1.4.0.

i face this error :

In file included from /root/tdbot/main.cpp:20:0: /root/tdbot/cliclient.hpp:49:22: error: expected ‘)’ before ‘stdin’ CliStdFd (td::Fd stdin, td::Fd stdout, CliClient *cli); ^ /root/tdbot/cliclient.hpp:57:9: error: ‘Fd’ in namespace ‘td’ does not name a type td::Fd stdin; ^ /root/tdbot/cliclient.hpp:58:9: error: ‘Fd’ in namespace ‘td’ does not name a type td::Fd stdout; ^ In file included from /root/tdbot/td/tdactor/td/actor/actor.h:14:0, from /root/tdbot/main.cpp:15: /root/tdbot/td/tdactor/td/actor/impl/Scheduler.h: In instantiation of ‘td::ActorOwn td::Scheduler::create_actor(td::Slice, Args&& ...) [with ActorT = td::ClientActor; Args = {std::unique_ptr<td::TdCallback, std::default_deletetd::TdCallback >}]’: /root/tdbot/td/tdactor/td/actor/impl/Scheduler.h:366:87: required from ‘td::ActorOwn td::create_actor(td::Slice, Args&& ...) [with ActorT = td::ClientActor; Args = {std::unique_ptr<td::TdCallback, std::default_deletetd::TdCallback >}]’ /root/tdbot/cliclient.hpp:212:86: required from here /root/tdbot/td/tdactor/td/actor/impl/Scheduler.h:81:111: error: no matching function for call to ‘td::ClientActor::ClientActor(std::unique_ptrtd::TdCallback)’ , new ActorT(std::forward(args)...), Actor::Deleter::Destroy, schedid); ^ In file included from /root/tdbot/cliclient.hpp:10:0, from /root/tdbot/main.cpp:20: /root/tdbot/td/td/telegram/ClientActor.h:59:3: note: candidate: td::ClientActor::ClientActor(td::ClientActor&&) ClientActor(ClientActor &&other); ^ /root/tdbot/td/td/telegram/ClientActor.h:59:3: note: no known conversion for argument 1 from ‘std::unique_ptrtd::TdCallback’ to ‘td::ClientActor&&’ /root/tdbot/td/td/telegram/ClientActor.h:34:12: note: candidate: td::ClientActor::ClientActor(td::unique_ptrtd::TdCallback) explicit ClientActor(unique_ptr callback); ^ /root/tdbot/td/td/telegram/ClientActor.h:34:12: note: no known conversion for argument 1 from ‘std::unique_ptrtd::TdCallback’ to ‘td::unique_ptrtd::TdCallback’ CMakeFiles/telegram-bot.dir/build.make:62: recipe for target 'CMakeFiles/telegram-bot.dir/main.cpp.o' failed make[3]: [CMakeFiles/telegram-bot.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:74: recipe for target 'CMakeFiles/telegram-bot.dir/all' failed make[2]: [CMakeFiles/telegram-bot.dir/all] Error 2 CMakeFiles/Makefile2:86: recipe for target 'CMakeFiles/telegram-bot.dir/rule' failed make[1]: [CMakeFiles/telegram-bot.dir/rule] Error 2 Makefile:162: recipe for target 'telegram-bot' failed make: [telegram-bot] Error 2

levlam commented 5 years ago

@Kia-Pashang You still haven't applied changes from commit https://github.com/vysheng/tdbot/commit/d976a7010df6c15f385eb504b5289e86bca93834 to the code.

Kia-Pashang commented 5 years ago

@Kia-Pashang You still haven't applied changes from commit vysheng/tdbot@d976a70 to the code.

it worked thanks alot 🌹🌹🌹