Automated Python live chat monitor with terminal UI for UNIT3D.
This repository provides an automated Python live chat monitor with a terminal-based UI designed specifically for UNIT3D. It leverages Selenium WebDriver for web automation, BeautifulSoup for HTML parsing, and curses for an interactive command-line interface.
- Real-Time Chat Monitoring: Utilizes a JavaScript MutationObserver to detect and process new chat messages.
- Interactive Terminal UI: Built with the curses library, offering a color-coded and user-friendly interface.
- Web Automation: Automates login and chat interactions through Selenium in headless mode.
- Thread-Safe Messaging: Processes messages using a thread-safe queue for reliable performance.
Install the required packages with:
pip install -r requirements.txt-
Clone the Repository:
git clone https://github.com/rkeaves/unit3d-terminal-chat.git
-
Set Up a Virtual Environment (Optional but Recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
For enhanced security and ease of configuration, store sensitive settings in a .env file rather than hardcoding them. This file should be located in the project's root directory.
-
Install
python-dotenv:pip install python-dotenv
-
Create a
.envfile with the following content:TRACKER_URL=https://your-unit3d-instance.example.com TRACKER_USERNAME=YOUR_USERNAME TRACKER_PASSWORD=YOUR_PASSWORD
Note: Your
.envfile contains sensitive data! Remove any sensitive information before sharing it publicly.
Before running the application, update the configuration parameters either directly in the code or via the .env file as shown above:
- TRACKER_URL: Set this to the URL of your UNIT3D instance.
- TRACKER_USERNAME & TRACKER_PASSWORD: Provide your tracker login credentials.
Note: Keep these sensitive values secure and avoid exposing them in public.
Run the application using:
python chat.pyThe application will automatically:
- Log in to your UNIT3D chat page.
- Monitor live chat messages in real time.
- Display messages in a terminal-based UI with color-coded formatting.
Type your message into the interface and press Enter to send.
For enhanced troubleshooting, run the script in debug mode to enable verbose logging. This mode provides detailed output that can help you pinpoint issues more effectively.
python chat.py --debugTip: Debug mode is especially useful when diagnosing issues with the UI, WebDriver, or authentication process.
-
Curses Module Error on Windows
If you encounter an error related to the curses module on Windows, install thewindows-cursespackage:pip install windows-curses
-
WebDriver Compatibility Issues
Ensure that Microsoft Edge WebDriver is installed correctly and that its version matches your browser. Incompatibility may lead to automation failures. -
Login Failures
Verify that the credentials and URL specified in your configuration or.envfile are correct. Incorrect details can result in login errors.
-
Check Log Output:
Always review the terminal log output for error messages or warnings. They provide crucial insights for troubleshooting. -
Review Environment Variables:
Double-check that all necessary environment variables are correctly set and securely stored.
Feel free to suggest improvements, submit commits, or report issues.
This project is licensed under the MIT License.