Sometimes words aren't enough to express your emotions, and searching for stickers or GIFs can be a hassle.
Try tg.jpg! It's like Google's "I'm Feeling Lucky" but for images, this bot will instantly reply with the first image it finds on Google.
"mic drop.gif"!
- Listens for messages containing image file names (e.g.,
example.jpg
,example.png
,example.gif
). - Searches for images on Google and sends the first result back to the user.
- Supports both regular images and GIFs.
- Rust and Cargo installed on your system. You can install them from rustup.rs.
- A Telegram bot token. You can create a bot and get a token by talking to BotFather on Telegram.
- Download Rust.
- Create a new bot using @Botfather to get a token in the format
123456789:blablabla
. - Initialise the
TELOXIDE_TOKEN
environmental variable to your token:
# Unix-like
$ export TELOXIDE_TOKEN=<Your token here>
# Windows command line
$ set TELOXIDE_TOKEN=<Your token here>
# Windows PowerShell
$ $env:TELOXIDE_TOKEN=<Your token here>
- Make sure that your Rust compiler is up to date (
teloxide
currently requires rustc at least version 1.80):
# If you're using stable
$ rustup update stable
$ rustup override set stable
# If you're using nightly
$ rustup update nightly
$ rustup override set nightly
-
Build and run the project:
cargo run
- Start the bot on Telegram by searching for your bot's username and sending a message with an image file name (e.g.,
example.jpg
). - The bot will respond with the first possible image result it finds.
- Teloxide for Telegram bot API interaction.
- Reqwest for making HTTP requests.
- Regex for regular expression matching.
- Anyhow for error handling.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.