Skip to content

Commit

Permalink
add autocomplete respond method to IAutocompleteInteraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Cenngo committed Nov 23, 2021
1 parent fc780c6 commit f2fc50f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Discord
{
/// <summary>
Expand All @@ -9,5 +12,21 @@ public interface IAutocompleteInteraction : IDiscordInteraction
/// Gets the autocomplete data of this interaction.
/// </summary>
new IAutocompleteInteractionData Data { get; }

/// <summary>
/// Responds to this interaction with a set of choices.
/// </summary>
/// <param name="result">
/// The set of choices for the user to pick from.
/// <remarks>
/// A max of 20 choices are allowed. Passing <see langword="null"/> for this argument will show the executing user that
/// there is no choices for their autocompleted input.
/// </remarks>
/// </param>
/// <param name="options">The request options for this response.</param>
/// <returns>
/// A task that represents the asynchronous operation of responding to this interaction.
/// </returns>
Task RespondAsync(IEnumerable<AutocompleteResult> result, RequestOptions options = null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,9 @@ public override string Respond(string text = null, Embed[] embeds = null, bool i
//IAutocompleteInteraction
/// <inheritdoc/>
IAutocompleteInteractionData IAutocompleteInteraction.Data => Data;

/// <inheritdoc/>
Task IAutocompleteInteraction.RespondAsync(IEnumerable<AutocompleteResult> result, RequestOptions options)
=> Task.FromResult(Respond(result, options));
}
}

0 comments on commit f2fc50f

Please sign in to comment.