Class RestInteractionContext<TInteraction>
Represents a Rest based context of an IDiscordInteraction.
public class RestInteractionContext<TInteraction> : IRestInteractionContext, IInteractionContext, IRouteMatchContainer where TInteraction : RestInteraction
Type Parameters
TInteraction
- Inheritance
-
RestInteractionContext<TInteraction>
- Implements
- Derived
- Inherited Members
Constructors
RestInteractionContext(DiscordRestClient, TInteraction)
Initializes a new RestInteractionContext<TInteraction>.
public RestInteractionContext(DiscordRestClient client, TInteraction interaction)
Parameters
client
DiscordRestClientThe underlying client.
interaction
TInteractionThe underlying interaction.
RestInteractionContext(DiscordRestClient, TInteraction, Func<string, Task>)
Initializes a new RestInteractionContext<TInteraction>.
public RestInteractionContext(DiscordRestClient client, TInteraction interaction, Func<string, Task> interactionResponseCallback)
Parameters
client
DiscordRestClientThe underlying client.
interaction
TInteractionThe underlying interaction.
interactionResponseCallback
Func<string, Task>The callback for outgoing json.
Properties
Channel
Gets the IRestMessageChannel the command originated from.
public IRestMessageChannel Channel { get; }
Property Value
Client
Gets the DiscordRestClient that the command will be executed with.
public DiscordRestClient Client { get; }
Property Value
Guild
Gets the RestGuild the command originated from.
public RestGuild Guild { get; }
Property Value
Remarks
Will be null if the command is from a DM Channel.
Interaction
Gets the RestInteraction the command was received with.
public TInteraction Interaction { get; }
Property Value
- TInteraction
InteractionResponseCallback
Gets or sets the callback to use when the service has outgoing json for the rest webhook.
public Func<string, Task> InteractionResponseCallback { get; set; }
Property Value
Remarks
If this property is null the default callback will be used.
SegmentMatches
Gets the collection of captured route segments in this container.
public IReadOnlyCollection<IRouteSegmentMatch> SegmentMatches { get; }
Property Value
- IReadOnlyCollection<IRouteSegmentMatch>
A collection of captured route segments.
User
Gets the RestUser who executed the command.
public RestUser User { get; }
Property Value
Methods
SetSegmentMatches(IEnumerable<IRouteSegmentMatch>)
Sets the SegmentMatches property of this container.
public void SetSegmentMatches(IEnumerable<IRouteSegmentMatch> segmentMatches)
Parameters
segmentMatches
IEnumerable<IRouteSegmentMatch>The collection of captured route segments.