Browse Source

update method name and add inline docs

pull/2369/head
Cenngo 3 years ago
parent
commit
78ab959ebb
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      src/Discord.Net.Interactions/Extensions/IDiscordInteractionExtensions.cs

+ 14
- 1
src/Discord.Net.Interactions/Extensions/IDiscordInteractionExtensions.cs View File

@@ -22,7 +22,20 @@ namespace Discord.Interactions
await SendModalResponseAsync(interaction, customId, modalInfo, options, modifyModal); await SendModalResponseAsync(interaction, customId, modalInfo, options, modifyModal);
} }


public static async Task RespondWithModalSafelyAsync<T>(this IDiscordInteraction interaction, string customId, InteractionService interactionService,
/// <summary>
/// Respond to an interaction with a <see cref="IModal"/>.
/// </summary>
/// <remarks>
/// This method overload uses the <paramref name="interactionService"/> parameter to create a new <see cref="ModalInfo"/>
/// if there isn't a built one already in cache.
/// </remarks>
/// <typeparam name="T">Type of the <see cref="IModal"/> implementation.</typeparam>
/// <param name="interaction">The interaction to respond to.</param>
/// <param name="interactionService">Interaction service instance that should be used to build <see cref="ModalInfo"/>s.</param>
/// <param name="options">The request options for this <see langword="async"/> request.</param>
/// <param name="modifyModal">Delegate that can be used to modify the modal.</param>
/// <returns></returns>
public static async Task RespondWithModalAsync<T>(this IDiscordInteraction interaction, string customId, InteractionService interactionService,
RequestOptions options = null, Action<ModalBuilder> modifyModal = null) RequestOptions options = null, Action<ModalBuilder> modifyModal = null)
where T : class, IModal where T : class, IModal
{ {


Loading…
Cancel
Save