This project automates the process of sending a contract address (CA) from the clipboard directly to a Telegram trading bot using a custom Telegram bot API. It eliminates the need for manually copying and pasting the address into the Telegram chat window and triggers the action with the press of the "1" key.
- Monitors the clipboard for contract addresses (CAs).
- Sends the clipboard contents to a Telegram bot chat with the press of the "1" key.
- Efficient integration with Telegram's Bot API for sending messages directly.
- No need for manual interaction with the Telegram client once configured.
Before running this project, make sure you have the following:
- Python 3.x installed on your machine.
- A Telegram bot created using BotFather.
- The Telegram chat ID where the message should be sent.
- Installed Python libraries:
python-telegram-bot,pyperclip, andkeyboard.
To get started, you need to install the required Python libraries. You can do this via pip:
pip install python-telegram-bot pyperclip keyboardCreate your Telegram bot using BotFather and retrieve the API token for your bot.
You need the chat ID of the target bot or user. You can obtain it by using the getUpdates method of the Telegram Bot API or by interacting with the bot.
Once the necessary libraries are installed, configure the following in the script:
- API Token: Set the
API_TOKENvariable to your bot's API token. - Chat ID: Set the
CHAT_IDvariable to your target bot's chat ID or user chat ID.
API_TOKEN = 'your_telegram_bot_token' # Replace with your bot's API token
CHAT_ID = 'your_chat_id' # Replace with your chat ID or target bot's chat IDOnce configured, you can run the script. The script will monitor your clipboard and send the contents to the Telegram bot when you press the "1" key.
python clipboard_to_telegram.py- When you press the "1" key, the script will grab the current clipboard content (such as a contract address) and send it to the Telegram bot chat you configured.
- The script waits for the "1" key press.
- Once "1" is pressed, the clipboard content (contract address) is sent to the Telegram bot.
- Clipboard Monitoring: The script listens for the "1" key press.
- Clipboard Content: When the "1" key is pressed, it grabs the current content of the clipboard.
- Send to Telegram: The content is sent to the Telegram bot chat automatically using the Telegram Bot API.
If you have any improvements, feel free to fork the project and submit a pull request.
This project is licensed under the MIT License.
Let me know if you need any further adjustments to the README!