Simple Discord .NET
A lightweight, dependency-free Discord bot SDK for .NET 10
Introduction
Simple Discord .NET is a lightweight, dependency-free Discord bot SDK for .NET 10 that provides direct access to Discord API v10 (REST + Gateway).
Whether you're building a small personal bot or a large-scale distributed application, Simple Discord .NET gives you the tools you need without the complexity of larger frameworks.
Quick Start
Get started with Simple Discord .NET in just a few steps:
# Install via NuGet
dotnet add package SimpleDiscordDotNet
using SimpleDiscordNet;
using SimpleDiscordNet.Commands;
using SimpleDiscordNet.Primitives;
// Define your commands with options
public sealed class MyCommands
{
[SlashCommand("greet", "Greet someone")]
public async Task GreetAsync(
InteractionContext ctx,
[CommandOption("name", "Person's name", MinLength = 2, MaxLength = 32)]
string name,
[CommandOption("style", "Greeting style", Choices = "Friendly:👋,Formal:🤝,Casual:✌️")]
string style)
{
// ✨ NEW in v1.4.0: Direct access to Member and Guild
string memberName = ctx.Member?.User.Username ?? "Unknown";
string guildName = ctx.Guild?.Name ?? "DM";
await ctx.RespondAsync($"{style} Hello, {name}! Called by {memberName} in {guildName}", ephemeral: true);
}
}
// Build and start your bot
var bot = DiscordBot.NewBuilder()
.WithToken(Environment.GetEnvironmentVariable("DISCORD_TOKEN")!)
.WithIntents(DiscordIntents.Guilds)
.WithDevelopmentMode(true)
.WithDevelopmentGuild("YOUR_DEV_GUILD_ID")
.Build();
await bot.StartAsync();
await Task.Delay(Timeout.Infinite);
Key Features
Zero Dependencies
Built only on BCL; no external packages required.
Full Discord API v10 Support
Complete coverage of REST and Gateway APIs, including components, modals, and sharding.
Native AOT Compatible
100% zero reflection with source generators for compile-time command discovery.
Memory Optimized
Span
Enhanced InteractionContext
Direct Member and Guild access without cache lookups.
Live Observable Collections
Thread-safe INotifyCollectionChanged support for real-time UI data binding.
What's New in v1.6.0
Simple Discord .NET v1.6.0 introduces Live Observable Collections for real-time UI data binding and Enhanced InteractionContext for direct member and guild access without cache lookups.
Live Observable Collections for UI Binding
Thread-safe collections with INotifyCollectionChanged support for real-time UI data binding:
// WPF Example
public class MainViewModel
{
public MainViewModel()
{
// Bind directly to live collections
Guilds = DiscordContext.LiveGuilds;
var guildId = 123456789;
Channels = DiscordContext.GetLiveChannelsForGuild(guildId);
Members = DiscordContext.GetLiveMembersForGuild(guildId);
}
public ObservableConcurrentDictionary Guilds { get; }
public ObservableConcurrentList Channels { get; }
public ObservableConcurrentList Members { get; }
}
// Configure UI thread marshaling
var bot = DiscordBot.NewBuilder()
.WithToken(token)
.WithSynchronizationContext(SynchronizationContext.Current) // ✨ UI thread marshaling
.Build();
Key Features
- Thread-safe - Built on
ConcurrentDictionaryandReaderWriterLockSlim - Batch operations -
BeginBatchUpdate(),AddOrUpdateRange()to prevent UI thrashing on large servers - UI thread marshaling - Optional
SynchronizationContextfor automatic UI thread dispatching - Backward compatible - All existing snapshot APIs preserved
Installation
Choose your preferred installation method:
# Package Manager
Install-Package SimpleDiscordDotNet
# .NET CLI
dotnet add package SimpleDiscordDotNet
# Package Reference
# Clone the repository
git clone https://github.com/SimpleDiscordNet/SimpleDiscordNet.git
# Build the project
cd SimpleDiscordNet
dotnet build
# Reference the built assembly
Project Navigation
Quick Actions
Project Stats
- Version: v1.6.0
- License: Apache 2.0
- .NET Version: 10.0+
- Last Updated: Jan-08-2026
- Stars: 180
- Forks: 10