Browse Source

Add ModalBuilder.AddModalCommand with option to specify callback

Fixes: #2597
pull/2599/head
Dedmen Miller GitHub 2 years ago
parent
commit
6da9264171
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      src/Discord.Net.Interactions/Builders/ModuleBuilder.cs

+ 17
- 0
src/Discord.Net.Interactions/Builders/ModuleBuilder.cs View File

@@ -390,6 +390,23 @@ namespace Discord.Interactions.Builders
_modalCommands.Add(command);
return this;
}
/// <summary>
/// Adds a modal command builder to <see cref="ModalCommands"/>.
/// </summary>
/// <param name="name">Name of the command.</param>
/// <param name="callback">Command callback to be executed.</param>
/// <param name="configure"><see cref="ModalCommands"/> factory.</param>
/// <returns>
/// The builder instance.
/// </returns>
public ModuleBuilder AddModalCommand(string name, ExecuteCallback callback, Action<ModalCommandBuilder> configure)
{
var command = new ModalCommandBuilder(this, name, callback);
configure(command);
_modalCommands.Add(command);
return this;
}

/// <summary>
/// Adds sub-module builder to <see cref="SubModules"/>.


Loading…
Cancel
Save