Skip to content

zukong111/submission_telebot

 
 

Repository files navigation

a simple telegram bot for channel submission

English | 简体中文 | 日本語

Features

  • Anonymous submission, support text, image, video and so on
  • Reply to user with reason when submission is approved or rejected
  • Multi-language, support Chinese, English and Japanese
  • Admin can view/ban/unban user
  • Admin can view/modify some config in bot
  • Anonymous not allowed for forwarded message
  • User can feedback with /feedback command
  • Docker support

TODO

  • Submission statistics
  • Submission limit, like word limit, image limit and so on
  • Comments in the submission through BOT (very useful when anonymous)

Q&A

  1. What are the roles?

    Admin: BOT administrator, can view/modify some config, view/ban/unban user

    Approver: approve submission

    User: submission with BOT

  2. How to add admin?

    Before server start, configure in config.yml by property super_admins, multiple admins are separated by commas ,

  3. How to add approver?

    Invite approver to join approval channel, all users who subscribe to the approval channel can approve submission

  4. How to set default language?

    Configure in i18n.yml by property langs, put the default language in the first place

Prepare

  1. Apply api_id and api_hash from https://my.telegram.org/apps
  2. Apply a bot token from @botfather
  3. Prepare a channel for approval, must be private channel, add bot to channel and grant admin permission
  4. Prepare a group for approval, must be private group, link to approval channel, add bot to group and grant admin permission
  5. Prepare a channel for show, add bot to channel and grant admin permission, submission will be forwarded to this channel when approved
  6. Get channel and group id from @userinfobot

Deploy

logfile path: appdata/submission_telebot.log

database file path: appdata/submission_telebot.db

Docker Install (Recommended)

When deploying with docker, you need to install docker and docker-compose first

  1. Download Dockerfiledocker-compose.ymlconfig.yml files
wget https://raw.githubusercontent.com/hormones/submission_telebot/main/Dockerfile -O Dockerfile
wget https://raw.githubusercontent.com/hormones/submission_telebot/main/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/hormones/submission_telebot/main/config.yml -O config.yml
  1. Modify config.yml file (or modify docker-compose.yml to configure environment variables), please read the comments carefully and fill in the correct configuration
  2. Run docker-compose up -d to start the service. The first time you start it, you will pull the image and install the dependencies, which may take a while
  3. Run docker logs -f --since=3m submission_telebot to view the log, or run tail -f appdata/submission_telebot.log to view the log

Code Install

The first time you run this BOT service, you need to perform steps 1, 2, and 3. After that, you can run directly step 3

  1. Run the following command on server (install git first, python >= 3.7.3)
git clone https://github.com/hormones/submission_telebot
cd submission_telebot
python3 -m venv venv
source venv/bin/activate
pip install -U pip setuptools
pip install -r requirements.txt
  1. Modify file config.yml or set environment variable, see config file for more detail
  2. Run source ./venv/bin/activate && nohup python main.py >/dev/null 2>&1 & to start bot

Commands

Users can use /help/lang/feedback by default, you can add or delete user commands in user_command in file config.py

BOT administrators can use all commands by default, can not be modified

Command Parameter Default permission Use range Description
/help Optional, command name All in BOT View help, you can enter command parameters to view the corresponding command detailed usage method
/setting - BOT admin in BOT View/modify some settings
/ban Optional, user ID/username/@username BOT admin in BOT View/ban/unban user
/lang - All in BOT Multi-language
/feedback Required, feedback content User in BOT Feedback
/reply Required, reply content approval channel members in approval channel message comments Reply to user with reason when submission is approved or rejected

License

MIT

Example

@submission_telebot

Current problems/optimization points

  • When the desktop version submits multiple pictures in one message, if you choose not to compress the picture, it will be sent by Telegram in turn, resulting in the submission being split into multiple messages (there is no problem with compressed pictures, and there is no good solution for the time being)

FAQ

  1. If server start failed, please check log file appdata/submission_telebot.log first, if you have any question, please submit issue
  2. all config in config.yml can be set as environment variable, when there is a corresponding environment variable, it will overwrite the configuration in the configuration file
  3. The English and Japanese translations in this project are translated by Github Copilot plugin, if there is any objection, please submit issue
  4. If you need to customize the information display, you can study and edit the multi-language configuration in the i18n.yml file to better fit the project theme
  5. If you have any other questions or suggestions, please submit issue

About

一个简单的telegram投稿机器人

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.1%
  • Dockerfile 0.9%