Class InteractionMethods

Methods for interacting with slash command specific endpoints

Hierarchy

  • InteractionMethods

Methods

  • Takes a list of application commands, overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour

    Returns

    An Array of application command objects

    Example

    const client = new SnowTransfer("TOKEN")
    const commands = await client.interaction.bulkOverwriteApplicationCommands("appId", [{ name: "test", description: "testing 1, 2, 3" }])

    Parameters

    • appId: string

      The Id of the application

    • data: ApplicationCommandBase[]

      Array of commands

    Returns Promise<FetchedApplicationCommand[]>

  • Takes a list of application commands, overwriting existing commands for the guild

    Returns

    An Array of application command objects

    Example

    const client = new SnowTransfer("TOKEN")
    const commands = await client.interaction.bulkOverwriteGuildApplicationCommands("appId", "guildId", [{ name: "test", description: "testing 1, 2, 3" }])

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • data: ApplicationCommandBase[]

      Array of commands

    Returns Promise<FetchedApplicationCommand[]>

  • Create a new global command. New global commands will be available in all guilds after 1 hour

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.createApplicationCommand("appId", { name: "test", description: "testing 1, 2, 3" })

    Parameters

    • appId: string

      The Id of the application

    • data: ApplicationCommandBase

      The command data

    Returns Promise<FetchedApplicationCommand>

  • Create a followup message for an Interaction

    Returns

    A message object

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    const message = await client.interaction.createFollowupMessage("appId", "token", { content: "The pacer gram fitness test-" })

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    • data: Omit<WebhookCreateMessageData, "avatar_url" | "username">

      Message data

    Returns Promise<Message>

  • Create a new guild command. New guild commands will be available in the guild immediately.

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.createGuildApplicationCommand("appId", "guildId", { name: "test", description: "testing 1, 2, 3" })

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • data: ApplicationCommandBase

      Command data

    Returns Promise<FetchedApplicationCommand>

  • Create a response to an Interaction

    When uploading attachments to respond to message interactions, you must provide the top level files property which needs to match attachments array length and each element needs to match the same indexes as where their filename is defined (the top level files property gets deleted before it's appended to payload_json). Should you have a more elegant solution, possibly rewriting the interface with the request handler, please submit a PR/issue.

    Returns

    Resolves the Promise on successful execution

    Example

    // Respond to a message interaction
    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    client.interaction.createInteractionResponse("interactionId", "token", { type: 4, data: { content: "Hello World" } })

    Parameters

    • interactionId: string

      The Id of the interaction

    • token: string

      The token of the interaction

    • data: InteractionResponse & {
          files?: {
              file: Buffer;
              name: string;
          }[];
      }

      Response data

    Returns Promise<void>

  • Deletes a global command

    Returns

    Resolves the Promise on successful execution

    Example

    const client = new SnowTransfer("TOKEN")
    client.interaction.deleteApplicationCommand("appId", "cmdId")

    Parameters

    • appId: string

      The Id of the application

    • cmdId: string

      The Id of the command

    Returns Promise<void>

  • Deletes a followup message for an Interaction

    Returns

    Resolves the Promise on successful execution

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    client.interaction.deleteFollowupMessage("appId", "token", "messageId")

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    • messageId: string

      The Id of the message

    Returns Promise<void>

  • Delete a guild command

    Returns

    Resolves the Promise on successful execution

    Example

    const client = new SnowTransfer("TOKEN")
    client.interaction.deleteGuildApplicationCommand("appId", "guildId", "cmdId")

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • cmdId: string

      The Id of the command

    Returns Promise<void>

  • Deletes the initial Interaction response

    Returns

    Resolves the Promise on successful execution

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    client.interaction.deleteOriginalInteractionResponse("appId", "token")

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    Returns Promise<void>

  • Edit a global command. Updates will be available in all guilds after 1 hour

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.editApplicationCommand("appId", "cmdId", { name: "cool", description: "tells you how cool you are" })

    Parameters

    • appId: string

      The Id of the application

    • cmdId: string

      The Id of the command

    • data: Partial<ApplicationCommandBase>

      The command data

    Returns Promise<FetchedApplicationCommand>

  • Edits a followup message for an Interaction

    Returns

    A message object

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    const message = await client.interaction.editFollowupMessage("appId", "token", "messageId", { content: "-is a multistage aerobic capacity test" })

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    • messageId: string

      The Id of the message

    • data: WebhookEditMessageData

      The new message data

    Returns Promise<Message>

  • Edit a guild command. Updates for guild commands will be available immediately.

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.editGuildApplicationCommand("appId", "guildId", "cmdId", { name: "coolest", description: "tells you that you are the coolest" })

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • cmdId: string

      The Id of the command

    • data: Partial<ApplicationCommandBase>

      New command data

    Returns Promise<FetchedApplicationCommand>

  • Edits command permissions for a specific command for your application in a guild. You can only add up to 10 permission overwrites for a command.

    Returns

    A guild application command permission object

    Example

    const client = new SnowTransfer("TOKEN")
    const permissions = await client.interaction.editGuildApplicationCommandPermissions("appId", "guildId", "cmdId", [{ type: 2, id: "userId", permission: true }])

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • cmdId: string

      The Id of the command

    • permissions: ApplicationCommandPermission[]

      New application command permissions data

    Returns Promise<ApplicationCommandPermissions>

  • Edits the initial Interaction response

    Returns

    A message object

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    const message = await client.interaction.editOriginalInteractionResponse("appId", "token", { content: "The world said hello back" })

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    • data: WebhookEditMessageData

      New response data

    Returns Promise<Message>

  • Fetch a global command for your application

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.getApplicationCommand("appId", "cmdId")

    Parameters

    • appId: string

      The Id of the application

    • cmdId: string

      The Id of the command

    Returns Promise<FetchedApplicationCommand>

  • Fetch all global commands for your application

    Returns

    An Array of application command objects

    Example

    const client = new SnowTransfer("TOKEN")
    const commands = await client.interaction.getApplicationCommands("appId")

    Parameters

    • appId: string

      The Id of the application

    • Optional withLocalizations: boolean

      Whether or not to include localizations

    Returns Promise<FetchedApplicationCommand[]>

  • Get a followup message for an Interaction

    Returns

    A message object

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    const message = await client.interaction.getFollowupMessage("appId", "token", "messageId")

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    • messageId: string

      The Id of the message

    Returns Promise<Message>

  • Fetch a guild command for your application

    Returns

    An application command object

    Example

    const client = new SnowTransfer("TOKEN")
    const command = await client.interaction.getGuildApplicationCommand("appId", "guildId", "cmdId")

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • cmdId: string

      The Id of the command

    Returns Promise<FetchedApplicationCommand>

  • Fetches command permissions for all or a specific command for your application in a guild

    Returns

    An Array or single guild application command permission objects

    Example

    // Gets all commands' permissions
    const client = new SnowTransfer("TOKEN")
    const permissions = await client.interaction.getGuildApplicationCommandPermissions("appId", "guildId")

    Example

    // Gets a specific command's permissions
    const client = new SnowTransfer("TOKEN")
    const permissions = await client.interaction.getGuildApplicationCommandPermissions("appId", "guildId", "cmdId")

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    Returns Promise<ApplicationCommandPermissions[]>

  • Parameters

    • appId: string
    • guildId: string
    • cmdId: string

    Returns Promise<ApplicationCommandPermissions>

  • Fetch all of the guild commands for your application for a specific guild.

    Returns

    An Array of application command objects

    Example

    const client = new SnowTransfer("TOKEN")
    const commands = await client.interaction.getGuildCommands("appId", "guildId", true)

    Parameters

    • appId: string

      The Id of the application

    • guildId: string

      The Id of the guild

    • Optional withLocalizations: boolean

      Whether or not to include localizations

    Returns Promise<FetchedApplicationCommand[]>

  • Returns the initial Interaction response

    Returns

    A message object

    Example

    const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
    const message = await client.interaction.getOriginalInteractionResponse("appId", "token")

    Parameters

    • appId: string

      The Id of the application

    • token: string

      The token of the interaction

    Returns Promise<Message>

Constructors

  • Create a new Interaction Method Handler

    Usually SnowTransfer creates a method handler for you, this is here for completion

    You can access the methods listed via client.interaction.method, where client is an initialized SnowTransfer instance

    Parameters

    • requestHandler: RequestHandler

      request handler that calls the rest api

    • webhooks: WebhookMethods

    Returns InteractionMethods

Properties

requestHandler: RequestHandler
webhooks: WebhookMethods

Generated using TypeDoc