Skip to content

Commit

Permalink
chore: Address PR comments again
Browse files Browse the repository at this point in the history
  • Loading branch information
VelvetToroyashi committed May 11, 2024
1 parent bf34c18 commit 6f1bb43
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ private static JsonSerializerOptions AddInteractionObjectConverters(this JsonSer
.WithPropertyConverter
(
i => i.AuthorizingIntegrationOwners,
new EnumKeyDictionaryConverterFactory()
new EnumIntKeyDictionaryConverterFactory()
);
options.AddDataObjectConverter
<
Expand Down Expand Up @@ -1197,7 +1197,7 @@ private static JsonSerializerOptions AddInteractionObjectConverters(this JsonSer
options.AddDataObjectConverter<ISelectDefaultValue, SelectDefaultValue>();

options.AddDataObjectConverter<IMessageInteractionMetadata, MessageInteractionMetadata>()
.WithPropertyConverter(m => m.AuthorizingIntegrationOwners, new EnumKeyDictionaryConverterFactory());
.WithPropertyConverter(m => m.AuthorizingIntegrationOwners, new EnumIntKeyDictionaryConverterFactory());

return options;
}
Expand All @@ -1213,7 +1213,7 @@ private static JsonSerializerOptions AddOAuth2ObjectConverters(this JsonSerializ
.WithPropertyName(a => a.IsBotPublic, "bot_public")
.WithPropertyName(a => a.DoesBotRequireCodeGrant, "bot_require_code_grant")
.WithPropertyName(a => a.PrimarySKUID, "primary_sku_id")
.WithPropertyConverter(a => a.IntegrationTypesConfig, new EnumKeyDictionaryConverterFactory());
.WithPropertyConverter(a => a.IntegrationTypesConfig, new EnumIntKeyDictionaryConverterFactory());

options.AddDataObjectConverter<IPartialApplication, PartialApplication>()
.WithPropertyName(a => a.IsBotPublic, "bot_public")
Expand All @@ -1229,7 +1229,7 @@ private static JsonSerializerOptions AddOAuth2ObjectConverters(this JsonSerializ

options.AddDataObjectConverter<IApplicationOAuth2InstallParams, ApplicationOAuth2InstallParams>();

options.Converters.Insert(0, new EnumKeyDictionaryConverterFactory.EnumKeyDictionaryConverterInner<ApplicationIntegrationType, IApplicationIntegrationTypeConfig>(options));
options.Converters.Insert(0, new EnumIntKeyDictionaryConverterFactory.EnumKeyDictionaryConverterInner<ApplicationIntegrationType, IApplicationIntegrationTypeConfig>(options));

return options;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// EnumKeyDictionaryConverterFactory.cs
// EnumIntKeyDictionaryConverterFactory.cs
//
// Author:
// Jarl Gullberg <[email protected]>
Expand Down Expand Up @@ -31,7 +31,7 @@ namespace Remora.Discord.API.Json;
/// <summary>
/// Creates a JSON converter for dictionaries with enum keys.
/// </summary>
internal class EnumKeyDictionaryConverterFactory : JsonConverterFactory
internal class EnumIntKeyDictionaryConverterFactory : JsonConverterFactory
{
/// <inheritdoc />
public override bool CanConvert(Type typeToConvert)
Expand Down
6 changes: 1 addition & 5 deletions Samples/SlashCommands/Commands/HttpCatCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
using Remora.Commands.Attributes;
using Remora.Commands.Groups;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.API.Abstractions.Rest;
using Remora.Discord.API.Objects;
using Remora.Discord.Commands.Attributes;
using Remora.Discord.Commands.Contexts;
using Remora.Discord.Commands.Feedback.Services;
using Remora.Results;

Expand All @@ -31,9 +29,7 @@ public class HttpCatCommands : CommandGroup
/// Initializes a new instance of the <see cref="HttpCatCommands"/> class.
/// </summary>
/// <param name="feedbackService">The feedback service.</param>
/// <param name="interactions">The interactions API.</param>
/// <param name="context">The context.</param>
public HttpCatCommands(FeedbackService feedbackService, IDiscordRestInteractionAPI interactions, IInteractionContext context)
public HttpCatCommands(FeedbackService feedbackService)
{
_feedbackService = feedbackService;
}
Expand Down

0 comments on commit 6f1bb43

Please sign in to comment.