Tg to Switch is a Python bot designed to copy messages from Telegram channels. It supports handling file uploads and downloads and can manage multiple bot instances concurrently.
Follow these steps to set up and run the Telegram Copy Bot on your system.
- Python 3.10 or higher
- Telethon library
- Switch Bot token
- Telegram API credentials (API ID, API Hash)
- Telegram bot token(s)
-
Clone the repository to your local machine:
git clone https://github.com/hummingbird28/SwitchImport.git
-
Navigate to the project directory:
cd SwitchImport -
Install the required Python packages using
pip:pip install -r requirements.txt
-
Obtain Telegram API credentials:
- Go to Telegram's website and log in with your Telegram account.
- Create a new application and obtain your API ID and API Hash.
-
Create a
config.pyfile in the project directory with the following content:# telegram api id/hash API_ID = 'your_api_id' API_HASH = 'your_api_hash' # switch bot token BOT_TOKEN = 'your_bot_token'
Replace
'your_api_id','your_api_hash', and'your_bot_token'with your actual API ID, API Hash, and bot token respectively. -
Create a
bot_tokens.txtfile in the project directory containing one or more bot tokens, each on a new line. (add telegram bot tokens)
Run the bot using the following command:
python main.pyThe bot will now start and listen for commands in your Switch channels.
-
/start: Get the start message. -
/copy channel_username startMsgId-endMsgId: Copy messages from the specified channel. Replacechannel_usernamewith the target channel's username andstartMsgId-endMsgIdwith the range of message IDs you want to copy. -
/cancel: Cancel ongoing tasks in the current chat.
This project is licensed under the MIT License - see the LICENSE file for details.