Class InteractionContext
Represents the context of an Interaction.
Namespace: Discord.Interactions
Assembly: Discord.Net.Interactions.dll
Syntax
public class InteractionContext : object, IInteractionContext, IRouteMatchContainer
Constructors
| Improve this Doc View SourceInteractionContext(IDiscordClient, IDiscordInteraction, IMessageChannel)
Initializes a new SocketInteractionContext<TInteraction>.
Declaration
public InteractionContext(IDiscordClient client, IDiscordInteraction interaction, IMessageChannel channel = null)
Parameters
Type | Name | Description |
---|---|---|
IDiscordClient | client | The underlying client. |
IDiscordInteraction | interaction | The underlying interaction. |
IMessageChannel | channel | IMessageChannel the command originated from. |
Properties
| Improve this Doc View SourceChannel
Gets the channel the interaction originated from.
Declaration
public IMessageChannel Channel { get; }
Property Value
Type | Description |
---|---|
IMessageChannel |
Client
Gets the client that will be used to handle this interaction.
Declaration
public IDiscordClient Client { get; }
Property Value
Type | Description |
---|---|
IDiscordClient |
Guild
Gets the guild the interaction originated from.
Declaration
public IGuild Guild { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public IDiscordInteraction Interaction { get; }
Property Value
Type | Description |
---|---|
IDiscordInteraction |
SegmentMatches
Gets the collection of captured route segments in this container.
Declaration
public IReadOnlyCollection<IRouteSegmentMatch> SegmentMatches { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<IRouteSegmentMatch> | A collection of captured route segments. |
User
Gets the user who invoked the interaction event.
Declaration
public IUser User { get; }
Property Value
Type | Description |
---|---|
IUser |
Methods
| Improve this Doc View SourceSetSegmentMatches(IEnumerable<IRouteSegmentMatch>)
Declaration
public void SetSegmentMatches(IEnumerable<IRouteSegmentMatch> segmentMatches)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IRouteSegmentMatch> | segmentMatches |