This document provides a detailed technical breakdown of the Discord bot, explaining the purpose and functionality of each component in the provided code.
## Overview
The bot is designed to handle user interactions within specified Discord channels, perform actions based on specific commands, and manage conversation resets and core restarts. It leverages several libraries for functionality, including Discord.js for Discord interactions, Axios for HTTP requests, and HE for encoding messages.
## Components and Workflow
### 1. **Environment Configuration**
The bot uses environment variables for configuration. These are loaded using `dotenv` and include sensitive information such as the bot token and API paths.
- **Environment Variables**:
-`THE_TOKEN`: Discord bot token.
-`CHANNEL_IDS`: Comma-separated list of Discord channel IDs where the bot is active.
-`ROOT_IP` and `ROOT_PORT`: IP address and port of the backend server.
The bot listens for messages in specified channels, processes commands for resetting conversations and restarting core services, and interacts with a backend API to handle user messages. It includes robust error handling and can split and send long messages in manageable chunks. Ensure proper environment configuration and dependencies installation to run the bot effectively.