2个版本
| 0.1.1 | 2023年12月21日 |
|---|---|
| 0.1.0 | 2023年12月21日 |
#33 in #telegram-api
18KB
232 行
Rust Telegram搜索机器人
这个Rust工具包允许你创建一个Telegram机器人,该机器人可以通过搜索API搜索并通过其他网站。 目前,仅支持通过Google搜索API进行搜索。
先决条件
在开始之前,请确保你拥有以下内容
- Rust已安装在你的系统上
- 一个Telegram机器人API令牌和一个具有Google搜索API必要凭证的Google Cloud Platform项目
入门
- 安装crate
cargo install search-bot
- 从你的
workdir中的.env文件设置.env.example文件
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
- 导航到你的
workdir
cd /path/to/my/workdir
- 运行机器人
search-bot
要查看更多日志,请设置系统环境变量 RUST_LOG=info
用法
要搜索:向机器人输入任何文本。
要打开任何网站:向机器人输入以 http:// 或 https:// 开头的网站URL
祝您编码愉快!
依赖项
~14–29MB
~474K SLoC