Remora.Discord
Remora.Discord copied to clipboard
[Bug]: Getting an auto mod message results in ExceptionError
Description
Calling IDiscordRestChannelAPI#GetChannelMessageAsync
with a message id of an auto mod action such as:
returns a result whose
Error
is set to an ExceptionError
.
The error:
ExceptionError
{
Message = Failed to deserialize an enumeration value.,
Exception = System.Text.Json.JsonException: Failed to deserialize an enumeration value.
at Remora.Rest.Json.StringEnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.Read[TValue](Utf8JsonReader& reader, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](Utf8JsonReader& reader, JsonSerializerOptions options)
at Remora.Rest.Json.Internal.OptionalConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadAsObject(Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize(Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
at Remora.Rest.Json.Internal.BoundDataObjectConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadAsObject(Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize(Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
at Remora.Rest.Json.Internal.BoundDataObjectConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
at Remora.Rest.RestHttpClient`1.UnpackResponseAsync[TEntity](HttpResponseMessage response, String jsonPath, Boolean allowNullReturn, CancellationToken ct)
at Remora.Rest.RestHttpClient`1.UnpackResponseAsync[TEntity](HttpResponseMessage response, String jsonPath, Boolean allowNullReturn, CancellationToken ct)
at Remora.Rest.RestHttpClient`1.GetAsync[TEntity](String endpoint, String jsonPath, Action`1 configureRequestBuilder, Boolean allowNullReturn, CancellationToken ct)
}
Steps to Reproduce
- Call
IDiscordRestChannelAPI#GetChannelMessageAsync
with message id of a Discord's auto mod action - Inspect the returned
Result
'sError
Expected Behavior
The method to return a successful Result<IMessage>
with a valid Entity
.
Current Behavior
A Result<IMessage>
with the Error
property set to ExceptionError
is returned.
Library / Runtime Information
Remora.Discord.API: 73.0.0-github4632897105
Remora.Discord.API.Abstractions: 77.0.0-github4632897105
This is due to Automod using an undocumented embed type auto_moderation_message
.
Could one of you open an issue on the docs repo for that type?
They have no intentions on documenting this, as AutoMod is "in beta and still being finalized" if memory serves.
That and embed types being deprecated, as far as the documentation is concerned.