refactor: move ReplyFormat out of ContextArgumentsExt

This commit is contained in:
rladenson 2024-10-01 12:49:52 -06:00
parent 30fd97e083
commit 78df03d727
5 changed files with 10 additions and 13 deletions

View file

@ -91,13 +91,6 @@ public static class ContextArgumentsExt
public static bool MatchClear(this Context ctx)
=> ctx.Match("clear", "reset", "default") || ctx.MatchFlag("c", "clear");
public enum ReplyFormat
{
Standard,
Raw,
Plaintext
}
public static ReplyFormat MatchFormat(this Context ctx)
{
if (ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw")) return ReplyFormat.Raw;
@ -195,4 +188,11 @@ public static class ContextArgumentsExt
return groups;
}
}
public enum ReplyFormat
{
Standard,
Raw,
Plaintext
}

View file

@ -7,7 +7,6 @@ using Myriad.Types;
using Newtonsoft.Json.Linq;
using PluralKit.Core;
using static PluralKit.Bot.ContextArgumentsExt;
namespace PluralKit.Bot;

View file

@ -7,7 +7,6 @@ using NodaTime;
using NodaTime.Extensions;
using PluralKit.Core;
using static PluralKit.Bot.ContextArgumentsExt;
namespace PluralKit.Bot;

View file

@ -354,7 +354,7 @@ public class ProxiedMessage
var format = ctx.MatchFormat();
if (format != ContextArgumentsExt.ReplyFormat.Standard)
if (format != ReplyFormat.Standard)
{
var discordMessage = await _rest.GetMessageOrNull(message.Message.Channel, message.Message.Mid);
if (discordMessage == null || !showContent)
@ -367,7 +367,7 @@ public class ProxiedMessage
return;
}
if (format == ContextArgumentsExt.ReplyFormat.Raw)
if (format == ReplyFormat.Raw)
{
await ctx.Reply($"```{content}```");
@ -385,7 +385,7 @@ public class ProxiedMessage
return;
}
if (format == ContextArgumentsExt.ReplyFormat.Plaintext)
if (format == ReplyFormat.Plaintext)
{
var eb = new EmbedBuilder()
.Description($"Showing contents of message {message.Message.Mid}");

View file

@ -10,7 +10,6 @@ using Myriad.Types;
using Newtonsoft.Json;
using PluralKit.Core;
using static PluralKit.Bot.ContextArgumentsExt;
namespace PluralKit.Bot;