Fix error on @ everyone
This commit is contained in:
parent
1c548e9d7b
commit
4ee0c13d62
@ -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);
|
||||
}
|
||||
}
|
@ -83,7 +83,10 @@ namespace PluralKit.Bot
|
||||
|
||||
var allowedMentions = content.ParseMentions();
|
||||
if (!req.AllowEveryone)
|
||||
allowedMentions = allowedMentions.RemoveUnmentionableRoles(guild);
|
||||
allowedMentions = allowedMentions.RemoveUnmentionableRoles(guild) with {
|
||||
// also clear @everyones
|
||||
Parse = Array.Empty<AllowedMentions.ParseType>()
|
||||
};
|
||||
|
||||
var webhookReq = new ExecuteWebhookRequest
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user