Garret Patti 3064e93011 init commit
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00
2026-07-04 20:43:38 -04:00

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

Quick Start

1. Clone and Setup

dotnet restore

2. Configure Your Bot Token

Edit appsettings.json and replace YOUR_BOT_TOKEN_HERE with your actual Discord bot token:

{
  "Discord": {
    "BotToken": "YOUR_ACTUAL_TOKEN_HERE"
  }
}

3. Run the Bot

dotnet run

The bot will connect to Discord and register its slash commands globally.

Run With Docker Compose

  1. Copy the example env file:
cp .env.example .env
  1. Edit .env and set your Discord token:
DISCORD_BOT_TOKEN=YOUR_ACTUAL_TOKEN_HERE
  1. Build and run with Docker Compose:
docker compose up --build -d
  1. View logs:
docker compose logs -f
  1. Stop the bot:
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<SocketInteractionContext>:

using Discord.Interactions;

namespace TentacleBot.Commands;

public class MyCommands : InteractionModuleBase<SocketInteractionContext>
{
    [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

{
  "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

License

MIT

Description
No description provided
Readme 65 KiB
Languages
C# 99.3%
Dockerfile 0.7%