Skip to content

Commit

Permalink
v3.1.1 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawxy authored Nov 20, 2020
1 parent 63c8ca1 commit f5a5a34
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Discord.Addons.Hosting/CommandServiceInitializerHost.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region License
/*
Copyright 2019 Hawxy
Copyright 2020 Hawxy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion Discord.Addons.Hosting/Discord.Addons.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5</TargetFrameworks>
<PackageId>Discord.Addons.Hosting</PackageId>
<Version>3.1.0</Version>
<Version>3.1.1</Version>
<Authors>Hawxy</Authors>
<Description>Simplifying Discord.Net hosting with .NET Generic Host (Microsoft.Extensions.Hosting)</Description>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
Expand All @@ -13,6 +13,7 @@
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<Copyright>Hawxy 2018-2021</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>discord,discord.net,addon,hosting,microsoft.extensions.hosting</PackageTags>
<Nullable>Enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Discord.Addons.Hosting/DiscordHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region License
/*
Copyright 2019 Hawxy
Copyright 2020 Hawxy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
18 changes: 17 additions & 1 deletion Discord.Addons.Hosting/DiscordHostConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region License
/*
Copyright 2019 Hawxy
Copyright 2020 Hawxy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,10 +20,26 @@ limitations under the License.

namespace Discord.Addons.Hosting
{

/// <summary>
/// Configuration passed to the hosted service
/// </summary>
public class DiscordHostConfiguration
{

/// <summary>
/// The bots token.
/// </summary>
public string Token { get; set; } = string.Empty;
/// <summary>
/// Sets a custom output format for logs coming from Discord.NET's integrated logger.
/// </summary>
/// <remarks>
/// The default simply concatenates the message source with the log message.
/// </remarks>
public Func<LogMessage, Exception, string> LogFormat { get; set; } = (message, exception) => $"{message.Source}: {message.Message}";

/// <inheritdoc cref="DiscordSocketConfig"/>
public DiscordSocketConfig SocketConfig { get; set; } = new DiscordSocketConfig();
}
}
2 changes: 1 addition & 1 deletion Discord.Addons.Hosting/DiscordHostedService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region License
/*
Copyright 2019 Hawxy
Copyright 2020 Hawxy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 3 additions & 0 deletions Discord.Addons.Hosting/InitializedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ public abstract class InitializedService : IHostedService
/// </summary>
/// <param name="cancellationToken">Triggered when <see cref="IHostedService"/> is stopped during startup.</param>
public abstract Task InitializeAsync(CancellationToken cancellationToken);

/// <inheritdoc cref="IHostedService.StartAsync"/>
public async Task StartAsync(CancellationToken cancellationToken)
{
if (_initialized) return;
await InitializeAsync(cancellationToken);
if (!cancellationToken.IsCancellationRequested) _initialized = true;
}

/// <inheritdoc cref="IHostedService.StopAsync"/>
public virtual Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}
2 changes: 1 addition & 1 deletion Discord.Addons.Hosting/Util/LogAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region License
/*
Copyright 2019 Hawxy
Copyright 2020 Hawxy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

0 comments on commit f5a5a34

Please sign in to comment.