Git Product home page Git Product logo

tgcopybot's Introduction

This bot does exactly what it is intented to do! If you want other features (e.g. editing messages, updating messages, etc), you have to customize it for yourself. Reading python-telegram and TDlib documentation may help you for doing so.

PLEASE DON'T ASK FOR NEW FEATURES!

Telegram Copy Bot

What it does

This bot copies (not forward) messages from a source channel (which doesn't have administrator privileges on it) to a destination chat (simple user, channel, etc.).

How to use

  1. Copy .env.example to .env.
    cp .env.example .env
    
  2. Obtain api_id and api_hash from this link and fill it inside Telegram Configuration section of the .env file alongside other configurations (such as phone number of your user, which acts as your bot).
  3. Run the project via Docker and login to Telegram:
    docker run -it \
        --env-file=.env \
        -v td-data:/tmp/.tdlib_files \
        radinshayanfar/tgcopybot
    
  4. After logging in, you will see your chat names and their chat id. Copy chat ids of source and destination chats and put them inside App Configuration section of the .env file.
  5. Run the container in detached mode and it will do the job:
    docker run -d \
       --env-file=.env \
       -v td-data:/tmp/.tdlib_files \
       radinshayanfar/tgcopybot
    

tgcopybot's People

Contributors

radinshayanfar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tgcopybot's Issues

Possible to run it on raspberry pi?

Hey there I have the Bot running on a V Server but I would like to get this running local on a pi but I'm not able to get it running with docker. Is the pi not able tp run this container?

Thanks in advance.

Successfully tagged copybot:latest
WARNING: Image for service bot was built because it did not already exist. To rebuild this image you must use docker-compose build or docker-compose up --build.
Creating tgcopybot_bot_run ... done
Traceback (most recent call last):
File "app/main.py", line 19, in
tg = Telegram(
File "/usr/local/lib/python3.8/dist-packages/telegram/client.py", line 113, in init
self._tdjson = TDJson(library_path=library_path, verbosity=tdlib_verbosity)
File "/usr/local/lib/python3.8/dist-packages/telegram/tdjson.py", line 27, in init
self._build_client(library_path, verbosity)
File "/usr/local/lib/python3.8/dist-packages/telegram/tdjson.py", line 36, in _build_client
self._tdjson = CDLL(library_path)
File "/usr/lib/python3.8/ctypes/init.py", line 373, in init
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/python3.8/dist-packages/telegram/lib/linux/libtdjson.so: wrong ELF class: ELFCLASS64
ERROR: 1

Messages are not being copied over

I made an app as was instructed by the link, copied all necessary infos to the env file and logged in with a code.

Then I pasted the source and destination channel which my account is in into the env file and run the command without forking to background:

$ sudo docker run --env-file=.env -v td-data:/home/wit/.temp/tgbot/tgfiles radinshayanfar/tgcopybot
[ 2][t 4][xxx][TdDb.cpp:318][#1][!Td]	Got PRAGMA user_version = 13
[ 2][t 4][xxx][AuthDataShared.cpp:107][#1][!Td]	DcId{1} [auth_key_id:xxx][state:OK][created_at: xxx]
[ 2][t 4][xxx][Session.cpp:170][#1][!SessionProxy:1:main]	Generate new session_id xxx for auth key xxx for main DC1
^C[ 2][t 4][xxx][Td.cpp:3764][#1][!Td]	Close Td in state 2
[ 2][t 4][xxx][Td.cpp:3607][#1][!Td]	Have no request actors
[ 2][t 4][xxx][Td.cpp:3510][#1][!Td]	ON_ACTORS_CLOSED
[ 2][t 4][xxx][Td.cpp:3583][#1][!Td]	ON_CLOSED
[ 2][t 4][xxx][Td.cpp:3593][#1][!Td]	Stop Td

Closed it with control-C

Can you tell me why nothing is being copied over?

My .env

######################
# App Configurations #
######################

SOURCE=-11111111111
DESTINATION=-111111111111111
(ones are only meant to replace actual channel number)

###########################
# Telegram Configurations #
###########################

# Your app_id and api_hash obtained from my.telegram.org/apps
API_ID=xxx
API_HASH=xxx

# Your user phone number
PHONE=+1xxxxxxxxxx

# An arbitrary key for app datebase
DB_PASSWORD=xxx
# Where the app stores files
FILES_DIRECTORY=/home/wit/.temp/tgbot/tgfiles

# Proxy (if needed)
PROXY_TYPE= # "proxyTypeMtproto", "proxyTypeHttp" or "proxyTypeSocks5"
PROXY_SERVER=
PROXY_PORT=

EDIT:
It actually does forward the messages, but only new ones. Is it possible for it to copy all existing messages from source?

Help

how can i start it without docker

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.