Merge branch 'vnext'

This commit is contained in:
13xforever
2025-05-29 09:50:17 +05:00
2 changed files with 7 additions and 12 deletions

View File

@@ -15,11 +15,10 @@ internal static class BotStatus
[Description("Bot subsystem configuration status and various runtime stats")]
public static async ValueTask Show(SlashCommandContext ctx)
{
var ephemeral = !ctx.Channel.IsSpamChannel();
await ctx.DeferResponseAsync(ephemeral).ConfigureAwait(false);
var latency = ctx.Client.GetConnectionLatency(Config.BotGuildId);
var embed = new DiscordEmbedBuilder
{
Color = DiscordColor.Purple,
}
var embed = new DiscordEmbedBuilder { Color = DiscordColor.Purple }
.AddField("Current Uptime", Config.Uptime.Elapsed.AsShortTimespan(), true)
.AddField("Discord Latency", $"{latency.TotalMilliseconds:0.0} ms", true);
if (Config.AzureComputerVisionKey is {Length: >0})
@@ -66,7 +65,7 @@ internal static class BotStatus
#if DEBUG
embed.WithFooter("Test Instance");
#endif
await ctx.RespondAsync(embed: embed, ephemeral: !ctx.Channel.IsSpamChannel());
await ctx.RespondAsync(embed: embed, ephemeral: ephemeral);
}
private static string GetConfiguredApiStats()

View File

@@ -124,7 +124,7 @@ public static class UsernameZalgoMonitor
}
}
public static async ValueTask<string> StripZalgoAsync(string displayName, string? userName, ulong userId, NormalizationForm normalizationForm = NormalizationForm.FormC, int level = 3)
public static async ValueTask<string> StripZalgoAsync(string displayName, string? userName, ulong userId, NormalizationForm normalizationForm = NormalizationForm.FormD, int level = 3)
{
const int minNicknameLength = 2;
displayName = displayName.Normalize(normalizationForm).TrimEager();
@@ -195,13 +195,9 @@ public static class UsernameZalgoMonitor
break;
}
}
var result = builder.ToString().TrimEager();
var result = builder.ToString().TrimEager().Normalize(NormalizationForm.FormC);
if (result is null or {Length: <minNicknameLength})
{
if (userName is null)
return await GenerateRandomNameAsync(userId).ConfigureAwait(false);
return await StripZalgoAsync(userName, null, userId, normalizationForm, level).ConfigureAwait(false);
}
return await GenerateRandomNameAsync(userId).ConfigureAwait(false);
return result;
}