Patch stalling when attempting to remove system messages

This commit is contained in:
femsci 2023-03-04 20:53:36 +01:00
parent 3f2fd049fb
commit ee396a626d
Signed by: femsci
GPG key ID: 08F7911F0E650C67
2 changed files with 6 additions and 1 deletions

View file

@ -23,6 +23,11 @@ public class Delete
var resp = await _cli.DeleteAsync($"https://discord.com/api/v9/channels/{msg.ChannelId}/messages/{msg.Id}"); var resp = await _cli.DeleteAsync($"https://discord.com/api/v9/channels/{msg.ChannelId}/messages/{msg.Id}");
Console.Write($"\x1b[2K\rRequest {cnt}/{_messages.Count} Status: {resp.StatusCode} [{(resp.IsSuccessStatusCode ? "OK" : "REPEATING")}] ... ({_messages.Count - cnt} left)"); Console.Write($"\x1b[2K\rRequest {cnt}/{_messages.Count} Status: {resp.StatusCode} [{(resp.IsSuccessStatusCode ? "OK" : "REPEATING")}] ... ({_messages.Count - cnt} left)");
if ((int)resp.StatusCode / 100 == 4)
{
cnt++;
continue;
}
if (!resp.IsSuccessStatusCode) if (!resp.IsSuccessStatusCode)
{ {
await Task.Delay(30000); await Task.Delay(30000);

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>