From 68e3bed4ff3edc044c4f5200ed9664ae7b061896 Mon Sep 17 00:00:00 2001
From: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
Date: Thu, 6 Jan 2022 01:24:18 +0300
Subject: [PATCH] Add user-built AddCommand overloads to ModuleBuilder (#2015)
* add user-built AddCommand overloads to ModuleBuilder
* fix inline docs
---
.../Builders/ModuleBuilder.cs | 82 +++++++++++++++++--
1 file changed, 75 insertions(+), 7 deletions(-)
diff --git a/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs b/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
index 73d5ed62f..c396ab5f4 100644
--- a/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
+++ b/src/Discord.Net.Interactions/Builders/ModuleBuilder.cs
@@ -159,7 +159,7 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds attributes to
+ /// Adds attributes to .
///
/// New attributes to be added to .
///
@@ -172,7 +172,7 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds preconditions to
+ /// Adds preconditions to .
///
/// New preconditions to be added to .
///
@@ -185,7 +185,7 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds slash command builder to
+ /// Adds slash command builder to .
///
/// factory.
///
@@ -200,7 +200,24 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds context command builder to
+ /// Adds slash command builder to .
+ ///
+ /// Name of the command.
+ /// Command callback to be executed.
+ /// factory.
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder AddSlashCommand(string name, ExecuteCallback callback, Action configure)
+ {
+ var command = new SlashCommandBuilder(this, name, callback);
+ configure(command);
+ _slashCommands.Add(command);
+ return this;
+ }
+
+ ///
+ /// Adds context command builder to .
///
/// factory.
///
@@ -215,7 +232,24 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds component command builder to
+ /// Adds context command builder to .
+ ///
+ /// Name of the command.
+ /// Command callback to be executed.
+ /// factory.
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder AddContextCommand(string name, ExecuteCallback callback, Action configure)
+ {
+ var command = new ContextCommandBuilder(this, name, callback);
+ configure(command);
+ _contextCommands.Add(command);
+ return this;
+ }
+
+ ///
+ /// Adds component command builder to .
///
/// factory.
///
@@ -230,7 +264,24 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds autocomplete command builder to
+ /// Adds component command builder to .
+ ///
+ /// Name of the command.
+ /// Command callback to be executed.
+ /// factory.
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder AddComponentCommand(string name, ExecuteCallback callback, Action configure)
+ {
+ var command = new ComponentCommandBuilder(this, name, callback);
+ configure(command);
+ _componentCommands.Add(command);
+ return this;
+ }
+
+ ///
+ /// Adds autocomplete command builder to .
///
/// factory.
///
@@ -245,7 +296,24 @@ namespace Discord.Interactions.Builders
}
///
- /// Adds sub-module builder to
+ /// Adds autocomplete command builder to .
+ ///
+ /// Name of the command.
+ /// Command callback to be executed.
+ /// factory.
+ ///
+ /// The builder instance.
+ ///
+ public ModuleBuilder AddSlashCommand(string name, ExecuteCallback callback, Action configure)
+ {
+ var command = new AutocompleteCommandBuilder(this, name, callback);
+ configure(command);
+ _autocompleteCommands.Add(command);
+ return this;
+ }
+
+ ///
+ /// Adds sub-module builder to .
///
/// factory.
///