arman92 / go-tdlib Goto Github PK
View Code? Open in Web Editor NEWGolang Telegram TdLib JSON bindings
License: GNU General Public License v3.0
Golang Telegram TdLib JSON bindings
License: GNU General Public License v3.0
I have a chat where contains 456 members, but i can get only 200 users, is there the to get they all, for example set offset parameter like in python in function get_chat_members from pyrogram"?
In python i can use function "get_chat_members" in "pyrogram" ans set offset parameter
I'm using that function in my code
cm,err := client.SearchChatMembers(-1001036605604,"",200,tdlib.NewChatMembersFilterMembers())
Telegram Bot API 2.0 contain varieties of buttons: https://core.telegram.org/bots/2-0-intro#switch-to-inline-buttons and I tried to handle them but didn't find a way how to do that.
Chat message from bot with buttons typed as *tdlib.MessageText
, with full text in Text.Text
area and text formatting options in Text.Entities
.
Is there any way to get button's text and entities?
Line 434 in 5bbe270
Please see https://github.com/Arman92/go-tl-parser/blob/master/schema.tl l.934
Just like you in README.md
git clone [email protected]:tdlib/td.git
Клонирование в «td»…
[email protected]: Permission denied (publickey).
and after:
git clone https://github.com/Arman92/go-tdlib td
Клонирование в «td»…
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 150 (delta 0), reused 0 (delta 0), pack-reused 146
Получение объектов: 100% (150/150), 541.41 KiB | 1.31 MiB/s, готово.
Определение изменений: 100% (65/65), готово.
But i have another erorr after:
cd td
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_BUILD_TYPE=Release ..
CMake Error: The source directory "/home/user/go/src/td" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
...
go run main.go
cgo-gcc-prolog: In function ‘_cgo_346a1d600dcf_Cfunc_td_set_log_file_path’:
cgo-gcc-prolog:144:2: warning: ‘td_set_log_file_path’ is deprecated [-Wdeprecated-declarations]
In file included from ../../pkg/mod/github.com/!arman92/[email protected]/tdlib.go:11:0:
/usr/local/include/td/telegram/td_log.h:33:30: note: declared here
TDJSON_DEPRECATED_EXPORT int td_set_log_file_path(const char *file_path);
^~~~~~~~~~~~~~~~~~~~
cgo-gcc-prolog: In function ‘_cgo_346a1d600dcf_Cfunc_td_set_log_verbosity_level’:
cgo-gcc-prolog:160:2: warning: ‘td_set_log_verbosity_level’ is deprecated [-Wdeprecated-declarations]
In file included from ../../pkg/mod/github.com/!arman92/[email protected]/tdlib.go:11:0:
/usr/local/include/td/telegram/td_log.h:59:31: note: declared here
TDJSON_DEPRECATED_EXPORT void td_set_log_verbosity_level(int new_verbosity_level);
^~~~~~~~~~~~~~~~~~~~~~~~~~
All the chats have order = 0
, so only first 100 chats could be received.
This is likely due to removal of updateChatOrder
in favor of updateChatPosition
: tdlib/td@0613614
Maybe tdlib classes regeneration would help?
Hack of tdlib.go for DestroyInstance()
var IsClosed = false
func NewClient(config Config) *Client {
// ...
go func() {
for !IsClosed {
// get update
updateBytes := client.Receive(10)
// ...
}
}()
// ...
}
usage:
tdlib.IsClosed = true
time.Sleep(1 * time.Second)
client.DestroyInstance()
https://core.telegram.org/tdlib/docs/td__json__client_8h.html
Can i retrieve all comments of channel post (new feature of telegram app)?
https://telegram.org/blog/filters-anonymous-admins-comments
thanks.
ERRO[0036] message repost failed. msg: {"id":94371840,"chat_id":-478600149,"sender_user_id":112620069,"is_outgoing":false,"content":{"@type":"messageText","text":{"@type":"formattedText","text":"yep","entities":[]}}}. tgbot.request: request api failed. code: 400, description: Bad Request: message to forward not found, method: forwardMessage, req: {"chat_id":-1001363008951,"from_chat_id":-478600149,"message_id":94371840}
for msg := range p.client.ListenNewMessages() {
err = p.bot.ForwardMessage(int64(chatId), msg.ChatId, msg.Id)
if err != nil {
logger.Errorf("message repost failed. msg: %s. %+v", msg, err)
}
}
Got this error:
../../../../pkg/mod/github.com/!arman92/[email protected]/tdlib.go:10:10: fatal error: 'td/telegram/td_json_client.h' file not found
#include <td/telegram/td_json_client.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I am running GO version 1.15.7 and first of all the install instructions does not work that is stated in the readme file.
There is no makefile for the "make install" to execute, at least not for me. So I followed the installation guide at https://tdlib.github.io/td/build.html?language=Go
I've managed to build everything but I have no idea where to place the TD folder so my program can link to it. When running "go build" or "go run main.go" I get
# github.com/Arman92/go-tdlib
vendor\github.com\Arman92\go-tdlib\tdlib.go:10:10: fatal error: td/telegram/td_json_client.h: No such file or directory
//#include <td/telegram/td_json_client.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
So the problem seems to be that GO does not find the C files, and hopefully this can be easily fixed by moving the "td" folder to the correct place.
Thanks in advance.
Is it possible to use this library with gomobile? If this is possible, could you help me compile tdlib for android with json interface and run the minimal example? I tried to follow the tips from here tdlib/td#77, but it looks like the JNI interface is not what I need in this case
%d is bad for float64
error! code: %!d(float64=3) msg: Member list is inaccessible
https://github.com/Arman92/go-tdlib/blob/master/examples/sendText/sendText.go
_, err := client.SendMessage(chatID, 0, false, true, nil, inputMsgTxt)
if err != nil {
log.Println(err)
}
error:
error! code: %!d(float64=5) msg: Chat not found
Can you add bot example? At least auth.
Thank you in advance ))
TDlib logs this error when password is sent with "SendAuthPassword" method.
The lib seems to be expecting 256 bytes and receives 255: https://github.com/tdlib/td/blob/e37f7d1537c963a0d7a2220825373847b2bbaaad/td/telegram/PasswordManager.cpp#L91
Could it be that something is not encoded properly?
go build -buildmode=c-shared -o /tmp/gomobile-work-729265132/lib/armeabi-v7a/libgotd.so gotd failed: exit status 2
/home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/../lib/armv7-a/libtdutils.a while searching for tdutils
/home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lssl
/home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/16/libtdutils.a while searching for tdutils
/home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/libtdutils.a while searching for tdutils
/home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /home/raif/Android/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/armv7-a/libtdutils.a while searching for tdutils
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:310: error: undefined reference to 'SSL_new'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:318: error: undefined reference to 'SSL_get0_param'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:333: error: undefined reference to 'SSL_set_bio'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:339: error: undefined reference to 'SSL_ctrl'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:342: error: undefined reference to 'SSL_set_connect_state'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:297: error: undefined reference to 'OPENSSL_init_ssl'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:164: error: undefined reference to 'TLS_client_method'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:171: error: undefined reference to 'SSL_CTX_new'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:183: error: undefined reference to 'SSL_CTX_set_options'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:185: error: undefined reference to 'SSL_CTX_ctrl'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:187: error: undefined reference to 'SSL_CTX_ctrl'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:239: error: undefined reference to 'SSL_CTX_load_verify_locations'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:229: error: undefined reference to 'SSL_CTX_set_default_verify_paths'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:250: error: undefined reference to 'SSL_CTX_set_verify'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:245: error: undefined reference to 'SSL_CTX_set_verify'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:248: error: undefined reference to 'SSL_CTX_set_verify_depth'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:254: error: undefined reference to 'SSL_CTX_set_cipher_list'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:0: error: undefined reference to 'SSL_CTX_free'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:149: error: undefined reference to 'SSL_is_init_finished'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:151: error: undefined reference to 'SSL_set_quiet_shutdown'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:152: error: undefined reference to 'SSL_shutdown'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:155: error: undefined reference to 'SSL_free'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:379: error: undefined reference to 'SSL_read'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:446: error: undefined reference to 'SSL_get_error'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdnet/td/net/SslStream.cpp:370: error: undefined reference to 'SSL_write'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdutils/td/utils/logging.cpp:0: error: undefined reference to '__android_log_write'
/home/raif/Android/android-ndk-r21d/toolchains/tddroid/tdbuild/td/tdutils/td/utils/logging.cpp:181: error: undefined reference to '__android_log_write'
/buildbot/src/android/binutils/prebuilts/ndk/current/platforms/android-16/arch-arm/lib/libcrypto.a(threads_pthread.o):threads_pthread.c:function fork_once_func: error: undefined reference to 'pthread_atfork'
bionic/libc/bionic/libc_init_common.cpp:105: error: undefined reference to 'pthread_atfork'
external/jemalloc_new/src/android_je_iterate.c:91: error: undefined reference to 'pthread_atfork'
external/jemalloc_new/src/jemalloc.c:1367: error: undefined reference to 'pthread_atfork'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i used https://github.com/bsglinux16/tddroid/ library for make
how do i send "typing..." status
Client.AddProxy
fails with timeout error when I'm trying to add tor as proxy. That same proxy configuration works in my Telegram client, but fails when I try to use it in code.
Am I missing something?
Minimal code reproducing the error:
package main
import (
"fmt"
"log"
"os"
"github.com/Arman92/go-tdlib"
)
func main() {
apiID := os.Getenv("TELEGRAM_API_ID")
apiHash := os.Getenv("TELEGRAM_API_HASH")
botToken := os.Getenv("TELEGRAM_BOT_TOKEN")
client := tdlib.NewClient(tdlib.Config{
APIID: apiID,
APIHash: apiHash,
SystemLanguageCode: "en",
DeviceModel: "Server",
SystemVersion: "1.0.0",
ApplicationVersion: "1.0.0",
UseMessageDatabase: true,
UseFileDatabase: true,
UseChatInfoDatabase: true,
UseTestDataCenter: false,
DatabaseDirectory: "./tdlib-db",
FileDirectory: "./tdlib-files",
IgnoreFileNames: false,
})
_, err := client.AddProxy("localhost", 9050, true, tdlib.NewProxyTypeSocks5("", ""))
if err != nil {
log.Fatalf("AddProxy: %v", err)
}
}
Full log:
�[1;36m[ 3][t 3][1584717900.858159304][Td.cpp:4707][#1][!Td][&td_requests] Sending update: updateOption {
name = "version"
value = optionValueString {
value = "1.6.0"
}
}�[0m
�[1;36m[ 3][t 0][1584717900.858172655][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000�[0m
�[1;36m[ 3][t 3][1584717900.858307838][Td.cpp:4707][#1][!Td][&td_requests] Sending update: updateAuthorizationState {
authorization_state = authorizationStateWaitTdlibParameters {
}
}�[0m
�[1;36m[ 3][t 0][1584717900.858319521][Client.cpp:276][&td_requests] End to wait for updates, returning object 0 0x7f05b8001890�[0m
�[1;36m[ 3][t 3][1584717900.858332396][Td.cpp:3592][#1][!Td][&td_requests] Receive request 1: addProxy {
server = "localhost"
port = 9050
enable = true
type = proxyTypeSocks5 {
username = ""
password = ""
}
}�[0m
�[1;36m[ 3][t 0][1584717900.858400583][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000�[0m
�[1;36m[ 3][t 0][1584717900.858410835][Client.cpp:276][&td_requests] End to wait for updates, returning object 0 0x7f05b8001e30�[0m
�[1;36m[ 3][t 0][1584717900.858433008][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000�[0m
2020/03/20 20:25:10 AddProxy: timeout
exit status 1
Thank you.
Is it possible to call high-level methods?
Like contacts.getStatuses.
There is part of error log. Seems like there is no linking.
/usr/local/lib/libtdcore.a(DialogFilter.cpp.o): In function td::DialogFilter::get_dialog_filter(td::tl::unique_ptr<td::telegram_api::dialogFilter>, bool)': DialogFilter.cpp:(.text._ZN2td12DialogFilter17get_dialog_filterENS_2tl10unique_ptrINS_12telegram_api12dialogFilterEEEb+0x125): undefined reference to
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::reserve(unsigned long)'
DialogFilter.cpp:(.text._ZN2td12DialogFilter17get_dialog_filterENS_2tl10unique_ptrINS_12telegram_api12dialogFilterEEEb+0x17c): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)' /usr/local/lib/libtdcore.a(DialogFilter.cpp.o): In function
td::DialogFilter::get_emoji_by_icon_name(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)':
DialogFilter.cpp:(.text._ZN2td12DialogFilter22get_emoji_by_icon_nameERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+0x31): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' /usr/local/lib/libtdcore.a(DialogFilter.cpp.o): In function
td::DialogFilter::init_icon_names()':
DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0x40f): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0x41b): undefined reference to
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)'
DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0x427): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0x433): undefined reference to
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)'
/usr/local/lib/libtdcore.a(DialogFilter.cpp.o):DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0x43f): more undefined references to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' follow /usr/local/lib/libtdcore.a(DialogFilter.cpp.o): In function
td::DialogFilter::init_icon_names()':
DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0xdb9): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0xdf5): undefined reference to
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)'
DialogFilter.cpp:(.text._ZN2td12DialogFilter15init_icon_namesEv+0xe3d): undefined reference to std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)' /usr/local/lib/libtdcore.a(DialogFilter.cpp.o): In function
td::DialogFilter::get_icon_name() const':
Hi,
I built an environment and try to modify the example to collect messages. When I restart the services in the third time. It stops working. So I print out the messages. It keeps giving me authorizationsStateWaitPhoneNumber
status. I can’t even enter my phone number in the console. Below is the code:
package main
import (
"fmt"
"log"
"math"
"os"
"os/signal"
"syscall"
"time"
"github.com/Arman92/go-tdlib"
"github.com/joho/godotenv"
)
const (
MaxAttempt = 10
)
var (
apiID string
apiHash string
)
var allChats []*tdlib.Chat
var haveFullChatList bool
func main() {
log.Println("Start Service")
log.Printf("API ID: %+v\n", apiID)
log.Printf("API HASH: %+v\n", apiHash)
tdlib.SetLogVerbosityLevel(1)
tdlib.SetFilePath("./errors.txt")
// Create new instance of client
client := tdlib.NewClient(tdlib.Config{
APIID: apiID,
APIHash: apiHash,
SystemLanguageCode: "en",
DeviceModel: "Server",
SystemVersion: "1.0.0",
ApplicationVersion: "1.0.0",
UseMessageDatabase: true,
UseFileDatabase: true,
UseChatInfoDatabase: true,
UseTestDataCenter: false,
DatabaseDirectory: "./tdlib-db",
FileDirectory: "./tdlib-files",
IgnoreFileNames: false,
})
log.Println("Starting auth")
// Wait while we get AuthorizationReady!
// Note: See authorization example for complete authorization sequence example
currentState, err := client.Authorize()
if err != nil {
log.Fatalf("Authorize error: %+v\n", err)
}
attempt := 0
for ; currentState.GetAuthorizationStateEnum() != tdlib.AuthorizationStateReadyType; currentState, err = client.Authorize() {
if err != nil {
log.Fatalf("Authorize error: %+v\n", err)
}
fmt.Printf("Current auth state: %+v\n", currentState)
attempt += 1
time.Sleep(5000 * time.Millisecond)
}
// get at most 1000 chats list
if err = getChatList(client, 1000); err != nil {
log.Fatalf("Error occurred in getChatList, msg: %+v\n", err)
}
log.Printf("got %d chats\n", len(allChats))
for _, chat := range allChats {
log.Printf("Chat title: %s \n", chat.Title)
}
signalTermination()
}
// see https://stackoverflow.com/questions/37782348/how-to-use-getchats-in-tdlib
func getChatList(client *tdlib.Client, limit int) error {
if !haveFullChatList && limit > len(allChats) {
offsetOrder := int64(math.MaxInt64)
offsetChatID := int64(0)
var lastChat *tdlib.Chat
if len(allChats) > 0 {
lastChat = allChats[len(allChats)-1]
offsetOrder = int64(lastChat.Order)
offsetChatID = lastChat.ID
}
// get chats (ids) from tdlib
chats, err := client.GetChats(tdlib.JSONInt64(offsetOrder),
offsetChatID, int32(limit-len(allChats)))
if err != nil {
return err
}
if len(chats.ChatIDs) == 0 {
haveFullChatList = true
return nil
}
for _, chatID := range chats.ChatIDs {
// get chat info from tdlib
chat, err := client.GetChat(chatID)
if err == nil {
allChats = append(allChats, chat)
} else {
return err
}
}
return getChatList(client, limit)
}
return nil
}
func signalTermination() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
<-c
}
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
apiID = os.Getenv("TELEGRAM_API_ID")
apiHash = os.Getenv("TELEGRAM_API_HASH")
}
Did I do something wrong?
How to register an account
I'm stuck at trying to pin a message that I sent to a supergroup:
I got Not enough rights to pin a message
when I call
result, err := client.SendAndCatch(tdlib.UpdateData{
"@type": "pinChatMessage",
"chat_id": newChat.ID,
"message_id": msgID,
"disable_notification": false,
})
I tried the supergroupID but the error was error! code: %!d(float64=6) msg: Message can't be pinned
I had tried the client method client.PinSupergroupMessage(mySuperGroup.SupergroupID, msgID, true)
which is of @type
pinSupergroupMessage
but it timed out
Hello guys, I want get supergroup info, but I don't know how to get the supergroup_id form *tdlib.Chat
My develop language is: Golang
Hi
I try to build my go app with your awesome lib on raspberry 3b
Previously, I successfully did it on my laptop. Now, I build tdlib on raspberry, put all compiled things to /usr/local/
$ ls /usr/local/include/td/*
/usr/local/include/td/telegram:
Client.h Log.h td_api.h td_api.hpp td_json_client.h td_log.h tdjson_export.h
/usr/local/include/td/tl:
TlObject.h
$ ls /usr/local/lib/
cmake libtdclient.a libtddb.a libtdjson.so.1.5.0 libtdjson_static.a libtdsqlite.a python2.7
libtdactor.a libtdcore.a libtdjson.so libtdjson_private.a libtdnet.a libtdutils.a python3.7```
But when I tried to build my app - I got a lot of errors
They are all about undefined reference
, like
...
/usr/bin/ld: mtproto_api.cpp:(.text._ZNK2td11mtproto_api17p_q_inner_data_dc5storeERNS_16TlStorerToStringEPKc+0x78): undefined reference to `std::__1
::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)'
/usr/bin/ld: mtproto_api.cpp:(.text._ZNK2td11mtproto_api17p_q_inner_data_dc5storeERNS_16TlStorerToStringEPKc+0x88): undefined reference to `std::__1
::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)'
...
/usr/bin/ld: mtproto_api.cpp:(.text._ZNK2td11mtproto_api17p_q_inner_data_dc5storeERNS_16TlStorerToStringEPKc+0x27c): undefined reference to `std::__
1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)'
/usr/bin/ld: mtproto_api.cpp:(.text._ZNK2td11mtproto_api17p_q_inner_data_dc5storeERNS_16TlStorerToStringEPKc+0x2a0): undefined reference to `std::__
1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: mtproto_api.cpp:(.text._ZNK2td11mtproto_api17p_q_inner_data_dc5storeERNS_16TlStorerToStringEPKc+0x2c0): undefined reference to `std::__
1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)'
...
utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0x24): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0x5c): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0x7c): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0x90): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0xa0): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)'
/usr/bin/ld: /usr/local/lib/libtdutils.a(utf8.cpp.o):utf8.cpp:(.text._ZN2td21append_utf8_characterERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj+0xb4): more undefined references to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)' follow
collect2: error: ld returned 1 exit status
And so on, and so on..
What I did wrong? Is there an issue with static/dynamic compiling of source tdlib?
Have you try to build your apps using your lib on arm?
Let me know, if you know, what can be the cause of errors.
Thanks a lot!
UPDATE:
go version go1.11.6 linux/arm
Linux raspberrypi 4.19.93-v7+ #1290 SMP Fri Jan 10 16:39:50 GMT 2020 armv7l GNU/Linux
I'm using Ubuntu 16.04 and use instruction for installing library on Ubuntu.
When I want to build the provided example I got the following errors:
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdsqlite.a(sqlite3.c.o): In function `sqlcipher_openssl_hmac':
sqlite3.c:(.text.sqlcipher_openssl_hmac+0x38): undefined reference to `HMAC_CTX_new'
sqlite3.c:(.text.sqlcipher_openssl_hmac+0x96): undefined reference to `HMAC_CTX_free'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdsqlite.a(sqlite3.c.o): In function `sqlcipher_openssl_activate':
sqlite3.c:(.text.sqlcipher_openssl_activate+0xa4): undefined reference to `OPENSSL_init_crypto'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdsqlite.a(sqlite3.c.o): In function `sqlcipher_openssl_ctx_init':
sqlite3.c:(.text.sqlcipher_openssl_ctx_init+0xbc): undefined reference to `OPENSSL_init_crypto'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdclient.a(Client.cpp.o): In function `std::thread::_State_impl<std::thread::_Invoker<std::tuple<td::detail::ThreadStl::ThreadStl<td::Client::Impl::init()::{lambda()#1}>(td::Client::Impl::init()::{lambda()#1}&&)::{lambda()#1}> > >::~_State_impl()':
Client.cpp:(.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_6Client4Impl4initEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED0Ev[_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_6Client4Impl4initEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED5Ev]+0x38): undefined reference to `std::thread::_State::~_State()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdclient.a(Client.cpp.o): In function `std::thread::_State_impl<std::thread::_Invoker<std::tuple<td::detail::ThreadStl::ThreadStl<td::Client::Impl::init()::{lambda()#1}>(td::Client::Impl::init()::{lambda()#1}&&)::{lambda()#1}> > >::~_State_impl()':
Client.cpp:(.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_6Client4Impl4initEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED2Ev[_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_6Client4Impl4initEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED5Ev]+0x3a): undefined reference to `std::thread::_State::~_State()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdclient.a(Client.cpp.o): In function `td::Client::Client()':
Client.cpp:(.text._ZN2td6ClientC2Ev+0x406): undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdcore.a(crypto.cpp.o): In function `td::RSA::from_pem(td::Slice)':
crypto.cpp:(.text._ZN2td3RSA8from_pemENS_5SliceE+0x6d0): undefined reference to `RSA_get0_key'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdactor.a(ConcurrentScheduler.cpp.o): In function `std::thread::_State_impl<std::thread::_Invoker<std::tuple<td::detail::ThreadStl::ThreadStl<td::ConcurrentScheduler::start()::{lambda()#1}>(td::ConcurrentScheduler::start()::{lambda()#1}&&)::{lambda()#1}> > >::~_State_impl()':
ConcurrentScheduler.cpp:(.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_19ConcurrentScheduler5startEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED2Ev+0x10): undefined reference to `std::thread::_State::~_State()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdactor.a(ConcurrentScheduler.cpp.o): In function `std::thread::_State_impl<std::thread::_Invoker<std::tuple<td::detail::ThreadStl::ThreadStl<td::ConcurrentScheduler::start()::{lambda()#1}>(td::ConcurrentScheduler::start()::{lambda()#1}&&)::{lambda()#1}> > >::~_State_impl()':
ConcurrentScheduler.cpp:(.text._ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN2td6detail9ThreadStlC4IZNS3_19ConcurrentScheduler5startEvEUlvE_JEEEOT_DpOT0_EUlvE_EEEEED0Ev+0x17): undefined reference to `std::thread::_State::~_State()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdactor.a(ConcurrentScheduler.cpp.o): In function `td::ConcurrentScheduler::start()':
ConcurrentScheduler.cpp:(.text._ZN2td19ConcurrentScheduler5startEv+0x11f): undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::detail::(anonymous namespace)::strm_create(bio_st*)':
SslStream.cpp:(.text._ZN2td6detail12_GLOBAL__N_111strm_createEP6bio_st[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0xa): undefined reference to `BIO_set_init'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::LambdaGuard<td::detail::SslStreamImpl::init(td::CSlice, td::CSlice, td::SslStream::VerifyPeer)::{lambda()#3}>::~LambdaGuard()':
SslStream.cpp:(.text._ZN2td11LambdaGuardIZNS_6detail13SslStreamImpl4initENS_6CSliceES3_NS_9SslStream10VerifyPeerEEUlvE1_ED2Ev[_ZN2td11LambdaGuardIZNS_6detail13SslStreamImpl4initENS_6CSliceES3_NS_9SslStream10VerifyPeerEEUlvE1_ED5Ev]+0x35): undefined reference to `SSL_is_init_finished'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::LambdaGuard<td::detail::SslStreamImpl::init(td::CSlice, td::CSlice, td::SslStream::VerifyPeer)::{lambda()#3}>::~LambdaGuard()':
SslStream.cpp:(.text._ZN2td11LambdaGuardIZNS_6detail13SslStreamImpl4initENS_6CSliceES3_NS_9SslStream10VerifyPeerEEUlvE1_ED0Ev[_ZN2td11LambdaGuardIZNS_6detail13SslStreamImpl4initENS_6CSliceES3_NS_9SslStream10VerifyPeerEEUlvE1_ED5Ev]+0x3b): undefined reference to `SSL_is_init_finished'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::detail::SslStreamImpl::init(td::CSlice, td::CSlice, td::SslStream::VerifyPeer)':
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x7e): undefined reference to `TLS_client_method'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0xa8): undefined reference to `SSL_CTX_set_options'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x37d): undefined reference to `OPENSSL_init_ssl'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x451): undefined reference to `BIO_set_data'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x635): undefined reference to `BIO_get_new_index'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x643): undefined reference to `BIO_meth_new'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x659): undefined reference to `BIO_meth_set_write'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x66f): undefined reference to `BIO_meth_set_read'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x685): undefined reference to `BIO_meth_set_create'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x69b): undefined reference to `BIO_meth_set_destroy'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x6b1): undefined reference to `BIO_meth_set_ctrl'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::detail::SslStreamImpl::~SslStreamImpl()':
SslStream.cpp:(.text._ZN2td6detail13SslStreamImplD2Ev[_ZN2td6detail13SslStreamImplD5Ev]+0x50): undefined reference to `SSL_is_init_finished'
SslStream.cpp:(.text._ZN2td6detail13SslStreamImplD2Ev[_ZN2td6detail13SslStreamImplD5Ev]+0x1ca): undefined reference to `SSL_is_init_finished'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::detail::(anonymous namespace)::strm_read(bio_st*, char*, int)':
SslStream.cpp:(.text._ZN2td6detail12_GLOBAL__N_19strm_readEP6bio_stPci[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x30): undefined reference to `BIO_get_data'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdnet.a(SslStream.cpp.o): In function `td::detail::(anonymous namespace)::strm_write(bio_st*, char const*, int)':
SslStream.cpp:(.text._ZN2td6detail12_GLOBAL__N_110strm_writeEP6bio_stPKci[_ZN2td6detail13SslStreamImpl4initENS_6CSliceES2_NS_9SslStream10VerifyPeerE]+0x2d): undefined reference to `BIO_get_data'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdutils.a(BigNum.cpp.o): In function `td::BigNum::ensure_const_time()':
BigNum.cpp:(.text._ZN2td6BigNum17ensure_const_timeEv+0x11): undefined reference to `BN_set_flags'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libtdutils.a(crypto.cpp.o): In function `td::init_crypto()':
crypto.cpp:(.text._ZN2td11init_cryptoEv+0xc9): undefined reference to `OPENSSL_init_crypto'
collect2: error: ld returned 1 exit status
I updated the tdlib and it lacks in the message type two fields SenderUserID and SenderChatID instead of this there is a Sender field how can I get the SenderUserID in the message filtering function?
I want to get information about a superuser group.
I use the chat example and try to access the superuser info with GetSupergroup().
The GetSupergroup() function accepts a int32 but the chat.ID returned by GetChat() is a int64.
Expected:
They both should be of the same type
When i try link tdlib as static lib i have this error in this line:
https://github.com/tdlib/td/blob/master/td/telegram/td_json_client.h#L50
Help me pls solve it...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xea1f3b]
goroutine 53 [running]:
github.com/Arman92/go-tdlib.(*Client).SendAndCatch(0x0, 0x1b31d20, 0xc000200cc0, 0x5, 0xc000205a98, 0x93fe8c77, 0xbfd9e98ddec3260e, 0xc00010c5a0, 0xc000188120)
/home/parallels/go/src/github.com/Arman92/go-tdlib/tdlib.go:269 +0x1fb
github.com/Arman92/go-tdlib.(*Client).GetChats(0x0, 0x7fffffffffffffff, 0x0, 0x3e8, 0xd, 0xc00003b708, 0x1)
/home/parallels/go/src/github.com/Arman92/go-tdlib/methods.go:905 +0x20a
_/home/parallels/Desktop/tglib/telegram.GetChatList(0x0, 0x3e8, 0x0, 0x0, 0x0, 0xc00002aac0, 0x1bda608)
/home/parallels/Desktop/tglib/telegram/telegram.go:192 +0x70
_/home/parallels/Desktop/tglib/telegram.UpdateTelegramGroupToDatabase(0x0)
/home/parallels/Desktop/tglib/telegram/telegram.go:250 +0x73
main.ScanTelegramGroup()
/home/parallels/Desktop/tglib/main.go:113 +0x2d
created by main.(*Service).ListenEvents
/home/parallels/Desktop/tglib/event.go:31 +0x313
Process finished with exit code 2
hi
i want build package for windows.I build tdlib based on this URLto get directory /src/
├── bin
│ └── tdjson.dll
├── include
│ └── td
│ ├── telegram
│ │ ├── Client.h
│ │ ├── Log.h
│ │ ├── td_api.h
│ │ ├── td_api.hpp
│ │ ├── td_json_client.h
│ │ ├── td_log.h
│ │ └── tdjson_export.h
│ └── tl
│ └── TlObject.h
└── lib
├── cmake
│ └── Td
│ ├── TdConfig.cmake
│ ├── TdConfigVersion.cmake
│ ├── TdTargets-release.cmake
│ └── TdTargets.cmake
├── tdactor.lib
├── tdapi.lib
├── tdclient.lib
├── tdcore.lib
├── tddb.lib
├── tdjson.lib
├── tdjson_private.lib
├── tdjson_static.lib
├── tdnet.lib
├── tdsqlite.lib
└── tdutils.lib
how setting cgo LDFLAGS?
original:
//#cgo windows CFLAGS: -IC:/src/td -IC:/src/td/build
//#cgo windows LDFLAGS: -LC:/src/td/build/Debug -ltdjson
i set:
//#cgo windows CFLAGS: -IC:/src/include
//#cgo windows LDFLAGS: -LC:/src/lib -tdactor -tdapi -tdclient -tdcore -tddb - tdjson -tdjson_private -tdjson_static -tdnet -tdsqlite -tdutils
Unfortunately it cannot be used!
client.RawUpdates undefined (type *tdlib.Client has no field or method RawUpdates)
I have cloned and built the tdlib with commands exactly from Readme
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -- -j5
make install
On macOS Mojave, i am unable to build the Go example (from Readme) itself because of error:
go build -o app/bin/run_backend
# github.com/Arman92/go-tdlib
../../go/src/github.com/Arman92/go-tdlib/tdlib.go:10:10: fatal error: 'td/telegram/td_json_client.h' file not found
#include <td/telegram/td_json_client.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [build] Error 2
I tried empty (default) GOPATH or appending path to td
clone to it.
To fix the error, create a symlink or copy "td/td" folder to /usr/local/include
:
$ ls -l /usr/local/include/td/.
total 0
drwxr-xr-x 33 travis staff 1056 May 14 04:21 generate
drwxr-xr-x 35 travis staff 1120 May 14 04:21 mtproto
drwxr-xr-x 206 travis staff 6592 May 14 04:21 telegram
drwxr-xr-x 9 travis staff 288 May 14 04:21 tl
After this, error changed to missing file tdjson_export.h
, and there is no such file anywhere.
First of all, great project and great job !
I propose to add GO modules related file to the directory
I suggest to set GO minimal required version to 1.13
I strongly advise starting to tag this project by following the semver convention and with the format v0.0.1
That will make your library compliant with go modules and will provide users of your library better control over the versions they want to use
WDYT @Arman92 ?
There is an issue with getting chat list. In some cases (why exactly it happens I couldn't understand) unmarshaling result.Raw to chatDummy fails with error "json: cannot unmarshal object into Go struct field .last_message of type tdlib.MessageSender".
I`ve attached result.Raw: https://pastebin.com/F1wq4zfg
I can't get url
parameter from inline keyboard
types.go:212
InlineKeyboardButtonTypeURLType InlineKeyboardButtonTypeEnum = "inlineKeyboardButtonTypeURL"
must be:
InlineKeyboardButtonTypeURLType InlineKeyboardButtonTypeEnum = "inlineKeyboardButtonTypeUrl"
Given I am a user of this library,
When I get an ID of a recent supergroup, the ID is int64 — 1001209913598, for instance. If I try to get information on this supergroup,
Then this example ID will overflow int32.
This happens because the function GetSupergroup takes in int32 as a param:
func (client *Client) GetSupergroup(supergroupID int32) (*Supergroup, error)
I'm not sure if I'm missing something here. Could we change the function signatures to become int64? I could create a PR with that, if you'd like.
@Arman92 thank you for the package!
I am getting the following error when building an example on Mac OS X Mojave:
# github.com/Arman92/go-tdlib Undefined symbols for architecture x86_64: "td::AesCtrState::init(td::UInt<256ul> const&, td::UInt<128ul> const&)", referenced from: td::Binlog::update_encryption(td::Slice, td::Slice) in libtddb.a(Binlog.cpp.o) td::FileDownloader::process_part(td::Part, td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a(FileDownloader.cpp.o) td::mtproto::tcp::ObfuscatedTransport::init(td::ChainBufferReader*, td::ChainBufferWriter*) in libtdcore.a(TcpTransport.cpp.o) "td::AesCtrState::decrypt(td::Slice, td::MutableSlice)", referenced from: td::FileDownloader::process_part(td::Part, td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a(FileDownloader.cpp.o) "td::AesCtrState::encrypt(td::Slice, td::MutableSlice)", referenced from: td::AesCtrByteFlow::loop() in libtddb.a(Binlog.cpp.o) td::AesCtrByteFlow::loop() in libtdcore.a(IStreamTransport.cpp.o) td::mtproto::tcp::ObfuscatedTransport::init(td::ChainBufferReader*, td::ChainBufferWriter*) in libtdcore.a(TcpTransport.cpp.o) td::mtproto::tcp::ObfuscatedTransport::write(td::BufferWriter&&, bool) in libtdcore.a(TcpTransport.cpp.o) td::AesCtrByteFlow::loop() in libtdcore.a(TcpTransport.cpp.o) "td::AesCtrState::AesCtrState(td::AesCtrState&&)", referenced from: td::Binlog::load_binlog(std::__1::function<void (td::BinlogEvent const&)> const&, std::__1::function<void (td::BinlogEvent const&)> const&) in libtddb.a(Binlog.cpp.o) td::Binlog::do_reindex() in libtddb.a(Binlog.cpp.o) "td::AesCtrState::AesCtrState()", referenced from: td::Binlog::Binlog() in libtddb.a(Binlog.cpp.o) td::Binlog::Binlog() in libtddb.a(Binlog.cpp.o) td::Binlog::update_read_encryption() in libtddb.a(Binlog.cpp.o) td::Binlog::update_write_encryption() in libtddb.a(Binlog.cpp.o) td::mtproto::create_transport(td::mtproto::TransportType) in libtdcore.a(IStreamTransport.cpp.o) td::FileDownloader::process_part(td::Part, td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a(FileDownloader.cpp.o) "td::AesCtrState::~AesCtrState()", referenced from: td::Binlog::~Binlog() in libtddb.a(Binlog.cpp.o) td::AesCtrByteFlow::~AesCtrByteFlow() in libtddb.a(Binlog.cpp.o) td::Binlog::load_binlog(std::__1::function<void (td::BinlogEvent const&)> const&, std::__1::function<void (td::BinlogEvent const&)> const&) in libtddb.a(Binlog.cpp.o) td::Binlog::do_reindex() in libtddb.a(Binlog.cpp.o) td::Binlog::update_read_encryption() in libtddb.a(Binlog.cpp.o) td::Binlog::update_write_encryption() in libtddb.a(Binlog.cpp.o) td::AesCtrByteFlow::~AesCtrByteFlow() in libtddb.a(Binlog.cpp.o) ... "td::AesCtrState::operator=(td::AesCtrState&&)", referenced from: td::Binlog::load_binlog(std::__1::function<void (td::BinlogEvent const&)> const&, std::__1::function<void (td::BinlogEvent const&)> const&) in libtddb.a(Binlog.cpp.o) td::Binlog::do_reindex() in libtddb.a(Binlog.cpp.o) td::Binlog::update_read_encryption() in libtddb.a(Binlog.cpp.o) td::Binlog::update_write_encryption() in libtddb.a(Binlog.cpp.o) "td::Sha256State::Sha256State()", referenced from: td::ActorOwn<td::FileHashUploader> td::create_actor<td::FileHashUploader, td::FullLocalFileLocation const&, long long&, std::__1::unique_ptr<td::FileLoadManager::FileHashUploaderCallback, std::__1::default_delete<td::FileLoadManager::FileHashUploaderCallback> > >(td::Slice, td::FullLocalFileLocation const&&&, long long&&&, std::__1::unique_ptr<td::FileLoadManager::FileHashUploaderCallback, std::__1::default_delete<td::FileLoadManager::FileHashUploaderCallback> >&&) in libtdcore.a(FileLoadManager.cpp.o) td::mtproto::Transport::calc_message_key2(td::mtproto::AuthKey const&, int, td::Slice) in libtdcore.a(Transport.cpp.o) "td::Sha256State::~Sha256State()", referenced from: td::mtproto::Transport::calc_message_key2(td::mtproto::AuthKey const&, int, td::Slice) in libtdcore.a(Transport.cpp.o) td::FileHashUploader::~FileHashUploader() in libtdcore.a(FileHashUploader.cpp.o) "td::hmac_sha256(td::Slice, td::Slice, td::MutableSlice)", referenced from: td::Binlog::do_event(td::BinlogEvent&&) in libtddb.a(Binlog.cpp.o) td::Binlog::reset_encryption() in libtddb.a(Binlog.cpp.o) "td::init_crypto()", referenced from: td::RSA::from_pem(td::Slice) in libtdcore.a(crypto.cpp.o) "td::sha256_init(td::Sha256State*)", referenced from: td::mtproto::Transport::calc_message_key2(td::mtproto::AuthKey const&, int, td::Slice) in libtdcore.a(Transport.cpp.o) td::FileHashUploader::init() in libtdcore.a(FileHashUploader.cpp.o) "td::pq_factorize(td::Slice, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from: td::mtproto::AuthKeyHandshake::on_res_pq(td::Slice, td::mtproto::AuthKeyHandshake::Callback*, td::PublicRsaKeyInterface*) in libtdcore.a(Handshake.cpp.o) "td::sha256_final(td::Sha256State*, td::MutableSlice)", referenced from: td::mtproto::Transport::calc_message_key2(td::mtproto::AuthKey const&, int, td::Slice) in libtdcore.a(Transport.cpp.o) td::FileHashUploader::loop_impl() in libtdcore.a(FileHashUploader.cpp.o) "td::BigNumContext::BigNumContext(td::BigNumContext&&)", referenced from: td::Result<td::SecretChatActor::AuthState> td::SecretChatDb::get_value<td::SecretChatActor::AuthState>() in libtdcore.a(SecretChatActor.cpp.o) td::Result<td::SecretChatActor::AuthState>::move_as_ok() in libtdcore.a(SecretChatActor.cpp.o) td::Result<td::SecretChatActor::PfsState> td::SecretChatDb::get_value<td::SecretChatActor::PfsState>() in libtdcore.a(SecretChatActor.cpp.o) td::Result<td::SecretChatActor::PfsState>::move_as_ok() in libtdcore.a(SecretChatActor.cpp.o) "td::BigNumContext::BigNumContext()", referenced from: td::CallActor::CallActor(td::CallId, td::ActorShared<td::Actor>, td::Promise<long long>) in libtdcore.a(CallActor.cpp.o) td::CallActor::CallActor(td::CallId, td::ActorShared<td::Actor>, td::Promise<long long>) in libtdcore.a(CallActor.cpp.o) td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::dh_handshake(int, td::Slice, td::Slice, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, td::DhCallback*) in libtdcore.a(crypto.cpp.o) td::SecretChatActor::SecretChatActor(int, std::__1::unique_ptr<td::SecretChatActor::Context, std::__1::default_delete<td::SecretChatActor::Context> >, bool) in libtdcore.a(SecretChatActor.cpp.o) td::SecretChatActor::request_new_key() in libtdcore.a(SecretChatActor.cpp.o) ... "td::BigNumContext::~BigNumContext()", referenced from: td::CallActor::~CallActor() in libtdcore.a(CallActor.cpp.o) td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::dh_handshake(int, td::Slice, td::Slice, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, td::DhCallback*) in libtdcore.a(crypto.cpp.o) td::SecretChatActor::request_new_key() in libtdcore.a(SecretChatActor.cpp.o) td::SecretChatActor::start_up() in libtdcore.a(SecretChatActor.cpp.o) td::Result<td::SecretChatActor::AuthState> td::SecretChatDb::get_value<td::SecretChatActor::AuthState>() in libtdcore.a(SecretChatActor.cpp.o) ... "td::BigNumContext::operator=(td::BigNumContext&&)", referenced from: td::DhHandshake::operator=(td::DhHandshake&&) in libtdcore.a(SecretChatActor.cpp.o) "td::pbkdf2_sha256(td::Slice, td::Slice, int, td::MutableSlice)", referenced from: td::detail::AesCtrEncryptionEvent::generate_key(td::DbKey const&) in libtddb.a(Binlog.cpp.o) "td::sha256_update(td::Slice, td::Sha256State*)", referenced from: td::mtproto::Transport::calc_message_key2(td::mtproto::AuthKey const&, int, td::Slice) in libtdcore.a(Transport.cpp.o) td::FileHashUploader::loop_sha() in libtdcore.a(FileHashUploader.cpp.o) "td::aes_cbc_decrypt(td::UInt<256ul> const&, td::UInt<128ul>*, td::Slice, td::MutableSlice)", referenced from: td::decode_config(td::Slice) in libtdcore.a(ConfigManager.cpp.o) "td::aes_ige_decrypt(td::UInt<256ul> const&, td::UInt<256ul>*, td::Slice, td::MutableSlice)", referenced from: td::FileDownloader::process_part(td::Part, td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a(FileDownloader.cpp.o) td::mtproto::AuthKeyHandshake::on_server_dh_params(td::Slice, td::mtproto::AuthKeyHandshake::Callback*, td::DhCallback*) in libtdcore.a(Handshake.cpp.o) td::Status td::mtproto::Transport::read_crypto_impl<td::mtproto::CryptoHeader, td::mtproto::CryptoPrefix>(int, td::MutableSlice, td::mtproto::AuthKey const&, td::mtproto::CryptoHeader**, td::mtproto::CryptoPrefix**, td::MutableSlice*, td::mtproto::PacketInfo*) in libtdcore.a(Transport.cpp.o) td::Status td::mtproto::Transport::read_crypto_impl<td::mtproto::EndToEndHeader, td::mtproto::EndToEndPrefix>(int, td::MutableSlice, td::mtproto::AuthKey const&, td::mtproto::EndToEndHeader**, td::mtproto::EndToEndPrefix**, td::MutableSlice*, td::mtproto::PacketInfo*) in libtdcore.a(Transport.cpp.o) "td::aes_ige_encrypt(td::UInt<256ul> const&, td::UInt<256ul>*, td::Slice, td::MutableSlice)", referenced from: td::FileUploader::generate_iv_map() in libtdcore.a(FileUploader.cpp.o) td::FileUploader::start_part(td::Part, int) in libtdcore.a(FileUploader.cpp.o) td::mtproto::AuthKeyHandshake::on_server_dh_params(td::Slice, td::mtproto::AuthKeyHandshake::Callback*, td::DhCallback*) in libtdcore.a(Handshake.cpp.o) void td::mtproto::Transport::write_crypto_impl<td::mtproto::CryptoHeader>(int, td::Storer const&, td::mtproto::AuthKey const&, td::mtproto::PacketInfo*, td::mtproto::CryptoHeader*, unsigned long) in libtdcore.a(Transport.cpp.o) void td::mtproto::Transport::write_crypto_impl<td::mtproto::EndToEndHeader>(int, td::Storer const&, td::mtproto::AuthKey const&, td::mtproto::PacketInfo*, td::mtproto::EndToEndHeader*, unsigned long) in libtdcore.a(Transport.cpp.o) "td::init_openssl_threads()", referenced from: td::Client::Client() in libtdclient.a(Client.cpp.o) td::Client::Client() in libtdclient.a(Client.cpp.o) "td::verbosity_connections", referenced from: td::ConnectionCreator::client_loop(td::ConnectionCreator::ClientInfo&) in libtdcore.a(ConnectionCreator.cpp.o) td::ConnectionCreator::request_raw_connection(td::DcId, bool, bool, td::Promise<std::__1::unique_ptr<td::mtproto::RawConnection, std::__1::default_delete<td::mtproto::RawConnection> > >, unsigned long) in libtdcore.a(ConnectionCreator.cpp.o) td::ConnectionCreator::client_set_timeout_at(td::ConnectionCreator::ClientInfo&, double) in libtdcore.a(ConnectionCreator.cpp.o) td::ConnectionCreator::client_create_raw_connection(td::Result<td::ConnectionCreator::ConnectionData>, bool, bool, unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int) in libtdcore.a(ConnectionCreator.cpp.o) auto td::ConnectionCreator::client_loop(td::ConnectionCreator::ClientInfo&)::$_1::operator()<std::__1::pair<std::__1::unique_ptr<td::mtproto::RawConnection, std::__1::default_delete<td::mtproto::RawConnection> >, double> >(std::__1::pair<std::__1::unique_ptr<td::mtproto::RawConnection, std::__1::default_delete<td::mtproto::RawConnection> >, double>&) const in libtdcore.a(ConnectionCreator.cpp.o) td::ConnectionCreator::client_create_raw_connection(td::Result<td::ConnectionCreator::ConnectionData>, bool, bool, unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int)::$_4::operator()(td::Result<std::__1::unique_ptr<td::mtproto::RawConnection, std::__1::default_delete<td::mtproto::RawConnection> > >) in libtdcore.a(ConnectionCreator.cpp.o) "td::md5(td::Slice, td::MutableSlice)", referenced from: td::FileManager::on_upload_ok(unsigned long long, td::FileType, td::PartialRemoteFileLocation const&, long long) in libtdcore.a(FileManager.cpp.o) "td::sha1(td::Slice, unsigned char*)", referenced from: td::RSA::get_fingerprint() const in libtdcore.a(crypto.cpp.o) td::dh_auth_key_id(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libtdcore.a(crypto.cpp.o) td::DhHandshake::gen_key() in libtdcore.a(crypto.cpp.o) td::DhHandshake::calc_key_id(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libtdcore.a(crypto.cpp.o) td::KDF(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, td::UInt<128ul> const&, int, td::UInt<256ul>*, td::UInt<256ul>*) in libtdcore.a(crypto.cpp.o) td::tmp_KDF(td::UInt<128ul> const&, td::UInt<256ul> const&, td::UInt<256ul>*, td::UInt<256ul>*) in libtdcore.a(crypto.cpp.o) td::SecretChatActor::calc_key_hash() in libtdcore.a(SecretChatActor.cpp.o) ... "td::BigNum::from_binary(td::Slice)", referenced from: td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_g_a(td::Slice) in libtdcore.a(crypto.cpp.o) void td::DhHandshake::parse<td::TlParser>(td::TlParser&) in libtdcore.a(SecretChatActor.cpp.o) "td::BigNum::ensure_const_time()", referenced from: td::RSA::RSA(td::BigNum, td::BigNum) in libtdcore.a(crypto.cpp.o) td::RSA::RSA(td::BigNum, td::BigNum) in libtdcore.a(crypto.cpp.o) td::RSA::clone() const in libtdcore.a(crypto.cpp.o) td::RSA::from_pem(td::Slice) in libtdcore.a(crypto.cpp.o) "td::BigNum::sub(td::BigNum&, td::BigNum const&, td::BigNum const&)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::random(td::BigNum&, int, int, int)", referenced from: td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) "td::BigNum::compare(td::BigNum const&, td::BigNum const&)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::mod_exp(td::BigNum&, td::BigNum const&, td::BigNum const&, td::BigNum const&, td::BigNumContext&)", referenced from: td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::gen_key() in libtdcore.a(crypto.cpp.o) "td::BigNum::set_bit(int)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::from_raw(void*)", referenced from: td::RSA::from_pem(td::Slice) in libtdcore.a(crypto.cpp.o) "td::BigNum::set_value(unsigned int)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) void td::DhHandshake::parse<td::TlParser>(td::TlParser&) in libtdcore.a(SecretChatActor.cpp.o) "td::BigNum::BigNum(td::BigNum&&)", referenced from: td::decode_config(td::Slice) in libtdcore.a(ConfigManager.cpp.o) td::RSA::RSA(td::BigNum, td::BigNum) in libtdcore.a(crypto.cpp.o) td::RSA::RSA(td::BigNum, td::BigNum) in libtdcore.a(crypto.cpp.o) td::RSA::clone() const in libtdcore.a(crypto.cpp.o) td::RSA::from_pem(td::Slice) in libtdcore.a(crypto.cpp.o) td::Result<td::SecretChatActor::AuthState> td::SecretChatDb::get_value<td::SecretChatActor::AuthState>() in libtdcore.a(SecretChatActor.cpp.o) td::Result<td::SecretChatActor::AuthState>::move_as_ok() in libtdcore.a(SecretChatActor.cpp.o) ... "td::BigNum::BigNum(td::BigNum const&)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) void std::__1::vector<td::PublicRsaKeyShared::RsaOption, std::__1::allocator<td::PublicRsaKeyShared::RsaOption> >::__push_back_slow_path<td::PublicRsaKeyShared::RsaOption>(td::PublicRsaKeyShared::RsaOption&&) in libtdcore.a(PublicRsaKeyShared.cpp.o) "td::BigNum::BigNum()", referenced from: td::CallActor::CallActor(td::CallId, td::ActorShared<td::Actor>, td::Promise<long long>) in libtdcore.a(CallActor.cpp.o) td::CallActor::CallActor(td::CallId, td::ActorShared<td::Actor>, td::Promise<long long>) in libtdcore.a(CallActor.cpp.o) td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::gen_key() in libtdcore.a(crypto.cpp.o) ... "td::BigNum::~BigNum()", referenced from: td::CallActor::~CallActor() in libtdcore.a(CallActor.cpp.o) td::decode_config(td::Slice) in libtdcore.a(ConfigManager.cpp.o) td::RSA::~RSA() in libtdcore.a(ConfigManager.cpp.o) td::PublicRsaKeyShared::~PublicRsaKeyShared() in libtdcore.a(ConfigManager.cpp.o) td::PublicRsaKeyShared::~PublicRsaKeyShared() in libtdcore.a(NetQueryDispatcher.cpp.o) td::RSA::clone() const in libtdcore.a(crypto.cpp.o) td::RSA::from_pem(td::Slice) in libtdcore.a(crypto.cpp.o) ... "td::BigNum::operator=(td::BigNum&&)", referenced from: td::DhHandshake::set_config(int, td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::set_g_a(td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::operator=(td::DhHandshake&&) in libtdcore.a(SecretChatActor.cpp.o) void td::DhHandshake::parse<td::TlParser>(td::TlParser&) in libtdcore.a(SecretChatActor.cpp.o) "td::BigNum::operator/=(unsigned int)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::operator-=(unsigned int)", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::Random::secure_bytes(td::MutableSlice)", referenced from: td::FileEncryptionKey::create() in libtdcore.a(FileManager.cpp.o) td::PasswordManager::do_update_password_settings(td::PasswordManager::UpdateSettings, td::PasswordManager::PasswordState, td::Promise<bool>) in libtdcore.a(PasswordManager.cpp.o) td::TdDb::init(int, td::TdParameters const&, td::DbKey, td::TdDb::Events&) in libtdcore.a(TdDb.cpp.o) td::Binlog::reset_encryption() in libtddb.a(Binlog.cpp.o) td::FileUploader::start_part(td::Part, int) in libtdcore.a(FileUploader.cpp.o) "td::Random::secure_bytes(unsigned char*, unsigned long)", referenced from: td::mtproto::PingConnection::flush() in libtdcore.a(ConnectionCreator.cpp.o) td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::SecretChatActor::create_encrypted_message(int, int, int, std::__1::unique_ptr<td::secret_api::DecryptedMessage, std::__1::default_delete<td::secret_api::DecryptedMessage> >&) in libtdcore.a(SecretChatActor.cpp.o) td::Session::Session(std::__1::unique_ptr<td::Session::Callback, std::__1::default_delete<td::Session::Callback> >, std::__1::shared_ptr<td::AuthDataShared>, bool, bool, bool, td::mtproto::AuthKey const&) in libtdcore.a(Session.cpp.o) td::mtproto::AuthKeyHandshake::on_res_pq(td::Slice, td::mtproto::AuthKeyHandshake::Callback*, td::PublicRsaKeyInterface*) in libtdcore.a(Handshake.cpp.o) td::mtproto::AuthKeyHandshake::on_server_dh_params(td::Slice, td::mtproto::AuthKeyHandshake::Callback*, td::DhCallback*) in libtdcore.a(Handshake.cpp.o) td::mtproto::AuthKeyHandshake::on_start(td::mtproto::AuthKeyHandshake::Callback*) in libtdcore.a(Handshake.cpp.o) ... "td::Random::secure_int32()", referenced from: td::CallActor::try_send_request_query() in libtdcore.a(CallActor.cpp.o) td::get_thumbnail_photo_size(td::FileManager*, td::BufferSlice, td::DialogId, int, int) in libtdcore.a(Photo.cpp.o) td::SecretChatsManager::create_chat(int, long long, td::Promise<td::SecretChatId>) in libtdcore.a(SecretChatsManager.cpp.o) td::SecretChatsManager::make_secret_chat_context(int) in libtdcore.a(SecretChatsManager.cpp.o) td::MultiSequenceDispatcher::send_with_callback(td::ObjectPool<td::NetQuery>::OwnerPtr, td::ActorShared<td::NetQueryCallback>, unsigned long long) in libtdcore.a(SequenceDispatcher.cpp.o) td::mtproto::AuthData::next_message_id(double) in libtdcore.a(AuthData.cpp.o) "td::Random::secure_int64()", referenced from: td::get_thumbnail_photo_size(td::FileManager*, td::BufferSlice, td::DialogId, int, int) in libtdcore.a(Photo.cpp.o) td::ContactsManager::get_blocked_users(int, int, td::Promise<td::Unit>&&) in libtdcore.a(ContactsManager.cpp.o) td::ContactsManager::import_contacts(std::__1::vector<std::__1::unique_ptr<td::td_api::contact, std::__1::default_delete<td::td_api::contact> >, std::__1::allocator<std::__1::unique_ptr<td::td_api::contact, std::__1::default_delete<td::td_api::contact> > > > const&, long long&, td::Promise<td::Unit>&&) in libtdcore.a(ContactsManager.cpp.o) td::ContactsManager::get_channel_participant(td::ChannelId, td::UserId, long long&, bool, td::Promise<td::Unit>&&) in libtdcore.a(ContactsManager.cpp.o) td::ContactsManager::get_channel_participants(td::ChannelId, std::__1::unique_ptr<td::td_api::SupergroupMembersFilter, std::__1::default_delete<td::td_api::SupergroupMembersFilter> > const&, int, int, long long&, bool, td::Promise<td::Unit>&&) in libtdcore.a(ContactsManager.cpp.o) td::MessagesManager::on_send_message_file_part_missing(long long, int) in libtdcore.a(MessagesManager.cpp.o) td::MessagesManager::create_new_group_chat(std::__1::vector<td::UserId, std::__1::allocator<td::UserId> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long long&, td::Promise<td::Unit>&&) in libtdcore.a(MessagesManager.cpp.o) ... "td::sha256(td::Slice, td::MutableSlice)", referenced from: td::AuthManager::check_password(unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libtdcore.a(AuthManager.cpp.o) td::CallActor::get_emojis_fingerprint(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libtdcore.a(CallActor.cpp.o) td::decode_config(td::Slice) in libtdcore.a(ConfigManager.cpp.o) td::calc_password_hash(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libtdcore.a(PasswordManager.cpp.o) td::DhHandshake::set_g_a(td::Slice) in libtdcore.a(crypto.cpp.o) td::DhHandshake::get_g_b_hash() const in libtdcore.a(crypto.cpp.o) td::KDF2(td::Slice, td::UInt<128ul> const&, int, td::UInt<256ul>*, td::UInt<256ul>*) in libtdcore.a(crypto.cpp.o) ... "td::IPAddress::init_host_port(td::CSlice, int)", referenced from: td::ConnectionCreator::client_loop(td::ConnectionCreator::ClientInfo&) in libtdcore.a(ConnectionCreator.cpp.o) td::GetHostByNameActor::load_ip(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int) in libtdnet.a(GetHostByNameActor.cpp.o) td::Wget::try_init() in libtdnet.a(Wget.cpp.o) (maybe you meant: __ZN2td9IPAddress14init_host_portENS_6CSliceEib) "td::BigNum::is_bit_set(int) const", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::get_num_bits() const", referenced from: td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::clone() const", referenced from: td::RSA::clone() const in libtdcore.a(crypto.cpp.o) "td::BigNum::is_prime(td::BigNumContext&) const", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) "td::BigNum::to_binary(int) const", referenced from: td::RSA::get_fingerprint() const in libtdcore.a(crypto.cpp.o) td::RSA::encrypt(unsigned char*, unsigned long, unsigned char*) const in libtdcore.a(crypto.cpp.o) td::RSA::decrypt(td::Slice, td::MutableSlice) const in libtdcore.a(crypto.cpp.o) td::DhHandshake::get_g_a() const in libtdcore.a(crypto.cpp.o) td::DhHandshake::get_g_b() const in libtdcore.a(crypto.cpp.o) td::DhHandshake::get_g_b_hash() const in libtdcore.a(crypto.cpp.o) td::DhHandshake::gen_key() in libtdcore.a(crypto.cpp.o) ... "td::BigNum::operator%(unsigned int) const", referenced from: td::DhHandshake::dh_check(td::Slice, td::BigNum const&, int, td::BigNum const&, td::BigNum const&, td::BigNumContext&, td::DhCallback*) in libtdcore.a(crypto.cpp.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Do you have any ideas about a possible fix for this issue or maybe I am missing something?
Please help me! :)
Please add ViewMessages example that reads message from chat and marks this message as read.
Can't make this work :(
Hello!
There is method GetChat
which returns chat information (Chat
struct), but it does not include user id, who are you chatting with.
Is it possible to get chat user id?
capacity
argument is unused in unused in GetRawUpdatesChannel()
:
Lines 161 to 164 in b17628c
Also client.rawUpdates
is overwritten every time this function called, making result of previous call useless.
How to get the message ID I sent out ?
I want to compile the message I sent.
inputMsgTxt2 := tdlib.NewInputMessageText(tdlib.NewFormattedText("TEST", nil), false, true)
msg1del, _ := client.SendMessage(chatID, 0, false, false, nil, inputMsgTxt2)
inputMsg := tdlib.NewInputMessageText(tdlib.NewFormattedText("✔️✔️", nil), true, true)
client.EditMessageText(msg1del.ChatID, msg1del.ID, nil, inputMsg)
I will report an error when I use it like this.
could not launch process: Process xxxxx has exited with status 3221225781
How to get the text content of historical messages
error message is error! code: %!d(float64=5) msg: Chat not found
I ran code with the assumption err
would return upon any limiting. After messages failed to send, I turned the TDLib logging level to find Telegram was repeatedly responding with 429 Too Many Requests and the amount of seconds to wait. My account was banned off Telegram over such. (Since such, it was restored after requesting.)
Additionally, the enum/interface/etcetera given from the UpdateNewMessage receiver isn't usable with my knowledge of how it'd work. (Please correct me if I'm not using Go properly.)
info := updateMsg.GetUpdateEnum().(tdlib.UpdateMessageSendFailed)
is invalid as
Invalid type assertion: updateMsg.GetUpdateEnum().(tdlib.UpdateMessageSendFailed) (non-interface type tdlib.UpdateEnum on left)
MessageSendingState is also the same way.
rawUpdates
can be accessed from multiple goroutines, but it's not synchronized.
Lines 109 to 112 in 2f743ae
Lines 161 to 164 in 2f743ae
Should use lock for it.
Here's related question on Stack Overflow.
Also, looks like it's possible to miss some updates, if GetRawUpdatesChannel
was called with some delay.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.