[Feature] RespondWithModal() which accepts an IModal instance as template (#2564)
* introduce overload for responding to an interaction with an instatiated IModal obj * add inline docs to ModalInfo.PropertyInfo * Apply suggestions from code review Co-authored-by: Casmir <68127614+csmir@users.noreply.github.com> --------- Co-authored-by: Casmir <68127614+csmir@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Discord.Interactions.Builders
|
||||
{
|
||||
@@ -38,6 +39,11 @@ namespace Discord.Interactions.Builders
|
||||
/// </summary>
|
||||
Type Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="PropertyInfo"/> of this component's property.
|
||||
/// </summary>
|
||||
PropertyInfo PropertyInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="ComponentTypeConverter"/> assigned to this input.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Discord.Interactions.Builders
|
||||
{
|
||||
@@ -33,6 +34,9 @@ namespace Discord.Interactions.Builders
|
||||
/// <inheritdoc/>
|
||||
public Type Type { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public PropertyInfo PropertyInfo { get; internal set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ComponentTypeConverter TypeConverter { get; private set; }
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Discord.Interactions.Builders
|
||||
if (!typeof(IModal).IsAssignableFrom(type))
|
||||
throw new ArgumentException($"Must be an implementation of {nameof(IModal)}", nameof(type));
|
||||
|
||||
Type = type;
|
||||
|
||||
_interactionService = interactionService;
|
||||
_components = new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user