Add scheduler

This commit is contained in:
Myx
2025-02-17 03:54:18 +01:00
parent 5726c110a1
commit ae1a4e14d6
22 changed files with 535 additions and 220 deletions

View File

@@ -68,9 +68,9 @@ public static class Extensions
await message.RespondAsync(content, ephemeral: true);
}
public static string GetOptionValueByName(this SocketSlashCommand command, string optionName)
public static T? GetOptionValueByName<T>(this SocketSlashCommand command, string optionName)
{
return command.Data.Options.FirstOrDefault(option => option.Name == optionName)?.Value.ToString() ?? string.Empty;
return (T?)(command.Data?.Options?
.FirstOrDefault(option => option.Name == optionName)?.Value ?? default(T));
}
}

View File

@@ -85,7 +85,7 @@ public class PlayHandler : IRequestHandler<PlayCommand>
return;
}
var searchQuery = context.GetOptionValueByName(Option.Input);
var searchQuery = context.GetOptionValueByName<string>(Option.Input);
if (string.IsNullOrWhiteSpace(searchQuery))
{