Random Wiki Bot is a Discord bot that joins your voice channel, fetches random Wikipedia articles, converts their summaries into audio, and plays them in your voice channel. It seamlessly integrates with the VoiceVox engine for high-quality text-to-speech synthesis, providing an engaging and informative experience for your Discord community.
- Random Wikipedia Articles: Fetches random articles from Wikipedia in Japanese.
- Text-to-Speech: Converts article summaries into audio using VoiceVox.
- Audio Playback: Plays the generated audio in the voice channel.
- Docker Support: Easily deployable using Docker and Docker Compose.
- Discord Account: To create and manage your Discord bot.
- Docker & Docker Compose: For containerized deployment.
- NVIDIA GPU (Optional): Required if you intend to leverage GPU acceleration for VoiceVox.
-
Clone the Repository:
git clone https://github.com/yourusername/random-wiki-bot.git cd random-wiki-bot
-
Create Environment Variables:
-
Rename the
.env.example
file to.env
:cp .env.example .env
-
Open the
.env
file and replace'YOUR_DISCORD_TOKEN'
with your actual Discord bot token.
-
-
Choose Deployment Type:
Depending on whether you want to utilize GPU acceleration for VoiceVox, follow one of the setups below.
If you do not have an NVIDIA GPU or prefer to run VoiceVox on the CPU, ensure the GPU-specific configurations are commented out.
services: random_wiki_bot: image: random_wiki_bot container_name: random_wiki_bot build: context: . dockerfile: Dockerfile environment: - TOKEN=${TOKEN} network_mode: host restart: unless-stopped voicevox_engine: # CPU image: voicevox/voicevox_engine:cpu-latest container_name: random_wiki_bot_voicevox_engine ports: - '50021:50021' tty: true restart: unless-stopped # GPU # image: voicevox/voicevox_engine:nvidia-latest # If you are using a GPU, add the following: # deploy: # resources: # reservations: # devices: # - driver: nvidia # count: 1 # capabilities: [gpu]
If you have an NVIDIA GPU and want to leverage GPU acceleration for VoiceVox, ensure the GPU-specific configurations are active.
services: random_wiki_bot: image: random_wiki_bot container_name: random_wiki_bot build: context: . dockerfile: Dockerfile environment: - TOKEN=${TOKEN} network_mode: host restart: unless-stopped voicevox_engine: # CPU # image: voicevox/voicevox_engine:cpu-latest # GPU image: voicevox/voicevox_engine:nvidia-latest container_name: random_wiki_bot_voicevox_engine ports: - '50021:50021' tty: true restart: unless-stopped # If you are using a GPU, add the following: deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu]
-
Build and Run the Containers:
Ensure Docker and Docker Compose are installed on your system. Then, execute:
docker compose up build
This command will build the Docker image for the bot and start both the
random_wiki_bot
andvoicevox_engine
services based on your selected setup (CPU or GPU).
The bot uses environment variables to manage sensitive information. Ensure you have a .env
file in the root directory with the following content:
TOKEN='YOUR_DISCORD_TOKEN'
- TOKEN: Your Discord bot token. Keep this value secret and do not share it publicly.
Once the bot is running and connected to your Discord server, you can use the following slash commands to interact with it.
-
/join
- Description: Makes the bot join your current voice channel and start playing random Wikipedia article summaries.
- Usage: Simply type
/join
in any text channel while connected to a voice channel.
-
/skip
- Description: Skips the currently playing audio and moves to the next one in the queue.
- Usage: Type
/skip
in any text channel. Note that this command has a cooldown of 10 seconds per user to prevent abuse.
-
/bye
- Description: Makes the bot leave the current voice channel and stops any ongoing audio playback.
- Usage: Type
/bye
in any text channel.
Happy Wiki browsing!