
Discord.Net is an unofficial .NET API Wrapper for the Discord client. Please read the documentation on how to setup the bot and what has been changed in 1.0.
1.0 Documentation: https://discord.foxbot.me/docs/index.html
0.9.6 Documentation: http://rtd.discord.foxbot.me/en/legacy/
Example Bots:
Foxbot Example C# Bot 1.0
Foxbot Example VB.Net Bot 1.0
Aux Example C# Bot 1.0
Aux Example C# Bot 0.9.6
Installation
Discord.Net current stable version is 0.9.6 and can be obtained from Nuget Packages.
You can also install other individual components from Nuget or Nuget Package Manager.
The following providers are available for platforms not supporting .NET Standard 1.3:
Unstable/Beta/Latest (MyGet)
You can get the Beta build from MyGet. The Beta build version is 1.0.xxx and contains every new feature from discord such as Embeds.
Nightly builds are available through MyGet feed.
Compiling
In order to compile Discord.Net you will need latest version of Visual Studio 2017 and .Net Core SDK. The .Net Core workload must be selected during Visual Studio Installation.
Known Issues
WebSockets (Win7 and earlier)
.NET Core 1.1 does not support WebSockets on Win7 and earlier. It's recommended to use the Discord.Net.Providers.WS4Net package until this is resolved.
Track the issue here.
Example Ping Command
using System.Threading.Tasks;
using System.Reflection;
using Discord;
using Discord.WebSocket;
using Discord.Commands;
public class Program
{
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
public async Task Start()
{
var client = new DiscordSocketClient();
client.MessageReceived += MessageReceived;
await client.LoginAsync(TokenType.Bot, "YOUR-TOKEN-GOES-HERE");
await client.ConnectAsync();
await Task.Delay(-1);
}
private async Task MessageReceived(SocketMessage message)
{
if (message.Content == "!ping"){
await message.Channel.SendMessageAsync("Pong!");
}
}
}