Skip to content

Commit 4c34db8

Browse files
authored
DisCatSharp v10.6.6 Release (#628)
* [ci skip] prep redirects * docs: add missing docs * docs: extend changelog with docs update note * docs: more updates * chore: cleanup * chore: code cleanup
1 parent 70ea96e commit 4c34db8

File tree

98 files changed

+923
-449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+923
-449
lines changed

Diff for: BUILDING.md

+2-3

Diff for: DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ internal async Task UpdateAsync()
608608
await this.RegisterCommands(this._updateList.Where(x => x.Key == key).Select(x => x.Value).ToList(), key).ConfigureAwait(false);
609609
}
610610

611-
this.MISSING_SCOPE_GUILD_IDS = [..failedGuilds];
611+
this.MISSING_SCOPE_GUILD_IDS = [.. failedGuilds];
612612
s_missingScopeGuildIdsGlobal.AddRange(failedGuilds);
613613
this.ShardStartupFinished = true;
614614
FinishedShardCount++;

Diff for: DisCatSharp.Common/RegularExpressions/DiscordRegEx.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ public static partial class DiscordRegEx
6262
public static partial Regex WebhookRegex();
6363

6464
[GeneratedRegex(@"^<sound:(?<guild_id>\\d+):(?<sound_id>\\d+)>$", RegexOptions.Compiled | RegexOptions.ECMAScript)]
65-
public static partial Regex SoundRegex();
65+
public static partial Regex SoundRegex();
6666
}

Diff for: DisCatSharp.Docs/changelogs/index.md

+1-1

Diff for: DisCatSharp.Docs/changelogs/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ items:
44
- name: Version 10.X
55
expanded: true
66
items:
7+
- name: Version 10.6.6
8+
href: v10/10_6_6.md
79
- name: Version 10.6.4
810
href: v10/10_6_4.md
911
- name: Version 10.6.2

Diff for: DisCatSharp.Docs/changelogs/v10/10_6_6.md

+2

Diff for: DisCatSharp.Docs/dcs/_redirects

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/changelogs/latest /changelogs/v10/10_6_3 303
1+
/changelogs/latest /changelogs/v10/10_6_6 303
File renamed without changes.
File renamed without changes.

Diff for: DisCatSharp.Experimental/Entities/Message/DiscordMessageBuilderMethodHooks.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ public static class DiscordMessageBuilderMethodHooks
1616
/// <param name="builder">The <see cref="DiscordMessageBuilder" /> to add the attachment to.</param>
1717
/// <param name="gcpAttachment">The attachment to add.</param>
1818
/// <param name="isVoice">Whether this is a voice message attachment.</param>
19-
/// <param name="originalStream">The voice message's stream, required if <paramref name="isVoice"/> is <see langword="true"/>.</param>
19+
/// <param name="originalStream">
20+
/// The voice message's stream, required if <paramref name="isVoice" /> is
21+
/// <see langword="true" />.
22+
/// </param>
2023
/// <returns>The chained <see cref="DiscordMessageBuilder" />.</returns>
2124
public static DiscordMessageBuilder AddGcpAttachment(this DiscordMessageBuilder builder, GcpAttachmentUploadInformation gcpAttachment, bool isVoice = false, Stream? originalStream = null)
2225
{

Diff for: DisCatSharp.Lavalink/LavalinkSession.cs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using DisCatSharp.Lavalink.Enums;
1717
using DisCatSharp.Lavalink.Enums.Websocket;
1818
using DisCatSharp.Lavalink.EventArgs;
19-
using DisCatSharp.Lavalink.Payloads;
2019
using DisCatSharp.Net;
2120
using DisCatSharp.Net.Abstractions;
2221
using DisCatSharp.Net.WebSocket;

Diff for: DisCatSharp.Lavalink/Models/LavalinkPlayerUpdateModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ internal LavalinkPlayerUpdateModel()
6666
public Optional<LavalinkFilters> Filters { internal get; set; }
6767

6868
/// <summary>
69-
/// Gets or sets the user data.
69+
/// Gets or sets the user data.
7070
/// </summary>
7171
[JsonProperty("userData")]
7272
public Optional<object> UserData { get; set; }

Diff for: DisCatSharp.Lavalink/Payloads/LavalinkRestPlayerUpdatePayload.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ internal LavalinkRestPlayerUpdatePayload(string guildId)
5656
internal Optional<LavalinkFilters> Filters { get; set; }
5757

5858
/// <summary>
59-
/// Gets or sets the track.
59+
/// Gets or sets the track.
6060
/// </summary>
6161
[JsonProperty("track", NullValueHandling = NullValueHandling.Ignore)]
6262
internal Optional<PlayerBase> Track { get; set; }
6363
}
6464

6565
/// <summary>
66-
/// The lavalink rest player update player track payload.
66+
/// The lavalink rest player update player track payload.
6767
/// </summary>
6868
internal class PlayerBase
6969
{
7070
/// <summary>
71-
/// Gets or sets the user data.
71+
/// Gets or sets the user data.
7272
/// </summary>
7373
[JsonProperty("userData", NullValueHandling = NullValueHandling.Ignore)]
7474
public object? UserData { get; set; }
7575
}
7676

7777
/// <summary>
78-
/// The lavalink rest player update player track payload.
78+
/// The lavalink rest player update player track payload.
7979
/// </summary>
8080
internal sealed class PlayerWithIdentifier : PlayerBase
8181
{
@@ -87,7 +87,7 @@ internal sealed class PlayerWithIdentifier : PlayerBase
8787
}
8888

8989
/// <summary>
90-
/// The lavalink rest player update player track payload.
90+
/// The lavalink rest player update player track payload.
9191
/// </summary>
9292
internal sealed class PlayerWithEncoded : PlayerBase
9393
{

Diff for: DisCatSharp.Tests/DisCatSharp.Hosting.Tests/HostTests.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public class HostTests
8888

8989
private IHostBuilder Create(Dictionary<string, string?> configValues) =>
9090
Host.CreateDefaultBuilder()
91-
.ConfigureLogging(logging => {
91+
.ConfigureLogging(logging =>
92+
{
9293
logging.ClearProviders();
9394
logging.AddConsole();
9495
})
@@ -97,7 +98,8 @@ private IHostBuilder Create(Dictionary<string, string?> configValues) =>
9798

9899
private IHostBuilder Create(string filename) =>
99100
Host.CreateDefaultBuilder()
100-
.ConfigureLogging(logging => {
101+
.ConfigureLogging(logging =>
102+
{
101103
logging.ClearProviders();
102104
logging.AddConsole();
103105
})
@@ -108,7 +110,8 @@ private IHostBuilder Create<TInterface, TBot>(string filename)
108110
where TInterface : class, IDiscordHostedService
109111
where TBot : class, TInterface, IDiscordHostedService =>
110112
Host.CreateDefaultBuilder()
111-
.ConfigureLogging(logging => {
113+
.ConfigureLogging(logging =>
114+
{
112115
logging.ClearProviders();
113116
logging.AddConsole();
114117
})

Diff for: DisCatSharp/Clients/BaseDiscordClient.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ protected BaseDiscordClient(DiscordConfiguration config)
7171
var optionsFactory = new OptionsFactory<ConsoleLoggerOptions>([configureNamedOptions], []);
7272
var optionsMonitor = new OptionsMonitor<ConsoleLoggerOptions>(optionsFactory, [], new OptionsCache<ConsoleLoggerOptions>());
7373
/*
74-
var configureFormatterOptions = new ConfigureNamedOptions<ConsoleFormatterOptions>(string.Empty, x => { x.TimestampFormat = this.Configuration.LogTimestampFormat; });
75-
var formatterFactory = new OptionsFactory<ConsoleFormatterOptions>(new[] { configureFormatterOptions }, Enumerable.Empty<IPostConfigureOptions<ConsoleFormatterOptions>>());
76-
var formatterMonitor = new OptionsMonitor<ConsoleFormatterOptions>(formatterFactory, Enumerable.Empty<IOptionsChangeTokenSource<ConsoleFormatterOptions>>(), new OptionsCache<ConsoleFormatterOptions>());
77-
*/
74+
var configureFormatterOptions = new ConfigureNamedOptions<ConsoleFormatterOptions>(string.Empty, x => { x.TimestampFormat = this.Configuration.LogTimestampFormat; });
75+
var formatterFactory = new OptionsFactory<ConsoleFormatterOptions>(new[] { configureFormatterOptions }, Enumerable.Empty<IPostConfigureOptions<ConsoleFormatterOptions>>());
76+
var formatterMonitor = new OptionsMonitor<ConsoleFormatterOptions>(formatterFactory, Enumerable.Empty<IOptionsChangeTokenSource<ConsoleFormatterOptions>>(), new OptionsCache<ConsoleFormatterOptions>());
77+
*/
7878

7979
var l = new ConsoleLoggerProvider(optionsMonitor);
8080
this.Configuration.LoggerFactory = new LoggerFactory();

Diff for: DisCatSharp/Clients/DiscordClient.Dispatch.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ internal async Task HandleDispatchAsync(GatewayPayload payload)
384384
var requestId = (ulong)dat["id"]!;
385385
await this.OnGuildJoinRequestDeleteAsync(requestId, uid, this.Guilds[gid]).ConfigureAwait(false);
386386
break;
387+
387388
#endregion
388389

389390
#region Invite
@@ -917,7 +918,7 @@ internal async Task OnChannelUpdateEventAsync(DiscordChannel channel)
917918
Id = channelNew.Id,
918919
LastMessageId = channelNew.LastMessageId,
919920
Name = channelNew.Name,
920-
PermissionOverwritesInternal = [..channelNew.PermissionOverwritesInternal],
921+
PermissionOverwritesInternal = [.. channelNew.PermissionOverwritesInternal],
921922
Position = channelNew.Position,
922923
Topic = channelNew.Topic,
923924
Type = channelNew.Type,

Diff for: DisCatSharp/Clients/DiscordClient.EventHandlers.cs

+12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@ namespace DisCatSharp;
1414
/// </summary>
1515
public sealed partial class DiscordClient
1616
{
17+
/// <summary>
18+
/// Stores the registered event handlers.
19+
/// </summary>
1720
private readonly Dictionary<Type, object> _registeredEventhandlers = [];
21+
22+
/// <summary>
23+
/// Maps a tuple of handler, type, and a boolean indicating whether static methods were registered to a list of event
24+
/// info and delegate arrays.
25+
/// </summary>
1826
private readonly Dictionary<(object?, Type, bool), List<(EventInfo, Delegate)[]>> _registrationToDelegate = [];
27+
28+
/// <summary>
29+
/// Maps a type to a list of anonymous handler objects.
30+
/// </summary>
1931
private readonly Dictionary<Type, List<object>> _typeToAnonymousHandlers = [];
2032

2133
/// <summary>

Diff for: DisCatSharp/Clients/DiscordClient.cs

+23-5
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ public int Ping
134134
public IReadOnlyDictionary<ulong, DiscordPresence> Presences
135135
=> this._presencesLazy.Value;
136136

137+
/// <summary>
138+
/// Gets the internal collection of presences.
139+
/// </summary>
137140
internal ConcurrentDictionary<ulong, DiscordPresence> PresencesInternal = [];
141+
142+
/// <summary>
143+
/// Lazily gets the collection of presences held by this client.
144+
/// </summary>
138145
private Lazy<IReadOnlyDictionary<ulong, DiscordPresence>> _presencesLazy;
139146

140147
/// <summary>
@@ -143,7 +150,14 @@ public IReadOnlyDictionary<ulong, DiscordPresence> Presences
143150
public IReadOnlyDictionary<string, DiscordActivity> EmbeddedActivities
144151
=> this._embeddedActivitiesLazy.Value;
145152

153+
/// <summary>
154+
/// Gets the internal collection of embedded activities.
155+
/// </summary>
146156
internal ConcurrentDictionary<string, DiscordActivity> EmbeddedActivitiesInternal = [];
157+
158+
/// <summary>
159+
/// Lazily gets the collection of embedded activities held by this client.
160+
/// </summary>
147161
private Lazy<IReadOnlyDictionary<string, DiscordActivity>> _embeddedActivitiesLazy;
148162

149163
/// <summary>
@@ -419,7 +433,6 @@ public async Task ConnectAsync(DiscordActivity? activity = null, UserStatus? sta
419433
return;
420434

421435
if (this.Configuration.AutoFetchSkuIds)
422-
{
423436
try
424437
{
425438
var skus = await this.ApiClient.GetSkusAsync(this.CurrentApplication.Id).ConfigureAwait(false);
@@ -432,7 +445,6 @@ public async Task ConnectAsync(DiscordActivity? activity = null, UserStatus? sta
432445
{
433446
this.Logger.LogError(LoggerEvents.Startup, ex, "Failed to fetch SKU IDs");
434447
}
435-
}
436448

437449
if (this.Configuration.AutoFetchApplicationEmojis)
438450
try
@@ -621,16 +633,22 @@ public async Task<IReadOnlyList<DiscordSku>> GetSkusAsync()
621633
/// <param name="before">Retrieve entitlements before this entitlement ID.</param>
622634
/// <param name="after">Retrieve entitlements after this entitlement ID.</param>
623635
/// <param name="limit">Number of entitlements to return, 1-100, default 100.</param>
624-
/// <param name="excludeEnded">Whether or not ended entitlements should be omitted. Defaults to false, ended entitlements are included by default.</param>
625-
/// <param name="excludeDeleted">Whether or not deleted entitlements should be omitted. Defaults to true, deleted entitlements are not included by default.</param>
636+
/// <param name="excludeEnded">
637+
/// Whether or not ended entitlements should be omitted. Defaults to false, ended entitlements
638+
/// are included by default.
639+
/// </param>
640+
/// <param name="excludeDeleted">
641+
/// Whether or not deleted entitlements should be omitted. Defaults to true, deleted
642+
/// entitlements are not included by default.
643+
/// </param>
626644
/// <returns>A list of <see cref="DiscordEntitlement" />.</returns>
627645
/// <exception cref="NotFoundException">Thrown when the entitlements do not exist.</exception>
628646
[RequiresFeature(Features.MonetizedApplication)]
629647
public async Task<IReadOnlyList<DiscordEntitlement>> GetEntitlementsAsync(ulong? guildId = null, ulong? userId = null, List<ulong>? skuIds = null, ulong? before = null, ulong? after = null, int limit = 100, bool? excludeEnded = null, bool? excludeDeleted = null)
630648
=> await this.ApiClient.GetEntitlementsAsync(this.CurrentApplication.Id, guildId, userId, skuIds, before, after, limit, excludeEnded, excludeDeleted).ConfigureAwait(false);
631649

632650
/// <summary>
633-
/// Gets an entitlement for given <paramref name="applicationId"/>.
651+
/// Gets an entitlement for given <paramref name="applicationId" />.
634652
/// </summary>
635653
/// <param name="entitlementId">The entitlement id to fetch.</param>
636654
/// <returns>The requested <see cref="DiscordEntitlement" />.</returns>

Diff for: DisCatSharp/Clients/DiscordOAuth2Client.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ internal void EventErrorHandler<TSender, TArgs>(AsyncEvent<TSender, TArgs> async
459459
private void Goof<TSender, TArgs>(AsyncEvent<TSender, TArgs> asyncEvent, Exception ex, AsyncEventHandler<TSender, TArgs> handler, TSender sender, TArgs eventArgs)
460460
where TArgs : AsyncEventArgs => this.Logger.LogCritical(LoggerEvents.EventHandlerException, ex, "Exception event handler {Method} (defined in {DeclaringType}) threw an exception", handler.Method, handler.Method.DeclaringType);
461461

462-
/// <inheritdoc />
462+
/// <summary>
463+
/// Disposes the client.
464+
/// </summary>
463465
~DiscordOAuth2Client()
464466
{
465467
this.Dispose();

Diff for: DisCatSharp/Clients/DiscordShardedClient.Events.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ public event AsyncEventHandler<DiscordClient, GuildSoundboardSoundsUpdateEventAr
790790
private AsyncEvent<DiscordClient, GuildSoundboardSoundsUpdateEventArgs> _guildSoundboardSoundsUpdated;
791791

792792
/// <summary>
793-
/// Fired in response to <see cref="DiscordClient.RequestSoundboardSoundsAsync"/>.
793+
/// Fired in response to <see cref="DiscordClient.RequestSoundboardSoundsAsync" />.
794794
/// </summary>
795795
public event AsyncEventHandler<DiscordClient, SoundboardSoundsEventArgs> SoundboardSounds
796796
{
@@ -2198,6 +2198,5 @@ private Task Client_GuildJoinRequestUpdated(DiscordClient client, GuildJoinReque
21982198
private Task Client_GuildJoinRequestDeleted(DiscordClient client, GuildJoinRequestDeleteEventArgs e)
21992199
=> this._guildJoinRequestDeleted.InvokeAsync(client, e);
22002200

2201-
22022201
#endregion
22032202
}

Diff for: DisCatSharp/Clients/DiscordShardedClient.cs

+3
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ internal async Task<int> InitializeShardsAsync()
185185

186186
#region Destructor
187187

188+
/// <summary>
189+
/// Disposes the client.
190+
/// </summary>
188191
~DiscordShardedClient()
189192
{
190193
this.InternalStopAsync(false).GetAwaiter().GetResult();

Diff for: DisCatSharp/Clients/DiscordWebhookClient.cs

+18-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ namespace DisCatSharp;
2020
/// </summary>
2121
public class DiscordWebhookClient
2222
{
23+
/// <summary>
24+
/// Gets the API client for this webhook client.
25+
/// </summary>
2326
internal readonly DiscordApiClient ApiClient;
27+
28+
/// <summary>
29+
/// Gets the log timestamp format for this webhook client.
30+
/// </summary>
2431
internal readonly string LogTimestampFormat;
2532

33+
/// <summary>
34+
/// Gets the minimum log level for this webhook client.
35+
/// </summary>
2636
internal readonly LogLevel MinimumLogLevel;
2737

28-
internal List<DiscordWebhook> Hooks;
29-
3038
/// <summary>
3139
/// Creates a new webhook client.
3240
/// </summary>
@@ -76,6 +84,11 @@ public DiscordWebhookClient(
7684
this.Webhooks = new ReadOnlyCollection<DiscordWebhook>(this.Hooks);
7785
}
7886

87+
/// <summary>
88+
/// Gets the list of registered webhooks.
89+
/// </summary>
90+
internal List<DiscordWebhook> Hooks { get; set; } = [];
91+
7992
/// <summary>
8093
/// Gets the logger for this client.
8194
/// </summary>
@@ -235,6 +248,9 @@ public async Task<Dictionary<DiscordWebhook, DiscordMessage>> BroadcastMessageAs
235248
return messages;
236249
}
237250

251+
/// <summary>
252+
/// Disposes the client.
253+
/// </summary>
238254
~DiscordWebhookClient()
239255
{
240256
this.Hooks.Clear();

Diff for: DisCatSharp/Entities/Application/DiscordApplication.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal DiscordApplication(TransportApplication tapp)
3939
this.CustomInstallUrl = tapp.CustomInstallUrl;
4040
this.InstallParams = tapp.InstallParams;
4141
this.RoleConnectionsVerificationUrl = tapp.RoleConnectionsVerificationUrl.ValueOrDefault();
42-
this.Tags = [..tapp.Tags];
42+
this.Tags = [.. tapp.Tags];
4343
this.Id = tapp.Id;
4444
this.Name = tapp.Name;
4545
this.IconHash = tapp.IconHash;
@@ -87,7 +87,7 @@ internal DiscordApplication(TransportApplication tapp)
8787
.Select(x => x.User)
8888
.ToArray();
8989

90-
this.Members = [..users];
90+
this.Members = [.. users];
9191
this.Team.Owner = members.First(x => x.Role == "owner").User;
9292
this.Team.Members = new List<DiscordTeamMember>(members);
9393
this.TeamName = this.Team.Name;

Diff for: DisCatSharp/Entities/Channel/DiscordGuildDirectoryChannel.cs

-4
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,4 @@ public override int GetHashCode()
7070
/// <returns>Whether the two channels are not equal.</returns>
7171
public static bool operator !=(DiscordGuildDirectoryChannel e1, DiscordGuildDirectoryChannel e2)
7272
=> !(e1 == e2);
73-
74-
#region Methods
75-
76-
#endregion
7773
}

0 commit comments

Comments
 (0)