Add ModalBuilder.AddModalCommand with option to specify callback (#2599)

Fixes: #2597
This commit is contained in:
Dedmen Miller
2023-02-14 22:31:50 +01:00
committed by GitHub
parent 257f246d1d
commit 50e0e5941a

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"/>.