A Discord bot for playing YouTube sounds in voice channels with customizable volume and per-server sound management.
- Add Sound:
/trollus addus
- Add a sound from a YouTube URL. - Play Sound:
/trollus playus
- Play a sound with optional voice channel selection. - List Sounds:
/trollus listus
- List all available sounds with pagination. - Remove Sound:
/trollus removus
- Remove a sound. - Stop Sound:
/trollus stopus
- Stop the current sound and disconnect. - Set Volume:
/trollus volumeus
- Set global volume (0.1x to 5.0x). - Manage Users:
/trollus userus
- Add or remove authorized users.
- Node.js v20+
- npm
- ffmpeg
-
Clone the repository:
git clone https://github.com/yourusername/trollus-bot.git cd trollus-bot
-
Install dependencies:
npm install
-
Create a
.env
file:DISCORD_TOKEN=your_discord_token CLIENT_ID=your_application_id
-
Create required directories:
mkdir -p assets/sounds mkdir -p data
-
Add a valid
cookies.txt
file in the root directory (for YouTube authentication). -
Configure allowed users in
src/config.ts
:allowedUsers: [ 'your_discord_user_id', // Add other admin user IDs ] as string[],
-
Build the project:
npm run build
-
Deploy slash commands:
npm run deploy
-
Start the bot:
npm start
- Maximum sound size: 100MB
- Maximum sounds per server: 100
- Maximum total storage: 20GB
- Default volume: 1.0
- Maximum volume: 5.0 (500%)
- Minimum volume: 0.1 (10%)
- Run with hot reload:
npm run dev
- Deploy slash commands:
npm run deploy
- Build TypeScript:
npm run build
- Start production bot:
npm start
trollus-bot/
├── src/
│ ├── commands/
│ │ └── trollus/
│ │ ├── add.ts
│ │ ├── play.ts
│ │ ├── list.ts
│ │ └── ...
│ ├── services/
│ │ └── YoutubeService.ts
│ ├── database/
│ │ └── JsonDatabase.ts
│ ├── utils/
│ │ └── validators.ts
│ ├── types/
│ │ └── index.ts
│ └── config.ts
├── assets/
│ └── sounds/
│ └── [guild_id]/
├── data/
│ └── database.json
└── dist/
interface DatabaseSchema {
servers: {
[guildId: string]: {
sounds: Sound[];
allowedUsers: string[];
settings: {
defaultVolume: number;
};
};
};
}
discord.js
: ^14.11.0@discordjs/voice
: ^0.18.0@discordjs/opus
: ^0.9.0youtube-dl-exec
: ^3.0.12dotenv
: ^16.0.3uuid
: ^9.0.0
-
Command not found
- Run
npm run deploy
to update slash commands. - Wait a few minutes for Discord to register commands.
- Run
-
Sound download fails
- Check
cookies.txt
is valid. - Verify YouTube URL format.
- Check storage limits.
- Check
-
Voice errors
- Ensure ffmpeg is installed.
- Check bot has voice permissions.
- Verify voice channel access.
MIT License
xdLulux
For issues and feature requests, please open an issue on GitHub. (no support L)