mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
workaround new bug in discord client
how do you fail to find user in cache after you just explicitly loaded it from the server
This commit is contained in:
@@ -107,7 +107,7 @@ namespace CompatBot.Commands
|
||||
public async Task Import(CommandContext ctx, string? url = null)
|
||||
{
|
||||
var msg = await ctx.RespondAsync("Please wait...").ConfigureAwait(false);
|
||||
if (!ImportCheck.Wait(0))
|
||||
if (!await ImportCheck.WaitAsync(0).ConfigureAwait(false))
|
||||
{
|
||||
await ctx.ReactWithAsync(Config.Reactions.Failure).ConfigureAwait(false);
|
||||
await msg.UpdateOrCreateMessageAsync(ctx.Channel, "There is another import in progress already").ConfigureAwait(false);
|
||||
|
||||
@@ -97,8 +97,15 @@ namespace CompatBot.Commands
|
||||
var headerLength = result.Length;
|
||||
var members = GetMembers(ctx.Client);
|
||||
foreach (var member in members)
|
||||
if (UsernameZalgoMonitor.NeedsRename(member.DisplayName))
|
||||
result.AppendLine($"{member.Mention} please change your nickname according to Rule #7");
|
||||
try
|
||||
{
|
||||
if (UsernameZalgoMonitor.NeedsRename(member.DisplayName))
|
||||
result.AppendLine($"{member.Mention} please change your nickname according to Rule #7");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Config.Log.Warn(e, $"Failed to audit username for {member.Id}");
|
||||
}
|
||||
if (result.Length == headerLength)
|
||||
result.AppendLine("No naughty users 🎉");
|
||||
await ctx.SendAutosplitMessageAsync(result, blockStart: "", blockEnd: "").ConfigureAwait(false);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>1701;1702;RS2008</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user