Table of Contents

Class RestInteractionContext<TInteraction>

Namespace
Discord.Rest
Assembly
Discord.Net.Rest.dll

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)

public RestInteractionContext(DiscordRestClient client, TInteraction interaction)

Parameters

client DiscordRestClient

The underlying client.

interaction TInteraction

The underlying interaction.

RestInteractionContext(DiscordRestClient, TInteraction, Func<string, Task>)

public RestInteractionContext(DiscordRestClient client, TInteraction interaction, Func<string, Task> interactionResponseCallback)

Parameters

client DiscordRestClient

The underlying client.

interaction TInteraction

The 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

IRestMessageChannel

Client

Gets the DiscordRestClient that the command will be executed with.

public DiscordRestClient Client { get; }

Property Value

DiscordRestClient

Guild

Gets the RestGuild the command originated from.

public RestGuild Guild { get; }

Property Value

RestGuild

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

Func<string, Task>

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

RestUser

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.