Class RestInteractionContext<TInteraction>
Represents a Rest based context of an IDiscordInteraction.
Namespace: Discord.Rest
Assembly: Discord.Net.Rest.dll
Syntax
public class RestInteractionContext<TInteraction> : object, IRestInteractionContext, IInteractionContext, IRouteMatchContainer where TInteraction : RestInteraction
Type Parameters
Name | Description |
---|---|
TInteraction |
Constructors
| Improve this Doc View SourceRestInteractionContext(DiscordRestClient, TInteraction)
Initializes a new RestInteractionContext<TInteraction>.
Declaration
public RestInteractionContext(DiscordRestClient client, TInteraction interaction)
Parameters
Type | Name | Description |
---|---|---|
DiscordRestClient | client | The underlying client. |
TInteraction | interaction | The underlying interaction. |
RestInteractionContext(DiscordRestClient, TInteraction, Func<String, Task>)
Initializes a new RestInteractionContext<TInteraction>.
Declaration
public RestInteractionContext(DiscordRestClient client, TInteraction interaction, Func<string, Task> interactionResponseCallback)
Parameters
Type | Name | Description |
---|---|---|
DiscordRestClient | client | The underlying client. |
TInteraction | interaction | The underlying interaction. |
Func<String, Task> | interactionResponseCallback | The callback for outgoing json. |
Properties
| Improve this Doc View SourceChannel
Gets the IRestMessageChannel the command originated from.
Declaration
public IRestMessageChannel Channel { get; }
Property Value
Type | Description |
---|---|
IRestMessageChannel |
Client
Gets the DiscordRestClient that the command will be executed with.
Declaration
public DiscordRestClient Client { get; }
Property Value
Type | Description |
---|---|
DiscordRestClient |
Guild
Gets the RestGuild the command originated from.
Declaration
public RestGuild Guild { get; }
Property Value
Type | Description |
---|---|
RestGuild |
Remarks
Will be null if the command is from a DM Channel.
Interaction
Gets the RestInteraction the command was received with.
Declaration
public TInteraction Interaction { get; }
Property Value
Type | Description |
---|---|
TInteraction |
InteractionResponseCallback
Gets or sets the callback to use when the service has outgoing json for the rest webhook.
Declaration
public Func<string, Task> InteractionResponseCallback { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public IReadOnlyCollection<IRouteSegmentMatch> SegmentMatches { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<IRouteSegmentMatch> | A collection of captured route segments. |
User
Gets the RestUser who executed the command.
Declaration
public RestUser User { get; }
Property Value
Type | Description |
---|---|
RestUser |
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 |