init commit

This commit is contained in:
Garret Patti
2026-07-04 20:43:38 -04:00
commit 3064e93011
12 changed files with 607 additions and 0 deletions

157
README.md Normal file
View File

@@ -0,0 +1,157 @@
# 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/
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Program.cs # Entry point and DI setup
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Services/
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BotService.cs # Core bot service
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Commands/
<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GeneralCommands.cs # Example slash commands
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> appsettings.json # Configuration
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Dockerfile # Container image definition
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> docker-compose.yml # Local compose setup
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .env.example # Environment variable template
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TentacleBot.csproj # Project file
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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>`:
```csharp
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
```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