Skip to content

Releases: Hawxy/Discord.Addons.Hosting

v6.1.0

10 Jun 02:54
42607f1
Compare
Choose a tag to compare
  • Updates Discord.NET to v3.15 to fix a binary compatibility break introduced in that version (Closes #32).

v6.0.0

14 Jan 08:27
0ea4b3d
Compare
Choose a tag to compare

Feature Updates

This release marks the IHostBuilder extensions as obsolete and replaces them with IServiceCollection alternatives (Closes #29). This allows for easier support of .NET 7+ IHostApplicationBuilder environments. The previous extensions will continue to work for the v6 lifecycle, however if you're interested in moving to the new extensions there's one of two options:

  1. Move to the new Host.CreateApplicationBuilder-based configuration model (Recommended):

Before

var host = Host.CreateDefaultBuilder()   
    .ConfigureDiscordHost((context, config) =>
    {
        config.SocketConfig = new DiscordSocketConfig
        {
            LogLevel = LogSeverity.Verbose,
            AlwaysDownloadUsers = true,
            MessageCacheSize = 200
        };

        config.Token = context.Configuration["token"];
    })
    .UseCommandService((context, config) =>
    {
        config.DefaultRunMode = RunMode.Async;
        config.CaseSensitiveCommands = false;
    })
    .UseInteractionService((context, config) =>
    {
        config.LogLevel = LogSeverity.Info;
        config.UseCompiledLambda = true;
    })
    .ConfigureServices((context, services) =>
    {
        services.AddHostedService<CommandHandler>();
        services.AddHostedService<BotStatusService>();
        services.AddHostedService<LongRunningService>();
    }).Build();
  
await host.RunAsync();

After

var builder = Host.CreateApplicationBuilder(args);

builder.Services.AddDiscordHost((config, _) =>
{
    config.SocketConfig = new DiscordSocketConfig
    {
        LogLevel = LogSeverity.Verbose,
        AlwaysDownloadUsers = true,
        MessageCacheSize = 200,
        GatewayIntents = GatewayIntents.All
    };

    config.Token = builder.Configuration["Token"]!;
});

builder.Services.AddCommandService((config, _) =>
{
    config.DefaultRunMode = RunMode.Async;
    config.CaseSensitiveCommands = false;
});

builder.Services.AddInteractionService((config, _) =>
{
    config.LogLevel = LogSeverity.Info;
    config.UseCompiledLambda = true;
});

builder.Services.AddHostedService<CommandHandler>();
builder.Services.AddHostedService<InteractionHandler>();
builder.Services.AddHostedService<BotStatusService>();
builder.Services.AddHostedService<LongRunningService>();

var host = builder.Build();

await host.RunAsync();
  1. Or, call the new extensions within .ConfigureServices((context, services) => //...):
.ConfigureServices((context, services) =>
    {
        services.AddDiscordHost((config, _) =>
        {
           // ...
        });
    })
  • Improved the validation message when an invalid token is provided. (Closes #30)
  • Minimum Discord.Net version is now v3.12.

v5.2.0

06 Nov 07:15
9d0367b
Compare
Choose a tag to compare
  • Updated Discord.Net to v3.8.1 (Release notes)
  • Removed references to Discord.Net.Labs & marked Discord.Net.Labs packages as end-of-life.

v5.1.0

30 Jan 06:59
f4e0c71
Compare
Choose a tag to compare
  • Update Discord.Net to v3.2.0
  • Minor sample tweak
  • Add README to nuget package

v5.0.0 - Discord.Net v3.0.0

19 Dec 13:42
249493c
Compare
Choose a tag to compare

It's finally here!

Breaking Changes:

  • Support for Discord.Net v3.0.0
  • Only targets .NET 6, support for all prior targets has been dropped.
  • InitializedService has been removed. See the v4 release notes for the relevant upgrade path.

New Features

  • Added UseInteractionService HostBuilder extension that'll wire up an InteractionService much in the same way that UseCommandService currently does.
    .UseInteractionService((context, config) =>
    {
        config.LogLevel = LogSeverity.Info;
        config.UseCompiledLambda = true;
    })
  • Support setting ShardIds within the sharded client configuration:
  config.ShardIds = new[] { 1 };

See the v5.0.0 samples for further information.

v4.0.2: Discord.Net.Labs Edition

03 Aug 10:20
Compare
Choose a tag to compare

By popular demand. This release is identical to v4.0.2 but is binary compatible with Discord.Net.Labs. You can find it under the nuget pre-release tag of v4.0.2-labs

v4.0.2

19 Jun 07:54
Compare
Choose a tag to compare

This is a small release to fix an ambiguous constructor exception with some addon packages that expose constructors of the client types and BaseSocketClient.

v4.0.0 🚀

14 Jun 13:53
Compare
Choose a tag to compare

New Features:

  • The Discord.NET sharded client is now supported. Use ConfigureDiscordShardedHost:
.ConfigureDiscordShardedHost((context, config) =>
{
    config.SocketConfig = new DiscordSocketConfig
    {
    	// Manually set the required shards, or leave empty for the recommended count
	TotalShards = 4
    };

    config.Token = context.Configuration["token"];
})

A new example with the sharded client is also available.

  • WaitForReadyAsync extensions have been added for the respective discord clients. This extension is designed for use within background services and will prevent continuation until the socket client ready event fires, or all shards have reached a ready state.
    public class BotStatusService : DiscordClientService
    {
        public BotStatusService(DiscordSocketClient client, ILogger<DiscordClientService> logger) : base(client, logger)
        {
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            await Client.WaitForReadyAsync(stoppingToken);
            Logger.LogInformation("Client is ready!");

            await Client.SetActivityAsync(new Game("Set my status!"));
        }
    }

Breaking Changes:

  • ConfigureDiscordHost no longer takes a generic parameter of client type:
- .ConfigureDiscordHost<DiscordSocketClient>((context, config) =>
+ .ConfigureDiscordHost((context, config) =>
  • InitializedService is deprecated and replaced with DiscordClientService. See the updated README docs for usage.

v3.1.1

20 Nov 14:15
f5a5a34
Compare
Choose a tag to compare
  • Fix XML documentation not appearing for nuget consumers

v3.1.0

15 Nov 06:57
63c8ca1
Compare
Choose a tag to compare

There are no public-facing API changes in this release.

  • Removed .NET Standard 2.0 target and added .NET 5 target. This drops support for .NET Core 2.x, however as I'm unable to find any public bot using both this package & .NET Core 2.x, this change shouldn't affect anyone. If you're consuming this package via a library project, target it to .NET Standard 2.1 or higher.

  • .NET 5 consumers will now receive the appropriate version of Microsoft.Extensions.Hosting. The version for 3.x consumers has also been bumped to latest.

  • Updated samples to .NET 5 and C# 9.

  • Misc internal fixes to quieten new roslyn warnings.