Show a message when 'prune fails due to already running error

This commit is contained in:
Toastie (DCS Team) 2024-07-19 15:26:45 +12:00
parent 47c6f9ab03
commit 7d6a7f159b
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 23 additions and 17 deletions

View file

@ -65,23 +65,6 @@ public partial class Administration
await progressMsg.DeleteAsync(); await progressMsg.DeleteAsync();
} }
private async Task SendResult(PruneResult result)
{
switch (result)
{
case PruneResult.Success:
break;
case PruneResult.AlreadyRunning:
break;
case PruneResult.FeatureLimit:
await Response().Pending(strs.feature_limit_reached_owner).SendAsync();
break;
default:
throw new ArgumentOutOfRangeException(nameof(result), result, null);
}
}
// prune x // prune x
[Cmd] [Cmd]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
@ -218,5 +201,27 @@ public partial class Administration
await Response().Confirm(strs.prune_cancelled).SendAsync(); await Response().Confirm(strs.prune_cancelled).SendAsync();
} }
private async Task SendResult(PruneResult result)
{
switch (result)
{
case PruneResult.Success:
break;
case PruneResult.AlreadyRunning:
var msg = await Response().Pending(strs.prune_already_running).SendAsync();
msg.DeleteAfter(5);
break;
case PruneResult.FeatureLimit:
var msg2 = await Response().Pending(strs.feature_limit_reached_owner).SendAsync();
msg2.DeleteAfter(10);
break;
default:
Log.Error("Unhandled result received in prune: {Result}", result);
await Response().Error(strs.error_occured).SendAsync();
break;
}
}
} }
} }

View file

@ -38,6 +38,7 @@
"prune_cancelled": "Pruning was cancelled.", "prune_cancelled": "Pruning was cancelled.",
"prune_not_found": "No active prune was found on this server.", "prune_not_found": "No active prune was found on this server.",
"prune_progress": "Pruning... {0}/{1} messages deleted.", "prune_progress": "Pruning... {0}/{1} messages deleted.",
"prune_already_running": "A prune is already running on this server.",
"timeoutdm": "You have been timed out in {0} server.\nReason: {1}", "timeoutdm": "You have been timed out in {0} server.\nReason: {1}",
"timedout_user": "User Timed Out", "timedout_user": "User Timed Out",
"remove_roles_pl": "have had their roles removed", "remove_roles_pl": "have had their roles removed",