Disqord icon indicating copy to clipboard operation
Disqord copied to clipboard

Asynchronous Discord API wrapper and bot framework for .NET.

Disqord

An asynchronous Discord API wrapper for .NET 5 that aims to make Discord bot development simple and enjoyable without needless boilerplate.

  • Designed around Microsoft's dependency injection abstractions
  • Integrates seamlessly with the Generic Host
  • Replaceable components, stateless REST, customizable caching, and more

AppVeyor NuGet MyGet Discord

Documentation

Documentation is available here.

Installation

Nightly Disqord builds can be pulled as NuGet packages from the MyGet feed: https://www.myget.org/F/disqord/api/v3/index.json.

Minimal Example

Typing ?ping or @YourBot ping in a channel will make the bot respond with Pong!.

using Disqord.Bot;
using Disqord.Bot.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Qmmands;

await new HostBuilder()
    .ConfigureAppConfiguration(x =>
    {
        // We will use the environment variable DISQORD_TOKEN for the bot token.
        x.AddEnvironmentVariables("DISQORD_");
    })
    .ConfigureLogging(x =>
    {
        x.AddSimpleConsole();
    })
    .ConfigureDiscordBot((context, bot) =>
    {
        bot.Token = context.Configuration["TOKEN"];
        bot.Prefixes = new[] { "?" };
    })
    .RunConsoleAsync();

public class ExampleModule : DiscordModuleBase
{
    [Command("ping")]
    public DiscordCommandResult Ping()
        => Response("Pong!");
}