# TentacleBot - Discord .NET Bot A Discord bot project built with Discord.Net and .NET 8+, featuring dependency injection and slash commands. ## Features - ? Built with Discord.Net 3.14+ - ? Dependency Injection for services - ? Slash commands support - ? Rich embed messages - ? Example commands included - ? .NET 8 or higher ## Prerequisites - .NET 8.0 or higher ([download here](https://dotnet.microsoft.com/download)) - A Discord Bot Token (create one at [Discord Developer Portal](https://discord.com/developers/applications)) ## Quick Start ### 1. Clone and Setup ```bash dotnet restore ``` ### 2. Configure Your Bot Token Edit `appsettings.json` and replace `YOUR_BOT_TOKEN_HERE` with your actual Discord bot token: ```json { "Discord": { "BotToken": "YOUR_ACTUAL_TOKEN_HERE" } } ``` ### 3. Run the Bot ```bash dotnet run ``` The bot will connect to Discord and register its slash commands globally. ## Run With Docker Compose 1. Copy the example env file: ```bash cp .env.example .env ``` 2. Edit `.env` and set your Discord token: ```dotenv DISCORD_BOT_TOKEN=YOUR_ACTUAL_TOKEN_HERE ``` 3. Build and run with Docker Compose: ```bash docker compose up --build -d ``` 4. View logs: ```bash docker compose logs -f ``` 5. Stop the bot: ```bash docker compose down ``` ## Project Structure ``` TentacleBot/ ├── Program.cs # Entry point and DI setup ├── Services/ │ └── BotService.cs # Core bot service ├── Commands/ │ └── GeneralCommands.cs # Example slash commands ├── appsettings.json # Configuration ├── Dockerfile # Container image definition ├── docker-compose.yml # Local compose setup ├── .env.example # Environment variable template ├── TentacleBot.csproj # Project file └── README.md # This file ``` ## Example Commands The bot includes example slash commands: - `/general ping` - Shows bot latency - `/general hello [user]` - Greet a user - `/general botinfo` - Display bot information ## Adding New Commands Create a new class in the `Commands` folder that inherits from `InteractionModuleBase`: ```csharp using Discord.Interactions; namespace TentacleBot.Commands; public class MyCommands : InteractionModuleBase { [SlashCommand("mycommand", "My custom command")] public async Task HandleMyCommandAsync() { await RespondAsync("Hello from my command!"); } } ``` Commands are automatically discovered and registered when the bot starts. ## Configuration ### appsettings.json ```json { "Discord": { "BotToken": "YOUR_BOT_TOKEN_HERE" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning" } } } ``` ## Troubleshooting - **"Bot token not found"**: Set `DISCORD_BOT_TOKEN` in `.env` (Docker) or in your shell. The app falls back to `appsettings.json` if the env var is not set - **"Insufficient permissions"**: Ensure your bot has the necessary permissions in Discord Developer Portal - **Commands not appearing**: The bot needs to connect first. Wait a few seconds after starting, then try `/` in Discord ## Resources - [Discord.Net Documentation](https://discordnet.dev/) - [Discord Developer Portal](https://discord.com/developers/applications) - [.NET Documentation](https://docs.microsoft.com/dotnet) ## License MIT