From ac4d59d17edfa77cf28c644f8797204035508a0a Mon Sep 17 00:00:00 2001 From: Micah Benac <66775276+OfficialSirH@users.noreply.github.com> Date: Tue, 8 Apr 2025 22:52:19 +0200 Subject: [PATCH] feat(RPC): types (#1200) * feat: rpc types Co-authored-by: Danial Raza * feat: complete documented types Co-authored-by: Danial Raza * feat: implement all of the interfaces and documented types Co-authored-by: Danial Raza * chore: minor type changes * feat: type changes * feat: shortcut and relationship types * feat: more types * fix: subscribe args types should be truly empty types * feat: more types * types: lobby/achievement stuff * types: now I remove the lobby types * types: now I remove the lobby types * chore: totally didn't forget this * fix: lol * types: forgor to test out these undocumented types * Update rpc/v10.ts Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * chore: suggested changes * chore: requested changes --------- Co-authored-by: Danial Raza Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- deno/payloads/v10/oauth2.ts | 12 + deno/rpc/common.ts | 475 +++++++ deno/rpc/v10.ts | 2636 +++++++++++++++++++++++++++++++++++ payloads/v10/oauth2.ts | 12 + rpc/common.ts | 475 +++++++ rpc/v10.ts | 2636 +++++++++++++++++++++++++++++++++++ 6 files changed, 6246 insertions(+) diff --git a/deno/payloads/v10/oauth2.ts b/deno/payloads/v10/oauth2.ts index b2016d51..483cd40c 100644 --- a/deno/payloads/v10/oauth2.ts +++ b/deno/payloads/v10/oauth2.ts @@ -69,6 +69,18 @@ export enum OAuth2Scopes { * For local rpc server access, this allows you to control a user's local Discord client - requires Discord approval */ RPC = 'rpc', + /** + * For local rpc server access, this allows you to update a user's activity - requires Discord approval + */ + RPCActivitiesWrite = 'rpc.activities.write', + /** + * For local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval + */ + RPCVoiceRead = 'rpc.voice.read', + /** + * For local rpc server access, this allows you to update a user's voice settings - requires Discord approval + */ + RPCVoiceWrite = 'rpc.voice.write', /** * For local rpc server api access, this allows you to receive notifications pushed out to the user - requires Discord approval */ diff --git a/deno/rpc/common.ts b/deno/rpc/common.ts index 529c98a8..b44fb551 100644 --- a/deno/rpc/common.ts +++ b/deno/rpc/common.ts @@ -1,33 +1,508 @@ +import type { Snowflake } from '../globals.ts'; +import type { APIMessage, APIUser, RPCVoiceConnectionStatusDispatchData } from '../v10.ts'; + +/** + * @unstable The ping object for the `VOICE_CONNECTION_STATUS` dispatched {@link RPCVoiceConnectionStatusDispatchData.pings} field, + * but discord's documentation incorrectly documents it as an 'array of integers'. + */ +export interface RPCVoiceConnectionStatusPing { + /** + * The time the ping was sent + */ + time: number; + /** + * The latency of the ping in milliseconds + */ + value: number; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentOriginalMatch { + 0: string; + index: 0; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentText { + type: 'text'; + originalMatch: RPCAPIMessageParsedContentOriginalMatch; + content: string; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentMention { + type: 'mention'; + userId: Snowflake; + channelId: Snowflake; + guildId: Snowflake; + /** + * Same as {@link RPCAPIMessageParsedContentMention.userId} + */ + parsedUserId: RPCAPIMessageParsedContentMention['userId']; + content: Omit; +} + +/** + * @unstable + */ +export interface RPCAPIMessage extends Omit { + /** + * The nickname of the user who sent the message + */ + nick?: string; + /** + * The color of the author's name + */ + author_color?: number; + /** + * The content of the message parsed into an array + */ + content_parsed: (RPCAPIMessageParsedContentMention | RPCAPIMessageParsedContentText)[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-oauth2-application-structure + */ +export interface RPCOAuth2Application { + /** + * Application description + */ + description: string; + /** + * Hash of the icon + */ + icon: string; + /** + * Application client id + */ + id: Snowflake; + /** + * Array of RPC origin urls + */ + rpc_origins: string[]; + /** + * Application name + */ + name: string; +} + +export interface RPCDeviceVendor { + /** + * Name of the vendor + */ + name: string; + /** + * Url for the vendor + */ + url: string; +} + +export interface RPCDeviceModel { + /** + * Name of the model + */ + name: string; + /** + * Url for the model + */ + url: string; +} + +export enum RPCDeviceType { + AudioInput = 'audioinput', + AudioOutput = 'audiooutput', + VideoInput = 'videoinput', +} + +export interface BaseRPCCertifiedDevice { + /** + * The type of device + */ + type: Type; + /** + * The device's Windows UUID + */ + id: string; + /** + * The hardware vendor + */ + vendor: RPCDeviceVendor; + /** + * The model of the product + */ + model: RPCDeviceModel; + /** + * UUIDs of related devices + */ + related: string[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setcertifieddevices-device-object + */ +export type RPCCertifiedDevice = + Type extends RPCDeviceType.AudioInput ? + BaseRPCCertifiedDevice & { + /** + * If the device's native echo cancellation is enabled + */ + echo_cancellation: boolean; + /** + * If the device's native noise suppression is enabled + */ + noise_suppression: boolean; + /** + * If the device's native automatic gain control is enabled + */ + automatic_gain_control: boolean; + /** + * If the device is hardware muted + */ + hardware_mute: boolean; + } + : BaseRPCCertifiedDevice; + +export interface RPCVoiceAvailableDevice { + /** + * Device id + */ + id: string; + /** + * Device name + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-input-object + */ +export interface RPCVoiceSettingsInput { + /** + * Device id + */ + device_id: string; + /** + * Input voice level (min: 0.0, max: 100.0) + */ + volume: number; + /** + * Array of read-only device objects containing `id` and `name` string keys + */ + available_devices: RPCVoiceAvailableDevice[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-output-object + */ +export interface RPCVoiceSettingsOutput { + /** + * Device id + */ + device_id: string; + /** + * Input voice level (min: 0.0, max: 200.0) + */ + volume: number; + /** + * Array of read-only device objects containing `id` and `name` string keys + */ + available_devices: RPCVoiceAvailableDevice[]; +} + +export enum RPCVoiceSettingsModeType { + PushToTalk = 'PUSH_TO_TALK', + VoiceActivity = 'VOICE_ACTIVITY', +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-key-types + */ +export enum RPCVoiceShortcutKeyComboKeyType { + KeyboardKey, + MouseButton, + KeyboardModifierKey, + GamepadButton, +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-shortcut-key-combo-object + */ +export interface RPCVoiceShortcutKeyCombo { + /** + * Type of key + */ + type: RPCVoiceShortcutKeyComboKeyType; + /** + * Key code + */ + code: number; + /** + * Key name + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-mode-object + */ +export interface RPCVoiceSettingsMode { + /** + * Voice setting mode type + */ + type: RPCVoiceSettingsModeType; + /** + * Voice activity threshold automatically sets its threshold + */ + auto_threshold: boolean; + /** + * Threshold for voice activity (in dB) (min: -100.0, max: 0.0) + */ + threshold: number; + /** + * Shortcut key combos for PTT + */ + shortcut: RPCVoiceShortcutKeyCombo; + /** + * The PTT release delay (in ms) (min: 0, max: 2000) + */ + delay: number; +} + +export enum VoiceConnectionStates { + /** + * TCP disconnected + */ + Disconnected = 'DISCONNECTED', + /** + * Waiting for voice endpoint + */ + AwaitingEndpoint = 'AWAITING_ENDPOINT', + /** + * TCP authenticating + */ + Authenticating = 'AUTHENTICATING', + /** + * TCP connecting + */ + Connecting = 'CONNECTING', + /** + * TCP connected + */ + Connected = 'CONNECTED', + /** + * TCP connected, Voice disconnected + */ + VoiceDisconnected = 'VOICE_DISCONNECTED', + /** + * TCP connected, Voice connecting + */ + VoiceConnecting = 'VOICE_CONNECTING', + /** + * TCP connected, Voice connected + */ + VoiceConnected = 'VOICE_CONNECTED', + /** + * No route to host + */ + NoRoute = 'NO_ROUTE', + /** + * WebRTC ice checking + */ + IceChecking = 'ICE_CHECKING', +} + +/** + * @unstable + */ +export enum RelationshipType { + None, + Friend, + Blocked, + PendingIncoming, + PendingOutgoing, + Implicit, +} + +/** + * @unstable + */ +export interface Relationship { + /** + * The id of the user + */ + id: Snowflake; + /** + * Relationship type + */ + type: RelationshipType; + /** + * User + */ + user: APIUser; +} + /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes */ export enum RPCErrorCodes { + /** + * An unknown error occurred. + */ UnknownError = 1_000, + /** + * @unstable + */ + ServiceUnavailable, + /** + * @unstable + */ + TransactionAborted, + /** + * You sent an invalid payload. + */ InvalidPayload = 4_000, + /** + * Invalid command name specified. + */ InvalidCommand = 4_002, + /** + * Invalid guild ID specified. + */ InvalidGuild, + /** + * Invalid event name specified. + */ InvalidEvent, + /** + * Invalid channel ID specified. + */ InvalidChannel, + /** + * You lack permissions to access the given resource. + */ InvalidPermissions, + /** + * An invalid OAuth2 application ID was used to authorize or authenticate with. + */ InvalidClientId, + /** + * An invalid OAuth2 application origin was used to authorize or authenticate with. + */ InvalidOrigin, + /** + * An invalid OAuth2 token was used to authorize or authenticate with. + */ InvalidToken, + /** + * The specified user ID was invalid. + */ InvalidUser, + /** + * @unstable + */ + InvalidInvite, + /** + * @unstable + */ + InvalidActivityJoinRequest, + /** + * @unstable + */ + InvalidEntitlement, + /** + * @unstable + */ + InvalidGiftCode, + /** + * A standard OAuth2 error occurred; check the data object for the OAuth2 error details. + */ OAuth2Error = 5_000, + /** + * An asynchronous `SELECT_TEXT_CHANNEL`/`SELECT_VOICE_CHANNEL` command timed out. + */ SelectChannelTimedOut, + /** + * An asynchronous `GET_GUILD` command timed out. + */ GetGuildTimedOut, + /** + * You tried to join a user to a voice channel but the user was already in one. + */ SelectVoiceForceRequired, + /** + * You tried to capture more than one shortcut key at once. + */ CaptureShortcutAlreadyListening, + /** + * @unstable + */ + InvalidActivitySecret, + /** + * @unstable + */ + NoEligibleActivity, + /** + * @unstable + */ + PurchaseCanceled, + /** + * @unstable + */ + PurchaseError, + /** + * @unstable + */ + UnauthorizedForAchievement, + /** + * @unstable + */ + RateLimited, } /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes */ export enum RPCCloseEventCodes { + /** + * @unstable + */ + CloseNormal = 1_000, + /** + * @unstable + */ + CloseUnsupported = 1_003, + /** + * @unstable + */ + CloseAbnormal = 1_006, + /** + * You connected to the RPC server with an invalid client ID. + */ InvalidClientId = 4_000, + /** + * You connected to the RPC server with an invalid origin. + */ InvalidOrigin, + /** + * You are being rate limited. + */ RateLimited, + /** + * The OAuth2 token associated with a connection was revoked, get a new one! + */ TokenRevoked, + /** + * The RPC Server version specified in the connection string was not valid. + */ InvalidVersion, + /** + * The encoding specified in the connection string was not valid. + */ InvalidEncoding, } diff --git a/deno/rpc/v10.ts b/deno/rpc/v10.ts index 85294f1e..33324107 100644 --- a/deno/rpc/v10.ts +++ b/deno/rpc/v10.ts @@ -1 +1,2637 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +import type { + APIInvite, + APIMessage, + APIPartialChannel, + APIPartialGuild, + APIUser, + APIVoiceState, + ChannelType, + GatewayActivity, + OAuth2Scopes, + Relationship, + RPCAPIMessage, + RPCCertifiedDevice, + RPCErrorCodes, + RPCOAuth2Application, + RPCVoiceConnectionStatusPing, + RPCVoiceSettingsInput, + RPCVoiceSettingsMode, + RPCVoiceSettingsOutput, + Snowflake, + VoiceConnectionStates, +} from '../v10.ts'; + export * from './common.ts'; + +export const RPCVersion = '1'; + +/** + * https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-commands + */ +export enum RPCCommands { + /** + * @unstable + */ + AcceptActivityInvite = 'ACCEPT_ACTIVITY_INVITE', + /** + * @unstable + */ + ActivityInviteUser = 'ACTIVITY_INVITE_USER', + /** + * Used to authenticate an existing client with your app + */ + Authenticate = 'AUTHENTICATE', + /** + * Used to authorize a new client with your app + */ + Authorize = 'AUTHORIZE', + /** + * @unstable + */ + BraintreePopupBridgeCallback = 'BRAINTREE_POPUP_BRIDGE_CALLBACK', + /** + * @unstable + */ + BrowserHandoff = 'BROWSER_HANDOFF', + /** + * used to reject a Rich Presence Ask to Join request + * + * @unstable the documented similarly named command `CLOSE_ACTIVITY_REQUEST` does not exist, but `CLOSE_ACTIVITY_JOIN_REQUEST` does + */ + CloseActivityJoinRequest = 'CLOSE_ACTIVITY_JOIN_REQUEST', + /** + * @unstable + */ + ConnectionsCallback = 'CONNECTIONS_CALLBACK', + CreateChannelInvite = 'CREATE_CHANNEL_INVITE', + /** + * @unstable + */ + DeepLink = 'DEEP_LINK', + /** + * Event dispatch + */ + Dispatch = 'DISPATCH', + /** + * @unstable + */ + GetApplicationTicket = 'GET_APPLICATION_TICKET', + /** + * Used to retrieve channel information from the client + */ + GetChannel = 'GET_CHANNEL', + /** + * Used to retrieve a list of channels for a guild from the client + */ + GetChannels = 'GET_CHANNELS', + /** + * @unstable + */ + GetEntitlementTicket = 'GET_ENTITLEMENT_TICKET', + /** + * @unstable + */ + GetEntitlements = 'GET_ENTITLEMENTS', + /** + * Used to retrieve guild information from the client + */ + GetGuild = 'GET_GUILD', + /** + * Used to retrieve a list of guilds from the client + */ + GetGuilds = 'GET_GUILDS', + /** + * @unstable + */ + GetImage = 'GET_IMAGE', + /** + * @unstable + */ + GetNetworkingConfig = 'GET_NETWORKING_CONFIG', + /** + * @unstable + */ + GetRelationships = 'GET_RELATIONSHIPS', + /** + * Used to get the current voice channel the client is in + */ + GetSelectedVoiceChannel = 'GET_SELECTED_VOICE_CHANNEL', + /** + * @unstable + */ + GetSkus = 'GET_SKUS', + /** + * @unstable + */ + GetUser = 'GET_USER', + /** + * Used to retrieve the client's voice settings + */ + GetVoiceSettings = 'GET_VOICE_SETTINGS', + /** + * @unstable + */ + GiftCodeBrowser = 'GIFT_CODE_BROWSER', + /** + * @unstable + */ + GuildTemplateBrowser = 'GUILD_TEMPLATE_BROWSER', + /** + * @unstable + */ + InviteBrowser = 'INVITE_BROWSER', + /** + * @unstable + */ + NetworkingCreateToken = 'NETWORKING_CREATE_TOKEN', + /** + * @unstable + */ + NetworkingPeerMetrics = 'NETWORKING_PEER_METRICS', + /** + * @unstable + */ + NetworkingSystemMetrics = 'NETWORKING_SYSTEM_METRICS', + /** + * @unstable + */ + OpenOverlayActivityInvite = 'OPEN_OVERLAY_ACTIVITY_INVITE', + /** + * @unstable + */ + OpenOverlayGuildInvite = 'OPEN_OVERLAY_GUILD_INVITE', + /** + * @unstable + */ + OpenOverlayVoiceSettings = 'OPEN_OVERLAY_VOICE_SETTINGS', + /** + * @unstable + */ + Overlay = 'OVERLAY', + /** + * Used to join or leave a text channel, group dm, or dm + */ + SelectTextChannel = 'SELECT_TEXT_CHANNEL', + /** + * Used to join or leave a voice channel, group dm, or dm + */ + SelectVoiceChannel = 'SELECT_VOICE_CHANNEL', + /** + * Used to consent to a Rich Presence Ask to Join request + */ + SendActivityJoinInvite = 'SEND_ACTIVITY_JOIN_INVITE', + /** + * Used to update a user's Rich Presence + */ + SetActivity = 'SET_ACTIVITY', + /** + * Used to send info about certified hardware devices + */ + SetCertifiedDevices = 'SET_CERTIFIED_DEVICES', + /** + * @unstable + */ + SetOverlayLocked = 'SET_OVERLAY_LOCKED', + /** + * Used to change voice settings of users in voice channels + */ + SetUserVoiceSettings = 'SET_USER_VOICE_SETTINGS', + SetUserVoiceSettings2 = 'SET_USER_VOICE_SETTINGS_2', + /** + * Used to set the client's voice settings + */ + SetVoiceSettings = 'SET_VOICE_SETTINGS', + SetVoiceSettings2 = 'SET_VOICE_SETTINGS_2', + /** + * @unstable + */ + StartPurchase = 'START_PURCHASE', + /** + * Used to subscribe to an RPC event + */ + Subscribe = 'SUBSCRIBE', + /** + * Used to unsubscribe from an RPC event + */ + Unsubscribe = 'UNSUBSCRIBE', + /** + * @unstable + */ + ValidateApplication = 'VALIDATE_APPLICATION', +} + +/** + * https://discord.com/developers/docs/topics/rpc#authorize-authorize-response-structure + */ +export interface RPCAuthorizeResultData { + /** + * OAuth2 authorization code + */ + code: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authorize-authorize-argument-structure + */ +export interface RPCAuthorizeArgs { + /** + * OAuth2 application id + */ + client_id: Snowflake; + /** + * Scopes to authorize + */ + scopes: OAuth2Scopes[]; + /** + * username to create a guest account with if the user does not have Discord + */ + username?: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-authenticate-argument-structure + */ +export interface RPCAuthenticateArgs { + /** + * OAuth2 access token + */ + access_token: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-authenticate-response-structure + */ +export interface RPCAuthenticateResultData { + /** + * The authed user + */ + user: APIUser; + /** + * Authorized scopes + */ + scopes: OAuth2Scopes[]; + /** + * Expiration date of OAuth2 token + */ + expires: string; + /** + * Application the user authorized + */ + application: RPCOAuth2Application; +} + +export interface RPCGetGuildsArgs {} + +/** + * https://discord.com/developers/docs/topics/rpc#getguilds-get-guilds-response-structure + */ +export interface RPCGetGuildsResultData { + /** + * The guilds the user is in + */ + guilds: APIPartialGuild[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getguild-get-guild-argument-structure + */ +export interface RPCGetGuildArgs { + /** + * Id of the guild to get + */ + guild_id: Snowflake; + /** + * Asynchronously get guild with time to wait before timing out + */ + timeout?: number; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getguild-get-guild-response-structure + */ +export interface RPCGetGuildResultData { + /** + * Guild id + */ + id: Snowflake; + /** + * Guild name + */ + name: string; + /** + * Guild icon url + */ + icon_url: string | null; + /** + * Members of the guild + * + * @deprecated This will always be an empty array + */ + members: []; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannel + */ +export interface RPCGetChannelArgs { + /** + * Id of the channel to get + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannel-get-channel-response-structure + */ +export interface RPCGetChannelResultData { + /** + * Channel id + */ + id: Snowflake; + /** + * Channel's guild id + */ + guild_id: Snowflake; + /** + * Channel name + */ + name: string; + /** + * Channel type + */ + type: ChannelType; + /** + * (text) channel topic + */ + topic?: string; + /** + * (voice) bitrate of voice channel + */ + bitrate?: number; + /** + * (voice) user limit of voice channel (0 for none) + */ + user_limit?: number; + /** + * Position of channel in channel list + */ + position: number; + /** + * (voice) channel's voice states + */ + voice_states?: APIVoiceState[]; + /** + * (text) channel's messages + */ + messages?: APIMessage[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannels-get-channels-argument-structure + */ +export interface RPCGetChannelsArgs { + /** + * Id of the guild to get channels for + */ + guild_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannels-get-channels-response-structure + */ +export interface RPCGetChannelsResultData { + /** + * Guild channels the user is in + */ + channels: APIPartialChannel[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings-pan-object + */ +export interface RPCVoicePan { + /** + * Left pan of user (min: 0.0, max: 1.0) + */ + left: number; + /** + * Right pan of user (min: 0.0, max: 1.0) + */ + right: number; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings + * + * @remarks Discord only supports a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. + */ +export interface RPCSetUserVoiceSettingsArgs { + /** + * User id + */ + user_id: Snowflake; + /** + * Set the pan of the user + */ + pan?: RPCVoicePan; + /** + * Set the volume of user (defaults to 100, min 0, max 200) + */ + volume?: number; + /** + * Set the mute state of the user + */ + mute?: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings-set-user-voice-settings-argument-and-response-structure + */ +export type RPCSetUserVoiceSettingsResultData = Required; + +/** + * https://discord.com/developers/docs/topics/rpc#selectvoicechannel-select-voice-channel-argument-structure + * + * @remarks When trying to join the user to a voice channel, you will receive a {@link RPCErrorCodes.SelectVoiceForceRequired} error coded response if the user is already in a voice channel. The `force` parameter should only be specified in response to the case where a user is already in a voice channel and they have approved to be moved by your app to a new voice channel. + */ +export interface RPCSelectVoiceChannelArgs { + /** + * Channel id to join (or `null` to leave) + */ + channel_id: Snowflake | null; + /** + * Asynchronously join channel with time to wait before timing out + */ + timeout?: number; + /** + * Forces a user to join a voice channel + */ + force?: boolean; + /** + * After joining the voice channel, navigate to it in the client + */ + navigate?: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#selectvoicechannel + */ +export type RPCSelectVoiceChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#getselectedvoicechannel + */ +export type RPCGetSelectedVoiceChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#getselectedvoicechannel + */ +export interface RPCGetSelectedVoiceChannelArgs {} + +/** + * @unstable + */ +export type RPCGetUserResultData = APIUser; + +/** + * @unstable + */ +export interface RPCGetUserArgs { + /** + * @unstable Id of the user to get + */ + id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-get-voice-settings-response-structure + */ +export interface RPCGetVoiceSettingsResultData { + /** + * Input settings + */ + input: RPCVoiceSettingsInput; + /** + * Output settings + */ + output: RPCVoiceSettingsOutput; + /** + * Voice mode settings + */ + mode: RPCVoiceSettingsMode; + /** + * State of automatic gain control + */ + automatic_gain_control: boolean; + /** + * State of echo cancellation + */ + echo_cancellation: boolean; + /** + * State of noise suppression + */ + noise_suppression: boolean; + /** + * State of voice quality of service + */ + qos: boolean; + /** + * State of silence warning notice + */ + silence_warning: boolean; + /** + * State of self-deafen + */ + deaf: boolean; + /** + * State of self-mute + */ + mute: boolean; +} + +export interface RPCGetVoiceSettingsArgs {} + +/** + * Returns the {@link https://discord.com/developers/docs/topics/rpc#getchannel | Get Channel} response, or `null` if none. + */ +export type RPCSelectTextChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#selecttextchannel-select-text-channel-argument-structure + */ +export interface RPCSelectTextChannelArgs { + /** + * Channel id to join (or `null` to leave) + */ + channel_id: Snowflake | null; + /** + * Asynchronously join channel with time to wait before timing out + */ + timeout?: number; +} + +export interface RPCSetActivityResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure + */ +export interface RPCSetActivityArgs { + /** + * The application's process id + */ + pid: number; + /** + * The rich presence to assign to the user + */ + activity?: Partial>; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setvoicesettings-set-voice-settings-argument-and-response-structure + */ +export type RPCSetVoiceSettingsResultData = RPCGetVoiceSettingsResultData; + +/** + * https://discord.com/developers/docs/topics/rpc#setvoicesettings-set-voice-settings-argument-and-response-structure + * + * @remarks Discord only supports a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. + */ +export type RPCSetVoiceSettingsArgs = RPCGetVoiceSettingsResultData; + +/** + * https://discord.com/developers/docs/topics/rpc#subscribe-subscribe-response-structure + */ +export interface RPCSubscribeResultData { + /** + * Event name now subscribed to + */ + evt: RPCEvents; +} + +/** + * https://discord.com/developers/docs/topics/rpc#subscribe + */ +export type RPCSubscribeArgs = + | RPCSubscribeActivityInviteArgs + | RPCSubscribeActivityJoinArgs + | RPCSubscribeActivityJoinRequestArgs + | RPCSubscribeActivitySpectateArgs + | RPCSubscribeChannelCreateArgs + | RPCSubscribeCurrentUserUpdateArgs + | RPCSubscribeEntitlementCreateArgs + | RPCSubscribeEntitlementDeleteArgs + | RPCSubscribeGameJoinArgs + | RPCSubscribeGameSpectateArgs + | RPCSubscribeGuildCreateArgs + | RPCSubscribeGuildStatusArgs + | RPCSubscribeMessageCreateArgs + | RPCSubscribeMessageDeleteArgs + | RPCSubscribeMessageUpdateArgs + | RPCSubscribeNotificationCreateArgs + | RPCSubscribeOverlayArgs + | RPCSubscribeOverlayUpdateArgs + | RPCSubscribeRelationshipUpdateArgs + | RPCSubscribeSpeakingStartArgs + | RPCSubscribeSpeakingStopArgs + | RPCSubscribeVoiceChannelSelectArgs + | RPCSubscribeVoiceConnectionStatusArgs + | RPCSubscribeVoiceSettingsUpdate2Args + | RPCSubscribeVoiceSettingsUpdateArgs + | RPCSubscribeVoiceStateCreateArgs + | RPCSubscribeVoiceStateDeleteArgs + | RPCSubscribeVoiceStateUpdateArgs; + +/** + * https://discord.com/developers/docs/topics/rpc#unsubscribe-unsubscribe-response-structure + */ +export interface RPCUnsubscribeResultData { + /** + * Event name now unsubscribed from + */ + evt: RPCEvents; +} + +/** + * https://discord.com/developers/docs/topics/rpc#unsubscribe + */ +export type RPCUnsubscribeArgs = RPCSubscribeArgs; + +/** + * @unstable + */ +export interface RPCAcceptActivityInviteResultData {} + +/** + * @unstable + */ +export interface RPCAcceptActivityInviteArgs { + /** + * @unstable Invite type + */ + type: 1; + /** + * @unstable Id of the user who sent the invite + */ + user_id: Snowflake; + /** + * @unstable Id of the session + */ + session_id: Snowflake; + /** + * @unstable Id of the channel that the invite comes from + */ + channel_id: Snowflake; + /** + * @unstable Id of the message that the invite comes from + */ + message_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCActivityInviteUserResultData {} + +/** + * @unstable + */ +export interface RPCActivityInviteUserArgs { + /** + * @unstable Invite type + */ + type: 1; + /** + * @unstable Id of the user to invite + */ + user_id: Snowflake; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCBraintreePopupBridgeCallbackResultData {} + +/** + * @unstable + */ +export interface RPCBraintreePopupBridgeCallbackArgs {} + +/** + * @unstable + */ +export interface RPCBrowserHandoffResultData {} + +/** + * @unstable + */ +export interface RPCBrowserHandoffArgs {} + +export interface RPCCloseActivityJoinRequestResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#closeactivityrequest-close-activity-request-argument-structure + */ +export interface RPCCloseActivityJoinRequestArgs { + /** + * The id of the requesting user + */ + user_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCConnectionsCallbackResultData {} + +/** + * @unstable + */ +export interface RPCConnectionsCallbackArgs {} + +/** + * @unstable Channel invite + */ +export type RPCCreateChannelInviteResultData = APIInvite & { + /** + * @unstable Timestamp of when the invite was created + */ + created_at: string; + /** + * @unstable Max age of the invite + */ + max_age: number; + /** + * @unstable Max uses of the invite + */ + max_uses: number; + /** + * @unstable Whether the invite is temporary + */ + temporary: boolean; + /** + * @unstable Uses of the invite + */ + uses: number; + /** + * @unstable Id of the guild + */ + guild_id: Snowflake; +}; + +/** + * @unstable Arguments to create channel invite + */ +export interface RPCCreateChannelInviteArgs { + /** + * Id of the channel to create an invite for + */ + channel_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCDeepLinkResultData {} + +/** + * @unstable + */ +export interface RPCDeepLinkArgs {} + +/** + * @unstable + */ +export interface RPCGetApplicationTicketResultData {} + +/** + * @unstable + */ +export interface RPCGetApplicationTicketArgs {} + +/** + * @unstable + */ +export interface RPCGetEntitlementTicketResultData {} + +/** + * @unstable + */ +export interface RPCGetEntitlementTicketArgs {} + +/** + * @unstable + */ +export interface RPCGetEntitlementsResultData {} + +/** + * @unstable + */ +export interface RPCGetEntitlementsArgs {} + +/** + * @unstable + */ +export interface RPCGetImageResultData { + /** + * @unstable Base64 image data + */ + data_url: string; +} + +/** + * @unstable + */ +export interface RPCGetImageArgs { + /** + * @unstable Image type + */ + type: 'user'; + /** + * @unstable Id of the image + */ + id: Snowflake; + /** + * @unstable Image format + */ + format: 'jpg' | 'png' | 'webp'; + /** + * @unstable Size of the image + */ + size: 1_024 | 16 | 32 | 64 | 128 | 256 | 512; +} + +/** + * @unstable + */ +export interface RPCGetNetworkingConfigResultData {} + +/** + * @unstable + */ +export interface RPCGetNetworkingConfigArgs {} + +/** + * @unstable + */ +export type RPCGetRelationshipsResultData = Relationship[]; + +/** + * @unstable + */ +export interface RPCGetRelationshipsArgs {} + +/** + * @unstable + */ +export type RPCGetSkusResultData = unknown[]; + +/** + * @unstable + */ +export interface RPCGetSkusArgs {} + +/** + * @unstable + */ +export interface RPCGiftCodeBrowserResultData {} + +/** + * @unstable + */ +export interface RPCGiftCodeBrowserArgs {} + +/** + * @unstable + */ +export interface RPCGuildTemplateBrowserResultData {} + +/** + * @unstable + */ +export interface RPCGuildTemplateBrowserArgs {} + +/** + * @unstable + */ +export interface RPCInviteBrowserResultData {} + +/** + * @unstable + */ +export interface RPCInviteBrowserArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingCreateTokenResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingCreateTokenArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingPeerMetricsResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingPeerMetricsArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingSystemMetricsResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingSystemMetricsArgs {} + +/** + * @unstable + */ +export interface RPCOpenOverlayActivityInviteResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayActivityInviteArgs { + /** + * @unstable + */ + type: 1; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOpenOverlayGuildInviteResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayGuildInviteArgs { + /** + * @unstable Guild invite code + */ + code: string; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOpenOverlayVoiceSettingsResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayVoiceSettingsArgs { + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOverlayResultData {} + +/** + * @unstable + */ +export interface RPCOverlayArgs {} + +export interface RPCSendActivityJoinInviteResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#sendactivityjoininvite-send-activity-join-invite-argument-structure + */ +export interface RPCSendActivityJoinInviteArgs { + /** + * The id of the requesting user + */ + user_id: Snowflake; +} + +export type RPCSetCertifiedDevicesResultData = null; + +/** + * https://discord.com/developers/docs/topics/rpc#setcertifieddevices-set-certified-devices-argument-structure + */ +export interface RPCSetCertifiedDevicesArgs { + /** + * A list of devices for your manufacturer, in order of priority + */ + devices: RPCCertifiedDevice[]; +} + +/** + * @unstable + */ +export interface RPCSetOverlayLockedResultData {} + +/** + * @unstable + */ +export interface RPCSetOverlayLockedArgs { + /** + * @unstable Whether the overlay is locked + */ + locked: boolean; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export type RPCSetUserVoiceSettings2ResultData = RPCSetUserVoiceSettingsResultData; + +/** + * @unstable + */ +export type RPCSetUserVoiceSettings2Args = RPCSetUserVoiceSettingsArgs; + +/** + * @unstable + */ +export type RPCSetVoiceSettings2ResultData = RPCSetVoiceSettingsResultData; + +/** + * @unstable + */ +export type RPCSetVoiceSettings2Args = RPCSetVoiceSettingsArgs; + +/** + * @unstable + */ +export interface RPCStartPurchaseResultData {} + +/** + * @unstable + */ +export interface RPCStartPurchaseArgs { + /** + * Id of the sku + */ + sku_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCValidateApplicationResultData {} + +/** + * @unstable + */ +export interface RPCValidateApplicationArgs {} + +/** + * https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-events + */ +export enum RPCEvents { + /** + * @unstable + */ + ActivityInvite = 'ACTIVITY_INVITE', + ActivityJoin = 'ACTIVITY_JOIN', + ActivityJoinRequest = 'ACTIVITY_JOIN_REQUEST', + ActivitySpectate = 'ACTIVITY_SPECTATE', + ChannelCreate = 'CHANNEL_CREATE', + CurrentUserUpdate = 'CURRENT_USER_UPDATE', + /** + * @unstable + */ + EntitlementCreate = 'ENTITLEMENT_CREATE', + /** + * @unstable + */ + EntitlementDelete = 'ENTITLEMENT_DELETE', + Error = 'ERROR', + /** + * @unstable + */ + GameJoin = 'GAME_JOIN', + /** + * @unstable + */ + GameSpectate = 'GAME_SPECTATE', + GuildCreate = 'GUILD_CREATE', + GuildStatus = 'GUILD_STATUS', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageCreate = 'MESSAGE_CREATE', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageDelete = 'MESSAGE_DELETE', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageUpdate = 'MESSAGE_UPDATE', + /** + * This event requires the `rpc.notifications.read` {@link https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes | OAuth2 scope}. + */ + NotificationCreate = 'NOTIFICATION_CREATE', + /** + * @unstable + */ + Overlay = 'OVERLAY', + /** + * @unstable + */ + OverlayUpdate = 'OVERLAY_UPDATE', + Ready = 'READY', + /** + * @unstable + */ + RelationshipUpdate = 'RELATIONSHIP_UPDATE', + SpeakingStart = 'SPEAKING_START', + SpeakingStop = 'SPEAKING_STOP', + VoiceChannelSelect = 'VOICE_CHANNEL_SELECT', + VoiceConnectionStatus = 'VOICE_CONNECTION_STATUS', + VoiceSettingsUpdate = 'VOICE_SETTINGS_UPDATE', + /** + * @unstable + */ + VoiceSettingsUpdate2 = 'VOICE_SETTINGS_UPDATE_2', + /** + * Dispatches channel voice state objects + */ + VoiceStateCreate = 'VOICE_STATE_CREATE', + /** + * Dispatches channel voice state objects + */ + VoiceStateDelete = 'VOICE_STATE_DELETE', + /** + * Dispatches channel voice state objects + */ + VoiceStateUpdate = 'VOICE_STATE_UPDATE', +} + +/** + * @unstable + */ +export type RPCSubscribeActivityInviteArgs = Record; + +export type RPCSubscribeActivityJoinArgs = Record; + +export type RPCSubscribeActivityJoinRequestArgs = Record; + +export type RPCSubscribeActivitySpectateArgs = Record; + +export type RPCSubscribeChannelCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeCurrentUserUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeEntitlementCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeEntitlementDeleteArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeGameJoinArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeGameSpectateArgs = Record; + +export type RPCSubscribeGuildCreateArgs = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#guildstatus-guild-status-argument-structure + */ +export interface RPCSubscribeGuildStatusArgs { + /** + * Id of guild to listen to updates of + */ + guild_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageCreateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageDeleteArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageUpdateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +export type RPCSubscribeNotificationCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeOverlayArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeOverlayUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeRelationshipUpdateArgs = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-argument-structure + */ +export interface RPCSubscribeSpeakingStartArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-argument-structure + */ +export interface RPCSubscribeSpeakingStopArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +export type RPCSubscribeVoiceChannelSelectArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeVoiceConnectionStatusArgs = Record; + +export type RPCSubscribeVoiceSettingsUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeVoiceSettingsUpdate2Args = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateCreateArgs { + /** + * id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateDeleteArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateUpdateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCActivityInviteDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#activityjoin-activity-join-dispatch-data-structure + */ +export interface RPCActivityJoinDispatchData { + /** + * The {@link https://discord.com/developers/docs/developer-tools/game-sdk#activitysecrets-struct | `join_secret`} for the given invite + */ + secret: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#activityjoinrequest-activity-join-request-data-structure + */ +export interface RPCActivityJoinRequestDispatchData { + /** + * Information about the user requesting to join + */ + user: APIUser; +} + +/** + * https://discord.com/developers/docs/topics/rpc#activityspectate-activity-spectate-dispatch-data-structure + */ +export interface RPCActivitySpectateDispatchData { + /** + * The {@link https://discord.com/developers/docs/developer-tools/game-sdk#activitysecrets-struct | `spectate_secret`} for the given invite + */ + secret: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#channelcreate-channel-create-dispatch-data-structure + */ +export interface RPCChannelCreateDispatchData { + /** + * Channel id + */ + id: Snowflake; + /** + * Name of the channel + */ + name: string; + /** + * Channel type + */ + type: ChannelType; +} + +/** + * @unstable + */ +export interface RPCCurrentUserUpdateDispatchData {} + +/** + * @unstable + */ +export interface RPCEntitlementCreateDispatchData {} + +/** + * @unstable + */ +export interface RPCEntitlementDeleteDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#error-error-data-structure + */ +export interface RPCErrorDispatchData { + /** + * RPC Error Code + */ + code: RPCErrorCodes; + /** + * Error description + */ + message: string; +} + +/** + * @unstable + */ +export interface RPCGameJoinDispatchData {} + +/** + * @unstable + */ +export interface RPCGameSpectateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#guildcreate-guild-create-dispatch-data-structure + */ +export interface RPCGuildCreateDispatchData { + /** + * Guild id + */ + id: Snowflake; + /** + * Name of the guild + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#guildstatus-guild-status-dispatch-data-structure + */ +export interface RPCGuildStatusDispatchData { + /** + * Guild with requested id + */ + guild: APIPartialGuild; + /** + * Number of online users in guild + * + * @deprecated This will always be `0` + */ + online: 0; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageCreateDispatchData { + /** + * Id of channel where message was sent + */ + channel_id: Snowflake; + /** + * message that was created + */ + message: RPCAPIMessage; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageDeleteDispatchData { + /** + * Id of channel where message was deleted + */ + channel_id: Snowflake; + /** + * Message that was deleted (only id) + */ + message: Pick; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageUpdateDispatchData { + /** + * Id of channel where message was updated + */ + channel_id: Snowflake; + /** + * message that was updated + */ + message: RPCAPIMessage; +} + +/** + * https://discord.com/developers/docs/topics/rpc#notificationcreate-notification-create-dispatch-data-structure + */ +export interface RPCNotificationCreateDispatchData { + /** + * Id of channel where notification occurred + */ + channel_id: Snowflake; + /** + * Message that generated this notification + */ + message: RPCAPIMessage; + /** + * Icon url of the notification + */ + icon_url: string; + /** + * Title of the notification + */ + title: string; + /** + * Body of the notification + */ + body: string; +} + +/** + * @unstable + */ +export interface RPCOverlayDispatchData {} + +/** + * @unstable + */ +export interface RPCOverlayUpdateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#ready-rpc-server-configuration-object + */ +export interface RPCServerConfiguration { + /** + * Server's cdn + */ + cdn_host: string; + /** + * Server's api endpoint + */ + api_endpoint: string; + /** + * Server's environment + */ + environment: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#ready-ready-dispatch-data-structure + */ +export interface RPCReadyDispatchData { + /** + * RPC version + */ + v: 1; + /** + * Server configuration + */ + config: RPCServerConfiguration; + /** + * The user to whom you are connected + */ + user: APIUser; +} + +/** + * @unstable + */ +export interface RPCRelationshipUpdateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-dispatch-data-structure + */ +export interface RPCSpeakingStartDispatchData { + /** + * Id of user who started speaking + */ + user_id: Snowflake; + /** + * @unstable + * id of channel where user is speaking + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-dispatch-data-structure + */ +export interface RPCSpeakingStopDispatchData { + /** + * Id of user who stopped speaking + */ + user_id: Snowflake; + /** + * @unstable + * id of channel where user is speaking + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicechannelselect-voice-channel-select-dispatch-data-structure + */ +export interface RPCVoiceChannelSelectDispatchData { + /** + * Id of channel (`null` if leaving channel) + */ + channel_id: Snowflake | null; + /** + * Id of guild (`null` if not in a guild. field is omitted when leaving any voice channel) + */ + guild_id?: Snowflake | null; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voiceconnectionstatus-voice-connection-status-dispatch-data-structure + */ +export interface RPCVoiceConnectionStatusDispatchData { + /** + * Voice connection states + */ + state: State; + /** + * Hostname of the connected voice server + */ + hostname: State extends VoiceConnectionStates.AwaitingEndpoint ? null : string; + /** + * All of the accumulated pings since connection + */ + pings: RPCVoiceConnectionStatusPing[]; + /** + * Average ping (in ms) + */ + average_ping: number; + /** + * Last ping (in ms) + */ + last_ping: number; +} + +export type RPCVoiceSettingsUpdateDispatchData = RPCGetVoiceSettingsResultData; + +/** + * @unstable + */ +export interface RPCVoiceSettingsUpdate2DispatchData { + /** + * @unstable + */ + input_mode: Pick; + /** + * @unstable + */ + local_mutes: unknown[]; + /** + * @unstable + */ + local_volumes: unknown; + /** + * @unstable + */ + self_mute: boolean; + /** + * @unstable + */ + self_deaf: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateCreateDispatchData { + /** + * Voice state of user + */ + voice_state: Pick; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateDeleteDispatchData { + /** + * Voice state of user + */ + voice_state: APIVoiceState; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateUpdateDispatchData { + /** + * Voice state of user + */ + voice_state: APIVoiceState; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +export interface BaseRPCMessage { + cmd: Cmd; +} + +export interface RPCCommandMessage extends BaseRPCMessage { + nonce: string; +} + +export interface RPCSubscribeMessage< + Evt extends RPCEvents, + Cmd extends RPCCommands.Subscribe | RPCCommands.Unsubscribe = RPCCommands.Subscribe | RPCCommands.Unsubscribe, +> extends RPCCommandMessage { + evt: Evt; +} + +export interface RPCCommandAuthorizePayload extends RPCCommandMessage { + args: RPCAuthorizeArgs; +} + +export interface RPCCommandAuthenticatePayload extends RPCCommandMessage { + args: RPCAuthenticateArgs; +} + +export interface RPCCommandGetChannelPayload extends RPCCommandMessage { + args: RPCGetChannelArgs; +} + +export interface RPCCommandGetChannelsPayload extends RPCCommandMessage { + args: RPCGetChannelsArgs; +} + +export interface RPCCommandGetGuildPayload extends RPCCommandMessage { + args: RPCGetGuildArgs; +} + +export interface RPCCommandGetGuildsPayload extends RPCCommandMessage { + args: RPCGetGuildsArgs; +} + +export interface RPCCommandGetUserPayload extends RPCCommandMessage { + args: RPCGetUserArgs; +} + +export interface RPCCommandGetVoiceSettingsPayload extends RPCCommandMessage { + args: RPCGetVoiceSettingsArgs; +} + +export interface RPCCommandSelectTextChannelPayload extends RPCCommandMessage { + args: RPCSelectTextChannelArgs; +} + +export interface RPCCommandSelectVoiceChannelPayload extends RPCCommandMessage { + args: RPCSelectVoiceChannelArgs; +} + +export interface RPCCommandSetActivityPayload extends RPCCommandMessage { + args: RPCSetActivityArgs; +} + +export interface RPCCommandSetVoiceSettingsPayload extends RPCCommandMessage { + args: RPCSetVoiceSettingsArgs; +} + +export type RPCCommandSubscribePayload = + | RPCSubscribeActivityInvite + | RPCSubscribeActivityJoin + | RPCSubscribeActivityJoinRequest + | RPCSubscribeActivitySpectate + | RPCSubscribeChannelCreate + | RPCSubscribeCurrentUserUpdate + | RPCSubscribeEntitlementCreate + | RPCSubscribeEntitlementDelete + | RPCSubscribeGameJoin + | RPCSubscribeGameSpectate + | RPCSubscribeGuildCreate + | RPCSubscribeGuildStatus + | RPCSubscribeMessageCreate + | RPCSubscribeMessageDelete + | RPCSubscribeMessageUpdate + | RPCSubscribeNotificationCreate + | RPCSubscribeOverlay + | RPCSubscribeOverlayUpdate + | RPCSubscribeRelationshipUpdate + | RPCSubscribeSpeakingStart + | RPCSubscribeSpeakingStop + | RPCSubscribeVoiceChannelSelect + | RPCSubscribeVoiceConnectionStatus + | RPCSubscribeVoiceSettingsUpdate + | RPCSubscribeVoiceSettingsUpdate2 + | RPCSubscribeVoiceStateCreate + | RPCSubscribeVoiceStateDelete + | RPCSubscribeVoiceStateUpdate; + +export type RPCCommandUnsubscribePayload = RPCCommandSubscribePayload; + +export interface RPCCommandAcceptActivityInvitePayload extends RPCCommandMessage { + args: RPCAcceptActivityInviteArgs; +} + +export interface RPCCommandActivityInviteUserPayload extends RPCCommandMessage { + args: RPCActivityInviteUserArgs; +} + +export interface RPCCommandBraintreePopupBridgeCallbackPayload + extends RPCCommandMessage { + args: RPCBraintreePopupBridgeCallbackArgs; +} + +export interface RPCCommandBrowserPayload extends RPCCommandMessage { + args: RPCBrowserHandoffArgs; +} + +export interface RPCCommandCloseActivityJoinRequestPayload + extends RPCCommandMessage { + args: RPCCloseActivityJoinRequestArgs; +} + +export interface RPCCommandConnectionsCallbackPayload extends RPCCommandMessage { + args: RPCConnectionsCallbackArgs; +} + +export interface RPCCommandCreateChannelInvitePayload extends RPCCommandMessage { + args: RPCCreateChannelInviteArgs; +} + +export interface RPCCommandDeepLinkPayload extends RPCCommandMessage { + args: RPCDeepLinkArgs; +} + +export interface RPCCommandGetApplicationTicketPayload extends RPCCommandMessage { + args: RPCGetApplicationTicketArgs; +} + +export interface RPCCommandGetEntitlementTicketPayload extends RPCCommandMessage { + args: RPCGetEntitlementTicketArgs; +} + +export interface RPCCommandGetEntitlementsPayload extends RPCCommandMessage { + args: RPCGetEntitlementsArgs; +} + +export interface RPCCommandGetImagePayload extends RPCCommandMessage { + args: RPCGetImageArgs; +} + +export interface RPCCommandGetNetworkingConfigPayload extends RPCCommandMessage { + args: RPCGetNetworkingConfigArgs; +} + +export interface RPCCommandGetRelationshipsPayload extends RPCCommandMessage { + args: RPCGetRelationshipsArgs; +} + +export interface RPCCommandGetSelectedVoiceChannelPayload + extends RPCCommandMessage { + args: RPCGetSelectedVoiceChannelArgs; +} + +export interface RPCCommandGetSkusPayload extends RPCCommandMessage { + args: RPCGetSkusArgs; +} + +export interface RPCCommandGiftCodeBrowserPayload extends RPCCommandMessage { + args: RPCGiftCodeBrowserArgs; +} + +export interface RPCCommandGuildTemplateBrowserPayload extends RPCCommandMessage { + args: RPCGuildTemplateBrowserArgs; +} + +export interface RPCCommandInviteBrowserPayload extends RPCCommandMessage { + args: RPCInviteBrowserArgs; +} + +export interface RPCCommandNetworkingCreateTokenPayload extends RPCCommandMessage { + args: RPCNetworkingCreateTokenArgs; +} + +export interface RPCCommandNetworkingPeerMetricsPayload extends RPCCommandMessage { + args: RPCNetworkingPeerMetricsArgs; +} + +export interface RPCCommandNetworkingSystemMetricsPayload + extends RPCCommandMessage { + args: RPCNetworkingSystemMetricsArgs; +} + +export interface RPCCommandOpenOverlayActivityInvitePayload + extends RPCCommandMessage { + args: RPCOpenOverlayActivityInviteArgs; +} + +export interface RPCCommandOpenOverlayGuildInvitePayload extends RPCCommandMessage { + args: RPCOpenOverlayGuildInviteArgs; +} + +export interface RPCCommandOpenOverlayVoiceSettingsPayload + extends RPCCommandMessage { + args: RPCOpenOverlayVoiceSettingsArgs; +} + +export interface RPCCommandOverlayPayload extends RPCCommandMessage { + args: RPCOverlayArgs; +} + +export interface RPCCommandSendActivityJoinInvitePayload extends RPCCommandMessage { + args: RPCSendActivityJoinInviteArgs; +} + +export interface RPCCommandSetCertifiedDevicesPayload extends RPCCommandMessage { + args: RPCSetCertifiedDevicesArgs; +} + +export interface RPCCommandSetOverlayLockedPayload extends RPCCommandMessage { + args: RPCSetOverlayLockedArgs; +} + +export interface RPCCommandSetUserVoiceSettingsPayload extends RPCCommandMessage { + args: RPCSetUserVoiceSettingsArgs; +} + +export interface RPCCommandSetUserVoiceSettings2Payload extends RPCCommandMessage { + args: RPCSetUserVoiceSettings2Args; +} + +export interface RPCCommandSetVoiceSettings2Payload extends RPCCommandMessage { + args: RPCSetVoiceSettings2Args; +} + +export interface RPCCommandStartPurchasePayload extends RPCCommandMessage { + args: RPCStartPurchaseArgs; +} + +export interface RPCCommandValidateApplicationPayload extends RPCCommandMessage { + args: RPCValidateApplicationArgs; +} + +export interface RPCSubscribeActivityInvite extends RPCSubscribeMessage { + args: RPCSubscribeActivityInviteArgs; + evt: RPCEvents.ActivityInvite; +} + +export interface RPCSubscribeActivityJoin extends RPCSubscribeMessage { + args: RPCSubscribeActivityJoinArgs; + evt: RPCEvents.ActivityJoin; +} + +export interface RPCSubscribeActivityJoinRequest extends RPCSubscribeMessage { + args: RPCSubscribeActivityJoinRequestArgs; + evt: RPCEvents.ActivityJoinRequest; +} + +export interface RPCSubscribeActivitySpectate extends RPCSubscribeMessage { + args: RPCSubscribeActivitySpectateArgs; + evt: RPCEvents.ActivitySpectate; +} + +export interface RPCSubscribeChannelCreate extends RPCSubscribeMessage { + args: RPCSubscribeChannelCreateArgs; + evt: RPCEvents.ChannelCreate; +} + +export interface RPCSubscribeCurrentUserUpdate extends RPCSubscribeMessage { + args: RPCSubscribeCurrentUserUpdateArgs; + evt: RPCEvents.CurrentUserUpdate; +} + +export interface RPCSubscribeEntitlementCreate extends RPCSubscribeMessage { + args: RPCSubscribeEntitlementCreateArgs; + evt: RPCEvents.EntitlementCreate; +} + +export interface RPCSubscribeEntitlementDelete extends RPCSubscribeMessage { + args: RPCSubscribeEntitlementDeleteArgs; + evt: RPCEvents.EntitlementDelete; +} + +export interface RPCSubscribeGameJoin extends RPCSubscribeMessage { + args: RPCSubscribeGameJoinArgs; + evt: RPCEvents.GameJoin; +} + +export interface RPCSubscribeGameSpectate extends RPCSubscribeMessage { + args: RPCSubscribeGameSpectateArgs; + evt: RPCEvents.GameSpectate; +} + +export interface RPCSubscribeGuildCreate extends RPCSubscribeMessage { + args: RPCSubscribeGuildCreateArgs; + evt: RPCEvents.GuildCreate; +} + +export interface RPCSubscribeGuildStatus extends RPCSubscribeMessage { + args: RPCSubscribeGuildStatusArgs; + evt: RPCEvents.GuildStatus; +} + +export interface RPCSubscribeMessageCreate extends RPCSubscribeMessage { + args: RPCSubscribeMessageCreateArgs; + evt: RPCEvents.MessageCreate; +} + +export interface RPCSubscribeMessageDelete extends RPCSubscribeMessage { + args: RPCSubscribeMessageDeleteArgs; + evt: RPCEvents.MessageDelete; +} + +export interface RPCSubscribeMessageUpdate extends RPCSubscribeMessage { + args: RPCSubscribeMessageUpdateArgs; + evt: RPCEvents.MessageUpdate; +} + +export interface RPCSubscribeNotificationCreate extends RPCSubscribeMessage { + args: RPCSubscribeNotificationCreateArgs; + evt: RPCEvents.NotificationCreate; +} + +export interface RPCSubscribeOverlay extends RPCSubscribeMessage { + args: RPCSubscribeOverlayArgs; + evt: RPCEvents.Overlay; +} + +export interface RPCSubscribeOverlayUpdate extends RPCSubscribeMessage { + args: RPCSubscribeOverlayUpdateArgs; + evt: RPCEvents.OverlayUpdate; +} + +export interface RPCSubscribeRelationshipUpdate extends RPCSubscribeMessage { + args: RPCSubscribeRelationshipUpdateArgs; + evt: RPCEvents.RelationshipUpdate; +} + +export interface RPCSubscribeSpeakingStart extends RPCSubscribeMessage { + args: RPCSubscribeSpeakingStartArgs; + evt: RPCEvents.SpeakingStart; +} + +export interface RPCSubscribeSpeakingStop extends RPCSubscribeMessage { + args: RPCSubscribeSpeakingStopArgs; + evt: RPCEvents.SpeakingStop; +} + +export interface RPCSubscribeVoiceChannelSelect extends RPCSubscribeMessage { + args: RPCSubscribeVoiceChannelSelectArgs; + evt: RPCEvents.VoiceChannelSelect; +} + +export interface RPCSubscribeVoiceConnectionStatus extends RPCSubscribeMessage { + args: RPCSubscribeVoiceConnectionStatusArgs; + evt: RPCEvents.VoiceConnectionStatus; +} + +export interface RPCSubscribeVoiceSettingsUpdate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceSettingsUpdateArgs; + evt: RPCEvents.VoiceSettingsUpdate; +} + +export interface RPCSubscribeVoiceSettingsUpdate2 extends RPCSubscribeMessage { + args: RPCSubscribeVoiceSettingsUpdate2Args; + evt: RPCEvents.VoiceSettingsUpdate2; +} + +export interface RPCSubscribeVoiceStateCreate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateCreateArgs; + evt: RPCEvents.VoiceStateCreate; +} + +export interface RPCSubscribeVoiceStateDelete extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateDeleteArgs; + evt: RPCEvents.VoiceStateDelete; +} + +export interface RPCSubscribeVoiceStateUpdate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateUpdateArgs; + evt: RPCEvents.VoiceStateUpdate; +} + +export interface RPCAuthorizeResult extends RPCCommandMessage { + data: RPCAuthorizeResultData; +} + +export interface RPCAuthenticateResult extends RPCCommandMessage { + data: RPCAuthenticateResultData; +} + +export interface RPCGetChannelResult extends RPCCommandMessage { + data: RPCGetChannelResultData; +} + +export interface RPCGetChannelsResult extends RPCCommandMessage { + data: RPCGetChannelsResultData; +} + +export interface RPCGetGuildResult extends RPCCommandMessage { + data: RPCGetGuildResultData; +} + +export interface RPCGetGuildsResult extends RPCCommandMessage { + data: RPCGetGuildsResultData; +} + +export interface RPCGetUserResult extends RPCCommandMessage { + data: RPCGetUserResultData; +} + +export interface RPCGetVoiceSettingsResult extends RPCCommandMessage { + data: RPCGetVoiceSettingsResultData; +} + +export interface RPCSelectTextChannelResult extends RPCCommandMessage { + data: RPCSelectTextChannelResultData; +} + +export interface RPCSelectVoiceChannelResult extends RPCCommandMessage { + data: RPCSelectVoiceChannelResultData; +} + +export interface RPCSetActivityResult extends RPCCommandMessage { + data: RPCSetActivityResultData; +} + +export interface RPCSetVoiceSettingsResult extends RPCCommandMessage { + data: RPCSetVoiceSettingsResultData; +} + +export interface RPCSubscribeResult extends RPCCommandMessage { + data: RPCSubscribeResultData; +} + +export interface RPCUnsubscribeResult extends RPCCommandMessage { + data: RPCUnsubscribeResultData; +} + +export interface RPCAcceptActivityInviteResult extends RPCCommandMessage { + data: RPCAcceptActivityInviteResultData; +} + +export interface RPCActivityInviteUserResult extends RPCCommandMessage { + data: RPCActivityInviteUserResultData; +} + +export interface RPCBraintreePopupBridgeCallbackResult + extends RPCCommandMessage { + data: RPCBraintreePopupBridgeCallbackResultData; +} + +export interface RPCBrowserResult extends RPCCommandMessage { + data: RPCBrowserHandoffResultData; +} + +export interface RPCCloseActivityJoinRequestResult extends RPCCommandMessage { + data: RPCCloseActivityJoinRequestResultData; +} + +export interface RPCConnectionsCallbackResult extends RPCCommandMessage { + data: RPCConnectionsCallbackResultData; +} + +export interface RPCCreateChannelInviteResult extends RPCCommandMessage { + data: RPCCreateChannelInviteResultData; +} + +export interface RPCDeepLinkResult extends RPCCommandMessage { + data: RPCDeepLinkResultData; +} + +export interface RPCGetApplicationTicketResult extends RPCCommandMessage { + data: RPCGetApplicationTicketResultData; +} + +export interface RPCGetEntitlementTicketResult extends RPCCommandMessage { + data: RPCGetEntitlementTicketResultData; +} + +export interface RPCGetEntitlementsResult extends RPCCommandMessage { + data: RPCGetEntitlementsResultData; +} + +export interface RPCGetImageResult extends RPCCommandMessage { + data: RPCGetImageResultData; +} + +export interface RPCGetNetworkingConfigResult extends RPCCommandMessage { + data: RPCGetNetworkingConfigResultData; +} + +export interface RPCGetRelationshipsResult extends RPCCommandMessage { + data: RPCGetRelationshipsResultData; +} + +export interface RPCGetSelectedVoiceChannelResult extends RPCCommandMessage { + data: RPCGetSelectedVoiceChannelResultData; +} + +export interface RPCGetSkusResult extends RPCCommandMessage { + data: RPCGetSkusResultData; +} + +export interface RPCGiftCodeBrowserResult extends RPCCommandMessage { + data: RPCGiftCodeBrowserResultData; +} + +export interface RPCGuildTemplateBrowserResult extends RPCCommandMessage { + data: RPCGuildTemplateBrowserResultData; +} + +export interface RPCInviteBrowserResult extends RPCCommandMessage { + data: RPCInviteBrowserResultData; +} + +export interface RPCNetworkingCreateTokenResult extends RPCCommandMessage { + data: RPCNetworkingCreateTokenResultData; +} + +export interface RPCNetworkingPeerMetricsResult extends RPCCommandMessage { + data: RPCNetworkingPeerMetricsResultData; +} + +export interface RPCNetworkingSystemMetricsResult extends RPCCommandMessage { + data: RPCNetworkingSystemMetricsResultData; +} + +export interface RPCOpenOverlayActivityInviteResult extends RPCCommandMessage { + data: RPCOpenOverlayActivityInviteResultData; +} + +export interface RPCOpenOverlayGuildInviteResult extends RPCCommandMessage { + data: RPCOpenOverlayGuildInviteResultData; +} + +export interface RPCOpenOverlayVoiceSettingsResult extends RPCCommandMessage { + data: RPCOpenOverlayVoiceSettingsResultData; +} + +export interface RPCOverlayResult extends RPCCommandMessage { + data: RPCOverlayResultData; +} + +export interface RPCSendActivityJoinInviteResult extends RPCCommandMessage { + data: RPCSendActivityJoinInviteResultData; +} + +export interface RPCSetCertifiedDevicesResult extends RPCCommandMessage { + data: RPCSetCertifiedDevicesResultData; +} + +export interface RPCSetOverlayLockedResult extends RPCCommandMessage { + data: RPCSetOverlayLockedResultData; +} + +export interface RPCSetUserVoiceSettingsResult extends RPCCommandMessage { + data: RPCSetUserVoiceSettingsResultData; +} + +export interface RPCSetUserVoiceSettings2Result extends RPCCommandMessage { + data: RPCSetUserVoiceSettings2ResultData; +} + +export interface RPCSetVoiceSettings2Result extends RPCCommandMessage { + data: RPCSetVoiceSettings2ResultData; +} + +export interface RPCStartPurchaseResult extends RPCCommandMessage { + data: RPCStartPurchaseResultData; +} + +export interface RPCValidateApplicationResult extends RPCCommandMessage { + data: RPCValidateApplicationResultData; +} + +export type RPCCommandsResult = + | RPCAcceptActivityInviteResult + | RPCActivityInviteUserResult + | RPCAuthenticateResult + | RPCAuthorizeResult + | RPCBraintreePopupBridgeCallbackResult + | RPCBrowserResult + | RPCCloseActivityJoinRequestResult + | RPCConnectionsCallbackResult + | RPCCreateChannelInviteResult + | RPCDeepLinkResult + | RPCGetApplicationTicketResult + | RPCGetChannelResult + | RPCGetChannelsResult + | RPCGetEntitlementsResult + | RPCGetEntitlementTicketResult + | RPCGetGuildResult + | RPCGetGuildsResult + | RPCGetImageResult + | RPCGetNetworkingConfigResult + | RPCGetRelationshipsResult + | RPCGetSelectedVoiceChannelResult + | RPCGetSkusResult + | RPCGetUserResult + | RPCGetVoiceSettingsResult + | RPCGiftCodeBrowserResult + | RPCGuildTemplateBrowserResult + | RPCInviteBrowserResult + | RPCNetworkingCreateTokenResult + | RPCNetworkingPeerMetricsResult + | RPCNetworkingSystemMetricsResult + | RPCOpenOverlayActivityInviteResult + | RPCOpenOverlayGuildInviteResult + | RPCOpenOverlayVoiceSettingsResult + | RPCOverlayResult + | RPCSelectTextChannelResult + | RPCSelectVoiceChannelResult + | RPCSendActivityJoinInviteResult + | RPCSetActivityResult + | RPCSetCertifiedDevicesResult + | RPCSetOverlayLockedResult + | RPCSetUserVoiceSettings2Result + | RPCSetUserVoiceSettingsResult + | RPCSetVoiceSettings2Result + | RPCSetVoiceSettingsResult + | RPCStartPurchaseResult + | RPCSubscribeResult + | RPCUnsubscribeResult + | RPCValidateApplicationResult; + +export interface RPCActivityInviteDispatch extends BaseRPCMessage { + data: RPCActivityInviteDispatchData; + evt: RPCEvents.ActivityInvite; +} + +export interface RPCActivityJoinDispatch extends BaseRPCMessage { + data: RPCActivityJoinDispatchData; + evt: RPCEvents.ActivityJoin; +} + +export interface RPCActivityJoinRequestDispatch extends BaseRPCMessage { + data: RPCActivityJoinRequestDispatchData; + evt: RPCEvents.ActivityJoinRequest; +} + +export interface RPCActivitySpectateDispatch extends BaseRPCMessage { + data: RPCActivitySpectateDispatchData; + evt: RPCEvents.ActivitySpectate; +} + +export interface RPCChannelCreateDispatch extends BaseRPCMessage { + data: RPCChannelCreateDispatchData; + evt: RPCEvents.ChannelCreate; +} + +export interface RPCCurrentUserUpdateDispatch extends BaseRPCMessage { + data: RPCCurrentUserUpdateDispatchData; + evt: RPCEvents.CurrentUserUpdate; +} + +export interface RPCEntitlementCreateDispatch extends BaseRPCMessage { + data: RPCEntitlementCreateDispatchData; + evt: RPCEvents.EntitlementCreate; +} + +export interface RPCEntitlementDeleteDispatch extends BaseRPCMessage { + data: RPCEntitlementDeleteDispatchData; + evt: RPCEvents.EntitlementDelete; +} + +export interface RPCErrorDispatch< + Cmd extends Exclude = Exclude, +> extends RPCCommandMessage { + data: RPCErrorDispatchData; + evt: RPCEvents.Error; +} + +export interface RPCGameJoinDispatch extends BaseRPCMessage { + data: RPCGameJoinDispatchData; + evt: RPCEvents.GameJoin; +} + +export interface RPCGameSpectateDispatch extends BaseRPCMessage { + data: RPCGameSpectateDispatchData; + evt: RPCEvents.GameSpectate; +} + +export interface RPCGuildCreateDispatch extends BaseRPCMessage { + data: RPCGuildCreateDispatchData; + evt: RPCEvents.GuildCreate; +} + +export interface RPCGuildStatusDispatch extends BaseRPCMessage { + data: RPCGuildStatusDispatchData; + evt: RPCEvents.GuildStatus; +} + +export interface RPCMessageCreateDispatch extends BaseRPCMessage { + data: RPCMessageCreateDispatchData; + evt: RPCEvents.MessageCreate; +} + +export interface RPCMessageDeleteDispatch extends BaseRPCMessage { + data: RPCMessageDeleteDispatchData; + evt: RPCEvents.MessageDelete; +} + +export interface RPCMessageUpdateDispatch extends BaseRPCMessage { + data: RPCMessageUpdateDispatchData; + evt: RPCEvents.MessageUpdate; +} + +export interface RPCNotificationCreateDispatch extends BaseRPCMessage { + data: RPCNotificationCreateDispatchData; + evt: RPCEvents.NotificationCreate; +} + +export interface RPCOverlayDispatch extends BaseRPCMessage { + data: RPCOverlayDispatchData; + evt: RPCEvents.Overlay; +} + +export interface RPCOverlayUpdateDispatch extends BaseRPCMessage { + data: RPCOverlayUpdateDispatchData; + evt: RPCEvents.OverlayUpdate; +} + +export interface RPCReadyDispatch extends BaseRPCMessage { + data: RPCReadyDispatchData; + evt: RPCEvents.Ready; +} + +export interface RPCRelationshipUpdateDispatch extends BaseRPCMessage { + data: RPCRelationshipUpdateDispatchData; + evt: RPCEvents.RelationshipUpdate; +} + +export interface RPCSpeakingStartDispatch extends BaseRPCMessage { + data: RPCSpeakingStartDispatchData; + evt: RPCEvents.SpeakingStart; +} + +export interface RPCSpeakingStopDispatch extends BaseRPCMessage { + data: RPCSpeakingStopDispatchData; + evt: RPCEvents.SpeakingStop; +} + +export interface RPCVoiceChannelSelectDispatch extends BaseRPCMessage { + data: RPCVoiceChannelSelectDispatchData; + evt: RPCEvents.VoiceChannelSelect; +} + +export interface RPCVoiceConnectionStatusDispatch extends BaseRPCMessage { + data: RPCVoiceConnectionStatusDispatchData; + evt: RPCEvents.VoiceConnectionStatus; +} + +export interface RPCVoiceSettingsUpdateDispatch extends BaseRPCMessage { + data: RPCVoiceSettingsUpdateDispatchData; + evt: RPCEvents.VoiceSettingsUpdate; +} + +export interface RPCVoiceSettingsUpdate2Dispatch extends BaseRPCMessage { + data: RPCVoiceSettingsUpdate2DispatchData; + evt: RPCEvents.VoiceSettingsUpdate2; +} + +export interface RPCVoiceStateCreateDispatch extends BaseRPCMessage { + data: RPCVoiceStateCreateDispatchData; + evt: RPCEvents.VoiceStateCreate; +} + +export interface RPCVoiceStateDeleteDispatch extends BaseRPCMessage { + data: RPCVoiceStateDeleteDispatchData; + evt: RPCEvents.VoiceStateDelete; +} + +export interface RPCVoiceStateUpdateDispatch extends BaseRPCMessage { + data: RPCVoiceStateUpdateDispatchData; + evt: RPCEvents.VoiceStateUpdate; +} + +export type RPCEventsDispatch = + | RPCActivityInviteDispatch + | RPCActivityJoinDispatch + | RPCActivityJoinRequestDispatch + | RPCActivitySpectateDispatch + | RPCChannelCreateDispatch + | RPCCurrentUserUpdateDispatch + | RPCEntitlementCreateDispatch + | RPCEntitlementDeleteDispatch + | RPCErrorDispatch + | RPCGameJoinDispatch + | RPCGameSpectateDispatch + | RPCGuildCreateDispatch + | RPCGuildStatusDispatch + | RPCMessageCreateDispatch + | RPCMessageDeleteDispatch + | RPCMessageUpdateDispatch + | RPCNotificationCreateDispatch + | RPCOverlayDispatch + | RPCOverlayUpdateDispatch + | RPCReadyDispatch + | RPCRelationshipUpdateDispatch + | RPCSpeakingStartDispatch + | RPCSpeakingStopDispatch + | RPCVoiceChannelSelectDispatch + | RPCVoiceConnectionStatusDispatch + | RPCVoiceSettingsUpdate2Dispatch + | RPCVoiceSettingsUpdateDispatch + | RPCVoiceStateCreateDispatch + | RPCVoiceStateDeleteDispatch + | RPCVoiceStateUpdateDispatch; + +export type RPCMessage = RPCCommandsResult | RPCEventsDispatch; + +export type RPCMessagePayload = + | RPCCommandAcceptActivityInvitePayload + | RPCCommandActivityInviteUserPayload + | RPCCommandAuthenticatePayload + | RPCCommandAuthorizePayload + | RPCCommandBraintreePopupBridgeCallbackPayload + | RPCCommandBrowserPayload + | RPCCommandCloseActivityJoinRequestPayload + | RPCCommandConnectionsCallbackPayload + | RPCCommandCreateChannelInvitePayload + | RPCCommandDeepLinkPayload + | RPCCommandGetApplicationTicketPayload + | RPCCommandGetChannelPayload + | RPCCommandGetChannelsPayload + | RPCCommandGetEntitlementsPayload + | RPCCommandGetEntitlementTicketPayload + | RPCCommandGetGuildPayload + | RPCCommandGetGuildsPayload + | RPCCommandGetImagePayload + | RPCCommandGetNetworkingConfigPayload + | RPCCommandGetRelationshipsPayload + | RPCCommandGetSelectedVoiceChannelPayload + | RPCCommandGetSkusPayload + | RPCCommandGetUserPayload + | RPCCommandGetVoiceSettingsPayload + | RPCCommandGiftCodeBrowserPayload + | RPCCommandGuildTemplateBrowserPayload + | RPCCommandInviteBrowserPayload + | RPCCommandNetworkingCreateTokenPayload + | RPCCommandNetworkingPeerMetricsPayload + | RPCCommandNetworkingSystemMetricsPayload + | RPCCommandOpenOverlayActivityInvitePayload + | RPCCommandOpenOverlayGuildInvitePayload + | RPCCommandOpenOverlayVoiceSettingsPayload + | RPCCommandOverlayPayload + | RPCCommandSelectTextChannelPayload + | RPCCommandSelectVoiceChannelPayload + | RPCCommandSendActivityJoinInvitePayload + | RPCCommandSetActivityPayload + | RPCCommandSetCertifiedDevicesPayload + | RPCCommandSetOverlayLockedPayload + | RPCCommandSetUserVoiceSettings2Payload + | RPCCommandSetUserVoiceSettingsPayload + | RPCCommandSetVoiceSettings2Payload + | RPCCommandSetVoiceSettingsPayload + | RPCCommandStartPurchasePayload + | RPCCommandSubscribePayload + | RPCCommandUnsubscribePayload + | RPCCommandValidateApplicationPayload; diff --git a/payloads/v10/oauth2.ts b/payloads/v10/oauth2.ts index b2016d51..483cd40c 100644 --- a/payloads/v10/oauth2.ts +++ b/payloads/v10/oauth2.ts @@ -69,6 +69,18 @@ export enum OAuth2Scopes { * For local rpc server access, this allows you to control a user's local Discord client - requires Discord approval */ RPC = 'rpc', + /** + * For local rpc server access, this allows you to update a user's activity - requires Discord approval + */ + RPCActivitiesWrite = 'rpc.activities.write', + /** + * For local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval + */ + RPCVoiceRead = 'rpc.voice.read', + /** + * For local rpc server access, this allows you to update a user's voice settings - requires Discord approval + */ + RPCVoiceWrite = 'rpc.voice.write', /** * For local rpc server api access, this allows you to receive notifications pushed out to the user - requires Discord approval */ diff --git a/rpc/common.ts b/rpc/common.ts index 529c98a8..32e405e1 100644 --- a/rpc/common.ts +++ b/rpc/common.ts @@ -1,33 +1,508 @@ +import type { Snowflake } from '../globals'; +import type { APIMessage, APIUser, RPCVoiceConnectionStatusDispatchData } from '../v10'; + +/** + * @unstable The ping object for the `VOICE_CONNECTION_STATUS` dispatched {@link RPCVoiceConnectionStatusDispatchData.pings} field, + * but discord's documentation incorrectly documents it as an 'array of integers'. + */ +export interface RPCVoiceConnectionStatusPing { + /** + * The time the ping was sent + */ + time: number; + /** + * The latency of the ping in milliseconds + */ + value: number; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentOriginalMatch { + 0: string; + index: 0; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentText { + type: 'text'; + originalMatch: RPCAPIMessageParsedContentOriginalMatch; + content: string; +} + +/** + * @unstable + */ +export interface RPCAPIMessageParsedContentMention { + type: 'mention'; + userId: Snowflake; + channelId: Snowflake; + guildId: Snowflake; + /** + * Same as {@link RPCAPIMessageParsedContentMention.userId} + */ + parsedUserId: RPCAPIMessageParsedContentMention['userId']; + content: Omit; +} + +/** + * @unstable + */ +export interface RPCAPIMessage extends Omit { + /** + * The nickname of the user who sent the message + */ + nick?: string; + /** + * The color of the author's name + */ + author_color?: number; + /** + * The content of the message parsed into an array + */ + content_parsed: (RPCAPIMessageParsedContentMention | RPCAPIMessageParsedContentText)[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-oauth2-application-structure + */ +export interface RPCOAuth2Application { + /** + * Application description + */ + description: string; + /** + * Hash of the icon + */ + icon: string; + /** + * Application client id + */ + id: Snowflake; + /** + * Array of RPC origin urls + */ + rpc_origins: string[]; + /** + * Application name + */ + name: string; +} + +export interface RPCDeviceVendor { + /** + * Name of the vendor + */ + name: string; + /** + * Url for the vendor + */ + url: string; +} + +export interface RPCDeviceModel { + /** + * Name of the model + */ + name: string; + /** + * Url for the model + */ + url: string; +} + +export enum RPCDeviceType { + AudioInput = 'audioinput', + AudioOutput = 'audiooutput', + VideoInput = 'videoinput', +} + +export interface BaseRPCCertifiedDevice { + /** + * The type of device + */ + type: Type; + /** + * The device's Windows UUID + */ + id: string; + /** + * The hardware vendor + */ + vendor: RPCDeviceVendor; + /** + * The model of the product + */ + model: RPCDeviceModel; + /** + * UUIDs of related devices + */ + related: string[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setcertifieddevices-device-object + */ +export type RPCCertifiedDevice = + Type extends RPCDeviceType.AudioInput ? + BaseRPCCertifiedDevice & { + /** + * If the device's native echo cancellation is enabled + */ + echo_cancellation: boolean; + /** + * If the device's native noise suppression is enabled + */ + noise_suppression: boolean; + /** + * If the device's native automatic gain control is enabled + */ + automatic_gain_control: boolean; + /** + * If the device is hardware muted + */ + hardware_mute: boolean; + } + : BaseRPCCertifiedDevice; + +export interface RPCVoiceAvailableDevice { + /** + * Device id + */ + id: string; + /** + * Device name + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-input-object + */ +export interface RPCVoiceSettingsInput { + /** + * Device id + */ + device_id: string; + /** + * Input voice level (min: 0.0, max: 100.0) + */ + volume: number; + /** + * Array of read-only device objects containing `id` and `name` string keys + */ + available_devices: RPCVoiceAvailableDevice[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-output-object + */ +export interface RPCVoiceSettingsOutput { + /** + * Device id + */ + device_id: string; + /** + * Input voice level (min: 0.0, max: 200.0) + */ + volume: number; + /** + * Array of read-only device objects containing `id` and `name` string keys + */ + available_devices: RPCVoiceAvailableDevice[]; +} + +export enum RPCVoiceSettingsModeType { + PushToTalk = 'PUSH_TO_TALK', + VoiceActivity = 'VOICE_ACTIVITY', +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-key-types + */ +export enum RPCVoiceShortcutKeyComboKeyType { + KeyboardKey, + MouseButton, + KeyboardModifierKey, + GamepadButton, +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-shortcut-key-combo-object + */ +export interface RPCVoiceShortcutKeyCombo { + /** + * Type of key + */ + type: RPCVoiceShortcutKeyComboKeyType; + /** + * Key code + */ + code: number; + /** + * Key name + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-voice-settings-mode-object + */ +export interface RPCVoiceSettingsMode { + /** + * Voice setting mode type + */ + type: RPCVoiceSettingsModeType; + /** + * Voice activity threshold automatically sets its threshold + */ + auto_threshold: boolean; + /** + * Threshold for voice activity (in dB) (min: -100.0, max: 0.0) + */ + threshold: number; + /** + * Shortcut key combos for PTT + */ + shortcut: RPCVoiceShortcutKeyCombo; + /** + * The PTT release delay (in ms) (min: 0, max: 2000) + */ + delay: number; +} + +export enum VoiceConnectionStates { + /** + * TCP disconnected + */ + Disconnected = 'DISCONNECTED', + /** + * Waiting for voice endpoint + */ + AwaitingEndpoint = 'AWAITING_ENDPOINT', + /** + * TCP authenticating + */ + Authenticating = 'AUTHENTICATING', + /** + * TCP connecting + */ + Connecting = 'CONNECTING', + /** + * TCP connected + */ + Connected = 'CONNECTED', + /** + * TCP connected, Voice disconnected + */ + VoiceDisconnected = 'VOICE_DISCONNECTED', + /** + * TCP connected, Voice connecting + */ + VoiceConnecting = 'VOICE_CONNECTING', + /** + * TCP connected, Voice connected + */ + VoiceConnected = 'VOICE_CONNECTED', + /** + * No route to host + */ + NoRoute = 'NO_ROUTE', + /** + * WebRTC ice checking + */ + IceChecking = 'ICE_CHECKING', +} + +/** + * @unstable + */ +export enum RelationshipType { + None, + Friend, + Blocked, + PendingIncoming, + PendingOutgoing, + Implicit, +} + +/** + * @unstable + */ +export interface Relationship { + /** + * The id of the user + */ + id: Snowflake; + /** + * Relationship type + */ + type: RelationshipType; + /** + * User + */ + user: APIUser; +} + /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes */ export enum RPCErrorCodes { + /** + * An unknown error occurred. + */ UnknownError = 1_000, + /** + * @unstable + */ + ServiceUnavailable, + /** + * @unstable + */ + TransactionAborted, + /** + * You sent an invalid payload. + */ InvalidPayload = 4_000, + /** + * Invalid command name specified. + */ InvalidCommand = 4_002, + /** + * Invalid guild ID specified. + */ InvalidGuild, + /** + * Invalid event name specified. + */ InvalidEvent, + /** + * Invalid channel ID specified. + */ InvalidChannel, + /** + * You lack permissions to access the given resource. + */ InvalidPermissions, + /** + * An invalid OAuth2 application ID was used to authorize or authenticate with. + */ InvalidClientId, + /** + * An invalid OAuth2 application origin was used to authorize or authenticate with. + */ InvalidOrigin, + /** + * An invalid OAuth2 token was used to authorize or authenticate with. + */ InvalidToken, + /** + * The specified user ID was invalid. + */ InvalidUser, + /** + * @unstable + */ + InvalidInvite, + /** + * @unstable + */ + InvalidActivityJoinRequest, + /** + * @unstable + */ + InvalidEntitlement, + /** + * @unstable + */ + InvalidGiftCode, + /** + * A standard OAuth2 error occurred; check the data object for the OAuth2 error details. + */ OAuth2Error = 5_000, + /** + * An asynchronous `SELECT_TEXT_CHANNEL`/`SELECT_VOICE_CHANNEL` command timed out. + */ SelectChannelTimedOut, + /** + * An asynchronous `GET_GUILD` command timed out. + */ GetGuildTimedOut, + /** + * You tried to join a user to a voice channel but the user was already in one. + */ SelectVoiceForceRequired, + /** + * You tried to capture more than one shortcut key at once. + */ CaptureShortcutAlreadyListening, + /** + * @unstable + */ + InvalidActivitySecret, + /** + * @unstable + */ + NoEligibleActivity, + /** + * @unstable + */ + PurchaseCanceled, + /** + * @unstable + */ + PurchaseError, + /** + * @unstable + */ + UnauthorizedForAchievement, + /** + * @unstable + */ + RateLimited, } /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes */ export enum RPCCloseEventCodes { + /** + * @unstable + */ + CloseNormal = 1_000, + /** + * @unstable + */ + CloseUnsupported = 1_003, + /** + * @unstable + */ + CloseAbnormal = 1_006, + /** + * You connected to the RPC server with an invalid client ID. + */ InvalidClientId = 4_000, + /** + * You connected to the RPC server with an invalid origin. + */ InvalidOrigin, + /** + * You are being rate limited. + */ RateLimited, + /** + * The OAuth2 token associated with a connection was revoked, get a new one! + */ TokenRevoked, + /** + * The RPC Server version specified in the connection string was not valid. + */ InvalidVersion, + /** + * The encoding specified in the connection string was not valid. + */ InvalidEncoding, } diff --git a/rpc/v10.ts b/rpc/v10.ts index d0b93236..f5d1d477 100644 --- a/rpc/v10.ts +++ b/rpc/v10.ts @@ -1 +1,2637 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +import type { + APIInvite, + APIMessage, + APIPartialChannel, + APIPartialGuild, + APIUser, + APIVoiceState, + ChannelType, + GatewayActivity, + OAuth2Scopes, + Relationship, + RPCAPIMessage, + RPCCertifiedDevice, + RPCErrorCodes, + RPCOAuth2Application, + RPCVoiceConnectionStatusPing, + RPCVoiceSettingsInput, + RPCVoiceSettingsMode, + RPCVoiceSettingsOutput, + Snowflake, + VoiceConnectionStates, +} from '../v10'; + export * from './common'; + +export const RPCVersion = '1'; + +/** + * https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-commands + */ +export enum RPCCommands { + /** + * @unstable + */ + AcceptActivityInvite = 'ACCEPT_ACTIVITY_INVITE', + /** + * @unstable + */ + ActivityInviteUser = 'ACTIVITY_INVITE_USER', + /** + * Used to authenticate an existing client with your app + */ + Authenticate = 'AUTHENTICATE', + /** + * Used to authorize a new client with your app + */ + Authorize = 'AUTHORIZE', + /** + * @unstable + */ + BraintreePopupBridgeCallback = 'BRAINTREE_POPUP_BRIDGE_CALLBACK', + /** + * @unstable + */ + BrowserHandoff = 'BROWSER_HANDOFF', + /** + * used to reject a Rich Presence Ask to Join request + * + * @unstable the documented similarly named command `CLOSE_ACTIVITY_REQUEST` does not exist, but `CLOSE_ACTIVITY_JOIN_REQUEST` does + */ + CloseActivityJoinRequest = 'CLOSE_ACTIVITY_JOIN_REQUEST', + /** + * @unstable + */ + ConnectionsCallback = 'CONNECTIONS_CALLBACK', + CreateChannelInvite = 'CREATE_CHANNEL_INVITE', + /** + * @unstable + */ + DeepLink = 'DEEP_LINK', + /** + * Event dispatch + */ + Dispatch = 'DISPATCH', + /** + * @unstable + */ + GetApplicationTicket = 'GET_APPLICATION_TICKET', + /** + * Used to retrieve channel information from the client + */ + GetChannel = 'GET_CHANNEL', + /** + * Used to retrieve a list of channels for a guild from the client + */ + GetChannels = 'GET_CHANNELS', + /** + * @unstable + */ + GetEntitlementTicket = 'GET_ENTITLEMENT_TICKET', + /** + * @unstable + */ + GetEntitlements = 'GET_ENTITLEMENTS', + /** + * Used to retrieve guild information from the client + */ + GetGuild = 'GET_GUILD', + /** + * Used to retrieve a list of guilds from the client + */ + GetGuilds = 'GET_GUILDS', + /** + * @unstable + */ + GetImage = 'GET_IMAGE', + /** + * @unstable + */ + GetNetworkingConfig = 'GET_NETWORKING_CONFIG', + /** + * @unstable + */ + GetRelationships = 'GET_RELATIONSHIPS', + /** + * Used to get the current voice channel the client is in + */ + GetSelectedVoiceChannel = 'GET_SELECTED_VOICE_CHANNEL', + /** + * @unstable + */ + GetSkus = 'GET_SKUS', + /** + * @unstable + */ + GetUser = 'GET_USER', + /** + * Used to retrieve the client's voice settings + */ + GetVoiceSettings = 'GET_VOICE_SETTINGS', + /** + * @unstable + */ + GiftCodeBrowser = 'GIFT_CODE_BROWSER', + /** + * @unstable + */ + GuildTemplateBrowser = 'GUILD_TEMPLATE_BROWSER', + /** + * @unstable + */ + InviteBrowser = 'INVITE_BROWSER', + /** + * @unstable + */ + NetworkingCreateToken = 'NETWORKING_CREATE_TOKEN', + /** + * @unstable + */ + NetworkingPeerMetrics = 'NETWORKING_PEER_METRICS', + /** + * @unstable + */ + NetworkingSystemMetrics = 'NETWORKING_SYSTEM_METRICS', + /** + * @unstable + */ + OpenOverlayActivityInvite = 'OPEN_OVERLAY_ACTIVITY_INVITE', + /** + * @unstable + */ + OpenOverlayGuildInvite = 'OPEN_OVERLAY_GUILD_INVITE', + /** + * @unstable + */ + OpenOverlayVoiceSettings = 'OPEN_OVERLAY_VOICE_SETTINGS', + /** + * @unstable + */ + Overlay = 'OVERLAY', + /** + * Used to join or leave a text channel, group dm, or dm + */ + SelectTextChannel = 'SELECT_TEXT_CHANNEL', + /** + * Used to join or leave a voice channel, group dm, or dm + */ + SelectVoiceChannel = 'SELECT_VOICE_CHANNEL', + /** + * Used to consent to a Rich Presence Ask to Join request + */ + SendActivityJoinInvite = 'SEND_ACTIVITY_JOIN_INVITE', + /** + * Used to update a user's Rich Presence + */ + SetActivity = 'SET_ACTIVITY', + /** + * Used to send info about certified hardware devices + */ + SetCertifiedDevices = 'SET_CERTIFIED_DEVICES', + /** + * @unstable + */ + SetOverlayLocked = 'SET_OVERLAY_LOCKED', + /** + * Used to change voice settings of users in voice channels + */ + SetUserVoiceSettings = 'SET_USER_VOICE_SETTINGS', + SetUserVoiceSettings2 = 'SET_USER_VOICE_SETTINGS_2', + /** + * Used to set the client's voice settings + */ + SetVoiceSettings = 'SET_VOICE_SETTINGS', + SetVoiceSettings2 = 'SET_VOICE_SETTINGS_2', + /** + * @unstable + */ + StartPurchase = 'START_PURCHASE', + /** + * Used to subscribe to an RPC event + */ + Subscribe = 'SUBSCRIBE', + /** + * Used to unsubscribe from an RPC event + */ + Unsubscribe = 'UNSUBSCRIBE', + /** + * @unstable + */ + ValidateApplication = 'VALIDATE_APPLICATION', +} + +/** + * https://discord.com/developers/docs/topics/rpc#authorize-authorize-response-structure + */ +export interface RPCAuthorizeResultData { + /** + * OAuth2 authorization code + */ + code: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authorize-authorize-argument-structure + */ +export interface RPCAuthorizeArgs { + /** + * OAuth2 application id + */ + client_id: Snowflake; + /** + * Scopes to authorize + */ + scopes: OAuth2Scopes[]; + /** + * username to create a guest account with if the user does not have Discord + */ + username?: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-authenticate-argument-structure + */ +export interface RPCAuthenticateArgs { + /** + * OAuth2 access token + */ + access_token: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#authenticate-authenticate-response-structure + */ +export interface RPCAuthenticateResultData { + /** + * The authed user + */ + user: APIUser; + /** + * Authorized scopes + */ + scopes: OAuth2Scopes[]; + /** + * Expiration date of OAuth2 token + */ + expires: string; + /** + * Application the user authorized + */ + application: RPCOAuth2Application; +} + +export interface RPCGetGuildsArgs {} + +/** + * https://discord.com/developers/docs/topics/rpc#getguilds-get-guilds-response-structure + */ +export interface RPCGetGuildsResultData { + /** + * The guilds the user is in + */ + guilds: APIPartialGuild[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getguild-get-guild-argument-structure + */ +export interface RPCGetGuildArgs { + /** + * Id of the guild to get + */ + guild_id: Snowflake; + /** + * Asynchronously get guild with time to wait before timing out + */ + timeout?: number; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getguild-get-guild-response-structure + */ +export interface RPCGetGuildResultData { + /** + * Guild id + */ + id: Snowflake; + /** + * Guild name + */ + name: string; + /** + * Guild icon url + */ + icon_url: string | null; + /** + * Members of the guild + * + * @deprecated This will always be an empty array + */ + members: []; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannel + */ +export interface RPCGetChannelArgs { + /** + * Id of the channel to get + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannel-get-channel-response-structure + */ +export interface RPCGetChannelResultData { + /** + * Channel id + */ + id: Snowflake; + /** + * Channel's guild id + */ + guild_id: Snowflake; + /** + * Channel name + */ + name: string; + /** + * Channel type + */ + type: ChannelType; + /** + * (text) channel topic + */ + topic?: string; + /** + * (voice) bitrate of voice channel + */ + bitrate?: number; + /** + * (voice) user limit of voice channel (0 for none) + */ + user_limit?: number; + /** + * Position of channel in channel list + */ + position: number; + /** + * (voice) channel's voice states + */ + voice_states?: APIVoiceState[]; + /** + * (text) channel's messages + */ + messages?: APIMessage[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannels-get-channels-argument-structure + */ +export interface RPCGetChannelsArgs { + /** + * Id of the guild to get channels for + */ + guild_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getchannels-get-channels-response-structure + */ +export interface RPCGetChannelsResultData { + /** + * Guild channels the user is in + */ + channels: APIPartialChannel[]; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings-pan-object + */ +export interface RPCVoicePan { + /** + * Left pan of user (min: 0.0, max: 1.0) + */ + left: number; + /** + * Right pan of user (min: 0.0, max: 1.0) + */ + right: number; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings + * + * @remarks Discord only supports a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. + */ +export interface RPCSetUserVoiceSettingsArgs { + /** + * User id + */ + user_id: Snowflake; + /** + * Set the pan of the user + */ + pan?: RPCVoicePan; + /** + * Set the volume of user (defaults to 100, min 0, max 200) + */ + volume?: number; + /** + * Set the mute state of the user + */ + mute?: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setuservoicesettings-set-user-voice-settings-argument-and-response-structure + */ +export type RPCSetUserVoiceSettingsResultData = Required; + +/** + * https://discord.com/developers/docs/topics/rpc#selectvoicechannel-select-voice-channel-argument-structure + * + * @remarks When trying to join the user to a voice channel, you will receive a {@link RPCErrorCodes.SelectVoiceForceRequired} error coded response if the user is already in a voice channel. The `force` parameter should only be specified in response to the case where a user is already in a voice channel and they have approved to be moved by your app to a new voice channel. + */ +export interface RPCSelectVoiceChannelArgs { + /** + * Channel id to join (or `null` to leave) + */ + channel_id: Snowflake | null; + /** + * Asynchronously join channel with time to wait before timing out + */ + timeout?: number; + /** + * Forces a user to join a voice channel + */ + force?: boolean; + /** + * After joining the voice channel, navigate to it in the client + */ + navigate?: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#selectvoicechannel + */ +export type RPCSelectVoiceChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#getselectedvoicechannel + */ +export type RPCGetSelectedVoiceChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#getselectedvoicechannel + */ +export interface RPCGetSelectedVoiceChannelArgs {} + +/** + * @unstable + */ +export type RPCGetUserResultData = APIUser; + +/** + * @unstable + */ +export interface RPCGetUserArgs { + /** + * @unstable Id of the user to get + */ + id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#getvoicesettings-get-voice-settings-response-structure + */ +export interface RPCGetVoiceSettingsResultData { + /** + * Input settings + */ + input: RPCVoiceSettingsInput; + /** + * Output settings + */ + output: RPCVoiceSettingsOutput; + /** + * Voice mode settings + */ + mode: RPCVoiceSettingsMode; + /** + * State of automatic gain control + */ + automatic_gain_control: boolean; + /** + * State of echo cancellation + */ + echo_cancellation: boolean; + /** + * State of noise suppression + */ + noise_suppression: boolean; + /** + * State of voice quality of service + */ + qos: boolean; + /** + * State of silence warning notice + */ + silence_warning: boolean; + /** + * State of self-deafen + */ + deaf: boolean; + /** + * State of self-mute + */ + mute: boolean; +} + +export interface RPCGetVoiceSettingsArgs {} + +/** + * Returns the {@link https://discord.com/developers/docs/topics/rpc#getchannel | Get Channel} response, or `null` if none. + */ +export type RPCSelectTextChannelResultData = RPCGetChannelResultData | null; + +/** + * https://discord.com/developers/docs/topics/rpc#selecttextchannel-select-text-channel-argument-structure + */ +export interface RPCSelectTextChannelArgs { + /** + * Channel id to join (or `null` to leave) + */ + channel_id: Snowflake | null; + /** + * Asynchronously join channel with time to wait before timing out + */ + timeout?: number; +} + +export interface RPCSetActivityResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#setactivity-set-activity-argument-structure + */ +export interface RPCSetActivityArgs { + /** + * The application's process id + */ + pid: number; + /** + * The rich presence to assign to the user + */ + activity?: Partial>; +} + +/** + * https://discord.com/developers/docs/topics/rpc#setvoicesettings-set-voice-settings-argument-and-response-structure + */ +export type RPCSetVoiceSettingsResultData = RPCGetVoiceSettingsResultData; + +/** + * https://discord.com/developers/docs/topics/rpc#setvoicesettings-set-voice-settings-argument-and-response-structure + * + * @remarks Discord only supports a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. + */ +export type RPCSetVoiceSettingsArgs = RPCGetVoiceSettingsResultData; + +/** + * https://discord.com/developers/docs/topics/rpc#subscribe-subscribe-response-structure + */ +export interface RPCSubscribeResultData { + /** + * Event name now subscribed to + */ + evt: RPCEvents; +} + +/** + * https://discord.com/developers/docs/topics/rpc#subscribe + */ +export type RPCSubscribeArgs = + | RPCSubscribeActivityInviteArgs + | RPCSubscribeActivityJoinArgs + | RPCSubscribeActivityJoinRequestArgs + | RPCSubscribeActivitySpectateArgs + | RPCSubscribeChannelCreateArgs + | RPCSubscribeCurrentUserUpdateArgs + | RPCSubscribeEntitlementCreateArgs + | RPCSubscribeEntitlementDeleteArgs + | RPCSubscribeGameJoinArgs + | RPCSubscribeGameSpectateArgs + | RPCSubscribeGuildCreateArgs + | RPCSubscribeGuildStatusArgs + | RPCSubscribeMessageCreateArgs + | RPCSubscribeMessageDeleteArgs + | RPCSubscribeMessageUpdateArgs + | RPCSubscribeNotificationCreateArgs + | RPCSubscribeOverlayArgs + | RPCSubscribeOverlayUpdateArgs + | RPCSubscribeRelationshipUpdateArgs + | RPCSubscribeSpeakingStartArgs + | RPCSubscribeSpeakingStopArgs + | RPCSubscribeVoiceChannelSelectArgs + | RPCSubscribeVoiceConnectionStatusArgs + | RPCSubscribeVoiceSettingsUpdate2Args + | RPCSubscribeVoiceSettingsUpdateArgs + | RPCSubscribeVoiceStateCreateArgs + | RPCSubscribeVoiceStateDeleteArgs + | RPCSubscribeVoiceStateUpdateArgs; + +/** + * https://discord.com/developers/docs/topics/rpc#unsubscribe-unsubscribe-response-structure + */ +export interface RPCUnsubscribeResultData { + /** + * Event name now unsubscribed from + */ + evt: RPCEvents; +} + +/** + * https://discord.com/developers/docs/topics/rpc#unsubscribe + */ +export type RPCUnsubscribeArgs = RPCSubscribeArgs; + +/** + * @unstable + */ +export interface RPCAcceptActivityInviteResultData {} + +/** + * @unstable + */ +export interface RPCAcceptActivityInviteArgs { + /** + * @unstable Invite type + */ + type: 1; + /** + * @unstable Id of the user who sent the invite + */ + user_id: Snowflake; + /** + * @unstable Id of the session + */ + session_id: Snowflake; + /** + * @unstable Id of the channel that the invite comes from + */ + channel_id: Snowflake; + /** + * @unstable Id of the message that the invite comes from + */ + message_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCActivityInviteUserResultData {} + +/** + * @unstable + */ +export interface RPCActivityInviteUserArgs { + /** + * @unstable Invite type + */ + type: 1; + /** + * @unstable Id of the user to invite + */ + user_id: Snowflake; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCBraintreePopupBridgeCallbackResultData {} + +/** + * @unstable + */ +export interface RPCBraintreePopupBridgeCallbackArgs {} + +/** + * @unstable + */ +export interface RPCBrowserHandoffResultData {} + +/** + * @unstable + */ +export interface RPCBrowserHandoffArgs {} + +export interface RPCCloseActivityJoinRequestResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#closeactivityrequest-close-activity-request-argument-structure + */ +export interface RPCCloseActivityJoinRequestArgs { + /** + * The id of the requesting user + */ + user_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCConnectionsCallbackResultData {} + +/** + * @unstable + */ +export interface RPCConnectionsCallbackArgs {} + +/** + * @unstable Channel invite + */ +export type RPCCreateChannelInviteResultData = APIInvite & { + /** + * @unstable Timestamp of when the invite was created + */ + created_at: string; + /** + * @unstable Max age of the invite + */ + max_age: number; + /** + * @unstable Max uses of the invite + */ + max_uses: number; + /** + * @unstable Whether the invite is temporary + */ + temporary: boolean; + /** + * @unstable Uses of the invite + */ + uses: number; + /** + * @unstable Id of the guild + */ + guild_id: Snowflake; +}; + +/** + * @unstable Arguments to create channel invite + */ +export interface RPCCreateChannelInviteArgs { + /** + * Id of the channel to create an invite for + */ + channel_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCDeepLinkResultData {} + +/** + * @unstable + */ +export interface RPCDeepLinkArgs {} + +/** + * @unstable + */ +export interface RPCGetApplicationTicketResultData {} + +/** + * @unstable + */ +export interface RPCGetApplicationTicketArgs {} + +/** + * @unstable + */ +export interface RPCGetEntitlementTicketResultData {} + +/** + * @unstable + */ +export interface RPCGetEntitlementTicketArgs {} + +/** + * @unstable + */ +export interface RPCGetEntitlementsResultData {} + +/** + * @unstable + */ +export interface RPCGetEntitlementsArgs {} + +/** + * @unstable + */ +export interface RPCGetImageResultData { + /** + * @unstable Base64 image data + */ + data_url: string; +} + +/** + * @unstable + */ +export interface RPCGetImageArgs { + /** + * @unstable Image type + */ + type: 'user'; + /** + * @unstable Id of the image + */ + id: Snowflake; + /** + * @unstable Image format + */ + format: 'jpg' | 'png' | 'webp'; + /** + * @unstable Size of the image + */ + size: 1_024 | 16 | 32 | 64 | 128 | 256 | 512; +} + +/** + * @unstable + */ +export interface RPCGetNetworkingConfigResultData {} + +/** + * @unstable + */ +export interface RPCGetNetworkingConfigArgs {} + +/** + * @unstable + */ +export type RPCGetRelationshipsResultData = Relationship[]; + +/** + * @unstable + */ +export interface RPCGetRelationshipsArgs {} + +/** + * @unstable + */ +export type RPCGetSkusResultData = unknown[]; + +/** + * @unstable + */ +export interface RPCGetSkusArgs {} + +/** + * @unstable + */ +export interface RPCGiftCodeBrowserResultData {} + +/** + * @unstable + */ +export interface RPCGiftCodeBrowserArgs {} + +/** + * @unstable + */ +export interface RPCGuildTemplateBrowserResultData {} + +/** + * @unstable + */ +export interface RPCGuildTemplateBrowserArgs {} + +/** + * @unstable + */ +export interface RPCInviteBrowserResultData {} + +/** + * @unstable + */ +export interface RPCInviteBrowserArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingCreateTokenResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingCreateTokenArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingPeerMetricsResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingPeerMetricsArgs {} + +/** + * @unstable + */ +export interface RPCNetworkingSystemMetricsResultData {} + +/** + * @unstable + */ +export interface RPCNetworkingSystemMetricsArgs {} + +/** + * @unstable + */ +export interface RPCOpenOverlayActivityInviteResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayActivityInviteArgs { + /** + * @unstable + */ + type: 1; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOpenOverlayGuildInviteResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayGuildInviteArgs { + /** + * @unstable Guild invite code + */ + code: string; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOpenOverlayVoiceSettingsResultData {} + +/** + * @unstable + */ +export interface RPCOpenOverlayVoiceSettingsArgs { + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export interface RPCOverlayResultData {} + +/** + * @unstable + */ +export interface RPCOverlayArgs {} + +export interface RPCSendActivityJoinInviteResultData {} + +/** + * https://discord.com/developers/docs/topics/rpc#sendactivityjoininvite-send-activity-join-invite-argument-structure + */ +export interface RPCSendActivityJoinInviteArgs { + /** + * The id of the requesting user + */ + user_id: Snowflake; +} + +export type RPCSetCertifiedDevicesResultData = null; + +/** + * https://discord.com/developers/docs/topics/rpc#setcertifieddevices-set-certified-devices-argument-structure + */ +export interface RPCSetCertifiedDevicesArgs { + /** + * A list of devices for your manufacturer, in order of priority + */ + devices: RPCCertifiedDevice[]; +} + +/** + * @unstable + */ +export interface RPCSetOverlayLockedResultData {} + +/** + * @unstable + */ +export interface RPCSetOverlayLockedArgs { + /** + * @unstable Whether the overlay is locked + */ + locked: boolean; + /** + * @unstable Process id + */ + pid: number; +} + +/** + * @unstable + */ +export type RPCSetUserVoiceSettings2ResultData = RPCSetUserVoiceSettingsResultData; + +/** + * @unstable + */ +export type RPCSetUserVoiceSettings2Args = RPCSetUserVoiceSettingsArgs; + +/** + * @unstable + */ +export type RPCSetVoiceSettings2ResultData = RPCSetVoiceSettingsResultData; + +/** + * @unstable + */ +export type RPCSetVoiceSettings2Args = RPCSetVoiceSettingsArgs; + +/** + * @unstable + */ +export interface RPCStartPurchaseResultData {} + +/** + * @unstable + */ +export interface RPCStartPurchaseArgs { + /** + * Id of the sku + */ + sku_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCValidateApplicationResultData {} + +/** + * @unstable + */ +export interface RPCValidateApplicationArgs {} + +/** + * https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-events + */ +export enum RPCEvents { + /** + * @unstable + */ + ActivityInvite = 'ACTIVITY_INVITE', + ActivityJoin = 'ACTIVITY_JOIN', + ActivityJoinRequest = 'ACTIVITY_JOIN_REQUEST', + ActivitySpectate = 'ACTIVITY_SPECTATE', + ChannelCreate = 'CHANNEL_CREATE', + CurrentUserUpdate = 'CURRENT_USER_UPDATE', + /** + * @unstable + */ + EntitlementCreate = 'ENTITLEMENT_CREATE', + /** + * @unstable + */ + EntitlementDelete = 'ENTITLEMENT_DELETE', + Error = 'ERROR', + /** + * @unstable + */ + GameJoin = 'GAME_JOIN', + /** + * @unstable + */ + GameSpectate = 'GAME_SPECTATE', + GuildCreate = 'GUILD_CREATE', + GuildStatus = 'GUILD_STATUS', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageCreate = 'MESSAGE_CREATE', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageDelete = 'MESSAGE_DELETE', + /** + * Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + */ + MessageUpdate = 'MESSAGE_UPDATE', + /** + * This event requires the `rpc.notifications.read` {@link https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes | OAuth2 scope}. + */ + NotificationCreate = 'NOTIFICATION_CREATE', + /** + * @unstable + */ + Overlay = 'OVERLAY', + /** + * @unstable + */ + OverlayUpdate = 'OVERLAY_UPDATE', + Ready = 'READY', + /** + * @unstable + */ + RelationshipUpdate = 'RELATIONSHIP_UPDATE', + SpeakingStart = 'SPEAKING_START', + SpeakingStop = 'SPEAKING_STOP', + VoiceChannelSelect = 'VOICE_CHANNEL_SELECT', + VoiceConnectionStatus = 'VOICE_CONNECTION_STATUS', + VoiceSettingsUpdate = 'VOICE_SETTINGS_UPDATE', + /** + * @unstable + */ + VoiceSettingsUpdate2 = 'VOICE_SETTINGS_UPDATE_2', + /** + * Dispatches channel voice state objects + */ + VoiceStateCreate = 'VOICE_STATE_CREATE', + /** + * Dispatches channel voice state objects + */ + VoiceStateDelete = 'VOICE_STATE_DELETE', + /** + * Dispatches channel voice state objects + */ + VoiceStateUpdate = 'VOICE_STATE_UPDATE', +} + +/** + * @unstable + */ +export type RPCSubscribeActivityInviteArgs = Record; + +export type RPCSubscribeActivityJoinArgs = Record; + +export type RPCSubscribeActivityJoinRequestArgs = Record; + +export type RPCSubscribeActivitySpectateArgs = Record; + +export type RPCSubscribeChannelCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeCurrentUserUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeEntitlementCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeEntitlementDeleteArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeGameJoinArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeGameSpectateArgs = Record; + +export type RPCSubscribeGuildCreateArgs = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#guildstatus-guild-status-argument-structure + */ +export interface RPCSubscribeGuildStatusArgs { + /** + * Id of guild to listen to updates of + */ + guild_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageCreateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageDeleteArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-message-argument-structure + */ +export interface RPCSubscribeMessageUpdateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +export type RPCSubscribeNotificationCreateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeOverlayArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeOverlayUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeRelationshipUpdateArgs = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-argument-structure + */ +export interface RPCSubscribeSpeakingStartArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-argument-structure + */ +export interface RPCSubscribeSpeakingStopArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +export type RPCSubscribeVoiceChannelSelectArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeVoiceConnectionStatusArgs = Record; + +export type RPCSubscribeVoiceSettingsUpdateArgs = Record; + +/** + * @unstable + */ +export type RPCSubscribeVoiceSettingsUpdate2Args = Record; + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateCreateArgs { + /** + * id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateDeleteArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-voice-state-argument-structure + */ +export interface RPCSubscribeVoiceStateUpdateArgs { + /** + * Id of channel to listen to updates of + */ + channel_id: Snowflake; +} + +/** + * @unstable + */ +export interface RPCActivityInviteDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#activityjoin-activity-join-dispatch-data-structure + */ +export interface RPCActivityJoinDispatchData { + /** + * The {@link https://discord.com/developers/docs/developer-tools/game-sdk#activitysecrets-struct | `join_secret`} for the given invite + */ + secret: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#activityjoinrequest-activity-join-request-data-structure + */ +export interface RPCActivityJoinRequestDispatchData { + /** + * Information about the user requesting to join + */ + user: APIUser; +} + +/** + * https://discord.com/developers/docs/topics/rpc#activityspectate-activity-spectate-dispatch-data-structure + */ +export interface RPCActivitySpectateDispatchData { + /** + * The {@link https://discord.com/developers/docs/developer-tools/game-sdk#activitysecrets-struct | `spectate_secret`} for the given invite + */ + secret: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#channelcreate-channel-create-dispatch-data-structure + */ +export interface RPCChannelCreateDispatchData { + /** + * Channel id + */ + id: Snowflake; + /** + * Name of the channel + */ + name: string; + /** + * Channel type + */ + type: ChannelType; +} + +/** + * @unstable + */ +export interface RPCCurrentUserUpdateDispatchData {} + +/** + * @unstable + */ +export interface RPCEntitlementCreateDispatchData {} + +/** + * @unstable + */ +export interface RPCEntitlementDeleteDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#error-error-data-structure + */ +export interface RPCErrorDispatchData { + /** + * RPC Error Code + */ + code: RPCErrorCodes; + /** + * Error description + */ + message: string; +} + +/** + * @unstable + */ +export interface RPCGameJoinDispatchData {} + +/** + * @unstable + */ +export interface RPCGameSpectateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#guildcreate-guild-create-dispatch-data-structure + */ +export interface RPCGuildCreateDispatchData { + /** + * Guild id + */ + id: Snowflake; + /** + * Name of the guild + */ + name: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#guildstatus-guild-status-dispatch-data-structure + */ +export interface RPCGuildStatusDispatchData { + /** + * Guild with requested id + */ + guild: APIPartialGuild; + /** + * Number of online users in guild + * + * @deprecated This will always be `0` + */ + online: 0; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageCreateDispatchData { + /** + * Id of channel where message was sent + */ + channel_id: Snowflake; + /** + * message that was created + */ + message: RPCAPIMessage; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageDeleteDispatchData { + /** + * Id of channel where message was deleted + */ + channel_id: Snowflake; + /** + * Message that was deleted (only id) + */ + message: Pick; +} + +/** + * https://discord.com/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete-example-message-dispatch-payload + */ +export interface RPCMessageUpdateDispatchData { + /** + * Id of channel where message was updated + */ + channel_id: Snowflake; + /** + * message that was updated + */ + message: RPCAPIMessage; +} + +/** + * https://discord.com/developers/docs/topics/rpc#notificationcreate-notification-create-dispatch-data-structure + */ +export interface RPCNotificationCreateDispatchData { + /** + * Id of channel where notification occurred + */ + channel_id: Snowflake; + /** + * Message that generated this notification + */ + message: RPCAPIMessage; + /** + * Icon url of the notification + */ + icon_url: string; + /** + * Title of the notification + */ + title: string; + /** + * Body of the notification + */ + body: string; +} + +/** + * @unstable + */ +export interface RPCOverlayDispatchData {} + +/** + * @unstable + */ +export interface RPCOverlayUpdateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#ready-rpc-server-configuration-object + */ +export interface RPCServerConfiguration { + /** + * Server's cdn + */ + cdn_host: string; + /** + * Server's api endpoint + */ + api_endpoint: string; + /** + * Server's environment + */ + environment: string; +} + +/** + * https://discord.com/developers/docs/topics/rpc#ready-ready-dispatch-data-structure + */ +export interface RPCReadyDispatchData { + /** + * RPC version + */ + v: 1; + /** + * Server configuration + */ + config: RPCServerConfiguration; + /** + * The user to whom you are connected + */ + user: APIUser; +} + +/** + * @unstable + */ +export interface RPCRelationshipUpdateDispatchData {} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-dispatch-data-structure + */ +export interface RPCSpeakingStartDispatchData { + /** + * Id of user who started speaking + */ + user_id: Snowflake; + /** + * @unstable + * id of channel where user is speaking + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#speakingstartspeakingstop-speaking-dispatch-data-structure + */ +export interface RPCSpeakingStopDispatchData { + /** + * Id of user who stopped speaking + */ + user_id: Snowflake; + /** + * @unstable + * id of channel where user is speaking + */ + channel_id: Snowflake; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicechannelselect-voice-channel-select-dispatch-data-structure + */ +export interface RPCVoiceChannelSelectDispatchData { + /** + * Id of channel (`null` if leaving channel) + */ + channel_id: Snowflake | null; + /** + * Id of guild (`null` if not in a guild. field is omitted when leaving any voice channel) + */ + guild_id?: Snowflake | null; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voiceconnectionstatus-voice-connection-status-dispatch-data-structure + */ +export interface RPCVoiceConnectionStatusDispatchData { + /** + * Voice connection states + */ + state: State; + /** + * Hostname of the connected voice server + */ + hostname: State extends VoiceConnectionStates.AwaitingEndpoint ? null : string; + /** + * All of the accumulated pings since connection + */ + pings: RPCVoiceConnectionStatusPing[]; + /** + * Average ping (in ms) + */ + average_ping: number; + /** + * Last ping (in ms) + */ + last_ping: number; +} + +export type RPCVoiceSettingsUpdateDispatchData = RPCGetVoiceSettingsResultData; + +/** + * @unstable + */ +export interface RPCVoiceSettingsUpdate2DispatchData { + /** + * @unstable + */ + input_mode: Pick; + /** + * @unstable + */ + local_mutes: unknown[]; + /** + * @unstable + */ + local_volumes: unknown; + /** + * @unstable + */ + self_mute: boolean; + /** + * @unstable + */ + self_deaf: boolean; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateCreateDispatchData { + /** + * Voice state of user + */ + voice_state: Pick; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateDeleteDispatchData { + /** + * Voice state of user + */ + voice_state: APIVoiceState; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +/** + * https://discord.com/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete-example-voice-state-dispatch-payload + */ +export interface RPCVoiceStateUpdateDispatchData { + /** + * Voice state of user + */ + voice_state: APIVoiceState; + /** + * User who joined voice channel + */ + user: APIUser; + /** + * Nickname of user + */ + nick: string; + /** + * Volume of user + */ + volume: number; + /** + * Is user muted for the client user + */ + mute: boolean; + /** + * Pan of user + */ + pan: RPCVoicePan; +} + +export interface BaseRPCMessage { + cmd: Cmd; +} + +export interface RPCCommandMessage extends BaseRPCMessage { + nonce: string; +} + +export interface RPCSubscribeMessage< + Evt extends RPCEvents, + Cmd extends RPCCommands.Subscribe | RPCCommands.Unsubscribe = RPCCommands.Subscribe | RPCCommands.Unsubscribe, +> extends RPCCommandMessage { + evt: Evt; +} + +export interface RPCCommandAuthorizePayload extends RPCCommandMessage { + args: RPCAuthorizeArgs; +} + +export interface RPCCommandAuthenticatePayload extends RPCCommandMessage { + args: RPCAuthenticateArgs; +} + +export interface RPCCommandGetChannelPayload extends RPCCommandMessage { + args: RPCGetChannelArgs; +} + +export interface RPCCommandGetChannelsPayload extends RPCCommandMessage { + args: RPCGetChannelsArgs; +} + +export interface RPCCommandGetGuildPayload extends RPCCommandMessage { + args: RPCGetGuildArgs; +} + +export interface RPCCommandGetGuildsPayload extends RPCCommandMessage { + args: RPCGetGuildsArgs; +} + +export interface RPCCommandGetUserPayload extends RPCCommandMessage { + args: RPCGetUserArgs; +} + +export interface RPCCommandGetVoiceSettingsPayload extends RPCCommandMessage { + args: RPCGetVoiceSettingsArgs; +} + +export interface RPCCommandSelectTextChannelPayload extends RPCCommandMessage { + args: RPCSelectTextChannelArgs; +} + +export interface RPCCommandSelectVoiceChannelPayload extends RPCCommandMessage { + args: RPCSelectVoiceChannelArgs; +} + +export interface RPCCommandSetActivityPayload extends RPCCommandMessage { + args: RPCSetActivityArgs; +} + +export interface RPCCommandSetVoiceSettingsPayload extends RPCCommandMessage { + args: RPCSetVoiceSettingsArgs; +} + +export type RPCCommandSubscribePayload = + | RPCSubscribeActivityInvite + | RPCSubscribeActivityJoin + | RPCSubscribeActivityJoinRequest + | RPCSubscribeActivitySpectate + | RPCSubscribeChannelCreate + | RPCSubscribeCurrentUserUpdate + | RPCSubscribeEntitlementCreate + | RPCSubscribeEntitlementDelete + | RPCSubscribeGameJoin + | RPCSubscribeGameSpectate + | RPCSubscribeGuildCreate + | RPCSubscribeGuildStatus + | RPCSubscribeMessageCreate + | RPCSubscribeMessageDelete + | RPCSubscribeMessageUpdate + | RPCSubscribeNotificationCreate + | RPCSubscribeOverlay + | RPCSubscribeOverlayUpdate + | RPCSubscribeRelationshipUpdate + | RPCSubscribeSpeakingStart + | RPCSubscribeSpeakingStop + | RPCSubscribeVoiceChannelSelect + | RPCSubscribeVoiceConnectionStatus + | RPCSubscribeVoiceSettingsUpdate + | RPCSubscribeVoiceSettingsUpdate2 + | RPCSubscribeVoiceStateCreate + | RPCSubscribeVoiceStateDelete + | RPCSubscribeVoiceStateUpdate; + +export type RPCCommandUnsubscribePayload = RPCCommandSubscribePayload; + +export interface RPCCommandAcceptActivityInvitePayload extends RPCCommandMessage { + args: RPCAcceptActivityInviteArgs; +} + +export interface RPCCommandActivityInviteUserPayload extends RPCCommandMessage { + args: RPCActivityInviteUserArgs; +} + +export interface RPCCommandBraintreePopupBridgeCallbackPayload + extends RPCCommandMessage { + args: RPCBraintreePopupBridgeCallbackArgs; +} + +export interface RPCCommandBrowserPayload extends RPCCommandMessage { + args: RPCBrowserHandoffArgs; +} + +export interface RPCCommandCloseActivityJoinRequestPayload + extends RPCCommandMessage { + args: RPCCloseActivityJoinRequestArgs; +} + +export interface RPCCommandConnectionsCallbackPayload extends RPCCommandMessage { + args: RPCConnectionsCallbackArgs; +} + +export interface RPCCommandCreateChannelInvitePayload extends RPCCommandMessage { + args: RPCCreateChannelInviteArgs; +} + +export interface RPCCommandDeepLinkPayload extends RPCCommandMessage { + args: RPCDeepLinkArgs; +} + +export interface RPCCommandGetApplicationTicketPayload extends RPCCommandMessage { + args: RPCGetApplicationTicketArgs; +} + +export interface RPCCommandGetEntitlementTicketPayload extends RPCCommandMessage { + args: RPCGetEntitlementTicketArgs; +} + +export interface RPCCommandGetEntitlementsPayload extends RPCCommandMessage { + args: RPCGetEntitlementsArgs; +} + +export interface RPCCommandGetImagePayload extends RPCCommandMessage { + args: RPCGetImageArgs; +} + +export interface RPCCommandGetNetworkingConfigPayload extends RPCCommandMessage { + args: RPCGetNetworkingConfigArgs; +} + +export interface RPCCommandGetRelationshipsPayload extends RPCCommandMessage { + args: RPCGetRelationshipsArgs; +} + +export interface RPCCommandGetSelectedVoiceChannelPayload + extends RPCCommandMessage { + args: RPCGetSelectedVoiceChannelArgs; +} + +export interface RPCCommandGetSkusPayload extends RPCCommandMessage { + args: RPCGetSkusArgs; +} + +export interface RPCCommandGiftCodeBrowserPayload extends RPCCommandMessage { + args: RPCGiftCodeBrowserArgs; +} + +export interface RPCCommandGuildTemplateBrowserPayload extends RPCCommandMessage { + args: RPCGuildTemplateBrowserArgs; +} + +export interface RPCCommandInviteBrowserPayload extends RPCCommandMessage { + args: RPCInviteBrowserArgs; +} + +export interface RPCCommandNetworkingCreateTokenPayload extends RPCCommandMessage { + args: RPCNetworkingCreateTokenArgs; +} + +export interface RPCCommandNetworkingPeerMetricsPayload extends RPCCommandMessage { + args: RPCNetworkingPeerMetricsArgs; +} + +export interface RPCCommandNetworkingSystemMetricsPayload + extends RPCCommandMessage { + args: RPCNetworkingSystemMetricsArgs; +} + +export interface RPCCommandOpenOverlayActivityInvitePayload + extends RPCCommandMessage { + args: RPCOpenOverlayActivityInviteArgs; +} + +export interface RPCCommandOpenOverlayGuildInvitePayload extends RPCCommandMessage { + args: RPCOpenOverlayGuildInviteArgs; +} + +export interface RPCCommandOpenOverlayVoiceSettingsPayload + extends RPCCommandMessage { + args: RPCOpenOverlayVoiceSettingsArgs; +} + +export interface RPCCommandOverlayPayload extends RPCCommandMessage { + args: RPCOverlayArgs; +} + +export interface RPCCommandSendActivityJoinInvitePayload extends RPCCommandMessage { + args: RPCSendActivityJoinInviteArgs; +} + +export interface RPCCommandSetCertifiedDevicesPayload extends RPCCommandMessage { + args: RPCSetCertifiedDevicesArgs; +} + +export interface RPCCommandSetOverlayLockedPayload extends RPCCommandMessage { + args: RPCSetOverlayLockedArgs; +} + +export interface RPCCommandSetUserVoiceSettingsPayload extends RPCCommandMessage { + args: RPCSetUserVoiceSettingsArgs; +} + +export interface RPCCommandSetUserVoiceSettings2Payload extends RPCCommandMessage { + args: RPCSetUserVoiceSettings2Args; +} + +export interface RPCCommandSetVoiceSettings2Payload extends RPCCommandMessage { + args: RPCSetVoiceSettings2Args; +} + +export interface RPCCommandStartPurchasePayload extends RPCCommandMessage { + args: RPCStartPurchaseArgs; +} + +export interface RPCCommandValidateApplicationPayload extends RPCCommandMessage { + args: RPCValidateApplicationArgs; +} + +export interface RPCSubscribeActivityInvite extends RPCSubscribeMessage { + args: RPCSubscribeActivityInviteArgs; + evt: RPCEvents.ActivityInvite; +} + +export interface RPCSubscribeActivityJoin extends RPCSubscribeMessage { + args: RPCSubscribeActivityJoinArgs; + evt: RPCEvents.ActivityJoin; +} + +export interface RPCSubscribeActivityJoinRequest extends RPCSubscribeMessage { + args: RPCSubscribeActivityJoinRequestArgs; + evt: RPCEvents.ActivityJoinRequest; +} + +export interface RPCSubscribeActivitySpectate extends RPCSubscribeMessage { + args: RPCSubscribeActivitySpectateArgs; + evt: RPCEvents.ActivitySpectate; +} + +export interface RPCSubscribeChannelCreate extends RPCSubscribeMessage { + args: RPCSubscribeChannelCreateArgs; + evt: RPCEvents.ChannelCreate; +} + +export interface RPCSubscribeCurrentUserUpdate extends RPCSubscribeMessage { + args: RPCSubscribeCurrentUserUpdateArgs; + evt: RPCEvents.CurrentUserUpdate; +} + +export interface RPCSubscribeEntitlementCreate extends RPCSubscribeMessage { + args: RPCSubscribeEntitlementCreateArgs; + evt: RPCEvents.EntitlementCreate; +} + +export interface RPCSubscribeEntitlementDelete extends RPCSubscribeMessage { + args: RPCSubscribeEntitlementDeleteArgs; + evt: RPCEvents.EntitlementDelete; +} + +export interface RPCSubscribeGameJoin extends RPCSubscribeMessage { + args: RPCSubscribeGameJoinArgs; + evt: RPCEvents.GameJoin; +} + +export interface RPCSubscribeGameSpectate extends RPCSubscribeMessage { + args: RPCSubscribeGameSpectateArgs; + evt: RPCEvents.GameSpectate; +} + +export interface RPCSubscribeGuildCreate extends RPCSubscribeMessage { + args: RPCSubscribeGuildCreateArgs; + evt: RPCEvents.GuildCreate; +} + +export interface RPCSubscribeGuildStatus extends RPCSubscribeMessage { + args: RPCSubscribeGuildStatusArgs; + evt: RPCEvents.GuildStatus; +} + +export interface RPCSubscribeMessageCreate extends RPCSubscribeMessage { + args: RPCSubscribeMessageCreateArgs; + evt: RPCEvents.MessageCreate; +} + +export interface RPCSubscribeMessageDelete extends RPCSubscribeMessage { + args: RPCSubscribeMessageDeleteArgs; + evt: RPCEvents.MessageDelete; +} + +export interface RPCSubscribeMessageUpdate extends RPCSubscribeMessage { + args: RPCSubscribeMessageUpdateArgs; + evt: RPCEvents.MessageUpdate; +} + +export interface RPCSubscribeNotificationCreate extends RPCSubscribeMessage { + args: RPCSubscribeNotificationCreateArgs; + evt: RPCEvents.NotificationCreate; +} + +export interface RPCSubscribeOverlay extends RPCSubscribeMessage { + args: RPCSubscribeOverlayArgs; + evt: RPCEvents.Overlay; +} + +export interface RPCSubscribeOverlayUpdate extends RPCSubscribeMessage { + args: RPCSubscribeOverlayUpdateArgs; + evt: RPCEvents.OverlayUpdate; +} + +export interface RPCSubscribeRelationshipUpdate extends RPCSubscribeMessage { + args: RPCSubscribeRelationshipUpdateArgs; + evt: RPCEvents.RelationshipUpdate; +} + +export interface RPCSubscribeSpeakingStart extends RPCSubscribeMessage { + args: RPCSubscribeSpeakingStartArgs; + evt: RPCEvents.SpeakingStart; +} + +export interface RPCSubscribeSpeakingStop extends RPCSubscribeMessage { + args: RPCSubscribeSpeakingStopArgs; + evt: RPCEvents.SpeakingStop; +} + +export interface RPCSubscribeVoiceChannelSelect extends RPCSubscribeMessage { + args: RPCSubscribeVoiceChannelSelectArgs; + evt: RPCEvents.VoiceChannelSelect; +} + +export interface RPCSubscribeVoiceConnectionStatus extends RPCSubscribeMessage { + args: RPCSubscribeVoiceConnectionStatusArgs; + evt: RPCEvents.VoiceConnectionStatus; +} + +export interface RPCSubscribeVoiceSettingsUpdate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceSettingsUpdateArgs; + evt: RPCEvents.VoiceSettingsUpdate; +} + +export interface RPCSubscribeVoiceSettingsUpdate2 extends RPCSubscribeMessage { + args: RPCSubscribeVoiceSettingsUpdate2Args; + evt: RPCEvents.VoiceSettingsUpdate2; +} + +export interface RPCSubscribeVoiceStateCreate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateCreateArgs; + evt: RPCEvents.VoiceStateCreate; +} + +export interface RPCSubscribeVoiceStateDelete extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateDeleteArgs; + evt: RPCEvents.VoiceStateDelete; +} + +export interface RPCSubscribeVoiceStateUpdate extends RPCSubscribeMessage { + args: RPCSubscribeVoiceStateUpdateArgs; + evt: RPCEvents.VoiceStateUpdate; +} + +export interface RPCAuthorizeResult extends RPCCommandMessage { + data: RPCAuthorizeResultData; +} + +export interface RPCAuthenticateResult extends RPCCommandMessage { + data: RPCAuthenticateResultData; +} + +export interface RPCGetChannelResult extends RPCCommandMessage { + data: RPCGetChannelResultData; +} + +export interface RPCGetChannelsResult extends RPCCommandMessage { + data: RPCGetChannelsResultData; +} + +export interface RPCGetGuildResult extends RPCCommandMessage { + data: RPCGetGuildResultData; +} + +export interface RPCGetGuildsResult extends RPCCommandMessage { + data: RPCGetGuildsResultData; +} + +export interface RPCGetUserResult extends RPCCommandMessage { + data: RPCGetUserResultData; +} + +export interface RPCGetVoiceSettingsResult extends RPCCommandMessage { + data: RPCGetVoiceSettingsResultData; +} + +export interface RPCSelectTextChannelResult extends RPCCommandMessage { + data: RPCSelectTextChannelResultData; +} + +export interface RPCSelectVoiceChannelResult extends RPCCommandMessage { + data: RPCSelectVoiceChannelResultData; +} + +export interface RPCSetActivityResult extends RPCCommandMessage { + data: RPCSetActivityResultData; +} + +export interface RPCSetVoiceSettingsResult extends RPCCommandMessage { + data: RPCSetVoiceSettingsResultData; +} + +export interface RPCSubscribeResult extends RPCCommandMessage { + data: RPCSubscribeResultData; +} + +export interface RPCUnsubscribeResult extends RPCCommandMessage { + data: RPCUnsubscribeResultData; +} + +export interface RPCAcceptActivityInviteResult extends RPCCommandMessage { + data: RPCAcceptActivityInviteResultData; +} + +export interface RPCActivityInviteUserResult extends RPCCommandMessage { + data: RPCActivityInviteUserResultData; +} + +export interface RPCBraintreePopupBridgeCallbackResult + extends RPCCommandMessage { + data: RPCBraintreePopupBridgeCallbackResultData; +} + +export interface RPCBrowserResult extends RPCCommandMessage { + data: RPCBrowserHandoffResultData; +} + +export interface RPCCloseActivityJoinRequestResult extends RPCCommandMessage { + data: RPCCloseActivityJoinRequestResultData; +} + +export interface RPCConnectionsCallbackResult extends RPCCommandMessage { + data: RPCConnectionsCallbackResultData; +} + +export interface RPCCreateChannelInviteResult extends RPCCommandMessage { + data: RPCCreateChannelInviteResultData; +} + +export interface RPCDeepLinkResult extends RPCCommandMessage { + data: RPCDeepLinkResultData; +} + +export interface RPCGetApplicationTicketResult extends RPCCommandMessage { + data: RPCGetApplicationTicketResultData; +} + +export interface RPCGetEntitlementTicketResult extends RPCCommandMessage { + data: RPCGetEntitlementTicketResultData; +} + +export interface RPCGetEntitlementsResult extends RPCCommandMessage { + data: RPCGetEntitlementsResultData; +} + +export interface RPCGetImageResult extends RPCCommandMessage { + data: RPCGetImageResultData; +} + +export interface RPCGetNetworkingConfigResult extends RPCCommandMessage { + data: RPCGetNetworkingConfigResultData; +} + +export interface RPCGetRelationshipsResult extends RPCCommandMessage { + data: RPCGetRelationshipsResultData; +} + +export interface RPCGetSelectedVoiceChannelResult extends RPCCommandMessage { + data: RPCGetSelectedVoiceChannelResultData; +} + +export interface RPCGetSkusResult extends RPCCommandMessage { + data: RPCGetSkusResultData; +} + +export interface RPCGiftCodeBrowserResult extends RPCCommandMessage { + data: RPCGiftCodeBrowserResultData; +} + +export interface RPCGuildTemplateBrowserResult extends RPCCommandMessage { + data: RPCGuildTemplateBrowserResultData; +} + +export interface RPCInviteBrowserResult extends RPCCommandMessage { + data: RPCInviteBrowserResultData; +} + +export interface RPCNetworkingCreateTokenResult extends RPCCommandMessage { + data: RPCNetworkingCreateTokenResultData; +} + +export interface RPCNetworkingPeerMetricsResult extends RPCCommandMessage { + data: RPCNetworkingPeerMetricsResultData; +} + +export interface RPCNetworkingSystemMetricsResult extends RPCCommandMessage { + data: RPCNetworkingSystemMetricsResultData; +} + +export interface RPCOpenOverlayActivityInviteResult extends RPCCommandMessage { + data: RPCOpenOverlayActivityInviteResultData; +} + +export interface RPCOpenOverlayGuildInviteResult extends RPCCommandMessage { + data: RPCOpenOverlayGuildInviteResultData; +} + +export interface RPCOpenOverlayVoiceSettingsResult extends RPCCommandMessage { + data: RPCOpenOverlayVoiceSettingsResultData; +} + +export interface RPCOverlayResult extends RPCCommandMessage { + data: RPCOverlayResultData; +} + +export interface RPCSendActivityJoinInviteResult extends RPCCommandMessage { + data: RPCSendActivityJoinInviteResultData; +} + +export interface RPCSetCertifiedDevicesResult extends RPCCommandMessage { + data: RPCSetCertifiedDevicesResultData; +} + +export interface RPCSetOverlayLockedResult extends RPCCommandMessage { + data: RPCSetOverlayLockedResultData; +} + +export interface RPCSetUserVoiceSettingsResult extends RPCCommandMessage { + data: RPCSetUserVoiceSettingsResultData; +} + +export interface RPCSetUserVoiceSettings2Result extends RPCCommandMessage { + data: RPCSetUserVoiceSettings2ResultData; +} + +export interface RPCSetVoiceSettings2Result extends RPCCommandMessage { + data: RPCSetVoiceSettings2ResultData; +} + +export interface RPCStartPurchaseResult extends RPCCommandMessage { + data: RPCStartPurchaseResultData; +} + +export interface RPCValidateApplicationResult extends RPCCommandMessage { + data: RPCValidateApplicationResultData; +} + +export type RPCCommandsResult = + | RPCAcceptActivityInviteResult + | RPCActivityInviteUserResult + | RPCAuthenticateResult + | RPCAuthorizeResult + | RPCBraintreePopupBridgeCallbackResult + | RPCBrowserResult + | RPCCloseActivityJoinRequestResult + | RPCConnectionsCallbackResult + | RPCCreateChannelInviteResult + | RPCDeepLinkResult + | RPCGetApplicationTicketResult + | RPCGetChannelResult + | RPCGetChannelsResult + | RPCGetEntitlementsResult + | RPCGetEntitlementTicketResult + | RPCGetGuildResult + | RPCGetGuildsResult + | RPCGetImageResult + | RPCGetNetworkingConfigResult + | RPCGetRelationshipsResult + | RPCGetSelectedVoiceChannelResult + | RPCGetSkusResult + | RPCGetUserResult + | RPCGetVoiceSettingsResult + | RPCGiftCodeBrowserResult + | RPCGuildTemplateBrowserResult + | RPCInviteBrowserResult + | RPCNetworkingCreateTokenResult + | RPCNetworkingPeerMetricsResult + | RPCNetworkingSystemMetricsResult + | RPCOpenOverlayActivityInviteResult + | RPCOpenOverlayGuildInviteResult + | RPCOpenOverlayVoiceSettingsResult + | RPCOverlayResult + | RPCSelectTextChannelResult + | RPCSelectVoiceChannelResult + | RPCSendActivityJoinInviteResult + | RPCSetActivityResult + | RPCSetCertifiedDevicesResult + | RPCSetOverlayLockedResult + | RPCSetUserVoiceSettings2Result + | RPCSetUserVoiceSettingsResult + | RPCSetVoiceSettings2Result + | RPCSetVoiceSettingsResult + | RPCStartPurchaseResult + | RPCSubscribeResult + | RPCUnsubscribeResult + | RPCValidateApplicationResult; + +export interface RPCActivityInviteDispatch extends BaseRPCMessage { + data: RPCActivityInviteDispatchData; + evt: RPCEvents.ActivityInvite; +} + +export interface RPCActivityJoinDispatch extends BaseRPCMessage { + data: RPCActivityJoinDispatchData; + evt: RPCEvents.ActivityJoin; +} + +export interface RPCActivityJoinRequestDispatch extends BaseRPCMessage { + data: RPCActivityJoinRequestDispatchData; + evt: RPCEvents.ActivityJoinRequest; +} + +export interface RPCActivitySpectateDispatch extends BaseRPCMessage { + data: RPCActivitySpectateDispatchData; + evt: RPCEvents.ActivitySpectate; +} + +export interface RPCChannelCreateDispatch extends BaseRPCMessage { + data: RPCChannelCreateDispatchData; + evt: RPCEvents.ChannelCreate; +} + +export interface RPCCurrentUserUpdateDispatch extends BaseRPCMessage { + data: RPCCurrentUserUpdateDispatchData; + evt: RPCEvents.CurrentUserUpdate; +} + +export interface RPCEntitlementCreateDispatch extends BaseRPCMessage { + data: RPCEntitlementCreateDispatchData; + evt: RPCEvents.EntitlementCreate; +} + +export interface RPCEntitlementDeleteDispatch extends BaseRPCMessage { + data: RPCEntitlementDeleteDispatchData; + evt: RPCEvents.EntitlementDelete; +} + +export interface RPCErrorDispatch< + Cmd extends Exclude = Exclude, +> extends RPCCommandMessage { + data: RPCErrorDispatchData; + evt: RPCEvents.Error; +} + +export interface RPCGameJoinDispatch extends BaseRPCMessage { + data: RPCGameJoinDispatchData; + evt: RPCEvents.GameJoin; +} + +export interface RPCGameSpectateDispatch extends BaseRPCMessage { + data: RPCGameSpectateDispatchData; + evt: RPCEvents.GameSpectate; +} + +export interface RPCGuildCreateDispatch extends BaseRPCMessage { + data: RPCGuildCreateDispatchData; + evt: RPCEvents.GuildCreate; +} + +export interface RPCGuildStatusDispatch extends BaseRPCMessage { + data: RPCGuildStatusDispatchData; + evt: RPCEvents.GuildStatus; +} + +export interface RPCMessageCreateDispatch extends BaseRPCMessage { + data: RPCMessageCreateDispatchData; + evt: RPCEvents.MessageCreate; +} + +export interface RPCMessageDeleteDispatch extends BaseRPCMessage { + data: RPCMessageDeleteDispatchData; + evt: RPCEvents.MessageDelete; +} + +export interface RPCMessageUpdateDispatch extends BaseRPCMessage { + data: RPCMessageUpdateDispatchData; + evt: RPCEvents.MessageUpdate; +} + +export interface RPCNotificationCreateDispatch extends BaseRPCMessage { + data: RPCNotificationCreateDispatchData; + evt: RPCEvents.NotificationCreate; +} + +export interface RPCOverlayDispatch extends BaseRPCMessage { + data: RPCOverlayDispatchData; + evt: RPCEvents.Overlay; +} + +export interface RPCOverlayUpdateDispatch extends BaseRPCMessage { + data: RPCOverlayUpdateDispatchData; + evt: RPCEvents.OverlayUpdate; +} + +export interface RPCReadyDispatch extends BaseRPCMessage { + data: RPCReadyDispatchData; + evt: RPCEvents.Ready; +} + +export interface RPCRelationshipUpdateDispatch extends BaseRPCMessage { + data: RPCRelationshipUpdateDispatchData; + evt: RPCEvents.RelationshipUpdate; +} + +export interface RPCSpeakingStartDispatch extends BaseRPCMessage { + data: RPCSpeakingStartDispatchData; + evt: RPCEvents.SpeakingStart; +} + +export interface RPCSpeakingStopDispatch extends BaseRPCMessage { + data: RPCSpeakingStopDispatchData; + evt: RPCEvents.SpeakingStop; +} + +export interface RPCVoiceChannelSelectDispatch extends BaseRPCMessage { + data: RPCVoiceChannelSelectDispatchData; + evt: RPCEvents.VoiceChannelSelect; +} + +export interface RPCVoiceConnectionStatusDispatch extends BaseRPCMessage { + data: RPCVoiceConnectionStatusDispatchData; + evt: RPCEvents.VoiceConnectionStatus; +} + +export interface RPCVoiceSettingsUpdateDispatch extends BaseRPCMessage { + data: RPCVoiceSettingsUpdateDispatchData; + evt: RPCEvents.VoiceSettingsUpdate; +} + +export interface RPCVoiceSettingsUpdate2Dispatch extends BaseRPCMessage { + data: RPCVoiceSettingsUpdate2DispatchData; + evt: RPCEvents.VoiceSettingsUpdate2; +} + +export interface RPCVoiceStateCreateDispatch extends BaseRPCMessage { + data: RPCVoiceStateCreateDispatchData; + evt: RPCEvents.VoiceStateCreate; +} + +export interface RPCVoiceStateDeleteDispatch extends BaseRPCMessage { + data: RPCVoiceStateDeleteDispatchData; + evt: RPCEvents.VoiceStateDelete; +} + +export interface RPCVoiceStateUpdateDispatch extends BaseRPCMessage { + data: RPCVoiceStateUpdateDispatchData; + evt: RPCEvents.VoiceStateUpdate; +} + +export type RPCEventsDispatch = + | RPCActivityInviteDispatch + | RPCActivityJoinDispatch + | RPCActivityJoinRequestDispatch + | RPCActivitySpectateDispatch + | RPCChannelCreateDispatch + | RPCCurrentUserUpdateDispatch + | RPCEntitlementCreateDispatch + | RPCEntitlementDeleteDispatch + | RPCErrorDispatch + | RPCGameJoinDispatch + | RPCGameSpectateDispatch + | RPCGuildCreateDispatch + | RPCGuildStatusDispatch + | RPCMessageCreateDispatch + | RPCMessageDeleteDispatch + | RPCMessageUpdateDispatch + | RPCNotificationCreateDispatch + | RPCOverlayDispatch + | RPCOverlayUpdateDispatch + | RPCReadyDispatch + | RPCRelationshipUpdateDispatch + | RPCSpeakingStartDispatch + | RPCSpeakingStopDispatch + | RPCVoiceChannelSelectDispatch + | RPCVoiceConnectionStatusDispatch + | RPCVoiceSettingsUpdate2Dispatch + | RPCVoiceSettingsUpdateDispatch + | RPCVoiceStateCreateDispatch + | RPCVoiceStateDeleteDispatch + | RPCVoiceStateUpdateDispatch; + +export type RPCMessage = RPCCommandsResult | RPCEventsDispatch; + +export type RPCMessagePayload = + | RPCCommandAcceptActivityInvitePayload + | RPCCommandActivityInviteUserPayload + | RPCCommandAuthenticatePayload + | RPCCommandAuthorizePayload + | RPCCommandBraintreePopupBridgeCallbackPayload + | RPCCommandBrowserPayload + | RPCCommandCloseActivityJoinRequestPayload + | RPCCommandConnectionsCallbackPayload + | RPCCommandCreateChannelInvitePayload + | RPCCommandDeepLinkPayload + | RPCCommandGetApplicationTicketPayload + | RPCCommandGetChannelPayload + | RPCCommandGetChannelsPayload + | RPCCommandGetEntitlementsPayload + | RPCCommandGetEntitlementTicketPayload + | RPCCommandGetGuildPayload + | RPCCommandGetGuildsPayload + | RPCCommandGetImagePayload + | RPCCommandGetNetworkingConfigPayload + | RPCCommandGetRelationshipsPayload + | RPCCommandGetSelectedVoiceChannelPayload + | RPCCommandGetSkusPayload + | RPCCommandGetUserPayload + | RPCCommandGetVoiceSettingsPayload + | RPCCommandGiftCodeBrowserPayload + | RPCCommandGuildTemplateBrowserPayload + | RPCCommandInviteBrowserPayload + | RPCCommandNetworkingCreateTokenPayload + | RPCCommandNetworkingPeerMetricsPayload + | RPCCommandNetworkingSystemMetricsPayload + | RPCCommandOpenOverlayActivityInvitePayload + | RPCCommandOpenOverlayGuildInvitePayload + | RPCCommandOpenOverlayVoiceSettingsPayload + | RPCCommandOverlayPayload + | RPCCommandSelectTextChannelPayload + | RPCCommandSelectVoiceChannelPayload + | RPCCommandSendActivityJoinInvitePayload + | RPCCommandSetActivityPayload + | RPCCommandSetCertifiedDevicesPayload + | RPCCommandSetOverlayLockedPayload + | RPCCommandSetUserVoiceSettings2Payload + | RPCCommandSetUserVoiceSettingsPayload + | RPCCommandSetVoiceSettings2Payload + | RPCCommandSetVoiceSettingsPayload + | RPCCommandStartPurchasePayload + | RPCCommandSubscribePayload + | RPCCommandUnsubscribePayload + | RPCCommandValidateApplicationPayload;