This project mirrors messages from a specified Telegram group to a Discord channel, enabling users to authenticate their Telegram accounts and select groups for seamless cross-platform communication.
The script serves as a bridge between Telegram and Discord by mirroring messages from a specified Telegram group to a Discord channel. It allows users to authenticate their Telegram accounts using their phone numbers and select which groups they want to monitor. Once authenticated, users can either choose from a list of their Telegram groups or input a specific group ID to begin mirroring messages. The script continuously listens for new messages in the selected group and forwards them to the designated Discord webhook, ensuring real-time communication between the two platforms. This functionality enhances cross-platform interaction and keeps communities connected, regardless of their preferred messaging app.
To get started with this project, follow the steps below:
- Python 3.8 or higher
- pip (Python package installer)
- A Telegram account: Create an app telegram in https://my.telegram.org/apps save api_id and api_hash
- A Discord account
- Clone the repository:
git clone https://github.com/yourusername/mirror-telegram-2-discord.git
- Navigate to the project directory:
cd mirror-telegram-2-discord
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
venv\Scripts\activate
- Install the required packages:
pip install -r requirements.txt
- Create a
.env
file in the root directory and add your Telegram API credentials:API_ID=your_api_id API_HASH=your_api_hash
- in
config.py
put your webhook discord url and a session_name (any name)WEBHOOK_URL='https://your_webhook_url' SESSION_NAME='your_session_name'
- Run the application
python main.py
- Follow the prompts to authenticate with your Telegram account and select the group you wish to mirror to Discord.
To deploy the application, you can run it locally or on a server. Make sure you have your .env file properly configured with your API credentials.
- Python - Language
- Telethon - Telegram client for Python
- python-dotenv - For managing environment variables Environment
- @OniMock - Idea & Initial work