This is a Telegram bot to convert links between Deezer and Spotify.
This bot relies on tbot crate to establish the connection to Telegram API. tbot relies on tokio which is a runtime to async Rust.
I consume the Deezer and Spotify Web API manually.
Q: But why you consume the Spotify API manually if there are so many Spotify crates that do it?
R: For learning purposes.
Q: And for Deezer API?
R: The same reason :)
This bot currently converts:
-
Songs.
-
Albums.
-
Artists.
- Clone this repository.
- Register a new Telegram bot. Then export a variable named
BOT_TOKEN
with the Telegram token:
In bash:
export BOT_TOKEN="TOKEN"
Spotify requires a registered app to make calls to its API.
-
Get the
CLIENT_ID
and theCLIENT_SECRET
of your registered app in the Spotify developers dashboard. Then, export those variables. In bash:
export BOT_SPOTIFY_CLIENT_ID="CLIENT_ID"
export BOT_SPOTIFY_CLIENT_SECRET="CLIENT_SECRET"
Deezer API allows to use its public data without regist an app.
Deezer is good.
Be like Deezer :)
- If you just want to use this bot, you should compile with the release option:
cargo build --release
It will last so much time because of Rust and LLVM optimizations.
- If you want to hack, compile without optimization:
cargo build
The compilation in this case will be faster.
cargo run
This bot is in ALPHA state.
Currently, if a link is malformated the bot will panic without sending a error response to the user. However, the bot will still working because tokio (the async machine used by tbot) will remain active.
I am refactoring the code in error_handling branch to handle errors properly.