Bot to help with managing multiple telegram chats
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Arlo (Hyena) 1de34e1364
glob imports
9 months ago
src glob imports 9 months ago
.env.sample Start work on admin bot 1 year ago
.gitignore Add information about windows -gnu release 1 year ago
.travis.yml fix url 1 year ago
Cargo.lock Work with recent deps 9 months ago
Cargo.toml Work with recent deps 9 months ago
LICENSE License 1 year ago
README.md Add information about windows -gnu release 1 year ago
Release.toml Add musl builds for amd64, armh, and armv7h 1 year ago

README.md

AdminBot

AdminBot was created to assist in managing a series of related groupchats on Telegram.

Crates.io

Information

  1. If you wish to say something to the admins in chat, you can type /relay with thatever it is you want to tell the admins and the bot will forward what you said to a designated admin chat.
  2. If you want to be anonymous, you can DM the bot and whatever you send will be anonymously forwarded to a designated admin chat.
  3. If you want to point out something specific from a chat, you can forward any messages you have an issue with directly to the bot and the forwarded messages along with who originally posted those messages will be anonymously sent to a designated admin chat.
  4. If you just want to @ the admins of the current chat you’re in you can do so by typing /admins

Using the bot

First, make sure you talk to @BotFather to get a bot token. Add your bot to the admin chat, and then send a message.

Go to https://api.telegram.org/bot<YourBOTToken>/getUpdates to view the current updates for your bot, and get the chat ID. It should be a negative number.

From Release Binary

If there is a release for your operating system and architecture, you can use the following command to run it:

TELEGRAM_BOT_TOKEN="your token" \
ADMIN_CHAT_ID="your admin chat" \
./path/to/the/binary

From crates.io

This bot requires Rust Nightly to compile.

The following command will download telecord, compile it, and put the binary in ~/.cargo/bin

cargo install telecord

From Source

This bot requires Rust Nightly to compile.

copy .env.sample to .env and set the required values.

TELEGRAM_BOT_TOKEN="123456789:ABCDEFGHIJK_LMNOPQRSTUVWXYZ123456"
ADMIN_CHAT_ID="-123456789"

Run cargo run from the project directory to run the project.

If you want to install this binary directly with cargo install, make sure the TELEGRAM_BOT_TOKEN and ADMIN_CHAT_ID environment variables are set.

As a system process with SystemD

After you have the bot compiled, copy the binary wherever you want it and make a systemd unit file based on the following template.

[Unit]
Description=A bot to help with adminning Coconuts
After=network.target

[Service]
Type=simple
User=your-admin_bot-user
Group=your-admin_bot-group
Environment="TELEGRAM_BOT_TOKEN=123456789:ABCDEFGHIJK_LMNOPQRSTUVWXYZ123456"
Environment="ADMIN_CHAT_ID=-123456789"
Environment="RUST_LOG=admin_bot=info"
ExecStart=/path/to/admin_bot/binary
TimeoutSec=90
Restart=always

[Install]
WantedBy=default.target

On Windows

With the -msvc release and powershell

In powershell, navigate to the folder that contains the .exe file and run the following commands

$env:RUST_LOG = "admin_bot=info"
$env:TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_TOKEN"
$env:ADMIN_CHAT_ID = "YOUR_ADMIN_CHAT"
.\admin_bot.exe
With the -gnu release and mingw

In bash, navigate to the folder that contains the .exe file and run the following commands

RUST_LOG=admin_bot=info \
TELEGRAM_BOT_TOKEN="123456789:ABCDEFGHIJK_LMNOPQRSTUVWXYZ123456" \
ADMIN_CHAT_ID="-123456789" \
./admin_bot.exe

License

AdminBot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

AdminBot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of AdminBot

You should have received a copy of the GNU General Public License along with AdminBot If not, see http://www.gnu.org/licenses/.