Show a message when 'prune fails due to already running error
This commit is contained in:
parent
47c6f9ab03
commit
7d6a7f159b
2 changed files with 23 additions and 17 deletions
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in a new issue