Skip to content

DiscordGateway

DiscordGateway is an internal class responsible for managing communication with the Discord API. This class handles rate limiting, scheduling HTTP requests, and processing events.

Properties

discordScheduler

DiscordGateway.discordScheduler  :: Network.HTTPScheduler

gatewayEventIn

DiscordGateway.gatewayEventIn  :: Network.EventIn

reporter

DiscordGateway.reporter  :: Vendor.Console

endpointRateLimits

DiscordGateway.endpointRateLimits  :: {
      {… [string]: HTTPRatelimit.HTTPRatelimit …}    }

endpointCaches

DiscordGateway.endpointCaches  :: {
      {… [string]: { [any]: any …}    }

Methods

parseErrors

DiscordGateway : parseErrors (

     errorTable: table
     source: string?
     depth: number?
)  -> string

Parses error messages from the Discord API response.

parseDiscordAPIErrors

DiscordGateway : parseDiscordAPIErrors (

     api: string
     networkResponse: Net.FetchResponse
)  -> string

Parses errors from a Discord API response.

requestAsync

DiscordGateway : requestAsync (

     api: string
     method: string
     data: table?
)  -> Vendor.Future

Sends an asynchronous request to the Discord API.

getAsync

DiscordGateway : getAsync (

     api: string
     headers: {
      {… [string]: string …}    }
)  -> Vendor.Future

Sends an asynchronous GET request to the Discord API.

postAsync

DiscordGateway : postAsync (

     api: string
     data: table
     headers: {
      {… [string]: string …}    }
)  -> Vendor.Future

Sends an asynchronous POST request to the Discord API.

putAsync

DiscordGateway : putAsync (

     api: string
     data: table
     headers: {
      {… [string]: string …}    }
)  -> Vendor.Future

Sends an asynchronous PUT request to the Discord API.

deleteAsync

DiscordGateway : deleteAsync (

     api: string
     data: table?
     headers: {
      {… [string]: string …}    }
)  -> Vendor.Future

Sends an asynchronous DELETE request to the Discord API.

patchAsync

DiscordGateway : patchAsync (

     api: string
     data: table
     headers: {
      {… [string]: string …}    }
)  -> Vendor.Future

Sends an asynchronous PATCH request to the Discord API.

setEndpointCache

DiscordGateway : setEndpointCache (

     endpoint: string
     cache: table
)  -> ()

Sets the cache for a specific API endpoint.

getEndpointCache

DiscordGateway : getEndpointCache (

     endpoint: string
)  -> table

Gets the cache for a specific API endpoint.

getApiVersion

DiscordGateway : getApiVersion ()  -> number

Gets the current Discord API version.

Functions

new

DiscordGateway . new (

     discordClient: any
)  -> ()

Creates a new instance of DiscordGateway.