Table of Contents

Class InteractionContext

Namespace
Discord.Interactions
Assembly
Discord.Net.Interactions.dll

Represents the context of an Interaction.

public class InteractionContext : IInteractionContext, IRouteMatchContainer
Inheritance
InteractionContext
Implements
Inherited Members

Constructors

InteractionContext(IDiscordClient, IDiscordInteraction, IMessageChannel)

Initializes a new InteractionContext.

public InteractionContext(IDiscordClient client, IDiscordInteraction interaction, IMessageChannel channel = null)

Parameters

client IDiscordClient

The underlying client.

interaction IDiscordInteraction

The underlying interaction.

channel IMessageChannel

IMessageChannel the command originated from.

Properties

Channel

Gets the channel the interaction originated from.

public IMessageChannel Channel { get; }

Property Value

IMessageChannel

Client

Gets the client that will be used to handle this interaction.

public IDiscordClient Client { get; }

Property Value

IDiscordClient

Guild

Gets the guild the interaction originated from.

public IGuild Guild { get; }

Property Value

IGuild

Remarks

Will be null if the interaction originated from a DM channel or the interaction was a Context Command interaction.

Interaction

Gets the underlying interaction.

public IDiscordInteraction Interaction { get; }

Property Value

IDiscordInteraction

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 user who invoked the interaction event.

public IUser User { get; }

Property Value

IUser

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.