Finite Reality 74f6a4b392 Allow commands to return a Task<RuntimeResult> (#466)
* Allow commands to return a Task<RuntimeResult>

This allows bot developers to centralize command result logic by
using result data whether the command as successful or not.

Example usage:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is RuntimeResult result)
{
    await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
    // Previous error handling
}
```

The RuntimeResult class can be subclassed too, for example:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is MySubclassedResult result)
{
    var builder = new EmbedBuilder();
    for (var pair in result.Data)
    {
        builder.AddField(pair.Key, pair.Value, true);
    }
    await message.Channel.SendMessageAsync("", embed: builder);
}
else if (_result is RuntimeResult result)
{
    await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
    // Previous error handling
}
```

* Make RuntimeResult's ctor protected

* Make RuntimeResult abstract

It never really made sense to have it instantiable in the first place,
frankly.
2017-06-29 19:21:05 -03:00
2017-06-20 20:44:33 -04:00
2017-05-09 20:51:00 -03:00
2015-08-09 11:36:55 -03:00
2017-05-04 12:45:24 -03:00
2017-04-26 12:19:50 -03:00
2015-08-04 05:04:33 -03:00

Discord.Net v1.0.0-rc

NuGet MyGet Build status Discord

An unofficial .NET API Wrapper for the Discord client (http://discordapp.com).

Check out the documentation or join the Discord API Chat.

Installation

Stable (NuGet)

Our stable builds available from NuGet through the Discord.Net metapackage:

The individual components may also be installed from NuGet:

The following provider is available for platforms not supporting .NET Standard 1.3:

Unstable (MyGet)

Nightly builds are available through our MyGet feed (https://www.myget.org/F/discord-net/api/v3/index.json).

Compiling

In order to compile Discord.Net, you require the following:

Using Visual Studio

The .NET Core workload must be selected during Visual Studio installation.

Using Command Line

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.

Languages
C# 100%