Disqord
An asynchronous Discord API wrapper for .NET 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
Installation
Stable builds are available on NuGet.
Nightly Disqord builds can be pulled as NuGet packages from the MyGet feed: https://www.myget.org/F/disqord/api/v3/index.json
.
Documentation
The Disqord documentation is available on GitHub Pages.
Examples
Explore examples of the library in the /examples folder, all of which are licensed under the MIT license.
Minimal Example
Typing ?ping
or @YourBot ping
in a channel will make the bot respond with Pong!
.
using Disqord.Bot.Commands.Text;
using Disqord.Bot.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Qmmands;
using Qmmands.Text;
await new HostBuilder()
.ConfigureAppConfiguration(configuration =>
{
// We will use the environment variable DISQORD_TOKEN for the bot token.
configuration.AddEnvironmentVariables("DISQORD_");
})
.ConfigureLogging(logging =>
{
logging.AddSimpleConsole();
})
.ConfigureDiscordBot((context, bot) =>
{
bot.Token = context.Configuration["TOKEN"];
bot.Prefixes = new[] { "?" };
})
.RunConsoleAsync();
public class ExampleModule : DiscordTextModuleBase
{
[TextCommand("ping")]
public IResult Ping()
{
return Response("Pong!");
}
}