GithubHelp home page GithubHelp logo

z01berg / subposter-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youkiname/subposter-bot

0.0 0.0 0.0 1.92 MB

This telegram bot allows subscribers to create their own posts on your channel; or sent posts to the special moderated channel to confirm it.

Python 100.00%

subposter-bot's Introduction

SUB POSTER BOT

This telegram bot allows subscribers to create their own posts on your channel; or sent posts to the special moderated channel to confirm it. For now interface is only in russian. Feedback: https://t.me/tolaptik

Features

  • Supporting photo, animation and video post types.
  • You can add multiple channels.
  • You can add multiple administrators.
  • Telegram native message text formatting.
  • Like and dislike buttons at posts.
  • You can set custom daily posts limit for each user and for any channel.
  • Rating. +1 point for like and -1 point for dislike.
  • Users statistic (rating, posts amount, likes, dislikes amount).

How to config

  1. Copy default_config.py file to config.py
  2. Now all next changes will be in config.py.
  3. Create bot and enter your token to TOKEN field. See Telegram Bot Introduction.
TOKEN = "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
  1. Enter database parameters. By default, this bot use PostgresDB.
DB_HOST = "127.0.0.1"
DB_PORT = 5432
DB_NAME = "your_bot_db_name"
DB_USER = "postgres"
DB_PASSWORD = "really_secure_password"
  1. Optional. Enter your telegram id. You can get it after starting bot by command '/get_id' in the private conversation with bot. Without this field you can't add channels, add new admins and use other admins only commands. By default, SUPER_ADMIN_ID will be saved id DB with username = 'superuser'.
SUPER_ADMIN_ID = 112233445
  1. Optional. You can set EXCEPTION_LOG_CHAT_ID, then bot will send exceptions text in this chat. It can be your private conversation or special channel.

How to run

  1. Setup configuration and run database.
  2. Installing requirements. Recommended to use Python Virtual Environment.
pip install -r requirements.txt
  1. Run bot.
python start.py

Setup Webhooks

  1. By default, bot use polling. It's not recommended for production. You can set webhooks in config.py. Telegram API require domain with SSL! Only 'https://' links.
WEBHOOK_HOST = '127.0.0.1'
WEBHOOK_PORT = 5000
POLLING_USING = False  # disable polling to start aiohttp app.
  1. Set Nginx redirection to 127.0.0.1:5000. Nginx config example:
server {
  listen 443 ssl;
  server_name example.com;


  location /your_bot_token {
     proxy_pass http://127.0.0.1:5000/bot/;
  }
}
  1. Restart Nginx.
sudo systemctl reload nginx
  1. Go to the BotFather and set domain settings to your bot. See Telegram Bot API -> Webhooks.

Using examples

Creating post

create post example

Post after sending to the channel.

create post example 2

Text formatting

You can use formatting by right click on pc and long press on phone -> formatting. text formatting example

Post sign

Bot can automatically add your first name or username to a post caption. user sign change example

Your profile info

profile info example

Admin commands

Add new admin.

Superuser required. add new admin

Delete admin.

Superuser required. Delete admin

Add new channel.

Superuser required. Add new channel

Delete channel.

Superuser required. Delete channel

Freeze channel.

Admin required. After freezing users can't send new posts to this channel until unfreeze. Channel will not be displayed while post creating. Freeze channel

Unfreeze channel.

Admin required. Unfreeze channel

Change user custom daily posts limit.

Admin required. User can send only 2 posts by default in every channel. You can set own limit for each user. Change user custom daily posts limit

Change user rating.

Admin required. Change user rating

TODO

  • English translation
  • Moderated channel
  • Change default channel daily posts limit.

subposter-bot's People

Contributors

youkiname avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.