Ananke.Platforms.Discord 0.7.2

dotnet add package Ananke.Platforms.Discord --version 0.7.2
                    
NuGet\Install-Package Ananke.Platforms.Discord -Version 0.7.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ananke.Platforms.Discord" Version="0.7.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ananke.Platforms.Discord" Version="0.7.2" />
                    
Directory.Packages.props
<PackageReference Include="Ananke.Platforms.Discord" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ananke.Platforms.Discord --version 0.7.2
                    
#r "nuget: Ananke.Platforms.Discord, 0.7.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ananke.Platforms.Discord@0.7.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ananke.Platforms.Discord&version=0.7.2
                    
Install as a Cake Addin
#tool nuget:?package=Ananke.Platforms.Discord&version=0.7.2
                    
Install as a Cake Tool

Ananke.Platforms.Discord

NuGet License

Discord adapter for Ananke - bridges Discord Gateway events to Ananke agent workflows via IMessagePlatformAdapter. Supports streaming chat responses using the post-then-edit pattern with automatic debouncing.

Install

dotnet add package Ananke.Platforms.Discord

Prerequisites

  1. Create a Discord Application at discord.com/developers
  2. Under Bot, click Reset Token and copy the bot token
  3. Under Bot > Privileged Gateway Intents, enable Message Content Intent
  4. Under OAuth2 > URL Generator, select scopes bot + permissions Send Messages, Read Message History, Add Reactions
  5. Use the generated URL to invite the bot to your server

Quick start

using Ananke.Platforms;
using Ananke.Platforms.Discord;

services.AddAnankeDiscord(options =>
{
    options.BotToken = config["Discord:BotToken"]!;
});

services.AddSingleton<IPlatformMessageHandler, MyAgentHandler>();

What it registers

Service Implementation
IMessagePlatformAdapter DiscordAdapter - connects via Discord Gateway (WebSocket), dispatches incoming messages
IPlatformResponseSink DiscordResponseSink - sends/edits messages, typing indicators, reactions via Discord API
IHostedService DiscordHostedService - starts/stops the adapter with the application host

Thread support

Discord threads are mapped automatically:

Discord context PlatformMessage.ChannelId PlatformMessage.ThreadId
Regular channel message Channel ID null
Thread message Parent channel ID Thread channel ID

Slash commands — ToolKit → /command bridge

When SlashCommandTools is set, every tool in the kit is registered as a Discord slash command on startup. Users invoke tools directly — the LLM is not involved.

var tools = new ToolKit("my-tools")
    .AddTool("current_time", "Returns the current UTC time.",
        () => ToolResult.Ok(DateTime.UtcNow.ToString("u")))
    .AddTool("echo", "Echoes input back.", b => b
        .Param("text", "The text to echo")
        .OnExecute(async args => ToolResult.Ok(args.Get("text"))));

services.AddAnankeDiscord(options =>
{
    options.BotToken = config["Discord:BotToken"]!;
    options.SlashCommandTools = tools;

    // Optional: register to a test guild for instant propagation during dev
    // (global commands can take up to an hour to appear)
    // options.TestGuildId = 123456789012345678;
});

This gives users /current_time and /echo text:hello in the Discord command picker with full autocomplete and type validation.

How it works

Step Detail
Registration On Ready, tools are registered via BulkOverwriteGlobalApplicationCommandsAsync (atomic — stale commands from previous runs are removed)
Execution SlashCommandExecuted → extract args → tool.ExecuteAsync(args) → respond with result
Timeout Uses DeferAsync + FollowupAsync — no 3-second limit on tool execution

Parameter type mapping

ToolParameter.JsonType Discord option type Discord validates
"string" String Free text
"integer" Integer Whole numbers only
"number" Number Decimal numbers
"boolean" Boolean True/False toggle

Documentation

Full docs, demos, and architecture: github.com/sevensamurai/Ananke

License

Apache 2.0

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.7.2 81 4/12/2026
0.7.1 79 4/11/2026
0.7.0 87 4/11/2026
0.6.0 86 4/10/2026