paper-plane-developers / tdlib-rs Goto Github PK
View Code? Open in Web Editor NEWRust wrapper around the Telegram Database Library
License: Apache License 2.0
Rust wrapper around the Telegram Database Library
License: Apache License 2.0
We can check for the "; for bots only" string inside the description to do that.
Hi @melix99,
After successful authorization, I need to save the current session for the next login without entering a phone number.
Could you please show an example?
Thanks!
In tdlib-rs we currently have something like Result<enums::Ok, types::Error> as the return value of some functions. The "Ok" enum is just a state indicating a non-error by tdlib, but this is useless in Rust because we already have a Result, so we already know if we have an error or not. We should remove that enum and swap it's use with just a "()", like it's usually done in Rust in this cases.
Currently this is the missing piece for having a 100% documented library. To do that we need to parse the "@Class" tag in the .tl file first.
Hi!
I was trying to use tdlib
to do some simple tasks. For example, get latest 20 messages from each group.
I added the following code to example/get_me.rs
just after line println!("Hi, I'm {}", me.first_name);
:
let chats = functions::get_chats(None, 100, client_id).await.unwrap();
if let tdlib::enums::Chats::Chats(chats) = chats {
for chat_id in chats.chat_ids {
dbg!(chat_id);
if let Ok(info) = functions::get_chat_history(chat_id, 0, 0, 20, false, client_id).await
{
dbg!(info);
}
}
}
Then I got an error "missing field reply_in_chat_id
", wonder if the code above is the correct way to use tdlib-rs
API?
Thanks!
We currently have quite a lot of 1-variant only enums. This is because of the tdlib's tl scheme, so it's not a parser bug. We have to workaround that by checking when there are this kind of enums and remove/replace them somehow.
Γ¥» cargo build
Compiling native-tls v0.2.11
Compiling sqlx-mysql v0.7.2
Compiling crypto-hash v0.3.4
Compiling tdlib v0.10.0
Compiling chromiumoxide v0.5.4
error: failed to run custom build command for `tdlib v0.10.0`
Caused by:
process didn't exit successfully: `/home/mxaddict/projects/deep/rusty-data/target/debug/build/tdlib-70396f3ece8ac5da/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=TDJSON_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PkgConfig(`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "tdjson" "tdjson >= 1.8.19"` did not exit successfully: exit status: 1
error: could not find system library 'tdjson' required by the 'tdlib' crate
--- stderr
Package tdjson was not found in the pkg-config search path.
Perhaps you should add the directory containing `tdjson.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tdjson' found
Package tdjson was not found in the pkg-config search path.
Perhaps you should add the directory containing `tdjson.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tdjson' found
)', /home/mxaddict/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tdlib-0.10.0/build.rs:39:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
Is there a package that I need to install to be able to compile the tdlib dependency?
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.