mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-23 06:15:09 +00:00
Add scheduler
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user