Fix various bugs and regressions

This commit is contained in:
Ske
2021-01-31 16:02:34 +01:00
parent 8785354a2b
commit 80c572f594
11 changed files with 60 additions and 57 deletions

View File

@@ -53,8 +53,6 @@ namespace PluralKit.Bot {
}
// Send embed!
// TODO: fix?
await using var conn = await _db.Obtain();
var embed = _embed.CreateLoggedMessageEmbed(await _repo.GetSystem(conn, ctx.SystemId.Value),
await _repo.GetMember(conn, proxy.Member.Id), hookMessage, trigger.Id, trigger.Author, proxy.Content,

View File

@@ -87,7 +87,7 @@ namespace PluralKit.Bot
var webhookReq = new ExecuteWebhookRequest
{
Username = FixClyde(req.Name).Truncate(80),
Username = FixProxyName(req.Name).Truncate(80),
Content = content,
AllowedMentions = allowedMentions,
AvatarUrl = !string.IsNullOrWhiteSpace(req.AvatarUrl) ? req.AvatarUrl : null,
@@ -185,6 +185,8 @@ namespace PluralKit.Bot
return chunks;
}
private string FixProxyName(string name) => FixSingleCharacterName(FixClyde(name));
private string FixClyde(string name)
{
static string Replacement(Match m) => m.Groups[1].Value + "\u200A" + m.Groups[2].Value;
@@ -193,5 +195,12 @@ namespace PluralKit.Bot
// since Discord blocks webhooks containing the word "Clyde"... for some reason. /shrug
return Regex.Replace(name, "(c)(lyde)", Replacement, RegexOptions.IgnoreCase);
}
private string FixSingleCharacterName(string proxyName)
{
if (proxyName.Length == 1)
return proxyName + "\u17b5";
return proxyName;
}
}
}