mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-17 03:00:13 +00:00
refactor: move ReplyFormat out of ContextArgumentsExt
This commit is contained in:
parent
30fd97e083
commit
78df03d727
5 changed files with 10 additions and 13 deletions
|
|
@ -91,13 +91,6 @@ public static class ContextArgumentsExt
|
||||||
public static bool MatchClear(this Context ctx)
|
public static bool MatchClear(this Context ctx)
|
||||||
=> ctx.Match("clear", "reset", "default") || ctx.MatchFlag("c", "clear");
|
=> ctx.Match("clear", "reset", "default") || ctx.MatchFlag("c", "clear");
|
||||||
|
|
||||||
public enum ReplyFormat
|
|
||||||
{
|
|
||||||
Standard,
|
|
||||||
Raw,
|
|
||||||
Plaintext
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ReplyFormat MatchFormat(this Context ctx)
|
public static ReplyFormat MatchFormat(this Context ctx)
|
||||||
{
|
{
|
||||||
if (ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw")) return ReplyFormat.Raw;
|
if (ctx.Match("r", "raw") || ctx.MatchFlag("r", "raw")) return ReplyFormat.Raw;
|
||||||
|
|
@ -196,3 +189,10 @@ public static class ContextArgumentsExt
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ReplyFormat
|
||||||
|
{
|
||||||
|
Standard,
|
||||||
|
Raw,
|
||||||
|
Plaintext
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,6 @@ using Myriad.Types;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PluralKit.Core;
|
using PluralKit.Core;
|
||||||
using static PluralKit.Bot.ContextArgumentsExt;
|
|
||||||
|
|
||||||
namespace PluralKit.Bot;
|
namespace PluralKit.Bot;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using NodaTime;
|
||||||
using NodaTime.Extensions;
|
using NodaTime.Extensions;
|
||||||
|
|
||||||
using PluralKit.Core;
|
using PluralKit.Core;
|
||||||
using static PluralKit.Bot.ContextArgumentsExt;
|
|
||||||
|
|
||||||
namespace PluralKit.Bot;
|
namespace PluralKit.Bot;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ public class ProxiedMessage
|
||||||
|
|
||||||
var format = ctx.MatchFormat();
|
var format = ctx.MatchFormat();
|
||||||
|
|
||||||
if (format != ContextArgumentsExt.ReplyFormat.Standard)
|
if (format != ReplyFormat.Standard)
|
||||||
{
|
{
|
||||||
var discordMessage = await _rest.GetMessageOrNull(message.Message.Channel, message.Message.Mid);
|
var discordMessage = await _rest.GetMessageOrNull(message.Message.Channel, message.Message.Mid);
|
||||||
if (discordMessage == null || !showContent)
|
if (discordMessage == null || !showContent)
|
||||||
|
|
@ -367,7 +367,7 @@ public class ProxiedMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == ContextArgumentsExt.ReplyFormat.Raw)
|
if (format == ReplyFormat.Raw)
|
||||||
{
|
{
|
||||||
await ctx.Reply($"```{content}```");
|
await ctx.Reply($"```{content}```");
|
||||||
|
|
||||||
|
|
@ -385,7 +385,7 @@ public class ProxiedMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == ContextArgumentsExt.ReplyFormat.Plaintext)
|
if (format == ReplyFormat.Plaintext)
|
||||||
{
|
{
|
||||||
var eb = new EmbedBuilder()
|
var eb = new EmbedBuilder()
|
||||||
.Description($"Showing contents of message {message.Message.Mid}");
|
.Description($"Showing contents of message {message.Message.Mid}");
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using Myriad.Types;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PluralKit.Core;
|
using PluralKit.Core;
|
||||||
using static PluralKit.Bot.ContextArgumentsExt;
|
|
||||||
|
|
||||||
namespace PluralKit.Bot;
|
namespace PluralKit.Bot;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue