mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-04-13 10:20:29 +00:00
27 lines
866 B
C#
27 lines
866 B
C#
using CompatBot.Commands.AutoCompleteProviders;
|
|
using CompatBot.Database.Providers;
|
|
using CompatBot.Utils.ResultFormatters;
|
|
using IrdLibraryClient;
|
|
|
|
namespace CompatBot.Commands;
|
|
|
|
internal static class Ird
|
|
{
|
|
private static readonly IrdClient Client = new();
|
|
|
|
[Command("ird")]
|
|
[Description("Search IRD Library")]
|
|
public static async ValueTask Search(
|
|
SlashCommandContext ctx,
|
|
[Description("Product code or game title"), MinMaxLength(3)]
|
|
[SlashAutoCompleteProvider<ProductCodeAutoCompleteProvider>]
|
|
string query
|
|
)
|
|
{
|
|
var ephemeral = !ctx.Channel.IsSpamChannel() && !ModProvider.IsMod(ctx.User.Id);
|
|
var result = await Client.SearchAsync(query, Config.Cts.Token).ConfigureAwait(false);
|
|
await ctx.RespondAsync(embed: result.AsEmbed(), ephemeral: ephemeral).ConfigureAwait(false);
|
|
}
|
|
}
|
|
|