fix MatchRaw commands *again*

This commit is contained in:
spiral 2021-09-13 01:22:40 -04:00
parent bae883c11f
commit a165a42046
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
3 changed files with 79 additions and 79 deletions

View File

@ -103,7 +103,15 @@ namespace PluralKit.Bot
// No perms check, display name isn't covered by member privacy
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (target.DisplayName == null)
await ctx.Reply(noDisplayNameSetMessage);
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
return;
}
if (!ctx.HasNext())
{
if (target.DisplayName == null)
await ctx.Reply(noDisplayNameSetMessage);
@ -122,14 +130,6 @@ namespace PluralKit.Bot
}
return;
}
if (ctx.MatchRaw())
{
if (target.DisplayName == null)
await ctx.Reply(noDisplayNameSetMessage);
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
return;
}
ctx.CheckOwnGroup(target);
@ -160,7 +160,15 @@ namespace PluralKit.Bot
if (ctx.System?.Id == target.System)
noDescriptionSetMessage += $" To set one, type `pk;group {target.Reference()} description <description>`.";
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{target.Description}\n```");
return;
}
if (!ctx.HasNext())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
@ -173,14 +181,6 @@ namespace PluralKit.Bot
.Build());
return;
}
if (ctx.MatchRaw())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{target.Description}\n```");
return;
}
ctx.CheckOwnGroup(target);

View File

@ -67,7 +67,15 @@ namespace PluralKit.Bot
if (!target.DescriptionPrivacy.CanAccess(ctx.LookupContextFor(target.System)))
throw Errors.LookupNotAllowed;
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{target.Description}\n```");
return;
}
if (!ctx.HasNext())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
@ -80,14 +88,6 @@ namespace PluralKit.Bot
.Build());
return;
}
else if (ctx.MatchRaw())
{
if (target.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{target.Description}\n```");
return;
}
ctx.CheckOwnMember(target);
@ -119,7 +119,15 @@ namespace PluralKit.Bot
if (!target.PronounPrivacy.CanAccess(ctx.LookupContextFor(target.System)))
throw Errors.LookupNotAllowed;
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (target.Pronouns == null)
await ctx.Reply(noPronounsSetMessage);
else
await ctx.Reply($"```\n{target.Pronouns}\n```");
return;
}
if (!ctx.HasNext())
{
if (target.Pronouns == null)
await ctx.Reply(noPronounsSetMessage);
@ -128,14 +136,6 @@ namespace PluralKit.Bot
+ (ctx.System?.Id == target.System ? $" To clear them, type `pk;member {target.Reference()} pronouns -clear`." : ""));
return;
}
else if (ctx.MatchRaw())
{
if (target.Pronouns == null)
await ctx.Reply(noPronounsSetMessage);
else
await ctx.Reply($"```\n{target.Pronouns}\n```");
return;
}
ctx.CheckOwnMember(target);
@ -355,7 +355,15 @@ namespace PluralKit.Bot
// No perms check, display name isn't covered by member privacy
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (target.DisplayName == null)
await ctx.Reply(noDisplayNameSetMessage);
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
return;
}
if (!ctx.HasNext())
{
var eb = await CreateMemberNameInfoEmbed(ctx, target);
if (ctx.System?.Id == target.System)
@ -365,14 +373,6 @@ namespace PluralKit.Bot
await ctx.Reply(embed: eb.Build());
return;
}
else if (ctx.MatchRaw())
{
if (target.DisplayName == null)
await ctx.Reply(noDisplayNameSetMessage);
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
return;
}
ctx.CheckOwnMember(target);
@ -404,15 +404,7 @@ namespace PluralKit.Bot
// No perms check, display name isn't covered by member privacy
if (!ctx.HasNext(false))
{
var eb = await CreateMemberNameInfoEmbed(ctx, target);
if (ctx.System?.Id == target.System)
eb.Description($"To change server name, type `pk;member {target.Reference()} servername <server name>`.\nTo clear it, type `pk;member {target.Reference()} servername -clear`.\nTo print the raw server name, type `pk;member {target.Reference()} servername -raw`.");
await ctx.Reply(embed: eb.Build());
return;
}
else if (ctx.MatchRaw())
if (ctx.MatchRaw())
{
MemberGuildSettings memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
@ -422,6 +414,14 @@ namespace PluralKit.Bot
await ctx.Reply($"```\n{memberGuildConfig.DisplayName}\n```");
return;
}
if (!ctx.HasNext())
{
var eb = await CreateMemberNameInfoEmbed(ctx, target);
if (ctx.System?.Id == target.System)
eb.Description($"To change server name, type `pk;member {target.Reference()} servername <server name>`.\nTo clear it, type `pk;member {target.Reference()} servername -clear`.\nTo print the raw server name, type `pk;member {target.Reference()} servername -raw`.");
await ctx.Reply(embed: eb.Build());
return;
}
ctx.CheckOwnMember(target);

View File

@ -33,14 +33,6 @@ namespace PluralKit.Bot
ctx.CheckSystem();
if (!ctx.HasNext(false))
{
if (ctx.System.Name != null)
await ctx.Reply($"Your system's name is currently **{ctx.System.Name}**. Type `pk;system name -clear` to clear it.");
else
await ctx.Reply(noNameSetMessage);
return;
}
if (ctx.MatchRaw())
{
if (ctx.System.Name != null)
@ -49,6 +41,14 @@ namespace PluralKit.Bot
await ctx.Reply(noNameSetMessage);
return;
}
if (!ctx.HasNext())
{
if (ctx.System.Name != null)
await ctx.Reply($"Your system's name is currently **{ctx.System.Name}**. Type `pk;system name -clear` to clear it.");
else
await ctx.Reply(noNameSetMessage);
return;
}
if (await ctx.MatchClear("your system's name"))
{
@ -77,7 +77,15 @@ namespace PluralKit.Bot
ctx.CheckSystem();
if (!ctx.HasNext(false))
if (ctx.MatchRaw())
{
if (ctx.System.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{ctx.System.Description}\n```");
return;
}
if (!ctx.HasNext())
{
if (ctx.System.Description == null)
await ctx.Reply(noDescriptionSetMessage);
@ -89,14 +97,6 @@ namespace PluralKit.Bot
.Build());
return;
}
if (ctx.MatchRaw())
{
if (ctx.System.Description == null)
await ctx.Reply(noDescriptionSetMessage);
else
await ctx.Reply($"```\n{ctx.System.Description}\n```");
return;
}
if (await ctx.MatchClear("your system's description"))
{
@ -167,14 +167,6 @@ namespace PluralKit.Bot
ctx.CheckSystem();
if (!ctx.HasNext(skipFlags: false))
{
if (ctx.System.Tag == null)
await ctx.Reply(noTagSetMessage);
else
await ctx.Reply($"Your current system tag is {ctx.System.Tag.AsCode()}. To change it, type `pk;s tag <tag>`. To clear it, type `pk;s tag -clear`.");
return;
}
if (ctx.MatchRaw())
{
if (ctx.System.Tag == null)
@ -183,6 +175,14 @@ namespace PluralKit.Bot
await ctx.Reply($"```\n{ctx.System.Tag}\n```");
return;
}
if (!ctx.HasNext())
{
if (ctx.System.Tag == null)
await ctx.Reply(noTagSetMessage);
else
await ctx.Reply($"Your current system tag is {ctx.System.Tag.AsCode()}. To change it, type `pk;s tag <tag>`. To clear it, type `pk;s tag -clear`.");
return;
}
if (await ctx.MatchClear("your system's tag"))
{