mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 16:50:10 +00:00
Fix error on @ everyone
This commit is contained in:
parent
1c548e9d7b
commit
4ee0c13d62
3 changed files with 25 additions and 2 deletions
|
|
@ -1,9 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using Myriad.Serialization;
|
||||
|
||||
namespace Myriad.Rest.Types
|
||||
{
|
||||
public record AllowedMentions
|
||||
{
|
||||
[JsonConverter(typeof(JsonSnakeCaseStringEnumConverter))]
|
||||
public enum ParseType
|
||||
{
|
||||
Roles,
|
||||
|
|
|
|||
17
Myriad/Serialization/JsonSnakeCaseStringEnumConverter.cs
Normal file
17
Myriad/Serialization/JsonSnakeCaseStringEnumConverter.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Myriad.Serialization
|
||||
{
|
||||
public class JsonSnakeCaseStringEnumConverter: JsonConverterFactory
|
||||
{
|
||||
private readonly JsonStringEnumConverter _inner = new(new JsonSnakeCaseNamingPolicy());
|
||||
|
||||
public override bool CanConvert(Type typeToConvert) =>
|
||||
_inner.CanConvert(typeToConvert);
|
||||
|
||||
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
|
||||
_inner.CreateConverter(typeToConvert, options);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue