1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-03 04:29:54 +03:00

more stuff. yeah

This commit is contained in:
l1ttleO 2021-12-15 11:19:14 +05:00
parent 382add19a3
commit 270fba5c3c
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
13 changed files with 301 additions and 116 deletions

View file

@ -13,7 +13,7 @@ public static class Utils {
[Obsolete("Stop hard-coding things!")]
public static ITextChannel GetAdminLogChannel() {
if (Boyfriend.Client.GetChannel(870929165141032971) is not ITextChannel adminLogChannel)
throw new ArgumentException("Invalid admin log channel");
throw new Exception("Invalid admin log channel");
return adminLogChannel;
}
@ -31,13 +31,6 @@ public static class Utils {
}
public static async Task StartDelayed(Task toRun, TimeSpan delay, Func<bool>? condition = null) {
switch (delay.TotalMilliseconds) {
case < -1:
throw new ArgumentOutOfRangeException(nameof(delay), "Указана отрицательная продолжительность!");
case > int.MaxValue:
throw new ArgumentOutOfRangeException(nameof(delay), "Указана слишком большая продолжительность!");
}
await Task.Delay(delay);
var conditionResult = condition?.Invoke() ?? true;
if (conditionResult)