Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ModalBuilder.AddModalCommand with option to specify callback #2599

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,23 @@ public ModuleBuilder AddModalCommand(Action<ModalCommandBuilder> configure)
_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"/>.
Expand Down