Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
revolt.js
https://revolt.js.org/
Admin
revolt.js is a JavaScript library for interacting with the entire Revolt API.
Tokens:
20,947
Snippets:
250
Trust Score:
8.1
Update:
3 months ago
Context
Chat
Benchmark
53.25
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Initialize and authenticate a Revolt bot client Source: https://revolt.js.org/index.html Demonstrates basic client setup, event listeners for readiness and message creation, and bot authentication. ```javascript import { Client } from "revolt.js"; let client = new Client(); client.on("ready", async () => console.info(`Logged in as ${client.user.username}!`), ); client.on("messageCreate", async (message) => { if (message.content === "hello") { message.channel.sendMessage("world"); } }); client.loginBot(".."); ``` -------------------------------- ### startTyping() Source: https://revolt.js.org/classes/Channel.html Starts the typing indicator in the current channel. This method is applicable for DirectMessage, Group, and TextChannel types. ```APIDOC ## startTyping() ### Description Start typing in this channel. ### Returns - **void** ### Requires - DirectMessage - Group - TextChannel ``` -------------------------------- ### get(id: string): undefined | Server Source: https://revolt.js.org/classes/ServerCollection.html Retrieves an existing server object from the collection by its ID. ```APIDOC ## get ### Description Get an existing object. ### Parameters - **id** (string) - Required - Id ### Returns - **undefined | Server** - Object ``` -------------------------------- ### get(id: string) Source: https://revolt.js.org/classes/UserCollection.html Retrieves an existing user object from the collection by ID. ```APIDOC ## get(id: string) ### Description Retrieves an existing user object from the collection by ID. ### Parameters - **id** (string) - Required - The ID of the user to retrieve. ### Returns - **undefined | User** - The User object if found, otherwise undefined. ``` -------------------------------- ### get Source: https://revolt.js.org/classes/ChannelCollection.html Retrieves an existing channel object from the collection by ID. ```APIDOC ## get(id: string): undefined | Channel ### Description Get an existing object. ### Parameters - **id** (string) - Required - Id ### Returns - **undefined | Channel** - Object ``` -------------------------------- ### get Source: https://revolt.js.org/classes/ClassCollection.html Retrieves an object from the collection by its ID. ```APIDOC ## get(id: string) ### Description Retrieves an existing object from the collection. ### Parameters - **id** (string) - Required - The ID of the object to retrieve. ### Returns - **T | undefined** - The object if found, otherwise undefined. ``` -------------------------------- ### new Client() Source: https://revolt.js.org/classes/Client.html Initializes a new instance of the Revolt.js Client with optional configuration settings. ```APIDOC ## new Client(options, configuration) ### Description Creates a new Revolt.js Client instance. This is the main class used to connect to and interact with a Revolt node. ### Parameters - **options** (Partial<ClientOptions>) - Optional - Configuration options for the client. - **configuration** (Object) - Optional - Node-specific configuration including API URLs, build info, and enabled features. - **app** (string) - URL pointing to the client serving this node. - **build** (Object) - Build information (commit_sha, commit_timestamp, origin_url, semver, timestamp). - **features** (Object) - Features enabled on this Revolt node (autumn, captcha, email, invite_only, january, voso). - **revolt** (string) - Revolt API Version. - **vapid** (string) - Web Push VAPID public key. - **ws** (string) - WebSocket URL. ### Returns - **Client** - An instance of the Client class. ``` -------------------------------- ### new Server(collection: ServerCollection, id: string) Source: https://revolt.js.org/classes/Server.html Constructs a new instance of the Server class. ```APIDOC ## constructor ### Description Constructs a new Server instance. ### Parameters - **collection** (ServerCollection) - Required - The server collection. - **id** (string) - Required - The unique server ID. ### Returns - **Server** - The constructed Server instance. ``` -------------------------------- ### createServer(data: { description?: null | string; name: string; nsfw?: null | boolean }): Promise<Server> Source: https://revolt.js.org/classes/ServerCollection.html Creates a new server with the specified details. ```APIDOC ## createServer ### Description Create a server. ### Parameters - **data** (object) - Required - Server options - **name** (string) - Required - Server name - **description** (string|null) - Optional - Server description - **nsfw** (boolean|null) - Optional - Whether this server is age-restricted ### Returns - **Promise<Server>** - The newly-created server ``` -------------------------------- ### Options Interface Source: https://revolt.js.org/interfaces/API.Options.html Configuration object used for client initialization. ```APIDOC ## Options Interface ### Description Configuration options for the revolt.js client. ### Properties - **authentication** (object) - Optional - Authentication credentials used for requests. - **headers** (Record<string, any>) - Optional - Custom headers for authentication. - **rauth** (string) - Optional - RAuth token. - **revolt** (string | { token: string }) - Optional - Revolt token or object containing the token. - **baseURL** (string) - Required - The base URL of the Revolt node. - **headers** (Record<string, any>) - Optional - Additional headers to apply to all requests. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/MessageWebhook.html Creates a new instance of the MessageWebhook class. ```APIDOC ## constructor(client: Client, webhook: { avatar?: null | string; name: string }, id: string) ### Description Constructs a new MessageWebhook instance. ### Parameters - **client** (Client) - The client instance. - **webhook** ({ avatar?: null | string; name: string }) - The webhook data containing name and optional avatar. - **id** (string) - The unique identifier for the webhook. ``` -------------------------------- ### connect(uri: string, token: string) Source: https://revolt.js.org/classes/EventClient.html Establishes a connection to the WebSocket service using the provided URI and authentication token. ```APIDOC ## connect(uri: string, token: string) ### Description Connect to the websocket service. ### Parameters - **uri** (string) - Required - WebSocket URI - **token** (string) - Required - Authentication token ### Returns - **void** ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/Session.html Creates a new instance of the Session class. ```APIDOC ## constructor(collection: SessionCollection, id: string) ### Description Constructs a new Session instance. ### Parameters - **collection** (SessionCollection) - Required - The session collection. - **id** (string) - Required - The session ID. ### Returns - **Session** - A new Session instance. ``` -------------------------------- ### join() Source: https://revolt.js.org/classes/ServerPublicInvite.html Joins the server associated with the invite. ```APIDOC ## join() ### Description Joins the server associated with the current invite instance. ### Returns - **Promise<Server>** - A promise that resolves to the joined Server object. ``` -------------------------------- ### login(details) Source: https://revolt.js.org/classes/Client.html Log in with authentication data, creating a new session in the process. ```APIDOC ## login(details) ### Description Log in with auth data, creating a new session in the process. ### Parameters - **details** (object) - Required - Login data object. Can be an object with email and password, or an object with mfa_ticket and optional mfa_response. ### Returns - **Promise<void>** - An on-boarding function if on-boarding is required, undefined otherwise. ``` -------------------------------- ### constructor(client, embed) Source: https://revolt.js.org/classes/WebsiteEmbed.html Creates a new instance of a WebsiteEmbed. This constructor initializes the embed with the provided client and embed data. ```APIDOC ## constructor(client, embed) ### Description Creates a new instance of a WebsiteEmbed. This constructor initializes the embed with the provided client and embed data. ### Parameters - **client** (Client) - Required - The client instance. - **embed** (Omit<Embed, "type">) - Required - The embed data object, excluding the type field, which must be set to "Website". ``` -------------------------------- ### ClientOptions Source: https://revolt.js.org/types/ClientOptions.html Configuration object for the revolt.js client. ```APIDOC ## ClientOptions ### Description Configuration object used to initialize the revolt.js client. ### Properties - **autoReconnect** (boolean) - Whether to reconnect when disconnected. Default: true. - **baseURL** (string) - Base URL of the API server. - **eagerFetching** (boolean) - Whether to eagerly fetch users and members for incoming events. Default: true. - **messageRewrites** (boolean) - Whether to rewrite sent messages that include identifiers. Default: true. (Deprecated) - **partials** (boolean) - Whether to allow partial objects to emit from events. Default: false. - **syncUnreads** (boolean) - Whether to automatically sync unreads information. Default: false. ### Methods - **channelExclusiveMuted(channel: Channel): boolean** - Check whether a channel is exclusively muted (irrespective of server). - **channelIsMuted(channel: Channel): boolean** - Check whether a channel is muted or through inheritance. - **retryDelayFunction(retryCount: number): number** - Custom function to determine retry delay in seconds. Default: (2^x-1) ±20%. ``` -------------------------------- ### createWebhook Source: https://revolt.js.org/classes/Channel.html Create a webhook. ```APIDOC ## createWebhook(name: string) ### Description Create a webhook. ### Parameters - **name** (string) - Required - Webhook name ### Returns - **Promise<ChannelWebhook>** - The newly-created webhook ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/PublicChannelInvite.html Creates a new instance of PublicChannelInvite. ```APIDOC ## constructor ### Description Constructs a new PublicChannelInvite object. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Group" | "Server" | "None") - Optional - The type of the invite, defaults to "None". ### Returns - **PublicChannelInvite** - A new instance of the class. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/SessionCollection.html Creates a new instance of the SessionCollection. ```APIDOC ## constructor ### Description Creates a new instance of the SessionCollection class. ### Signature `new SessionCollection(client: Client): SessionCollection` ### Parameters - **client** (Client) - Required - The client instance. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/UnknownEmbed.html Initializes a new instance of the UnknownEmbed class. ```APIDOC ## constructor(client, type) ### Description Constructs a new UnknownEmbed instance. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Text" | "Video" | "Image" | "Website" | "None") - Required - The type of the embed (defaults to "None"). ### Returns - **UnknownEmbed** - The newly created embed instance. ``` -------------------------------- ### toList() Source: https://revolt.js.org/classes/ServerCollection.html Returns an array containing all server objects in the collection. ```APIDOC ### toList() #### Description List of values in the map. #### Returns - **Server[]** - List of server objects. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/PublicBot.html Creates a new instance of a PublicBot. ```APIDOC ## constructor(client: Client, data: { _id: string; avatar?: string; description?: string; username: string }) ### Description Constructs a new PublicBot instance. ### Parameters - **client** (Client) - Required - The client instance. - **data** (Object) - Required - Bot data. - **_id** (string) - Required - Bot Id. - **avatar** (string) - Optional - Profile Avatar. - **description** (string) - Optional - Profile Description. - **username** (string) - Required - Bot Username. ``` -------------------------------- ### static from(client, invite) Source: https://revolt.js.org/classes/ChannelInvite.html Creates a ChannelInvite instance from raw API invite data. ```APIDOC ## static from(client, invite) ### Description Creates a ChannelInvite instance from an API invite object. ### Parameters - **client** (Client) - Required - The client instance. - **invite** (Object) - Required - The invite data object, which can be a Server invite or a Group invite. ### Returns - **ChannelInvite** - The initialized invite object. ``` -------------------------------- ### connect Source: https://revolt.js.org/classes/Client.html Establishes a connection to Revolt. ```APIDOC ## connect() ### Description Initiates the connection process to the Revolt service. ### Returns - **void** ``` -------------------------------- ### from Source: https://revolt.js.org/classes/UnknownInvite.html Creates a ChannelInvite instance from raw API invite data. ```APIDOC ## from ### Description Creates a ChannelInvite from provided API invite data. ### Parameters - **client** (Client) - Required - The client instance. - **invite** (Object) - Required - The invite data object, which can be a Server invite or a Group invite. ### Returns - **ChannelInvite** - The resulting ChannelInvite instance. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/ClassCollection.html Creates a new instance of a ClassCollection. ```APIDOC ## constructor(client: Client) ### Description Creates a new generic class collection instance. ### Parameters - **client** (Client) - Required - The client instance. ``` -------------------------------- ### constructor(client, type) Source: https://revolt.js.org/classes/ChannelInvite.html Creates a new instance of a ChannelInvite. ```APIDOC ## constructor(client, type) ### Description Constructs a new ChannelInvite object. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Group" | "Server" | "None") - Required - The type of invite (defaults to "None"). ### Returns - **ChannelInvite** - The created invite instance. ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/UnknownInvite.html Creates a new instance of the UnknownInvite class. ```APIDOC ## constructor ### Description Constructs a new Channel Invite instance. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Group" | "Server" | "None") - Optional - The type of the invite (defaults to "None"). ### Returns - **UnknownInvite** - A new instance of the UnknownInvite class. ``` -------------------------------- ### Default Configuration Values Source: https://revolt.js.org/types/ClientOptions.html Default values for various client options. ```text true ``` ```text true ``` ```text true ``` ```text false ``` ```text false ``` ```text false ``` ```text false ``` ```text (2^x-1) ±20% ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/EventClient.html Creates a new instance of the EventClient to manage websocket communication. ```APIDOC ## constructor ### Description Create a new event client instance to connect to the Revolt websocket service. ### Signature `new EventClient<T extends 1>(protocolVersion: T, transportFormat?: "json", options?: Partial<EventClientOptions>): EventClient<T>` ### Parameters - **protocolVersion** (T) - Required - Target protocol version. - **transportFormat** ("json") - Optional - Communication format (defaults to "json"). - **options** (Partial<EventClientOptions>) - Optional - Configuration options for the client. ``` -------------------------------- ### Define Options Interface Source: https://revolt.js.org/interfaces/API.Options.html The main configuration interface for the Revolt client. ```typescript interface Options { authentication: { headers?: Record<string, any>; rauth?: string; revolt?: string | { token: string }; }; baseURL: string; headers?: Record<string, any>; } ``` -------------------------------- ### from Source: https://revolt.js.org/classes/PublicChannelInvite.html Creates a PublicChannelInvite instance from an API invite response. ```APIDOC ## static from ### Description Creates a PublicChannelInvite instance from an API invite response object. ### Parameters - **client** (Client) - Required - The client instance. - **invite** (Object) - Required - The invite data object received from the API, which can be a Server or Group type invite. ### Returns - **PublicChannelInvite** - An instance of PublicChannelInvite populated with the provided data. ``` -------------------------------- ### fetchInvites() Source: https://revolt.js.org/classes/Server.html Fetch all active invites for the server. ```APIDOC ## fetchInvites() ### Description Retrieves an array of the server's invites. ### Returns - **Promise<ChannelInvite[]>** ``` -------------------------------- ### constructor(client, embed) Source: https://revolt.js.org/classes/ImageEmbed.html Creates a new instance of an ImageEmbed. This constructor initializes the embed object with the provided client and embed data. ```APIDOC ## constructor(client, embed) ### Description Constructs a new ImageEmbed instance. ### Parameters - **client** (Client) - Required - The client instance. - **embed** (Object) - Required - The embed data object containing image details such as height, width, size, and URL. ``` -------------------------------- ### constructor(client, embed) Source: https://revolt.js.org/classes/TextEmbed.html Creates a new instance of the TextEmbed class. ```APIDOC ## constructor(client, embed) ### Description Constructs a new TextEmbed object using the provided client and embed data. ### Parameters - **client** (Client) - Required - The revolt.js client instance. - **embed** (Object) - Required - The embed configuration object, excluding the 'type' property, which must be set to 'Text'. ``` -------------------------------- ### createInvite Source: https://revolt.js.org/classes/Channel.html Create an invite to the channel. ```APIDOC ## createInvite() ### Description Create an invite to the channel. ### Returns - **Promise<Object>** - Newly created invite code ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/MessageEmbed.html Creates a new instance of a MessageEmbed. ```APIDOC ## constructor(client, type) ### Description Constructs a new MessageEmbed instance. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Text" | "Video" | "Image" | "Website" | "None") - Optional - The type of the embed. Defaults to "None". ``` -------------------------------- ### constructor Source: https://revolt.js.org/classes/UnknownPublicInvite.html Constructs a new instance of UnknownPublicInvite. ```APIDOC ## constructor(client, type) ### Description Constructs a new UnknownPublicInvite instance. ### Parameters - **client** (Client) - Optional - The client instance. - **type** ("Group" | "Server" | "None") - Optional - The type of the invite. Defaults to "None". ``` -------------------------------- ### new Bot(collection, id) Source: https://revolt.js.org/classes/Bot.html Constructs a new instance of the Bot class. ```APIDOC ### constructor #### Signature `new Bot(collection: BotCollection, id: string): Bot` #### Parameters - **collection** (BotCollection) - The collection the bot belongs to. - **id** (string) - The unique identifier of the bot. #### Returns - **Bot** - A new Bot instance. ``` -------------------------------- ### openDM() Source: https://revolt.js.org/classes/User.html Opens a direct message channel with the user. ```APIDOC ## openDM() ### Description Open a DM with a user. ### Returns - **Promise<Channel>** - DM Channel. ``` -------------------------------- ### from() Source: https://revolt.js.org/classes/ServerPublicInvite.html Static method to create a PublicChannelInvite instance from an API response. ```APIDOC ## from(client, invite) ### Description Creates a PublicChannelInvite instance from a raw API invite response object. ### Parameters - **client** (Client) - The client instance. - **invite** (Object) - The raw invite data structure received from the API. ``` -------------------------------- ### uploadFile Source: https://revolt.js.org/classes/Client.html Uploads a file to the media server. ```APIDOC ## uploadFile(tag: string, file: File, uploadUrl?: string) ### Description Uploads a file to the specified media server. ### Parameters - **tag** (string) - Required - The tag associated with the file. - **file** (File) - Required - The file object to upload. - **uploadUrl** (string) - Optional - The media server upload route. ### Returns - **Promise<string>** - A promise that resolves to the file URL. ``` -------------------------------- ### from Source: https://revolt.js.org/classes/ImageEmbed.html Creates a MessageEmbed instance from raw API embed data. ```APIDOC ## from(client, embed) ### Description Static method to create a MessageEmbed object from provided API embed data. ### Parameters - **client** (Client) - The current client instance. - **embed** (Object) - The raw embed data structure from the API. ``` -------------------------------- ### from Source: https://revolt.js.org/classes/MessageEmbed.html Creates a MessageEmbed instance from raw API embed data. ```APIDOC ## static from(client, embed) ### Description Creates a MessageEmbed instance from an API embed object. ### Parameters - **client** (Client) - Required - The client instance. - **embed** (Object) - Required - The raw embed data object containing type and content fields. ``` -------------------------------- ### getOrCreate(id, data, isNew) Source: https://revolt.js.org/classes/ServerCollection.html Retrieves an existing server instance by ID or creates a new one using the provided data. ```APIDOC ## getOrCreate(id, data, isNew) ### Description Retrieves an existing server instance from the collection by its ID, or creates a new one if it does not exist using the provided server data. ### Parameters - **id** (string) - Required - The unique identifier for the server. - **data** (object) - Required - The server configuration object. - **_id** (string) - Required - Unique Id. - **analytics** (boolean) - Optional - Whether to enable analytics. - **banner** (object) - Optional - Banner attachment details. - **categories** (array) - Optional - Categories for this server. - **channels** (array) - Required - Channels within this server. - **default_permissions** (number) - Required - Default set of server and channel permissions. - **description** (string) - Optional - Description for the server. - **discoverable** (boolean) - Optional - Whether this server should be publicly discoverable. - **flags** (number) - Optional - Server flags. - **isNew** (boolean) - Optional - Flag indicating if the server is newly created. ``` -------------------------------- ### createBot Source: https://revolt.js.org/classes/BotCollection.html Creates a new bot. ```APIDOC ## createBot(name: string): Promise<Bot> ### Description Create a bot with the specified name. ### Parameters - **name** (string) - Required - Bot name ### Returns - **Promise<Bot>** - The newly-created bot ``` -------------------------------- ### addToServer Source: https://revolt.js.org/classes/PublicBot.html Adds the bot to a specified server. ```APIDOC ## addToServer(server: string | Server) ### Description Adds the bot to a server. ### Parameters - **server** (string | Server) - Required - The server or server ID to add the bot to. ``` -------------------------------- ### toList(): ChannelWebhook[] Source: https://revolt.js.org/classes/ChannelWebhookCollection.html Converts the collection into an array of ChannelWebhook objects. ```APIDOC ## toList() ### Description Returns an array containing all ChannelWebhook objects currently in the collection. ### Returns - **ChannelWebhook[]** - A list of all webhooks. ``` -------------------------------- ### create Source: https://revolt.js.org/classes/ClassCollection.html Creates a new instance of an object within the collection. ```APIDOC ## create(id: string, type: string, instance: T, context: unknown, data?: unknown) ### Description Creates a new instance of an object and adds it to the collection. ### Parameters - **id** (string) - Required - The unique identifier. - **type** (string) - Required - The type of object (e.g., "user", "server", "channel"). - **instance** (T) - Required - The object instance. - **context** (unknown) - Required - The context for the object. - **data** (unknown) - Optional - Additional data. ``` -------------------------------- ### server Source: https://revolt.js.org/classes/ServerInvite.html Retrieves the server associated with the invite. ```APIDOC ## server ### Description Gets the server this invite points to. ### Returns - **undefined | Server** - The server object or undefined if not available. ``` -------------------------------- ### Integrate revolt.js with Solid.js components Source: https://revolt.js.org/index.html Utilizes built-in reactivity to display client data directly within Solid.js JSX components. ```javascript const client = new Client(); // initialise the client function MyApp() { return ( <h1>Your username is: {client.user?.username ?? "[logging in...]"}</h1> ); } ``` -------------------------------- ### loginBot(token) Source: https://revolt.js.org/classes/Client.html Log in as a bot using a token. ```APIDOC ## loginBot(token) ### Description Log in as a bot. ### Parameters - **token** (string) - Required - Bot token. ### Returns - **Promise<void>** ``` -------------------------------- ### kick(): Promise<void> Source: https://revolt.js.org/classes/ServerMember.html Kicks the member from the server. ```APIDOC ## kick() ### Description Kick this member from the server. ### Returns - **Promise<void>** ``` -------------------------------- ### createFileURL(forceAnimation?: boolean) Source: https://revolt.js.org/classes/File.html Generates a URL to access the file, with an optional parameter to force animation for supported file types. ```APIDOC ## createFileURL(forceAnimation?: boolean) ### Description Creates a URL to a given file with given options. ### Parameters - **forceAnimation** (boolean) - Optional - Returns GIF if applicable (for avatars/icons) ### Returns - **undefined | string** - Generated URL or nothing ``` -------------------------------- ### fetch Source: https://revolt.js.org/classes/SessionCollection.html Fetches active sessions from the server. ```APIDOC ## fetch ### Description Retrieves a list of active sessions. ### Signature `fetch(): Promise<Session[]>` ### Returns - **Promise<Session[]>** - A promise that resolves to a list of sessions. ``` -------------------------------- ### proxyFile Source: https://revolt.js.org/classes/Client.html Proxies a file URL through January. ```APIDOC ## proxyFile(url: string) ### Description Proxies a file through January. ### Parameters - **url** (string) - The URL to proxy. ### Returns - **undefined | string** - The proxied media URL. ``` -------------------------------- ### fetchMembers() Source: https://revolt.js.org/classes/Server.html Fetch all members of the server. ```APIDOC ## fetchMembers() ### Description Retrieves a list of the server's members and their associated user objects. ### Returns - **Promise<{ members: ServerMember[]; users: User[] }>** ``` -------------------------------- ### toList(): User[] Source: https://revolt.js.org/classes/UserCollection.html Returns a list of values in the map. ```APIDOC ## toList(): User[] ### Description Returns a list of values in the map. ### Returns - **User[]** - List of values. ``` -------------------------------- ### fetchBans() Source: https://revolt.js.org/classes/Server.html Fetch a list of all bans for the server. ```APIDOC ## fetchBans() ### Description Retrieves an array of the server's bans. ### Returns - **Promise<ServerBan[]>** ``` -------------------------------- ### ack() Source: https://revolt.js.org/classes/Server.html Marks the server as read. ```APIDOC ## ack() ### Description Mark a server as read. ### Returns - **Promise<void>** ``` -------------------------------- ### from Source: https://revolt.js.org/classes/WebsiteEmbed.html Static factory method to create a MessageEmbed instance from an API embed object. ```APIDOC ## from ### Description Creates a MessageEmbed instance from a raw API embed object. ### Parameters - **client** (Client) - The client instance. - **embed** (Object) - The raw API embed data structure. ### Returns - **MessageEmbed** - A new instance of MessageEmbed. ``` -------------------------------- ### server Source: https://revolt.js.org/classes/ServerPublicInvite.html Retrieves the server object from the cache if it exists. ```APIDOC ## server ### Description Returns the server object if it is currently available in the client cache. ### Returns - **undefined | Server** - The Server object or undefined if not found. ``` -------------------------------- ### useExistingSession Source: https://revolt.js.org/classes/Client.html Configures the client to use an existing session. ```APIDOC ## useExistingSession(session: PrivateSession) ### Description Initializes the client using an existing session object. ### Parameters - **session** (PrivateSession) - Required - The session data to use. ### Returns - **void** ``` -------------------------------- ### fetch Source: https://revolt.js.org/classes/BotCollection.html Fetches a bot by its ID. ```APIDOC ## fetch(id: string): Promise<Bot> ### Description Fetch bot by ID. ### Parameters - **id** (string) - Required - Id ### Returns - **Promise<Bot>** - Bot ``` -------------------------------- ### fetch(id: string): Promise<Server> Source: https://revolt.js.org/classes/ServerCollection.html Fetches a server by its ID. Note that this method does not fetch channels. ```APIDOC ## fetch ### Description Fetch server by ID. This will not fetch channels! ### Parameters - **id** (string) - Required - Id ### Returns - **Promise<Server>** - Server ``` -------------------------------- ### constructor(collection: EmojiCollection, id: string) Source: https://revolt.js.org/classes/Emoji.html Creates a new instance of the Emoji class. ```APIDOC ## constructor(collection: EmojiCollection, id: string) ### Description Constructs a new Emoji instance. ### Parameters - **collection** (EmojiCollection) - Required - The collection the emoji belongs to. - **id** (string) - Required - The unique identifier for the emoji. ### Returns - **Emoji** - The newly created Emoji instance. ``` -------------------------------- ### addListener Source: https://revolt.js.org/classes/Client.html Registers an event listener for a specific event. ```APIDOC ## addListener(eventName, listener) ### Description Adds a listener function for the specified event. ### Parameters - **eventName** (K) - The name of the event. - **listener** (Function) - The callback function to execute when the event is emitted. ### Returns - **this** - The client instance. ``` -------------------------------- ### prependListener Source: https://revolt.js.org/classes/EventClient.html Adds a listener to the beginning of the listeners array for the specified event. ```APIDOC ## prependListener(eventName, listener) ### Description Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. ### Parameters - **eventName** (K) - Required - The name of the event. - **listener** (Function) - Required - The callback function to invoke when the event is emitted. ### Returns - **this** (EventClient) - Returns the instance of the EventClient. ``` -------------------------------- ### toString() Source: https://revolt.js.org/classes/Channel.html Returns a string representation of the channel, formatted as a channel mention. ```APIDOC ## toString() ### Description Write to string as a channel mention. ### Returns - **string** - Formatted String ``` -------------------------------- ### toList() Source: https://revolt.js.org/classes/ChannelCollection.html Returns an array of all values in the collection. ```APIDOC ## toList() ### Description Returns a list of values in the map. ### Returns - **Channel[]** - List of channels. ``` -------------------------------- ### RequestOptions Interface Source: https://revolt.js.org/interfaces/API.RequestOptions.html Configuration options for API requests. ```APIDOC ## Interface: RequestOptions ### Description Defines the configuration options for making requests within the revolt.js library. ### Properties - **baseURL** (string) - Optional - The base URL used for this request. - **headers** (Record<string, any>) - Optional - Headers to apply for this request. - **responseType** ("text" | "json" | "blob" | "arrayBuffer") - Optional - The type of response expected from the request. ``` -------------------------------- ### once(emitter, eventName, options?) Source: https://revolt.js.org/classes/Client.html The once method listens for a single occurrence of a specified event from an AsyncEventEmitter and returns a promise that resolves when the event is emitted. ```APIDOC ## once(emitter, eventName, options?) ### Description Listens for a single occurrence of an event from an AsyncEventEmitter. The promise resolves with the event parameters once the event is triggered. ### Parameters - **emitter** (AsyncEventEmitter<EventMap>) - Required - The event emitter instance to listen to. - **eventName** (EventName) - Required - The name of the event to listen for. - **options** (AbortableMethods) - Optional - Configuration options for aborting the operation. ### Returns - **Promise<InternalGetAsyncEventEmitterEventParameters>** - A promise that resolves with the event parameters. ``` -------------------------------- ### toString() Source: https://revolt.js.org/classes/User.html Returns the user mention string. ```APIDOC ## toString() ### Description Write to string as a user mention. ### Returns - **string** - Formatted String. ``` -------------------------------- ### fetchProfile() Source: https://revolt.js.org/classes/User.html Fetches the profile information for the user. ```APIDOC ## fetchProfile() ### Description Fetch the profile of a user. ### Returns - **Promise<UserProfile>** - The profile of the user. ``` -------------------------------- ### handle(event: EventProtocol<T>["server"]) Source: https://revolt.js.org/classes/EventClient.html Processes events intended for the client before they are propagated. ```APIDOC ## handle(event: EventProtocol<T>["server"]) ### Description Handle events intended for client before passing them along. ### Parameters - **event** (EventProtocol<T>["server"]) - Required - Event ### Returns - **void** ``` -------------------------------- ### Server Properties Source: https://revolt.js.org/classes/Server.html Accessors for retrieving server information and state. ```APIDOC ## Server Properties ### Description Various properties to retrieve server state, metadata, and configuration. ### Properties - **id** (string) - The server ID. - **name** (string) - The server name. - **description** (string | undefined) - The server description. - **iconURL** (string | undefined) - URL to the server icon. - **bannerURL** (string | undefined) - URL to the server banner. - **ownerId** (string) - The ID of the server owner. - **channels** (Channel[]) - List of channels in the server. - **emojis** (Emoji[]) - List of emojis in the server. - **createdAt** (Date) - The creation timestamp of the server. ``` -------------------------------- ### fetchOwned Source: https://revolt.js.org/classes/BotCollection.html Fetches all bots owned by the current user. ```APIDOC ## fetchOwned(): Promise<Bot[]> ### Description Fetch owned bots. ### Returns - **Promise<Bot[]>** - List of bots ``` -------------------------------- ### createTicket Source: https://revolt.js.org/classes/MFA.html Creates an MFA ticket using one of the available authentication methods. ```APIDOC ## createTicket(params) ### Description Creates an MFA ticket required for further authentication steps. ### Parameters - **params** (object) - Required - The authentication method to use: { password: string } | { recovery_code: string } | { totp_code: string } ### Returns - **Promise<MFATicket>** - A promise that resolves to an MFA ticket. ``` -------------------------------- ### createRole(name) Source: https://revolt.js.org/classes/Server.html Creates a new role on the server. ```APIDOC ## createRole(name) ### Description Create a new role on the server. ### Parameters - **name** (string) - Required - Role name. ### Returns - **Promise<object>** - Returns an object containing the new role ID and role details. ``` -------------------------------- ### toList Source: https://revolt.js.org/classes/ServerMemberCollection.html Returns a list of all values in the collection. ```APIDOC ## toList() ### Description Returns a list of all values in the collection. ``` -------------------------------- ### prependOnceListener Source: https://revolt.js.org/classes/EventClient.html Adds a one-time listener to the beginning of the listeners array for the specified event. ```APIDOC ## prependOnceListener(eventName, listener) ### Description Adds a one-time listener function to the beginning of the listeners array for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked. ### Parameters - **eventName** (K) - Required - The name of the event. - **listener** (Function) - Required - The callback function to invoke once when the event is emitted. ### Returns - **this** (EventClient) - Returns the instance of the EventClient. ``` -------------------------------- ### getOrCreate Source: https://revolt.js.org/classes/BotCollection.html Retrieves an existing bot or creates a new one if it does not exist. ```APIDOC ## getOrCreate(id: string, data: object): Bot ### Description Get or create a bot instance. ### Parameters - **id** (string) - Required - Id - **data** (object) - Required - Data object containing _id, owner, public, token, and optional fields like analytics, discoverable, flags, interactions_url, privacy_policy_url, terms_of_service_url. ### Returns - **Bot** - Bot ``` -------------------------------- ### server Source: https://revolt.js.org/classes/ServerRole.html Retrieves the server object associated with this role. ```APIDOC ## server ### Description Server attached to this role. ### Returns - **undefined | Server** - The server object or undefined if not available. ``` -------------------------------- ### constructor(collection, id) Source: https://revolt.js.org/classes/ChannelUnread.html Creates a new instance of the ChannelUnread class. ```APIDOC ## constructor(collection, id) ### Description Constructs a new ChannelUnread instance. ### Parameters - **collection** (ChannelUnreadCollection) - Required - The collection this object belongs to. - **id** (string) - Required - The ID of the channel. ### Returns - **ChannelUnread** - The initialized instance. ``` -------------------------------- ### on(eventName, listener) Source: https://revolt.js.org/classes/EventClient.html Registers a listener function for the specified event name. ```APIDOC ## on(eventName, listener) ### Description Registers a listener function to be invoked whenever the specified event is emitted. ### Parameters - **eventName** (K) - The name of the event to listen for. - **listener** (Function) - The callback function to execute when the event occurs. ### Returns - **this** - Returns the instance of the EventClient. ``` -------------------------------- ### values() Source: https://revolt.js.org/classes/ServerCollection.html Returns an iterator for all server objects in the collection. ```APIDOC ### values() #### Description Iterable of values in the map. #### Returns - **IterableIterator<Server>** - Iterable of server objects. ``` -------------------------------- ### fetchWebhooks Source: https://revolt.js.org/classes/Channel.html Retrieves a list of webhooks associated with the channel. ```APIDOC ## fetchWebhooks ### Description Fetch a channel's webhooks. ### Returns - **Promise<ChannelWebhook[]>** - A list of webhooks. ``` -------------------------------- ### emit Source: https://revolt.js.org/classes/Client.html Emits an event with the provided arguments. ```APIDOC ## emit(eventName, ...args) ### Description Triggers an event, executing all registered listeners. ### Parameters - **eventName** (K) - The name of the event. - **...args** (any[]) - Arguments to pass to the listeners. ### Returns - **boolean** - True if the event had listeners, false otherwise. ``` -------------------------------- ### ban(options: { reason?: null | string }): Promise<void> Source: https://revolt.js.org/classes/ServerMember.html Bans the member from the server with an optional reason. ```APIDOC ## ban(options: { reason?: null | string }) ### Description Ban this member from the server. ### Parameters - **options** (object) - Required - Ban options - **reason** (string | null) - Optional - Ban reason ### Returns - **Promise<void>** ``` -------------------------------- ### toString() Source: https://revolt.js.org/classes/ServerRole.html Returns the string representation of the role as a mention. ```APIDOC ## toString() ### Description Write to string as a role mention. ### Returns - **string** - Formatted string representing the role mention. ``` -------------------------------- ### getOrCreate Source: https://revolt.js.org/classes/ServerMemberCollection.html Retrieves an existing server member or creates a new one if it does not exist. ```APIDOC ## getOrCreate(id, data) ### Description Retrieves an existing server member or creates a new one if it does not exist. ### Parameters - **id** (object) - Required - The composite ID containing server and user strings. - **data** (object) - Required - The member data object including joined_at, and optional fields like nickname, roles, and timeout. ``` -------------------------------- ### toString(): string Source: https://revolt.js.org/classes/ServerMember.html Converts the member object to a string representation. ```APIDOC ## toString() ### Description Convert to string. ### Returns - **string** ``` -------------------------------- ### proxiedURL Source: https://revolt.js.org/classes/VideoEmbed.html Retrieves the proxied URL for the video embed. ```APIDOC ## proxiedURL ### Description Returns the proxied URL for the video embed if available. ### Returns - **undefined | string** - The proxied URL or undefined. ``` -------------------------------- ### markdownToText(source) Source: https://revolt.js.org/classes/Client.html Prepare a markdown-based message to be displayed to the user as plain text. ```APIDOC ## markdownToText(source) ### Description Prepare a markdown-based message to be displayed to the user as plain text. ### Parameters - **source** (string) - Required - Source markdown text. ### Returns - **string** - Modified plain text. ``` -------------------------------- ### fetch Source: https://revolt.js.org/classes/ChannelCollection.html Fetches a channel by its unique ID. ```APIDOC ## fetch(id: string): Promise<Channel> ### Description Fetch channel by ID. ### Parameters - **id** (string) - Required - Id ### Returns - **Promise<Channel>** - Channel ``` -------------------------------- ### createChannel(data) Source: https://revolt.js.org/classes/Server.html Creates a new channel within the server. ```APIDOC ## createChannel(data) ### Description Create a channel in the server. ### Parameters - **data** (object) - Required - **name** (string) - Required - Channel name. - **description** (string) - Optional - Channel description. - **nsfw** (boolean) - Optional - Whether this channel is age restricted. - **type** ("Text" | "Voice") - Optional - Channel type (Default: "Text"). ### Returns - **Promise<Channel>** - The newly-created channel. ``` -------------------------------- ### createGroup Source: https://revolt.js.org/classes/ChannelCollection.html Creates a new group channel with the specified name and list of users. ```APIDOC ## createGroup(name: string, users: (string | User)[]): Promise<Channel> ### Description Creates a new group channel with the specified name and list of users. ### Parameters - **name** (string) - Required - Group name - **users** ((string | User)[]) - Required - Users to add ### Returns - **Promise<Channel>** - The newly-created group ``` -------------------------------- ### send Source: https://revolt.js.org/classes/EventClient.html Sends an event to the server. ```APIDOC ## send(event) ### Description Sends an event to the server. ### Parameters - **event** (EventProtocol<T>["client"]) - Required - The event object to send. ``` -------------------------------- ### pardon() Source: https://revolt.js.org/classes/ServerBan.html Removes the current server ban. ```APIDOC ## pardon() ### Description Removes this server ban. ### Returns - **Promise<void>** - A promise that resolves when the ban has been successfully removed. ``` -------------------------------- ### size() Source: https://revolt.js.org/classes/ChannelCollection.html Returns the number of stored objects in the collection. ```APIDOC ## size() ### Description Returns the number of stored objects. ### Returns - **number** - The size of the collection. ``` -------------------------------- ### map<O>(cb: (value: ChannelWebhook, key: string) => O): O[] Source: https://revolt.js.org/classes/ChannelWebhookCollection.html Maps the collection values using a provided callback function. ```APIDOC ## map<O>(cb: (value: ChannelWebhook, key: string) => O) ### Description Applies a callback function to every webhook in the collection and returns an array of the results. ### Parameters - **cb** (function) - Required - A callback function that receives the webhook value and its key. ### Returns - **O[]** - An array of mapped results. ``` -------------------------------- ### keys() Source: https://revolt.js.org/classes/ChannelCollection.html Returns an iterable of all keys in the collection. ```APIDOC ## keys() ### Description Returns an iterable of keys in the map. ### Returns - **IterableIterator<string>** - Iterable of keys. ``` -------------------------------- ### getOrCreate Source: https://revolt.js.org/classes/SessionCollection.html Retrieves an existing session or creates a new one if it does not exist. ```APIDOC ## getOrCreate ### Description Gets an existing session or creates a new one using the provided data. ### Signature `getOrCreate(id: string, data: { _id: string; name: string }): Session` ### Parameters - **id** (string) - Required - The ID of the session. - **data** (object) - Required - The data object containing _id and name. ``` -------------------------------- ### ack(skipRateLimiter, skipRequest, skipNextMarking) Source: https://revolt.js.org/classes/Message.html Acknowledge this message as read. ```APIDOC ## ack(skipRateLimiter?: boolean, skipRequest?: boolean, skipNextMarking?: boolean) ### Description Acknowledge this message as read. ### Parameters - **skipRateLimiter** (boolean) - Optional - Whether to skip the internal rate limiter - **skipRequest** (boolean) - Optional - For internal updates only - **skipNextMarking** (boolean) - Optional - For internal usage only ### Returns - **void** ### Requires - SavedMessages, DirectMessage, Group, TextChannel ``` -------------------------------- ### fetchMutual() Source: https://revolt.js.org/classes/User.html Retrieves mutual servers and users between the current user and the target user. ```APIDOC ## fetchMutual() ### Description Fetch the mutual connections of the current user and a target user. ### Returns - **Promise<{ servers: string[], users: string[] }>** - The mutual connections of the current user and a target user. ``` -------------------------------- ### Headers Property Source: https://revolt.js.org/interfaces/API.Options.html Optional additional headers to apply to requests. ```typescript headers?: Record<string, any> ``` -------------------------------- ### edit(data) Source: https://revolt.js.org/classes/Server.html Edit a server's configuration, including name, description, and system message settings. ```APIDOC ## edit(data) ### Description Edit a server's properties. You can update fields like name, description, banner, icon, and system message configurations. ### Parameters - **data** (object) - Required - The server update object. - **analytics** (boolean) - Optional - Whether analytics should be collected. - **banner** (string) - Optional - Attachment Id for banner. - **categories** (array) - Optional - Category structure for server. - **description** (string) - Optional - Server description. - **discoverable** (boolean) - Optional - Whether this server is public. - **flags** (number) - Optional - Bitfield of server flags. - **icon** (string) - Optional - Attachment Id for icon. - **name** (string) - Optional - Server name. - **remove** (array) - Optional - Fields to remove from server object. - **system_messages** (object) - Optional - System message configuration. ### Returns - **Promise<void>** ``` -------------------------------- ### size Source: https://revolt.js.org/classes/ServerMemberCollection.html Returns the number of stored objects in the collection. ```APIDOC ## size() ### Description Returns the number of stored objects in the collection. ``` -------------------------------- ### fetchEmojis() Source: https://revolt.js.org/classes/Server.html Fetch all custom emojis associated with the server. ```APIDOC ## fetchEmojis() ### Description Retrieves a list of server emoji. ### Returns - **Promise<Emoji[]>** ``` -------------------------------- ### size(): number Source: https://revolt.js.org/classes/ChannelWebhookCollection.html Returns the number of webhooks stored in the collection. ```APIDOC ## size() ### Description Returns the total count of webhook objects currently stored in the collection. ### Returns - **number** - The size of the collection. ``` -------------------------------- ### fetch(id: string) Source: https://revolt.js.org/classes/UserCollection.html Fetches a user by their unique ID. ```APIDOC ## fetch(id: string) ### Description Fetches a user by their unique ID. ### Parameters - **id** (string) - Required - The ID of the user to fetch. ### Returns - **Promise<User>** - A promise that resolves to the requested User object. ``` -------------------------------- ### keys(): IterableIterator<string> Source: https://revolt.js.org/classes/ChannelWebhookCollection.html Returns an iterator for all webhook IDs in the collection. ```APIDOC ## keys() ### Description Returns an iterable iterator containing all the keys (webhook IDs) stored in the collection. ### Returns - **IterableIterator<string>** - An iterator of IDs. ``` -------------------------------- ### fetchMessages Source: https://revolt.js.org/classes/Channel.html Fetch multiple messages from a channel. ```APIDOC ## fetchMessages(params?: Object) ### Description Fetch multiple messages from a channel. ### Parameters - **params** (Object) - Optional - Message fetching route data - **after** (string) - Optional - **before** (string) - Optional - **limit** (number) - Optional - **nearby** (string) - Optional - **sort** (string) - Optional - Relevance, Latest, or Oldest ### Returns - **Promise<Message[]>** - Messages ```