UNPKG

oceanic.js

Version:

A NodeJS library for interfacing with Discord.

111 lines (110 loc) 5.73 kB
/** @module Application */ import ClientApplication from "./ClientApplication"; import OAuthGuild from "./OAuthGuild"; import User from "./User"; import Team from "./Team"; import type Client from "../Client"; import type { InstallParams } from "../types/oauth"; import type { ApplicationDiscoverabilityState, ApplicationEventWebhookEventType, ApplicationEventWebhookStatus, ApplicationExplicitContentFilterLevel, ApplicationIntegrationTypes, ApplicationMonetizationState, ApplicationVerificationState, ImageFormat, RPCApplicationState, StoreApplicationState } from "../Constants"; import type { JSONApplication } from "../types/json"; import type { IntegrationTypesConfig, RESTApplication } from "../types"; /** Represents an application. */ export default class Application extends ClientApplication { /** The approximate number of guilds the application is in. */ approximateGuildCount: number; /** The approximate number of users this application has been installed by. */ approximateUserInstallCount: number; /** If the bot can be invited by anyone. */ botPublic?: boolean; /** If authorizing the bot requires a code grant. */ botRequireCodeGrant?: boolean; /** This application's rich presence invite cover image hash, if any. */ coverImage: string | null; /** This application's default custom authorization link, if any. */ customInstallURL?: string; /** The description of the application. */ description: string; /** The state of this application's discoverability. */ discoverabilityState?: ApplicationDiscoverabilityState; /** The { @link Constants~ApplicationDiscoveryEligibilityFlags | flags } for this application's discovery eligibility. */ discoveryEligibilityFlags?: number; /** If webhook events are enabled for the app. */ eventWebhooksStatus: ApplicationEventWebhookStatus; /** List of Webhook event types the app subscribes to. */ eventWebhooksTypes?: Array<ApplicationEventWebhookEventType>; /** Event webhooks URL for the app to receive webhook events. */ eventWebhooksURL?: string | null; /** The explicit content filter for this application. */ explicitContentFilter?: ApplicationExplicitContentFilterLevel; /** If this application is a game sold on Discord, the guild to which it has been linked. This will only be present if recieved via {@link REST/Applications.getCurrent | `/applications/@me`}. */ guild: OAuthGuild | null; /** If this application is a game sold on Discord, the ID of the guild to which it has been linked. */ guildID: string | null; hook: boolean; /** The icon hash of the application. */ icon: string | null; /** Settings for this application's in-app authorization link, if enabled. */ installParams?: InstallParams; /** The install types available for this application. */ integrationTypes: Array<ApplicationIntegrationTypes>; /** The configs for the install types available for this application. */ integrationTypesConfig: IntegrationTypesConfig; /** This applications interaction endpoint url, if any. */ interactionsEndpointURL: string | null; /** The event types that will be recieved like http interactions, if interactionsVersion is 2. */ interactionsEventTypes?: Array<string>; /** The interactions version of this application. */ interactionsVersion?: number; /** If this application is monetized. */ isMonetized: boolean; /** The { @link Constants~ApplicationMonetizationEligibilityFlags | flags } for this application's monetization eligibility. */ monetizationEligibilityFlags?: number; /** This application's monetization state. */ monetizationState?: ApplicationMonetizationState; /** The name of the application. */ name: string; /** The owner of this application. */ owner: User | null; /** If this application is a game sold on Discord, the id of the Game's SKU. */ primarySKUID?: string; /** A URL to this application's privacy policy. */ privacyPolicyURL?: string; /** The redirect URIs for this application. */ redirectURIs: Array<string>; /** This application's role connections verification url, if any. */ roleConnectionsVerificationURL: string | null; /** The state of this application's RPC application. */ rpcApplicationState?: RPCApplicationState; /** A list of rpc origin urls, if rpc is enabled. */ rpcOrigins: Array<string>; /** If this application is a game sold on Discord, the slug that links to its store page. */ slug?: string; /** The state of this application's store application state. */ storeApplicationState?: StoreApplicationState; /** The tags for this application. */ tags: Array<string>; /** The team that owns this application. */ team: Team | null; /** A URL to this application's terms of service. */ termsOfServiceURL?: string; /** The type of this application. */ type: number | null; /** The state of this application's verification. */ verificationState?: ApplicationVerificationState; /** The bot's hex encoded public key. */ verifyKey: string; constructor(data: RESTApplication, client: Client); /** * The url of this application's cover image. * @param format The format the url should be. * @param size The dimensions of the image. */ coverImageURL(format?: ImageFormat, size?: number): string | null; /** * The url of this application's icon. * @param format The format the url should be. * @param size The dimensions of the image. */ iconURL(format?: ImageFormat, size?: number): string | null; toJSON(): JSONApplication; }