Replace most "code-escaped" literals with properly-escaping helpers

This commit is contained in:
Ske
2020-08-25 22:44:52 +02:00
parent 6e88739424
commit 203dbc65a1
11 changed files with 50 additions and 36 deletions

View File

@@ -65,10 +65,7 @@ namespace PluralKit.Bot
if (target.ProxyTags.Count == 0)
await ctx.Reply("This member does not have any proxy tags.");
else
{
var tags = string.Join("\n", target.ProxyTags.Select(t => $"``{t.ProxyString.EscapeBacktickPair()}``"));
await ctx.Reply($"This member's proxy tags are:\n{tags}");
}
await ctx.Reply($"This member's proxy tags are:\n{target.ProxyTagsString("\n")}");
}
// Subcommand: "add"
else if (ctx.Match("add", "append"))
@@ -88,7 +85,7 @@ namespace PluralKit.Bot
var patch = new MemberPatch {ProxyTags = Partial<ProxyTag[]>.Present(newTags.ToArray())};
await _db.Execute(conn => conn.UpdateMember(target.Id, patch));
await ctx.Reply($"{Emojis.Success} Added proxy tags ``{tagToAdd.ProxyString.EscapeBacktickPair()}``.");
await ctx.Reply($"{Emojis.Success} Added proxy tags {tagToAdd.ProxyString.AsCode()}.");
}
// Subcommand: "remove"
else if (ctx.Match("remove", "delete"))
@@ -105,7 +102,7 @@ namespace PluralKit.Bot
var patch = new MemberPatch {ProxyTags = Partial<ProxyTag[]>.Present(newTags.ToArray())};
await _db.Execute(conn => conn.UpdateMember(target.Id, patch));
await ctx.Reply($"{Emojis.Success} Removed proxy tags ``{tagToRemove.ProxyString.EscapeBacktickPair()}``.");
await ctx.Reply($"{Emojis.Success} Removed proxy tags {tagToRemove.ProxyString.AsCode()}.");
}
// Subcommand: bare proxy tag given
else
@@ -129,7 +126,7 @@ namespace PluralKit.Bot
var patch = new MemberPatch {ProxyTags = Partial<ProxyTag[]>.Present(newTags)};
await _db.Execute(conn => conn.UpdateMember(target.Id, patch));
await ctx.Reply($"{Emojis.Success} Member proxy tags set to ``{requestedTag.ProxyString.EscapeBacktickPair()}``.");
await ctx.Reply($"{Emojis.Success} Member proxy tags set to {requestedTag.ProxyString.AsCode()}.");
}
}
}