2 releases

0.1.1 Dec 21, 2023
0.1.0 Dec 21, 2023

#46 in #telegram-api

MIT license

18KB
232 lines

Rust Telegram Search Bot

This Rust kit allows you to create a Telegram bot that can search through the Search API and open other websites. Currently, search is only supported through the Google Search API.

Prerequisites

Before you start, make sure you have the following:

  • Rust installed on your system
  • A Telegram Bot API token and a Google Cloud Platform project with the necessary credentials for the Google Search API

Getting Started

  1. Install the crate:
cargo install search-bot
  1. Setup .env file from .env.example file in your workdir:
GOOGLE_SEARCH_API_KEY=[secret-string]
GOOGLE_SEARCH_APP_ID=[special-string]
TELOXIDE_TOKEN=[secret-string]
ALLOWED_USERS=id1,id2 # To get your id, start the bot and run command /getid
  1. Navigate to your workdir:
cd /path/to/my/workdir
  1. Run bot:

search-bot

To watch more logs set the system env variable RUST_LOG=info


Usage

To search: enter any text to the bot.
To open any site: enter to the bot a site URL starting with http:// or https://

Happy hacking!

Dependencies

~16–31MB
~485K SLoC