Fix various bugs and regressions
This commit is contained in:
@@ -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,
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user