Simple API to ping a telegram bot using superbot (mtproto)
Find a file
forgejo-actions b71687acbd
All checks were successful
CD / build-assets (aarch64-unknown-linux-gnu) (push) Successful in 6m9s
CD / build-assets (aarch64-unknown-linux-musl) (push) Successful in 6m4s
CD / build-assets (x86_64-pc-windows-gnu) (push) Successful in 6m52s
CD / build-assets (x86_64-unknown-linux-gnu) (push) Successful in 5m34s
CD / build-assets (x86_64-unknown-linux-musl) (push) Successful in 5m40s
CD / release (push) Successful in 13s
chore(changelog): Update changelog
2024-06-05 15:32:56 +00:00
.forgejo chore: Initialize actions 2024-05-29 01:20:19 +03:00
.github/workflows chore: Initialize actions 2024-05-29 01:20:19 +03:00
src feat: Support cmd and args querys 2024-06-05 18:32:13 +03:00
.gitignore chore: Replace the file with config.toml 2024-05-31 19:06:26 +03:00
Cargo.lock chore(deps): Add base64 to dependencies 2024-06-05 18:30:51 +03:00
Cargo.toml chore(deps): Add base64 to dependencies 2024-06-05 18:30:51 +03:00
CHANGELOG.md chore(changelog): Update changelog 2024-06-05 15:32:56 +00:00
cliff.toml chore: Initialize the changelogs 2024-05-28 22:27:33 +03:00
config.toml.example chore: Add example config file 2024-05-31 19:06:26 +03:00
Justfile chore: Add Justfile 2024-05-28 22:27:33 +03:00
LICENSE Add the license 2023-11-18 19:40:07 +03:00
README.md chore: Update README.md 2024-06-05 18:32:43 +03:00
rust-toolchain.toml chore: Add rust files 2024-05-28 22:27:33 +03:00
rustfmt.toml chore: Add rust files 2024-05-28 22:27:33 +03:00

TelePingBot

A simple API to ping telegram bots and returns if it's online or not. using superbot to send message to the bots (mtproto).

Forgejo CI Status Forgejo CD Status

agplv3-or-later

Why is simple?

Add your API tokens (Authorization header) and your bot usernames in the config.toml file, and you're ready to go.

Note

Check out the config.toml.example file to see how to fill the config.toml file.

Warning

Remember to keep the config.toml file safe, because anyone can use it to ping your bots.

CLI Arguments

  • --config: The path to the config file. (default: config.toml)

Requirements

  • Rust (MSRV 1.75.0)
  • Cargo

Build

cargo build --release

Run

cargo run --release

Or just run the binary file in target/release/telepingbot

Endpoints

/ping/@<bot_username>

This endpoint is to ping the bot and returns if it's online or not.

Url querys

  • "cmd": One word base64Url encoded, will use it as a command, default is start
  • "args": Base64Url encoded, will use it as arguments for the command, default is ""

Headers

  • Authorization: The API access token. e.g: Authorization: FirstToken

Response

  • 200: The bot is online.
  • 404: The bot is offline.
  • 401: The API access token is invalid.
  • 500: Internal server error. e.g: The bot username is invalid or the superbot can't send message to the bot.

Example

Note

Replace FirstToken with your API access token and @testbot with your bot username and the host and port with your host and port.

curl -v 0.0.0.0:3939/ping/@testbot -H "Authorization: FirstToken"