Skip to content

v4.0.0 🚀

Compare
Choose a tag to compare
@Hawxy Hawxy released this 14 Jun 13:53
· 13 commits to master since this release

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.