Class BaseContext
Represents a base context for application command contexts.
Namespace: DisCatSharp.ApplicationCommands.Context
Assembly: DisCatSharp.ApplicationCommands.dll
Syntax
public class BaseContext : object
Properties
| Improve this Doc View SourceApplicationCommandsExtension
Gets the application command module this interaction was created in.
Declaration
public ApplicationCommandsExtension ApplicationCommandsExtension { get; }
Property Value
Type | Description |
---|---|
ApplicationCommandsExtension |
AppPermissions
Gets the applications permissions.
Declaration
public Permissions AppPermissions { get; }
Property Value
Type | Description |
---|---|
Permissions |
Channel
Gets the channel this interaction was executed in.
Declaration
public DiscordChannel Channel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
Client
Gets the client for this interaction.
Declaration
public DiscordClient Client { get; }
Property Value
Type | Description |
---|---|
DiscordClient |
CommandName
Gets the name of the command.
Declaration
public string CommandName { get; }
Property Value
Type | Description |
---|---|
String |
Guild
Gets the guild this interaction was executed in.
Declaration
public DiscordGuild Guild { get; }
Property Value
Type | Description |
---|---|
DiscordGuild |
GuildLocale
Gets the guild locale if applicable.
Declaration
public string GuildLocale { get; }
Property Value
Type | Description |
---|---|
String |
Interaction
Gets the interaction that was created.
Declaration
public DiscordInteraction Interaction { get; }
Property Value
Type | Description |
---|---|
DiscordInteraction |
InteractionId
Gets the id for this interaction.
Declaration
public ulong InteractionId { get; }
Property Value
Type | Description |
---|---|
UInt64 |
Locale
Gets the invoking user locale.
Declaration
public string Locale { get; }
Property Value
Type | Description |
---|---|
String |
Member
Gets the member which executed this interaction, or null if the command is in a DM.
Declaration
public DiscordMember Member { get; }
Property Value
Type | Description |
---|---|
DiscordMember |
Services
Gets the service provider.
This allows passing data around without resorting to static members.
Defaults to an empty service provider.
Declaration
public IServiceProvider Services { get; }
Property Value
Type | Description |
---|---|
IServiceProvider |
Token
Gets the token for this interaction.
Declaration
public string Token { get; }
Property Value
Type | Description |
---|---|
String |
Type
Gets the type of this interaction.
Declaration
public ApplicationCommandType Type { get; }
Property Value
Type | Description |
---|---|
ApplicationCommandType |
User
Gets the user which executed this interaction.
Declaration
public DiscordUser User { get; }
Property Value
Type | Description |
---|---|
DiscordUser |
Methods
| Improve this Doc View SourceCreateModalResponseAsync(DiscordInteractionModalBuilder)
Creates a modal response to this interaction.
Declaration
public Task CreateModalResponseAsync(DiscordInteractionModalBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
DiscordInteractionModalBuilder | builder | The data to send. |
Returns
Type | Description |
---|---|
Task |
CreateResponseAsync(InteractionResponseType, DiscordInteractionResponseBuilder)
Creates a response to this interaction.
You must create a response within 3 seconds of this interaction being executed; if the command has the potential to take more than 3 seconds, create a DeferredChannelMessageWithSource at the start, and edit the response later.
Declaration
public Task CreateResponseAsync(InteractionResponseType type, DiscordInteractionResponseBuilder builder = null)
Parameters
Type | Name | Description |
---|---|---|
InteractionResponseType | type | The type of the response. |
DiscordInteractionResponseBuilder | builder | The data to be sent, if any. |
Returns
Type | Description |
---|---|
Task |
DeleteFollowupAsync(UInt64)
Deletes a followup message.
Declaration
public Task DeleteFollowupAsync(ulong followupMessageId)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | followupMessageId | The id of the followup message to delete. |
Returns
Type | Description |
---|---|
Task |
DeleteResponseAsync()
Deletes the interaction response.
Declaration
public Task DeleteResponseAsync()
Returns
Type | Description |
---|---|
Task |
EditFollowupAsync(UInt64, DiscordWebhookBuilder)
Edits a followup message.
Declaration
public Task<DiscordMessage> EditFollowupAsync(ulong followupMessageId, DiscordWebhookBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | followupMessageId | The id of the followup message to edit. |
DiscordWebhookBuilder | builder | The webhook builder. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> | The created message. |
EditFollowupAsync(UInt64, String)
Edits a followup message.
Declaration
public Task<DiscordMessage> EditFollowupAsync(ulong followupMessageId, string content)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | followupMessageId | The id of the followup message to edit. |
String | content | The content of the webhook. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> | The created message. |
EditResponseAsync(DiscordWebhookBuilder)
Edits the interaction response.
Declaration
public Task<DiscordMessage> EditResponseAsync(DiscordWebhookBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
DiscordWebhookBuilder | builder | The data to edit the response with. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> |
FollowUpAsync(DiscordFollowupMessageBuilder)
Creates a follow up message to the interaction.
Declaration
public Task<DiscordMessage> FollowUpAsync(DiscordFollowupMessageBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
DiscordFollowupMessageBuilder | builder | The message to be sent, in the form of a webhook. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> | The created message. |
FollowUpAsync(String)
Creates a follow up message to the interaction.
Declaration
public Task<DiscordMessage> FollowUpAsync(string content)
Parameters
Type | Name | Description |
---|---|---|
String | content | The content of the message to be sent. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> | The created message. |
GetFollowupMessageAsync(UInt64)
Gets the followup message.
Declaration
public Task<DiscordMessage> GetFollowupMessageAsync(ulong followupMessageId)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | followupMessageId | The followup message id. |
Returns
Type | Description |
---|---|
Task<DiscordMessage> |
GetOriginalResponseAsync()
Gets the original interaction response.
Declaration
public Task<DiscordMessage> GetOriginalResponseAsync()
Returns
Type | Description |
---|---|
Task<DiscordMessage> | The original interaction response. |