Skip to content

Latest commit

 

History

History
123 lines (82 loc) · 4.17 KB

README.md

File metadata and controls

123 lines (82 loc) · 4.17 KB

Discord Voice Monitor (VCM)

A Discord bot that monitors voice chat for inappropriate language using AssemblyAI's transcription service. The bot joins the most populated voice channel, records audio, transcribes it, and detects swear words from a predefined list. It sends warnings to users and logs incidents in a specified channel.


Features

  • Automatic Voice Channel Join: Joins the most populated voice channel in a server.
  • Audio Recording: Records audio when a user speaks.
  • Speech-to-Text Transcription: Transcribes audio using AssemblyAI's API.
  • Swear Word Detection: Detects swear words from a predefined list.
  • Moderation Alerts: Sends warnings to users and logs incidents in a specified channel.
  • Configurable: Easily configure swear words, reconnect timeout, and more via environment variables.

Prerequisites

Before running the bot, ensure you have the following:

  1. Node.js: Version 18 or higher.
  2. Discord Bot Token: Create a bot on the Discord Developer Portal.
  3. AssemblyAI API Key: # at AssemblyAI to get your API key.
  4. Git: To clone the repository.

Setup

1. Clone the Repository

Clone the repository to your local machine:

git clone https://github.com/justblaxe/vcm.git
cd vcm

2. Install Dependencies

Install the required dependencies using npm:

npm install

3. Configure Environment Variables

Create a .env file in the root directory and add the following variables:

# Discord Bot Token
DISCORD_BOT_TOKEN=your-discord-bot-token

# AssemblyAI API Key
ASSEMBLYAI_API_KEY=your-assemblyai-api-key

# Swear Words (comma-separated)
SWEAR_WORDS=badword,test,bad

# Reconnect Timeout (in milliseconds)
RECONNECT_TIMEOUT=5000

# Max Reconnect Attempts
MAX_RECONNECT_ATTEMPTS=3

# Max Concurrent Transcriptions
MAX_CONCURRENT_TRANSCRIPTIONS=5

# Mod Log Channel Name
MOD_LOG_CHANNEL=bad-words

Replace the placeholders (your-discord-bot-token, your-assemblyai-api-key, etc.) with your actual values.

4. Build the Project

Compile the TypeScript code into JavaScript:

npm run build

5. Start the Bot

Run the bot using the following command:

npm start

Usage

  1. Invite the Bot: Invite the bot to your Discord server using the OAuth2 URL from the Discord Developer Portal.
  2. Join a Voice Channel: The bot will automatically join the most populated voice channel in your server.
  3. Monitor Voice Chat: When a user speaks, the bot will record their audio, transcribe it, and check for swear words.
  4. Alerts and Logs:
    • If swear words are detected, the bot will send a warning to the user.
    • Incidents will be logged in the specified moderation log channel (bad-words by default).

Configuration

You can customize the bot's behavior by modifying the following environment variables in the .env file:

Variable Description Default Value
DISCORD_BOT_TOKEN Your Discord bot token. -
ASSEMBLYAI_API_KEY Your AssemblyAI API key. -
SWEAR_WORDS Comma-separated list of swear words to detect. badword,test,bad
RECONNECT_TIMEOUT Time (in milliseconds) to wait before reconnecting to a voice channel. 5000
MAX_RECONNECT_ATTEMPTS Maximum number of reconnect attempts. 3
MAX_CONCURRENT_TRANSCRIPTIONS Maximum number of concurrent transcription requests. 5
MOD_LOG_CHANNEL The name of the channel where warnings will be logged. bad-words

Scripts

  • Start the Bot: npm start
  • Build the Project: npm run build