Class SocketInteractionContext<TInteraction>
Represents a Web-Socket based context of an IDiscordInteraction.
Inheritance
Namespace: Discord.Interactions
Assembly: Discord.Net.WebSocket.dll
Syntax
public class SocketInteractionContext<TInteraction> : object, IInteractionContext, IRouteMatchContainer where TInteraction : SocketInteraction
Type Parameters
Name | Description |
---|---|
TInteraction |
Constructors
| Improve this Doc View SourceSocketInteractionContext(DiscordSocketClient, TInteraction)
Initializes a new SocketInteractionContext<TInteraction>.
Declaration
public SocketInteractionContext(DiscordSocketClient client, TInteraction interaction)
Parameters
Type | Name | Description |
---|---|---|
DiscordSocketClient | client | The underlying client. |
TInteraction | interaction | The underlying interaction. |
Properties
| Improve this Doc View SourceChannel
Gets the ISocketMessageChannel the command originated from.
Declaration
public ISocketMessageChannel Channel { get; }
Property Value
Type | Description |
---|---|
ISocketMessageChannel |
Client
Gets the DiscordSocketClient that the command will be executed with.
Declaration
public DiscordSocketClient Client { get; }
Property Value
Type | Description |
---|---|
DiscordSocketClient |
Guild
Gets the SocketGuild the command originated from.
Declaration
public SocketGuild Guild { get; }
Property Value
Type | Description |
---|---|
SocketGuild |
Remarks
Will be null if the command is from a DM Channel.
Interaction
Gets the SocketInteraction the command was received with.
Declaration
public TInteraction Interaction { get; }
Property Value
Type | Description |
---|---|
TInteraction |
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 SocketUser who executed the command.
Declaration
public SocketUser User { get; }
Property Value
Type | Description |
---|---|
SocketUser |
Methods
| Improve this Doc View SourceSetSegmentMatches(IEnumerable<IRouteSegmentMatch>)
Declaration
public void SetSegmentMatches(IEnumerable<IRouteSegmentMatch> segmentMatches)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IRouteSegmentMatch> | segmentMatches |
Explicit Interface Implementations
| Improve this Doc View SourceIInteractionContext.Channel
Gets the channel the interaction originated from.
Declaration
IMessageChannel IInteractionContext.Channel { get; }
Returns
Type | Description |
---|---|
IMessageChannel |
IInteractionContext.Client
Gets the client that will be used to handle this interaction.
Declaration
IDiscordClient IInteractionContext.Client { get; }
Returns
Type | Description |
---|---|
IDiscordClient |
IInteractionContext.Guild
Gets the guild the interaction originated from.
Declaration
IGuild IInteractionContext.Guild { get; }
Returns
Type | Description |
---|---|
IGuild |
Remarks
Will be null if the interaction originated from a DM channel or the interaction was a Context Command interaction.
IInteractionContext.Interaction
Gets the underlying interaction.
Declaration
IDiscordInteraction IInteractionContext.Interaction { get; }
Returns
Type | Description |
---|---|
IDiscordInteraction |
IInteractionContext.User
Gets the user who invoked the interaction event.
Declaration
IUser IInteractionContext.User { get; }
Returns
Type | Description |
---|---|
IUser |