Add raw display name printing

This commit is contained in:
Spectralitree 2021-04-13 11:25:05 +02:00
parent a2d2036851
commit e016229be5
2 changed files with 69 additions and 20 deletions

View File

@ -104,15 +104,30 @@ namespace PluralKit.Bot
else if (!ctx.HasNext())
{
// No perms check, display name isn't covered by member privacy
if (ctx.MatchFlag("r", "raw"))
{
if (target.DisplayName == null)
{
if (ctx.System?.Id == target.System)
await ctx.Reply($"This group does not have a display name set. To set one, type `pk;group {target.Reference()} displayname <display name>`.");
else
await ctx.Reply("This group does not have a display name set.");
}
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
}
else
{
var eb = new EmbedBuilder()
.Field(new("Name", target.Name))
.Field(new("Display Name", target.DisplayName ?? "*(none)*"));
if (ctx.System?.Id == target.System)
eb.Description($"To change display name, type `pk;group {target.Reference()} displayname <display name>`.\nTo clear it, type `pk;group {target.Reference()} displayname -clear`.");
eb.Description($"To change display name, type `pk;group {target.Reference()} displayname <display name>`.\nTo clear it, type `pk;group {target.Reference()} displayname -clear`.\nTo print the raw display name, type `pk;group {target.Reference()} displayname -raw`.");
await ctx.Reply(embed: eb.Build());
}
}
else
{
ctx.CheckOwnGroup(target);

View File

@ -115,8 +115,10 @@ namespace PluralKit.Bot
await ctx.Reply($"This member does not have pronouns set. To set some, type `pk;member {target.Reference()} pronouns <pronouns>`.");
else
await ctx.Reply("This member does not have pronouns set.");
else if (ctx.MatchFlag("r", "raw"))
await ctx.Reply($"```\n{target.Pronouns}\n```");
else
await ctx.Reply($"**{target.NameFor(ctx)}**'s pronouns are **{target.Pronouns}**."
await ctx.Reply($"**{target.NameFor(ctx)}**'s pronouns are **{target.Pronouns}**.\nTo print the pronouns with formatting, type `pk;member {target.Reference()} pronouns -raw`."
+ (ctx.System?.Id == target.System ? $" To clear them, type `pk;member {target.Reference()} pronouns -clear`." : ""));
}
else
@ -284,11 +286,26 @@ namespace PluralKit.Bot
else if (!ctx.HasNext())
{
// No perms check, display name isn't covered by member privacy
if (ctx.MatchFlag("r", "raw"))
{
if (target.DisplayName == null)
{
if (ctx.System?.Id == target.System)
await ctx.Reply($"This member does not have a display name set. To set one, type `pk;member {target.Reference()} displayname <display name>`.");
else
await ctx.Reply("This member does not have a display name set.");
}
else
await ctx.Reply($"```\n{target.DisplayName}\n```");
}
else
{
var eb = await CreateMemberNameInfoEmbed(ctx, target);
if (ctx.System?.Id == target.System)
eb.Description($"To change display name, type `pk;member {target.Reference()} displayname <display name>`.\nTo clear it, type `pk;member {target.Reference()} displayname -clear`.");
eb.Description($"To change display name, type `pk;member {target.Reference()} displayname <display name>`.\nTo clear it, type `pk;member {target.Reference()} displayname -clear`.\nTo print the raw display name, type `pk;member {target.Reference()} displayname -raw`.");
await ctx.Reply(embed: eb.Build());
}
}
else
{
ctx.CheckOwnMember(target);
@ -320,12 +337,29 @@ namespace PluralKit.Bot
}
else if (!ctx.HasNext())
{
// No perms check, server name isn't covered by member privacy
// No perms check, display name isn't covered by member privacy
if (ctx.MatchFlag("r", "raw"))
{
MemberGuildSettings memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
if (memberGuildConfig.DisplayName == null)
{
if (ctx.System?.Id == target.System)
await ctx.Reply($"This member does not have a server name set. To set one, type `pk;member {target.Reference()} servername <server name>`.");
else
await ctx.Reply("This member does not have a server name set.");
}
else
await ctx.Reply($"```\n{memberGuildConfig.DisplayName}\n```");
}
else
{
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`.");
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());
}
}
else
{
ctx.CheckOwnMember(target);