SimpleDiscordDotNet 1.11.0
dotnet add package SimpleDiscordDotNet --version 1.11.0
NuGet\Install-Package SimpleDiscordDotNet -Version 1.11.0
<PackageReference Include="SimpleDiscordDotNet" Version="1.11.0" />
<PackageVersion Include="SimpleDiscordDotNet" Version="1.11.0" />
<PackageReference Include="SimpleDiscordDotNet" />
paket add SimpleDiscordDotNet --version 1.11.0
#r "nuget: SimpleDiscordDotNet, 1.11.0"
#:package SimpleDiscordDotNet@1.11.0
#addin nuget:?package=SimpleDiscordDotNet&version=1.11.0
#tool nuget:?package=SimpleDiscordDotNet&version=1.11.0
SimpleDiscordDotNet
A lightweight, dependency-free Discord bot SDK for .NET 10 that provides direct access to Discord API v10 (REST + Gateway).
Purpose
SimpleDiscordDotNet is designed for developers who want:
- Zero dependencies - BCL only, no external packages
- Performance - UTF-8 JSON handling, dictionary-based cache lookups and per-resource rate limiting
- Simplicity - Clean, approachable API with builder patterns
- Modern C# - Built for .NET 10 with C# 14 features
- Broad API coverage - Bucket-aware rate limiting and most of Discord's REST and gateway API
Key Features
- ✅ Slash commands, components, and modals with attribute-based handlers
- ✅ Checks, cooldowns, enum options and event handlers as attributes
- ✅ Built-in confirmations and pagination
- ✅ Constructor injection for handlers, with no reflection
- ✅ Modals defined as plain classes, with fields filled in for you
- ✅ Polls, threads, forum posts and layout messages (Components V2)
- ✅ Command translation, and DM and user-install support, through attributes
- ✅ Source generator for zero-reflection command/component discovery
- ✅ Ambient context for accessing cached guilds, channels, members, roles
- ✅ Live observable collections - Thread-safe
INotifyCollectionChangedfor WPF/MAUI/Avalonia UI binding - ✅ Comprehensive gateway events for all entity changes
- ✅ Advanced rate limiting with bucket management and monitoring
- ✅ Full Discord API v10 support (messages, reactions, permissions, roles, channels, threads, etc.)
- ✅ Native AOT and trimming compatible
- ✅ Span-based formatting helpers and direct UTF-8 serialization
- ✅ Sharding - Run all shards in one process, or use experimental distributed coordinator/worker mode
Quick Example
using SimpleDiscordNet;
using SimpleDiscordNet.Commands;
using SimpleDiscordNet.Primitives;
var bot = DiscordBot.NewBuilder()
.WithToken(Environment.GetEnvironmentVariable("DISCORD_TOKEN")!)
.WithIntents(DiscordIntents.Guilds | DiscordIntents.GuildMessages)
.Build();
await bot.StartAsync();
await Task.Delay(Timeout.Infinite);
public sealed class AppCommands
{
[SlashCommand("hello", "Say hello")]
public async Task HelloAsync(InteractionContext ctx)
{
var embed = new EmbedBuilder()
.WithTitle("Hello!")
.WithDescription("Welcome to SimpleDiscordDotNet")
.WithColor(0x00FF00);
await ctx.RespondAsync(embed: embed);
}
[SlashCommand("chart", "Send a chart image")]
public async Task ChartAsync(InteractionContext ctx)
{
byte[] chartBytes = await File.ReadAllBytesAsync("chart.png");
// Slash commands are deferred automatically, so slow work is fine here
await ctx.RespondAsync("Here's the latest chart:",
fileName: "chart.png",
fileData: chartBytes);
}
[SlashCommand("userinfo", "Get user information")]
public async Task UserInfoAsync(InteractionContext ctx)
{
var user = ctx.User;
var member = ctx.Member;
await ctx.RespondAsync($"Hello {user?.Username}! You joined this server on {member?.Joined_At}");
}
}
Documentation
📖 Full documentation is available in the Wiki
- Installation - Get started with NuGet or source reference
- Getting Started - Your first bot in minutes
- Beginner's Guide - Step-by-step guide for Discord bot beginners
- Feature Examples - A simple and a realistic example of every feature
- Configuration - Builder patterns, DI, intents
- Commands - Slash commands, components, modals
- Permissions - Dual-layer command permissions
- Moderation - Bans, kicks, timeouts, voice control, audit logs
- Working with Entities - Channels, guilds, members, messages, and roles
- Events - Gateway events and logging
- Sharding - Scaling across shards and processes
- API Reference - Every public type and member
- Rate Limit Monitoring - Monitoring and analytics
- FAQ - Common questions and troubleshooting
Installation
Install from NuGet:
dotnet add package SimpleDiscordDotNet
Or via Package Manager:
Install-Package SimpleDiscordDotNet
Requirements
- .NET SDK 10.0 or newer
- A Discord bot token from the Discord Developer Portal
- Gateway intents configured as needed
Contributing
Issues and pull requests are welcome! Please keep the code dependency-free and aligned with the existing style.
Community
Join our Discord community for support, discussions, and updates: https://discord.gg/2KrUPCgh
License
Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE for details.
Ready to build your Discord bot? Head to the Wiki to get started!
Version History
v1.11.0
A large release: new attribute-based features, plus reliability fixes across the library. Most changes need no code changes, but read the upgrade notes below first.
New features
- Checks -
[Cooldown],[RequireRole],[RequireBotPermissions]and[RequireOwner]run before a handler and tell the user why they failed. - Enum parameters - An enum becomes a list of choices automatically.
- Return a reply - Handlers can return a string,
EmbedBuilderorMessageBuilder, or aTaskof one. - Data in component IDs -
[ButtonHandler("vote:{pollId}:{choice}")]binds parts of the ID to parameters. - Questions and pages -
ctx.ConfirmAsync(),ctx.ChooseAsync()andctx.PaginateAsync(). - Event attributes - Over 40 attributes such as
[OnMemberJoined],[OnMessageCreated],[OnBanAdded]and[OnVoiceStateUpdated], plus[OnEvent]for the rarer ones. - Services in handlers - Handler classes can take services through their constructors, with
WithServices. - Error handling and help -
[OnCommandError]for all failures, and[assembly: GenerateHelp]for a help command. - Compile errors - Library diagnostics now point at the file and line.
- Attribute modals - Define a form as a class with
[Modal]and field attributes such as[ModalText],[ModalSelect],[ModalCheckbox]and[ModalFile]. Open it withctx.OpenModalAsync<TForm>()and receive it filled in through[ModalHandler]. Modals use Discord's current Label components. - Where commands work -
[GuildOnly],[AllowInDMs]and[UserInstallable]. - Translations -
[Localized]on commands, groups, parameters and context menu commands. - Polls -
builder.WithPoll(...),PollBuilder,message.EndPollAsync()andmessage.GetPollVotersAsync(). - Threads and forum posts -
channel.CreateThreadAsync(),message.CreateThreadAsync(),channel.CreateForumPostAsync(),channel.GetArchivedThreadsAsync()andguild.GetActiveThreadsAsync(). Channels now expose forum tags and thread details. - Layout messages - Components V2 through
WithText,WithContainer,WithSection,WithGalleryandWithSeparator. - More actions -
message.ForwardAsync(),message.UnpinAsync(),guild.SearchMembersAsync(),guild.SearchMessagesAsync(),guild.BulkBanAsync()and application emoji methods. - Permissions -
PermissionFlagsnow includesPinMessages,SendPolls,CreateEvents,CreateGuildExpressions,BypassSlowmode,UseExternalAppsand more. - Events -
ChannelPinsUpdated,ThreadMemberUpdated,ThreadMembersUpdated,ThreadListSyncedandGatewayRateLimited. - Hidden channels -
DiscordChannel.IsObfuscateddetects channels Discord hides from the bot.
Upgrade notes
- Re-sync your commands.
ulongparameters are now string options, because Discord's integer options can't hold a snowflake. Context menu commands are registered with the empty description Discord requires. [CommandOption]-Required,MinLength,MaxLength,MinValueandMaxValueare now non-nullable. The old nullable properties couldn't be set from an attribute, so existing code that compiled isn't affected.- Channel creation - The
permissionOverwritesparameter is now strongly typed. Code passing anobjectneeds updating. IDiscordBot- GainedRateLimitMonitor, optionalreasonparameters on the kick, ban, unban and timeout methods, and the new thread, poll, search and emoji methods. Custom implementations need updating, including customIDiscordContextOperations.- Pins - Pinning now needs Discord's
PinMessagespermission rather thanManageMessages.GetPinnedMessagesAsyncuses Discord's current routes and returns every pin. - Forum posts -
WithForumPostnow goes to Discord's thread route, so the returned message'sChannelIdis the new post's thread. TextInput- Thelabelargument is now optional. Wrap a text input in aLabelinstead, because Discord has deprecated the old form.- Gateway member limits - Discord allows one full member request per guild every 30 seconds. Rejected requests are now retried after the wait Discord asks for.
- Thread cache - Threads now stay in the cache as they're created, updated and deleted.
- Option defaults - A command parameter's default value now applies when the option is omitted.
int age = 18used to arrive as 0. [CommandChoice]- It failed to compile before and now works.CommandChoice.Createbuilds a choice for autocomplete.DiscordBot.FromOptions- It now registers your generated commands, which it used to skip.- Handler classes - A class whose only public constructor takes parameters now gets them from
WithServices, rather than being a compile error. DiscordRole.Guildis no longerrequired.- POST retries - POST requests are no longer retried on 5xx responses, because Discord may have already processed them. Handle these errors yourself where it matters.
GuildRemovedno longer fires when a guild is only temporarily unavailable during an outage.- Gateway debug output from
WithGatewayDebug()now goes through the logger at Debug level rather than the console. - Packaging - The project no longer builds a package on every build. Use
dotnet pack. - Distributed sharding - All nodes must upgrade together, because cluster traffic now requires a secret derived from the bot token. This mode is experimental, and there's no automatic coordinator failover.
Entities and caching
- Fixed parsing of users, members, roles, guilds and audit logs that failed or lost data on real gateway payloads.
- Messages in DMs and uncached channels now reach handlers.
- Member, channel and role lookups are now dictionary lookups, and member chunks are added in batches.
- Live collections now raise change notifications for bulk updates.
Gateway
- Rewrote connection handling: resume uses
resume_gateway_url, close codes follow Discord's rules, heartbeat requests are answered, and the first heartbeat is jittered. - Fatal close codes stop reconnecting, and outgoing commands respect the 120 per 60 seconds send limit.
REST
- Rate limits are tracked per bucket and per channel, guild or webhook. Interaction endpoints are exempt from the global limit.
RateLimitMonitoris now implemented, and tokens are redacted from logs.- Added audit log
reasonsupport,DiscordMember.KickAsyncandDiscordMember.BanAsync, and paginatedGetAllCurrentUserGuildsAsync.
Commands
DiscordUser,DiscordMember,DiscordChannel,DiscordRole, attachment,doubleandfloatparameters now work.- Added
TargetId,TargetUser,TargetMemberandTargetMessagetoInteractionContextfor context menu commands. - Unsupported parameter types are now a compile error (SDN004) instead of failing at runtime.
Sharding
- Cluster traffic is authenticated, shards honor
max_concurrencywhen identifying, and URL handling is fixed for trailing slashes and wildcard hosts. - Cluster traffic uses
http://unless you set up TLS, so keep it on a private network or behind a TLS proxy. See the Sharding guide.
Quality
- Added an automated test suite, a Native AOT smoke test, and CI that runs both.
- Corrected the documentation against the real API.
v1.10.17 - Connected Event Reliability Fix
- Connected Event Fix —
Connectedevent now fires after every full gateway reconnection (IDENTIFY), not just the initial one. Previously,Disconnectedwould fire on transient network issues, butConnectedonly fired once on the firstREADYdue to an_isReadyflag that was never reset. When a session expired during reconnect, the subsequent fresh IDENTIFY/READY cycle would silently skip firingConnected, leaving consumers trackingIsConnectedpermanently stuck at "Disconnected". - _isReady is now reset to 0 in two code paths:
ResumeAsyncfallback-to-identify (when_sessionIdis empty), and op=9 INVALID_SESSION handler (when resume isn't possible). This guarantees thatConnectedfires on every full reconnect, matching consumer expectations. - ✅ 0 breaking changes — All existing API and event types unchanged.
v1.10.16 - Disconnected Event Reliability Fix
- Disconnected Event Fix —
Disconnectednow fires reliably before every silent reconnect attempt, not just on WebSocket close frames. Added to four code paths: missed heartbeat ACKs, receive loop exceptions, socket state loss (half-close without close frame), and op=7 RECONNECT requests. Upstream consumers trackingIsConnectedvia events will no longer show stale "Connected" state after silent connection loss. - ✅ 0 breaking changes — All existing API and event types unchanged.
v1.10.15 - Session Resumed Event
- New
SessionResumedEvent — Added toGatewayClient,DiscordEvents, andShardinfrastructure. Fires when the gateway successfully resumes an existing session after a WebSocket disconnect (t="RESUMED"), distinct fromConnectedwhich only fires on initial or newREADY. - Shard Status Fix —
Shard._statusnow correctly transitions fromReconnectingback toConnectedon successful resume, rather than staying stuck inReconnectingpermanently. WireShardEventsUpdated — Now accepts anonSessionResumedparameter so sharded consumers can subscribe to resume events through the wiring helper.- ✅ 0 breaking changes — All existing API and event types unchanged.
SessionResumedis a new event; existingConnectedbehavior is preserved.
v1.10.14 - Gateway Reconnect & Session Resume Fix
- 30-Minute Disconnect Fixed — Close code 4003 (Not authenticated) no longer waits 30 minutes before retrying. Reduced to 30-second delay.
- Session Resume Attempt — On 4003, the gateway first attempts to resume the existing session. If resume fails, it clears all cached entities (guilds, channels, members, users, roles) and performs a fresh identify to guarantee a clean state.
- Fatal Codes Stop Retrying — Close codes 4004, 4010, 4011, 4012 are now treated as fatal configuration errors and stop the reconnect loop immediately.
- ✅ 0 breaking changes — All existing API and event types unchanged.
v1.10.13 - Anonymous Type Serialization Fix
- Anonymous Type Serialization Crash — 6 REST methods (
CreateRoleAsync,ModifyRoleAsync,CreateChannelAsync,ModifyChannelAsync,EditMessageAsync,ModifyGuildAsync) used anonymous types as request payloads, causingNotSupportedExceptionwhen serialized via source-generatedDiscordJsonContext. Replaced all anonymous types with named request classes (CreateGuildRoleRequest,CreateGuildChannelRequest,ModifyChannelRequest,EditMessageRequest,ModifyGuildRequest) and registered them with[JsonSerializable]. - ✅ 0 breaking changes — All method signatures and public API unchanged.
v1.10.12 - Gateway Reconnect Hardening & Invite Event Fixes
- Non-Recoverable Close Code Protection — Gateway now detects non-recoverable Discord close codes (4003, 4004, 4010, 4011, 4012) and applies a 30-minute delay before retrying instead of entering an infinite reconnect loop. On successful reconnection, the normal backoff timer resets immediately.
- Auth Failure Diagnostics —
Disconnectedevent now logs a clear error when authentication is rejected, directing users to verify their bot token. - Invite Event Crash Fix —
TryEmitInviteCreateEventandTryEmitInviteDeleteEventnow useTryGetPropertyfor optional fields (guild_id,inviter,code,created_at), preventingKeyNotFoundExceptioncrashes when Discord omits these fields (e.g. DM invites, vanity URL invites). - ✅ 0 breaking changes — All existing API and event types unchanged.
v1.10.11 - Kick & Ban via DiscordContext.Operations
- Moderation API Completeness —
KickMemberAsyncandBanMemberAsyncare now exposed onDiscordContext.Operations, completing moderation coverage alongside existing timeout, role, and voice operations.KickMemberAsyncalso added to theIDiscordBotinterface. - ✅ 0 breaking changes — New methods only, all existing API unchanged.
v1.10.10 - DM Channel Deserialization Fix
- DM Channel Fix —
DiscordChannel.Nameis no longer markedrequired, defaulting tostring.Empty. DM/GroupDM channels omitnamefrom API responses, which previously caused deserialization crashes inSendDMAsync,GetChannelAsync, and interaction resolved channel data. - ✅ 0 breaking changes —
Namestill returnsstring(non-nullable). Existing code settingNamecontinues to work unchanged.
v1.10.9 - File Attachments on Interaction Responses & Followups
- File Attachments on Responses —
RespondAsync,FollowupAsync,EditFollowupAsync, andUpdateMessageAsyncnow support file attachments viaMessageBuilder.AddFile()or directfileName/fileDataparameters. The SDK automatically defers then sends files as followups when used on initial interaction responses (Discord does not support files on type 4/7 callbacks). - File Attachments on Followups & Edits —
FollowupAsync(MessageBuilder),EditFollowupAsync(string, MessageBuilder), andEditOriginalResponseAsync(MessageBuilder)new overloads support multipart file uploads via webhook endpoints, including PATCH multipart for editing messages with attachments. allowed_mentionsPropagation —InteractionResponseDataandWebhookMessageRequestnow includeallowed_mentionsfromMessagePayload, fixing silent data loss when usingMessageBuilder.WithMention()on interaction responses.- Auto-Defer Detection —
RespondAsyncandUpdateMessageAsyncnow automatically defer (type 5/type 6) when file attachments are present on the initial response path. The user never needs to manually defer just to send files.RestClient.SendMultipartAsyncrefactored to acceptHttpMethodfor PATCH multipart support. [Ephemeral]Propagation — The[Ephemeral]attribute now properly propagates to followup messages. When a handler has[Ephemeral], followups sent viaFollowupAsync/RespondAsyncdefault to ephemeral without requiring explicitephemeral: trueon every call. Useephemeral: falseto override per-message.FollowupAsyncnow acceptsbool? ephemeralfor nullable semantics.- AOT Serialization Fixes — Added missing
[JsonSerializable]registrations:DiscordMessage[],IEnumerable<DiscordBan>,int?. New typed entities replaceobject/object[]deserialization:DiscordWebhook,DiscordSticker,DiscordInvitewith array variants. Webhook/Sticker/Invite API methods now return strongly-typed entities instead ofIEnumerable<object>orTask<object?>. - ✅ 0 breaking changes — All new parameters are optional with defaults.
Taskreturn types unchanged.bool→bool?implicit conversion compatible.
v1.10.8 - Component Serialization Fix for .NET 10
- Polymorphic Serialization Fix —
IComponentimplementations (ActionRow,Button,StringSelect,TextInput,UserSelect,RoleSelect,MentionableSelect,ChannelSelect) now use[JsonIgnore]on thetypeproperty, resolving anInvalidOperationExceptioncrash caused by a metadata name conflict with the[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]discriminator in .NET 10.
v1.10.7 - Gateway Hardening, Missing Event Wiring & Presence Fix
- Gateway Reliability — WebSocket write serialization via
SemaphoreSlimprevents concurrentSendAsyncrace causing disconnects._wsfield madevolatile; all send/receive methods capture_wslocally eliminating TOCTOU races.ConnectSocketAsyncdefers_wsassignment until connection succeeds. State checks moved inside write lock. - Missing Events Wired — 26 dispatch cases added to
HandleDispatchfor previously-dead gateway events:VoiceStateUpdate,PresenceUpdate,TypingStart,WebhooksUpdate,InviteCreate,InviteDelete,GuildIntegrationsUpdate,AutoModeration*,StageInstance*,GuildScheduledEvent*,Integration*,VoiceServerUpdate,GuildJoinRequest*,PollVote*. 7 newTryEmit*helpers + 20 handler methods wired throughDiscordBot,ShardManager, andDiscordEvents. - Presence Fix —
UpdatePresencePayload.sinceuses[JsonIgnore(Condition = Never)]— Discord requires this field present even whennull.BotActivity.urluses[JsonIgnore(Condition = WhenWritingNull)]to omitnullfor non-streaming activities.DefaultIgnoreCondition = WhenWritingNulladded to source-gen options. - AOT Serialization —
ApplicationCommandDefinition[]no longer boxed toobject[](caused 4002 errors). All command sync paths use strongly-typed arrays registered in source-gen context. - Diagnostics — Close frame reason now logged via
Errorevent.Disconnectedevent fires before auto-reconnect. AddedWithGatewayDebug()opt-in diagnostic logging for all outgoing gateway payloads.EnableGatewayDebugadded toDiscordBotOptions. - API Enhancements — Optional
statusparameter added toSetGameAsync,SetWatchingAsync,SetListeningAsync,SetStreamingAsync,SetCompetingAsync.UpdatePresenceAsyncandRequestGuildMembersAsyncnow fireErrorinstead of silently returning.ActivityTypeenum gap at value 4 documented.
v1.10.0 - Comprehensive Bug Fixes & Hardening Pass
- Rate Limiter — Route-to-bucketId mapping fixed (rate limiting was non-functional). Semaphore deadlock eliminated. Sync-over-async removed.
Handle429AsyncusesMax(existing, new)for reset time. - Gateway Reliability —
async voidheartbeat →async Taskloop.ReceiveLoopuses while-loop instead of recursion; no longer dies on reconnect contention._ctsHeartbeatprotected by lock. Author parsing handles webhook messages.Disposesets_autoReconnect=false. - AOT Compatibility — Zero anonymous types in any serialization path.
IComponentgets[JsonPolymorphic]+[JsonDerivedType]for all 8 implementations. 30+ new[JsonSerializable]registrations. Allobject/object[]payload properties replaced with typed alternatives.[UnconditionalSuppressMessage]checkIds fixed. - Memory Safety —
_usersLRU eviction with stale-entry drain (max 100k). Event handler leaks closed inShard,DiscordBot.ObservableConcurrentListnow disposesReaderWriterLockSlimon replacement. - Thread Safety — Dozens of race conditions fixed:
_ctsHeartbeatTOCTOU,PeerNode.AssignedShardsconcurrent reads viaGetShardsSnapshot(),EntityCacherole array writes under lock,RemoveChannel/RemoveMemberuse atomicRemove(),_startedatomic gate,DisposeAsyncre-entrancy guard. - Autocomplete —
InteractionOption.Focusedparsed from gateway. Handler key includes subcommand group/command path.AutocompleteHandleruses primary constructor. Generator respectsHasContextflag, emits per-subcommand permissions, SDN003 duplicate diagnostic. - InteractionContext — Double-acknowledge guard via
_responded._deferred/_deferredUpdatemade volatile.UpdateMessageAsyncroutes to edit-original when type-5 deferred._respondedreset on defer failure. - Performance — ChannelId ulong cached; O(1) option lookup dictionary.
EntityCacheO(1) channel/role secondary indices.SnapshotUsersO(N*M)→O(N). Prefix matching prefers longest match. - Cleanup — Dead fields/classes removed (
_heartbeatTimer,PendingRequest,RequestMetricstimer).DiscordEvents.UnsubscribeAll()helper.SendMessageWithButtonsAsyncacceptsCancellationToken. - Sharding —
ShardCoordinator.HandleResumptionAsynccallsStopAsyncafter handoff. Timer disposal usesDispose(WaitHandle). Assignment operations protected by_assignmentLock.
v1.9.0 - Context Menus, Autocomplete, Presence & Full API Coverage
- Presence/Status API —
SetGameAsync("Minecraft"),SetWatchingAsync("YouTube"),SetListeningAsync("Spotify"),SetStreamingAsync("Live!", url),SetCompetingAsync("tournament"),SetStatusAsync(PresenceStatus.DoNotDisturb) - Context Menu Commands —
[UserContextMenu("Info")]and[MessageContextMenu("Report")]attributes - Autocomplete Handlers —
[Autocomplete("command_name", "option_name")]with full interaction routing - Global Command Sync —
bot.SyncGlobalCommandsAsync() - Guild Management —
ModifyGuildAsync,LeaveGuildAsync,PruneMembersAsync,GetPruneCountAsync - Webhook Management —
CreateWebhookAsync,GetChannelWebhooksAsync,ModifyWebhookAsync,DeleteWebhookAsync - Emoji & Sticker Management —
CreateEmojiAsync,ModifyEmojiAsync,DeleteEmojiAsync,GetGuildStickersAsync, sticker CRUD - Invite Management —
CreateInviteAsync,GetChannelInvitesAsync,GetGuildInvitesAsync - Message Replies & Forum Posts —
builder.WithReply(messageId),builder.WithForumPost(title, tags),channel.ReplyAsync() - Bot User Modify —
bot.ModifyCurrentUserAsync(username:, avatarBase64:) - Interaction Followup Editing —
GetOriginalResponseAsync,EditOriginalResponseAsync,DeleteOriginalResponseAsync,EditFollowupAsync,DeleteFollowupAsync - ulong Overloads — All ID-accepting methods now support both
stringandulong - Stage Instances, Scheduled Events, Auto-Mod Rules — Full CRUD for all remaining Discord REST endpoints
- Bug Fix —
LoadCompleteGuildDataAsyncNRE in sharded modes (SingleProcess + Distributed worker) - Source Generator — Extended to handle context menu commands and autocomplete handlers
- ✅ Voice control operations - Deafen/undeafen members, move between channels, disconnect from voice
bot.DeafenMemberAsync(),bot.UndeafenMemberAsync()bot.MoveMemberToVoiceChannelAsync(),bot.DisconnectMemberFromVoiceAsync()
- ✅ Ban management - Retrieve guild bans with reasons
bot.GetGuildBansAsync()- Get all bansbot.GetGuildBanAsync()- Get specific ban- New
DiscordBanentity with user and reason
- ✅ Audit log access - Complete audit log with advanced filtering
bot.GetAuditLogAsync()with filters: userId, actionType, before, after, limit- Enhanced
DiscordAuditLogentity with audit_log_entries, users, threads - Full
AuditLogActionenum for all Discord actions
- ✅ Bug fixes - Resolved 3 nullable reference warnings (CS8602, CS8601)
- ✅ API compatibility - All methods support both string and ulong overloads
- 📖 New Moderation Guide with comprehensive examples
v1.6.8 - Dual-Layer Command Permissions (2025-01-15)
- ✅ Discord-level permissions -
[RequirePermissions]attribute for default visibility- Sets
default_member_permissionsduring command registration - Integrated with source generator for zero-reflection operation
- Sets
- ✅ Runtime per-guild rules -
bot.PermissionsAPI for dynamic restrictionsRegisterGuildRule()for custom permission checksCheckPermission()evaluates rules before command execution- Thread-safe with ConcurrentDictionary storage
- ✅ 100% AOT compatible - Delegate-based, no reflection
- ✅ Shard-safe - Works across all sharding modes
- ✅ Beginner-friendly - Simple attribute + delegate API
- 📖 New Permissions Guide with database integration examples
v1.6.0 - Cache-First Entity Retrieval & Live Collections (2025-01-11)
- ✅ Cache-first entity retrieval - Optional
useCacheparameter (default: true)GetUserAsync(),GetGuildMemberAsync(),GetGuildAsync(),GetChannelAsync()- Reduces unnecessary API calls while maintaining backward compatibility
- ✅ Live observable collections - Thread-safe
INotifyCollectionChangedfor UI bindingbot.GetLiveGuilds(),guild.GetLiveChannels(),guild.GetLiveMembers()- WPF/MAUI/Avalonia support with
SynchronizationContext - Real-time updates from gateway events
- ✅ API completeness - Added missing methods:
GetGuildChannelsAsync(),GetGuildRolesAsync()
v1.5.0 - Complete Gateway Events (2024-12-24)
- ✅ Added missing Discord gateway events - All previously unwired events are now fully exposed:
InteractionCreated– raised for every interaction (slash commands, components, modals)GuildEmojisUpdated– emoji updates within a guildVoiceStateUpdated– voice state changesPresenceUpdated– presence updatesTypingStarted– typing indicatorsWebhooksUpdated– webhook changesInviteCreated– new invitesInviteDeleted– invite deletionsGuildIntegrationsUpdated– integration updates
- ✅ Event wiring – Events are now wired in both single‑gateway and sharded modes.
- ✅ Modern C# 14 patterns – Explicit type names and collection expressions where applicable.
- ✅ Backward compatible – No breaking changes; existing code continues to work unchanged.
v1.4.4 - Advanced Components & Collection Improvements (2025-12-20)
- ✅ Advanced select menu features - Default values, resolved entity data, emoji support
- Pre-populate select menus:
new UserSelect("id", defaultValues: new[] { SelectDefaultValue.User(userId) }) - Access resolved entities:
ctx.GetResolvedUsers(),ctx.GetResolvedRoles(),ctx.GetResolvedChannels() - Emoji support in SelectOption:
new SelectOption("Label", "value", emojiName: "🎉")
- Pre-populate select menus:
- ✅ Specialized component handler attributes - Type-safe handler registration
[ButtonHandler("id")],[UserSelectHandler("id")],[RoleSelectHandler("id")][ChannelSelectHandler("id")],[MentionableSelectHandler("id")]
- ✅ File attachments in MessageBuilder - Send files with messages
builder.AddFile("file.pdf", bytes),builder.AddFile("image.png", stream)- Multiple overloads: byte[], ReadOnlyMemory, Stream, MemoryStream, async support
- ✅ Message collection methods - Fetch and manage message history
channel.GetMessagesAsync(limit)- Fetch up to 100 messageschannel.BulkDeleteMessagesAsync(count)- Delete 2-100 recent messages
- ✅ IEnumerable returns - All collection methods now return
IEnumerable<T>instead ofT[]- Better LINQ support:
foreach (var msg in await channel.GetMessagesAsync(50)) { } - Consistent API across all collection methods
- Better LINQ support:
- ✅ UpdateAsync aliases - Convenient update methods for component interactions
ctx.UpdateAsync("text")andctx.UpdateAsync(builder)overloads- Works with both string content and MessageBuilder
- ✅ ComponentType enum - Type-safe component type constants
- ✅ Source generator updates - Recognizes all new specialized handler attributes
v1.4.3 - Channel Permissions & Source Generator Fixes (2025-12-20)
- ✅ Channel permission management - Add, remove, deny, and modify permissions for roles and members
channel.AddPermissionAsync(roleId, PermissionFlags.AttachFiles)role.AddChannelPermissionAsync(channel, permission)member.AddChannelPermissionAsync(channel, permission)
- ✅ Source generator fixes -
[CommandOption]attribute now optional for backward compatibility - ✅ Added
ulongparameter support - Commands can now useulongparameters (Discord snowflake IDs) - ✅ Fixed mixed static/instance class handling - Classes with both static and instance methods now generate correctly
- 🔧 Type compatibility - Fixed
IReadOnlyList<InteractionOption>handling
v1.4.1 - Entity-First Architecture & Rich API (2025-12-20)
- ✅ Removed WithGuild wrappers - All entities (Channel, Member, Role, User) now have direct Guild/Guilds properties
- ✅ Rich entity methods - Entities can perform operations on themselves (channel.SendMessageAsync, member.AddRoleAsync, message.PinAsync)
- ✅ Enhanced channel management - SetTopicAsync, SetNameAsync, SetNsfwAsync, SetBitrateAsync, SetUserLimitAsync, SetSlowmodeAsync
- ✅ Message operations return entities - All SendMessageAsync/SendDMAsync methods return DiscordMessage for chaining
- ✅ Guild channel creation - CreateChannelAsync and CreateCategoryAsync directly on DiscordGuild
- ✅ DM channel caching - DM channels are now cached in EntityCache for performance
- ✅ Type consistency - Author.Id changed from string to ulong, InteractionContext.User now returns DiscordUser
- ✅ Optional parameters - RespondAsync content parameter defaults to empty string for embed-only responses
- 📖 Comprehensive documentation - New Beginners-Guide.md and Entities.md wiki pages with detailed examples
v1.4.0 - Enhanced InteractionContext & Security (2025-12-19)
- ✅ Member and Guild objects in InteractionContext - Direct access to member/guild without cache lookups
- ✅ HTTPS-only ShardCoordinator - Secure TLS communication for distributed sharding (upgraded from HTTP)
- ✅ 100% Zero Reflection - All anonymous objects replaced with strongly-typed classes for full AoT compatibility
- ✅ Enhanced type safety - MessagePayload, BulkDeleteMessagesRequest, BanMemberRequest, HttpErrorResponse
- ✅ Code quality improvements - Removed redundant type specifications and method overload warnings
- 🔒 Security hardened - TLS 1.3+ for shard coordination endpoints
- Superseded: TLS for cluster traffic now depends on your setup. See the v1.11.0 notes.
v1.3.0 - Sharding Support (2025-12-19)
- ✅ Added 3-mode sharding system: single process, multi-shard, distributed
- ✅ Distributed coordinator/worker architecture with auto-discovery
- ✅ Health monitoring, load balancing, coordinator succession
- ✅ Cross-shard entity cache queries
- ✅ Shard-aware InteractionContext for commands
- ✅ Full AoT compliance with source-generated JSON serialization
- ✅ Zero reflection usage, ready for native compilation
- 📖 See the Sharding guide
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.11.0 | 141 | 11/5/2026 |
| 1.10.17 | 193 | 6/4/2026 |
| 1.10.16 | 149 | 6/1/2026 |
| 1.10.15 | 138 | 5/30/2026 |
| 1.10.14 | 145 | 5/26/2026 |
| 1.10.13 | 135 | 5/25/2026 |
| 1.10.12 | 145 | 5/23/2026 |
| 1.10.11 | 150 | 5/21/2026 |
| 1.10.10 | 135 | 5/20/2026 |
| 1.10.9 | 141 | 5/14/2026 |
| 1.10.8 | 142 | 5/10/2026 |
| 1.10.7 | 134 | 5/10/2026 |
| 1.10.6-preview1 | 139 | 5/10/2026 |
| 1.10.5 | 135 | 5/10/2026 |
| 1.10.4 | 129 | 5/10/2026 |
| 1.10.3 | 132 | 5/10/2026 |
| 1.10.2 | 137 | 5/10/2026 |
| 1.10.1 | 132 | 5/10/2026 |
| 1.10.0 | 147 | 5/3/2026 |
| 1.9.0 | 150 | 4/29/2026 |
v1.11.0: New attributes for checks and cooldowns, forms, events, command translation, and where commands work. Adds enum options, replying by returning a value, data in component IDs, confirmations and pagination, constructor injection, a generated help command, polls, threads and forum posts, layout messages (Components V2), message forwarding, member and message search, bulk bans and application emojis. Fixes entity parsing, DM and uncached-channel messages, gateway reconnect and resume, per-resource rate limits, command parameters and context menu commands. Sharding reworked: cluster traffic is now authenticated, so upgrade all nodes together. Distributed sharding is experimental. Includes behavior changes, so re-sync your commands and read the upgrade notes: https://github.com/Simple-DotNet/SimpleDiscordDotNet#v1110