Giter VIP home page Giter VIP logo

telemirror's Introduction

Telegram channel mirroring app

App helps make telegram channel mirror. We will use Telegram client API because Bot API have limited functionality.

Functionality

  1. Catching NewMessage and MessageEdited event and sending them forward
  2. Flexible source and target channels mapping

Prepare

  1. Create Telegram App
  2. Obtain API App ID and hash Telegram API Credentials
  3. Setup Postgres database
  4. Fill .env-example with your data and rename it to .env
    1. SESSION_STRING can be obtained by running login.py with putted API_ID and API_HASH before.
API_ID=test # Telegram app ID
API_HASH=test # Telegram app hash
SESSION_STRING=test # Telegram session string
# Mapping between source and target channels
# Channel id can be fetched by using @messageinformationsbot telegram bot
# and it always starts with -100 prefix
# [id1, id2, id3:id4] means send messages from id1, id2, id3 to id4
# id5:id6 means send messages from id5 to id6
# [id1, id2, id3:id4];[id5:id6] semicolon means AND
CHAT_MAPPING=[-100999999,-100999999,-100999999:-1009999999];
TIMEOUT_MIRRORING=0.1 # Delay in sec between sending or editing messages
REMOVE_URLS=false   # Apply removing URLs on messages
# Remove URLs whitelist
REMOVE_URLS_WL=youtube.com,youtu.be,vk.com,twitch.tv,instagram.com
# Postgres credentials
DATABASE_URL=postgres://user:pass@host/dbname
# or
DB_NAME=test
DB_USER=test
DB_HOST=test
DB_PASS=test

Deploy

Locally

  1. Create and activate python virtual environment
python -m venv myvenv
source myvenv/Scripts/activate # linux
myvenv/Scripts/activate # windows
  1. Install depencies
pip install -r requirements.txt
  1. Run
python app/telemirror.py

Heroku

Deploy

or

  1. Clone project
    git clone https://github.com/khoben/telemirror.git
  1. Create new heroku app within Heroku CLI
    heroku create {your app name}
  1. Add heroku remote
    heroku git:remote -a {your app name}
  1. Set environment variables to your heroku app from .env by running .bash script
    ./.bash
  1. Upload on heroku host
    git push heroku master
  1. Start heroku app
    heroku ps:scale run=1

telemirror's People

Contributors

khoben avatar mashed-potatoes 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.