-
Notifications
You must be signed in to change notification settings - Fork 45
/
Ird.cs
29 lines (25 loc) · 1.02 KB
/
Ird.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Threading.Tasks;
using CompatBot.Commands.Attributes;
using CompatBot.Utils;
using CompatBot.Utils.ResultFormatters;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using IrdLibraryClient;
namespace CompatBot.Commands;
internal sealed class Ird: BaseCommandModuleCustom
{
private static readonly IrdClient Client = new();
[Command("ird"), TriggersTyping]
[Description("Searches IRD Library for the matching .ird files")]
public async Task Search(CommandContext ctx, [RemainingText, Description("Product code or game title to look up")] string query)
{
if (string.IsNullOrEmpty(query))
{
await ctx.ReactWithAsync(Config.Reactions.Failure, "Can't search for nothing, boss").ConfigureAwait(false);
return;
}
var result = await Client.SearchAsync(query, Config.Cts.Token).ConfigureAwait(false);
var embed = result.AsEmbed();
await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false);
}
}