### Reactivity with Solid.js and revolt.js Client
Source: https://revolt.js.org/index
Illustrates how to integrate the revolt.js client with Solid.js for reactive UI updates. This example shows how to display the user's username dynamically within a Solid.js component.
```JavaScript
const client = new Client();
// initialise the client
function MyApp() {
return (
Your username is: {client.user?.username ?? "[logging in...]"}
);
}
```
--------------------------------
### Get Server Path (Server.path)
Source: https://revolt.js.org/classes/Server
Retrieves the absolute pathname to this server within the client.
```APIDOC
get path(): string
Returns: string
```
--------------------------------
### Basic Client Usage with revolt.js
Source: https://revolt.js.org/index
Demonstrates how to initialize the revolt.js client, log in, and handle message creation events to send a reply. It shows event listeners for 'ready' and 'messageCreate' events.
```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("..");
```
--------------------------------
### Get Server Owner (Server.owner)
Source: https://revolt.js.org/classes/Server
Retrieves the User object representing the owner of the server.
```APIDOC
get owner(): undefined | User
Returns: undefined | User
```
--------------------------------
### API Documentation for Session Management
Source: https://revolt.js.org/classes/Client
API documentation for the `useExistingSession` method, used to initialize the client with a pre-existing session.
```APIDOC
useExistingSession(session: PrivateSession): void
- Description: Uses an existing private session for authentication.
- Parameters:
- session: PrivateSession - The private session object to use.
- Returns: void
```
--------------------------------
### Server Class Constructor
Source: https://revolt.js.org/classes/Server
Initializes a new instance of the Server class, requiring a ServerCollection and an ID.
```APIDOC
constructor(collection: ServerCollection, id: string): Server
- Construct Server
- Parameters:
- collection: ServerCollection - Collection
- id: string - Id
- Returns: Server
- Defined in src/classes/Server.ts:51
```
--------------------------------
### Get Server Roles (Server.roles)
Source: https://revolt.js.org/classes/Server
Retrieves a ReactiveMap of roles associated with the server, mapped by their IDs.
```APIDOC
get roles(): ReactiveMap
Returns: ReactiveMap
```
--------------------------------
### Get User Permission (Server.permission)
Source: https://revolt.js.org/classes/Server
Retrieves the permission level the currently authenticated user has against this server.
```APIDOC
get permission(): number
Returns: number
```
--------------------------------
### ServerMemberCollection Class API Reference
Source: https://revolt.js.org/classes/ServerMemberCollection
Comprehensive API documentation for the `ServerMemberCollection` class in revolt.js, detailing its constructor, properties, and the `create` method for managing server members.
```APIDOC
Class: ServerMemberCollection
Collection of Server Members
Hierarchy: ClassCollection
Constructors:
constructor(client: Client): ServerMemberCollection
- Description: Create generic class collection
- Parameters:
- client: Client - Client instance
- Returns: ServerMemberCollection
- Inherited from: ClassCollection.constructor
- Defined in: src/collections/Collection.ts:239
Properties:
client: Client (Readonly)
- Inherited from: ClassCollection.client
- Defined in: src/collections/Collection.ts:233
getUnderlyingObject: (id: string) => HydratedServerMember (Readonly)
- Inherited from: ClassCollection.getUnderlyingObject
- Defined in: src/collections/Collection.ts:120
updateUnderlyingObject: SetStoreFunction> (Readonly)
- Inherited from: ClassCollection.updateUnderlyingObject
- Defined in: src/collections/Collection.ts:121
Methods:
create(id: string, type: "user" | "server" | "channel" | "bot" | "channelUnread" | "channelWebhook" | "emoji" | "message" | "serverMember" | "session", instance: ServerMember, context: unknown, data?: unknown): void
- Description: Create a new instance of an object
- Parameters:
- id: string - Id
- type: "user" | "server" | "channel" | "bot" | "channelUnread" | "channelWebhook" | "emoji" | "message" | "serverMember" | "session" - Type of object
- instance: ServerMember - Instance
- context: unknown - Context
- data?: unknown (Optional) - Data
- Returns: void
- Inherited from: ClassCollection.create
- Defined in: src/collections/Collection.ts:167
```
--------------------------------
### Get Server Owner ID (Server.ownerId)
Source: https://revolt.js.org/classes/Server
Retrieves the user ID of the server's owner.
```APIDOC
get ownerId(): string
Returns: string
```
--------------------------------
### API Documentation for File Uploads
Source: https://revolt.js.org/classes/Client
API documentation for the `uploadFile` method, used to upload files to the media server.
```APIDOC
uploadFile(tag: string, file: File, uploadUrl?: string): Promise
- Description: Uploads a file to the media server.
- Parameters:
- tag: string - A tag associated with the file.
- file: File - The file object to upload.
- uploadUrl?: string (Optional) - The media server upload route.
- Returns: Promise (A promise that resolves with the URL of the uploaded file)
```
--------------------------------
### Revolt.js Client connect Method
Source: https://revolt.js.org/classes/Client
Initiates a connection to the Revolt chat platform.
```APIDOC
connect(): void
- Connect to Revolt.
- Returns: void
- Defined in src/Client.ts:298
```
--------------------------------
### Get Ordered Roles (Server.orderedRoles)
Source: https://revolt.js.org/classes/Server
Retrieves an ordered array of roles with their IDs. Roles are ordered by their 'rank' property, where a smaller rank indicates higher priority.
```APIDOC
get orderedRoles(): { colour?: null | string; hoist?: boolean; id: string; name: string; permissions: { a: number; d: number }; rank?: number; }[]
Returns: { colour?: null | string; hoist?: boolean; id: string; name: string; permissions: { a: number; d: number }; rank?: number; }[]
```
--------------------------------
### Revolt.js Client Constructor
Source: https://revolt.js.org/classes/Client
Creates a new Revolt.js Client instance. It accepts optional client options and a comprehensive configuration object detailing the Revolt node's app, build, and enabled features.
```APIDOC
new Client(
options?: Partial,
configuration?: {
app: string;
build: {
commit_sha: string;
commit_timestamp: string;
origin_url: string;
semver: string;
timestamp: string;
};
features: {
autumn: { enabled: boolean; url: string };
captcha: { enabled: boolean; key: string };
email: boolean;
invite_only: boolean;
january: { enabled: boolean; url: string };
voso: { enabled: boolean; url: string; ws: string };
};
revolt: string;
vapid: string;
ws: string;
}
): Client
Description: Create Revolt.js Client
Parameters:
options: Partial (Optional)
Description: Client options.
configuration: object (Optional)
Description: Configuration for the Revolt node.
Properties:
app: string
Description: URL pointing to the client serving this node.
build: object
Description: Build information.
Properties:
commit_sha: string
Description: Commit Hash.
commit_timestamp: string
Description: Commit Timestamp.
origin_url: string
Description: Git Origin URL.
semver: string
Description: Git Semver.
timestamp: string
Description: Build Timestamp.
features: object
Description: Features enabled on this Revolt node.
Properties:
autumn: object
Description: File server service configuration.
Properties:
enabled: boolean
Description: Whether the service is enabled.
url: string
Description: URL pointing to the service.
captcha: object
Description: hCaptcha configuration.
Properties:
enabled: boolean
Description: Whether captcha is enabled.
key: string
Description: Client key used for solving captcha.
email: boolean
Description: Whether email verification is enabled.
invite_only: boolean
Description: Whether this server is invite only.
january: object
Description: Proxy service configuration.
Properties:
enabled: boolean
Description: Whether the service is enabled.
url: string
Description: URL pointing to the service.
voso: object
Description: Voice server configuration.
Properties:
enabled: boolean
Description: Whether voice is enabled.
url: string
Description: URL pointing to the voice API.
ws: string
Description: URL pointing to the voice WebSocket server.
revolt: string
Description: Revolt API Version.
vapid: string
Description: Web Push VAPID public key.
ws: string
Description: WebSocket URL.
Returns: Client
Description: The new Client instance.
```
--------------------------------
### Get Server System Messages Configuration (Server.systemMessages)
Source: https://revolt.js.org/classes/Server
Retrieves the configuration for system message channels, including channels for user banned, joined, kicked, and left events.
```APIDOC
get systemMessages(): undefined | null | {
user_banned?: null | string;
user_joined?: null | string;
user_kicked?: null | string;
user_left?: null | string;
}
Returns: undefined | null | {
user_banned?: null | string;
user_joined?: null | string;
user_kicked?: null | string;
user_left?: null | string;
}
Parameters:
user_banned?: null | string - ID of channel to send user banned messages in
user_joined?: null | string - ID of channel to send user join messages in
user_kicked?: null | string - ID of channel to send user kicked messages in
user_left?: null | string - ID of channel to send user left messages in
```
--------------------------------
### Get Ordered Channels (Server.orderedChannels)
Source: https://revolt.js.org/classes/Server
Retrieves an array of ordered categories, each containing its respective channels. Uncategorized channels are grouped under an 'id="default"' category.
```APIDOC
get orderedChannels(): (Omit<{ channels: string[]; id: string; title: string }, "channels"> & { channels: Channel[]; })[]
Returns: (Omit<{ channels: string[]; id: string; title: string }, "channels"> & { channels: Channel[]; })[]
```
--------------------------------
### API Documentation for Event Listener Management
Source: https://revolt.js.org/classes/Client
Comprehensive API documentation for managing event listeners, including removing listeners, setting maximum listener limits, and waiting for listener completion.
```APIDOC
removeListener(
eventName: K,
listener: Exclude, K, Events>["listener"], undefined,>,
): this
- Description: Removes a specific listener for the given event name.
- Parameters:
- eventName: K (Type: K extends (keyof AsyncEventEmitterPredefinedEvents) | (keyof Events)) - The name of the event to remove the listener from.
- listener: Exclude, K, Events>["listener"], undefined,> - The listener function to remove.
- Returns: this (The current instance for chaining)
removeListener(
eventName: K,
listener: Exclude, K, Events>["listener"], undefined,>,
): this
- Description: Removes a specific listener for the given event name (generic string/symbol overload).
- Parameters:
- eventName: K (Type: K extends string | symbol) - The name of the event to remove the listener from.
- listener: Exclude, K, Events>["listener"], undefined,> - The listener function to remove.
- Returns: this (The current instance for chaining)
setMaxListeners(n: number): this
- Description: Sets the maximum number of listeners that can be registered for an event.
- Parameters:
- n: number - The maximum number of listeners.
- Returns: this (The current instance for chaining)
waitForAllListenersToComplete(): Promise
- Description: Waits for all currently active listeners to complete their execution.
- Parameters: None
- Returns: Promise (A promise that resolves to true if all listeners completed, false otherwise)
```
--------------------------------
### Client
Source: https://revolt.js.org/hierarchy
Represents Revolt.js Clients, the main entry point for interacting with the API.
```APIDOC
Client:
Description: Represents Revolt.js Clients, the main entry point for interacting with the API.
```
--------------------------------
### Get Path Name Utility Function
Source: https://revolt.js.org/functions/API.getPathName
Retrieves the specific path name from a given path string. This function is defined within the Revolt API's TypeScript declaration files.
```APIDOC
getPathName(anyPath: string): undefined | string
- Description: Get the specific path name of any given path.
- Parameters:
- anyPath: string
Description: Any path
- Returns: undefined | string
Description: Specific path
- Source: node_modules/.pnpm/revolt-api@0.8.8/node_modules/revolt-api/lib/index.d.ts:18
```
--------------------------------
### ServerInvite Class API Reference
Source: https://revolt.js.org/classes/ServerInvite
Comprehensive API documentation for the ServerInvite class, including its constructor, properties, and accessors. This class represents an invitation to a Revolt server.
```APIDOC
Class ServerInvite:
Description: Server Invite
Hierarchy: Inherits from ChannelInvite
Defined in: src/classes/Invite.ts:50
Constructors:
constructor:
Signature: new ServerInvite(client: Client, invite: ( | { _id: string; channel: string; creator: string; server: string; type: "Server"; } | { _id: string; channel: string; creator: string; type: "Group" }) & { type: "Server" }): ServerInvite
Description: Construct Server Invite
Parameters:
client: Client
Description: Client
invite: ( | { _id: string; channel: string; creator: string; server: string; type: "Server"; } | { _id: string; channel: string; creator: string; type: "Group" }) & { type: "Server" }
Description: Invite
Properties:
_id: string
Description: Invite code
channel: string
Description: Id of the server channel this invite points to (for Server type) or Id of the group channel this invite points to (for Group type)
creator: string
Description: Id of user who created this invite
server: string
Description: Id of the server this invite points to (only for Server type)
type: "Server" | "Group"
Description: Type of invite (Server or Group), constrained to "Server" by intersection.
Returns: ServerInvite
Overrides: ChannelInvite.constructor
Defined in: src/classes/Invite.ts:61
Properties:
channelId: string
Readonly: true
Defined in: src/classes/Invite.ts:54
client?: Client
Protected: true
Optional: true
Inherited from: ChannelInvite.client
Defined in: src/classes/Invite.ts:13
creatorId: string
Readonly: true
Defined in: src/classes/Invite.ts:52
id: string
Readonly: true
Defined in: src/classes/Invite.ts:51
serverId: string
Readonly: true
Defined in: src/classes/Invite.ts:53
type: "Group" | "Server" | "None"
Readonly: true
Inherited from: ChannelInvite.type
Defined in: src/classes/Invite.ts:14
Accessors:
channel: get channel(): undefined | Channel
Description: Channel this invite points to
Defined in: src/classes/Invite.ts:87
Methods:
delete: (Details not provided in text)
from: (Details not provided in text)
```
--------------------------------
### Revolt.js ServerMember Class API Reference
Source: https://revolt.js.org/classes/ServerMember
Comprehensive API documentation for the `ServerMember` class in Revolt.js, including methods for checking permissions, managing members, and utility functions.
```APIDOC
getPermissions:
Signature: getPermissions(target: Channel | Server): number
Description: Get the permissions that this member has against a certain object
Parameters:
target: Channel | Server - Target object to check permissions against
Returns: number - Permissions that this member has
hasPermission:
Signature: hasPermission(target: Channel | Server, ...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "MentionEveryone" | "MentionRoles" | "GrantAllSafe")[]): boolean
Description: Check whether a member has a certain permission against a certain object
Parameters:
target: Channel | Server - Target object to check permissions against
...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "MentionEveryone" | "MentionRoles" | "GrantAllSafe")[] - Permission names to check for
Returns: boolean - Whether the member has this permission
inferiorTo:
Signature: inferiorTo(target: ServerMember): boolean
Description: Checks whether the target member has a higher rank than this member.
Parameters:
target: ServerMember - The member to compare against
Returns: boolean - Whether this member is inferior to the target
kick:
Signature: kick(): Promise
Description: Kick this member from the server
Returns: Promise
toString:
Signature: toString(): string
Description: Convert to string
Returns: string - String
```
--------------------------------
### Collection Manipulation Methods (keys, map, size, toList, values) in Revolt.js
Source: https://revolt.js.org/classes/ServerCollection
These methods provide standard collection functionalities for iterating over elements, transforming them, getting the size, or converting to a list. They are inherited from `ClassCollection`.
```APIDOC
keys(): IterableIterator
- Description: Iterable of keys in the map
- Returns: IterableIterator (Iterable)
map(cb: (value: Server, key: string) => O): O[]
- Description: Map the collection using a given callback
- Type Parameters:
- O
- Parameters:
- cb: (value: Server, key: string) => O (Callback)
- Returns: O[]
size(): number
- Description: Number of stored objects
- Returns: number (Size)
toList(): Server[]
- Description: List of values in the map
- Returns: Server[] (List)
values(): IterableIterator
- Description: Iterable of values in the map
- Returns: IterableIterator (Iterable)
```
--------------------------------
### Get Raw Event Listeners (rawListeners) API
Source: https://revolt.js.org/classes/EventClient
Retrieves a list of raw listeners for a specified event name from the event emitter. This method is inherited from `AsyncEventEmitter` and supports different event name types.
```APIDOC
rawListeners<
K extends (keyof AsyncEventEmitterPredefinedEvents) | (keyof Events>)
>(
eventName: K
): InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter>>,
K,
Events>
>[]
Type Parameters:
K: Extends `keyof AsyncEventEmitterPredefinedEvents` or `keyof Events>`
Parameters:
eventName: K - The name of the event to get listeners for.
Returns:
An array of internal listener functions for the specified event.
rawListeners<
K extends string | symbol
>(
eventName: K
): InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter>>,
K,
Events>
>[]
Type Parameters:
K: Extends `string` or `symbol`
Parameters:
eventName: K - The name of the event to get listeners for.
Returns:
An array of internal listener functions for the specified event.
```
--------------------------------
### Channel Class API Reference
Source: https://revolt.js.org/classes/Channel
Detailed API documentation for the `Channel` class, including its constructor, read-only properties, and various accessors for channel state and metadata.
```APIDOC
Class Channel:
Defined in src/classes/Channel.ts:36
Constructor:
new Channel(collection: ChannelCollection, id: string): Channel
Description: Construct Channel
Parameters:
collection: ChannelCollection - Collection
id: string - Channel Id
Returns: Channel
Properties:
Readonly id: string
Defined in src/classes/Channel.ts:38
Accessors:
$exists(): boolean
Description: Whether this object exists
Returns: boolean
Defined in src/classes/Channel.ts:61
active(): boolean
Description: Whether the conversation is active
Returns: boolean
Defined in src/classes/Channel.ts:132
animatedIconURL(): undefined | string
Description: URL to the animated channel icon
Returns: undefined | string
Defined in src/classes/Channel.ts:326
createdAt(): Date
Description: Time when this server was created
Returns: Date
Defined in src/classes/Channel.ts:68
defaultPermissions(): undefined | { a: number; d: number }
Description: Default permissions for this server channel
Returns: undefined | { a: number; d: number }
Defined in src/classes/Channel.ts:237
```
--------------------------------
### User Class Constructor
Source: https://revolt.js.org/classes/User
Defines how to instantiate a new User object, requiring a UserCollection and a user ID.
```APIDOC
constructor(collection: UserCollection, id: string): User
- Construct User
- Parameters:
- collection: UserCollection
Collection
- id: string
Id
- Returns: User
```
--------------------------------
### Get Listener Count for AsyncEventEmitter Events
Source: https://revolt.js.org/classes/Client
The `listenerCount` static method returns the number of listeners for a specified event on a given AsyncEventEmitter instance. It supports both generic and untyped event names.
```APIDOC
listenerCount<
EventMap extends {},
EventName extends PropertyKey = (keyof AsyncEventEmitterPredefinedEvents) | keyof EventMap,
>(
emitter: AsyncEventEmitter,
eventName: (keyof AsyncEventEmitterPredefinedEvents) | EventName,
): number
listenerCount(
emitter: AsyncEventEmitter,
eventName: string | symbol,
): number
Parameters:
emitter: AsyncEventEmitter - The event emitter instance.
eventName: (keyof AsyncEventEmitterPredefinedEvents) | EventName | string | symbol - The name of the event to count listeners for.
Returns:
number - The number of listeners for the specified event.
```
--------------------------------
### Revolt.js Get or Create Message API
Source: https://revolt.js.org/classes/MessageCollection
API documentation for retrieving or creating a Revolt.js message. This function takes a message ID and optional message data to either fetch an existing message or create a new one, returning the Message object.
```APIDOC
Function: Get or create message
Signature:
(id: string, data: object, isNew?: boolean): Message
Description:
Retrieves an existing message or creates a new one.
Parameters:
id: string
Description: The unique identifier of the message.
data: object
Description: The message data object for creation or update. (Structure incomplete in provided text)
isNew: boolean (optional)
Description: Flag indicating if the message is new.
Returns:
Message: The retrieved or newly created message object.
```
--------------------------------
### PublicChannelInvite Static from Method API Reference
Source: https://revolt.js.org/classes/ServerPublicInvite
Detailed API documentation for the `Static from` method, including its parameters, their types, and the comprehensive structure of the `invite` object for both 'Server' and 'Group' types, along with the return type.
```APIDOC
Static from(
client: Client,
invite: ServerInvite | GroupInvite
): PublicChannelInvite
Description: Create an Invite from an API Invite Response.
Parameters:
client: Client
Description: The client instance.
invite: ServerInvite | GroupInvite
Description: The raw API invite response object, which can be either a ServerInvite or a GroupInvite.
ServerInvite (invite type "Server") properties:
channel_description?: null | string - Optional description of the channel.
channel_id: string - The ID of the channel.
channel_name: string - The name of the channel.
code: string - The invite code.
member_count: number - The number of members in the server.
server_banner?: null | Attachment - Optional server banner attachment details.
server_flags?: null | number - Optional server flags.
server_icon?: null | Attachment - Optional server icon attachment details.
server_id: string - The ID of the server.
server_name: string - The name of the server.
type: "Server" - Indicates the invite is for a server.
user_avatar?: null | Attachment - Optional user avatar attachment details.
user_name: string - The user's name.
GroupInvite (invite type "Group") properties:
channel_description?: null | string - Optional description of the channel.
channel_id: string - The ID of the channel.
channel_name: string - The name of the channel.
code: string - The invite code.
type: "Group" - Indicates the invite is for a group.
user_avatar?: null | Attachment - Optional user avatar attachment details.
user_name: string - The user's name.
Attachment (common type for banner/icon/avatar) properties:
_id: string - Unique ID of the attachment.
content_type: string - MIME type of the content (e.g., "image/png").
deleted?: null | boolean - Indicates if the attachment is deleted.
filename: string - Original filename.
message_id?: null | string - Optional message ID associated with the attachment.
metadata: FileMetadata | TextMetadata | ImageMetadata | VideoMetadata | AudioMetadata - Metadata describing the file type.
object_id?: null | string - Optional object ID.
reported?: null | boolean - Indicates if the attachment has been reported.
server_id?: null | string - Optional server ID associated with the attachment.
size: number - Size of the file in bytes.
tag: string - Tag for the attachment.
user_id?: null | string - Optional user ID who uploaded the attachment.
Returns: PublicChannelInvite
Description: A new instance of PublicChannelInvite, representing the parsed invite.
```
--------------------------------
### Get or Return Partial Server Member (Revolt.js API)
Source: https://revolt.js.org/classes/ServerMemberCollection
This method attempts to retrieve a server member based on the provided ID. If the member is not found, it returns undefined, allowing for handling cases where a full member object might not be available or necessary.
```APIDOC
getOrPartial(
id: { server: string; user: string }
): undefined | ServerMember
Parameters:
id: { server: string; user: string }
Description: The ID object containing server and user IDs.
- server: string
Description: The ID of the server.
- user: string
Description: The ID of the user.
Returns:
undefined | ServerMember: The ServerMember object if found, otherwise undefined.
```
--------------------------------
### Revolt.js Client Configuration Object Structure
Source: https://revolt.js.org/classes/Client
The `configuration` property defines the comprehensive structure of the client's runtime configuration. It includes details about the application, build information (commit SHA, timestamp, version), and feature flags for various Revolt services such as Autumn, Captcha, Email, January, and Voso, along with core Revolt and VAPID settings.
```APIDOC
configuration:
| undefined
| {
app: string;
build: {
commit_sha: string;
commit_timestamp: string;
origin_url: string;
semver: string;
timestamp: string;
};
features: {
autumn: { enabled: boolean; url: string };
captcha: { enabled: boolean; key: string };
email: boolean;
invite_only: boolean;
january: { enabled: boolean; url: string };
voso: { enabled: boolean; url: string; ws: string };
};
revolt: string;
vapid: string;
ws: string;
}
```
--------------------------------
### ServerMember Class API Reference
Source: https://revolt.js.org/classes/ServerMember
Detailed API documentation for the `ServerMember` class, including its constructor, read-only properties, and various accessors for retrieving member-related information like avatar URLs, display name, and hoisted role.
```APIDOC
Class ServerMember
Constructors:
constructor(collection: ServerMemberCollection, id: { server: string; user: string }): ServerMember
Description: Construct Server Member
Parameters:
collection: ServerMemberCollection - Collection
id: { server: string; user: string } - Id
server: string - Server Id
user: string - User Id
Returns: ServerMember
Properties:
id: { server: string; user: string } (Readonly)
Type Declaration:
server: string - Server Id
user: string - User Id
Accessors:
$exists: get $exists(): boolean
Description: Whether this object exists
Returns: boolean
animatedAvatarURL: get animatedAvatarURL(): undefined | string
Description: URL to the member's animated avatar
Returns: undefined | string
avatar: get avatar(): undefined | File
Description: Avatar
Returns: undefined | File
avatarURL: get avatarURL(): undefined | string
Description: URL to the member's avatar
Returns: undefined | string
displayName: get displayName(): undefined | string
Description: Display name
Returns: undefined | string
hoistedRole: get hoistedRole(): null | Partial<{
colour?: null | string;
hoist?: boolean;
name: string;
permissions: { a: number; d: number };
rank?: number;
}>
Description: Member's currently hoisted role.
Returns: null | Partial<{
colour?: null | string;
hoist?: boolean;
name: string;
permissions: { a: number; d: number };
rank?: number;
}>
```
--------------------------------
### Get Raw Event Listeners (TypeScript APIDOC)
Source: https://revolt.js.org/classes/Client
Retrieves an array of raw listeners for a specified event. This method is inherited from `AsyncEventEmitter` and supports different event name types, including predefined events or generic string/symbol event names.
```APIDOC
rawListeners(
eventName: K
): InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter,
K,
Events
>[]
- Type Parameters:
- K: Extends `keyof AsyncEventEmitterPredefinedEvents` or `keyof Events`.
- Parameters:
- eventName: The name of the event to get listeners for.
- Returns: An array of internal listener functions for the specified event.
rawListeners(
eventName: K
): InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter,
K,
Events
>[]
- Type Parameters:
- K: Extends `string` or `symbol`.
- Parameters:
- eventName: The name of the event to get listeners for.
- Returns: An array of internal listener functions for the specified event.
```
--------------------------------
### AsyncEventEmitter Core Methods
Source: https://revolt.js.org/classes/Client
Comprehensive API documentation for the core event emission and listener management methods, including emitting events, retrieving event names, managing listener counts, and accessing listener functions. These methods are inherited from the AsyncEventEmitter class.
```APIDOC
AsyncEventEmitter Methods:
emit(eventName: K, ...args: InternalGetAsyncEventEmitterEventParameters, K>): boolean
emit(eventName: K, ...args: InternalGetAsyncEventEmitterEventParameters, K>): boolean
- Emits an event with the given name and arguments, calling all registered listeners.
- Type Parameters:
- K: Extends event name types (predefined or custom string/symbol).
- Parameters:
- eventName: The name of the event to emit.
- ...args: Arguments to pass to the event listeners.
- Returns: boolean (true if event had listeners, false otherwise).
eventNames(): (string | symbol)[] & (keyof AsyncEventEmitterPredefinedEvents)[] & (keyof Events)[]
- Returns an array of all registered event names.
- Returns: An array containing all event names for which listeners are registered.
getMaxListeners(): number
- Returns the current maximum number of listeners that can be registered for an event.
- Returns: number (the maximum number of listeners).
listenerCount(eventName: K): number
listenerCount(eventName: string | symbol): number
- Returns the number of listeners for a given event name.
- Parameters:
- eventName: The name of the event.
- Returns: number (the count of listeners).
listeners(eventName: K): Exclude, K, Events>["listener"], undefined>[]
listeners(eventName: K): Exclude, K, Events>["listener"], undefined>[]
- Returns a copy of the array of listeners for the specified event name.
- Parameters:
- eventName: The name of the event.
- Returns: An array of listener functions.
```
--------------------------------
### Get or Create Server Member (Revolt.js API)
Source: https://revolt.js.org/classes/ServerMemberCollection
This method retrieves an existing server member or creates a new one if it doesn't exist, based on the provided ID and data. It's useful for ensuring a member's presence in the collection with up-to-date information.
```APIDOC
getOrCreate(
id: { server: string; user: string },
data: {
_id: { server: string; user: string };
avatar?: null | {
_id: string;
content_type: string;
deleted?: null | boolean;
filename: string;
message_id?: null | string;
metadata: { type: "File" } | { type: "Text" } | { height: number; type: "Image"; width: number } | { height: number; type: "Video"; width: number } | { type: "Audio" };
object_id?: null | string;
reported?: null | boolean;
server_id?: null | string;
size: number;
tag: string;
user_id?: null | string;
};
joined_at: string;
nickname?: null | string;
roles?: string[];
timeout?: null | string;
}
): ServerMember
Parameters:
id: { server: string; user: string }
Description: The ID object containing server and user IDs.
- server: string
Description: The ID of the server.
- user: string
Description: The ID of the user.
data: { ... }
Description: The data to use for creating or updating the server member.
- _id: { server: string; user: string }
Description: Unique identifier for the member, composed of server and user IDs.
- server: string
Description: The server ID.
- user: string
Description: The user ID.
- avatar?: null | { ... }
Description: Optional avatar attachment details for the member.
- joined_at: string
Description: The timestamp when the user joined the server.
- nickname?: null | string
Description: Optional nickname for the member.
- roles?: string[]
Description: Optional list of roles assigned to the member.
- timeout?: null | string
Description: Optional timestamp indicating when the member is timed out until.
Returns:
ServerMember: The created or retrieved ServerMember object.
```
--------------------------------
### Create Channel API Method
Source: https://revolt.js.org/classes/Server
Creates a new channel within the server. Supports specifying channel name, description, NSFW status, and type (Text or Voice).
```APIDOC
createChannel(
data: {
description?: null | string;
name: string;
nsfw?: null | boolean;
type?: "Text" | "Voice";
}
): Promise
Description: Create a channel
Parameters:
data: {
description?: null | string;
name: string;
nsfw?: null | boolean;
type?: "Text" | "Voice";
}
Description: Channel creation route data.
description?: null | string
Description: Channel description.
name: string
Description: Channel name.
nsfw?: null | boolean
Description: Whether this channel is age restricted.
type?: "Text" | "Voice"
Description: Channel type. Default: Text.
Returns: Promise
Description: A promise that resolves with the newly-created channel object.
```
--------------------------------
### revolt.js Collection Utility Methods API
Source: https://revolt.js.org/classes/SessionCollection
Comprehensive API documentation for common utility methods found on collection objects within the revolt.js library. These methods provide ways to access keys, values, map over elements, get the collection size, and convert the collection to a list.
```APIDOC
keys(): IterableIterator
Description: Iterable of keys in the map
Returns: IterableIterator
map(cb: (value: Session, key: string) => O): O[]
Description: Map the collection using a given callback
Parameters:
cb: (value: Session, key: string) => O - Callback function to apply to each element.
Returns: O[] - An array of the mapped values.
size(): number
Description: Number of stored objects in the collection.
Returns: number - The current size of the collection.
toList(): Session[]
Description: List of values in the map.
Returns: Session[] - An array containing all values in the collection.
values(): IterableIterator
Description: Iterable of values in the map.
Returns: IterableIterator
```
--------------------------------
### Retrieve Event Listeners from AsyncEventEmitter
Source: https://revolt.js.org/classes/EventClient
The `listeners` method is used to get an array of all listeners currently registered for the specified `eventName`. It has two overloads to accommodate different types of event keys: one for predefined event keys or keys from a specific event protocol, and another for generic string or symbol event keys. The method returns an array of listener functions.
```APIDOC
listeners>)>(
eventName: K
): Exclude<
InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter>>,
K,
Events>
>["listener"],
undefined,
>[]
Type Parameters:
K: Extends either predefined event keys or keys from a specific event protocol (Events>).
Parameters:
eventName: K - The name of the event for which to retrieve listeners.
Returns:
Exclude>>,
K, Events>>["listener"], undefined,>[] - An array of listener functions registered for the event, or an empty array if no listeners are found. The return type excludes 'undefined' to ensure only valid listener functions are returned.
listeners(
eventName: K
): Exclude<
InternalAsyncEventEmitterInternalListenerForEvent<
AsyncEventEmitter>>,
K,
Events>
>["listener"],
undefined,
>[]
Type Parameters:
K: Extends string | symbol, allowing for generic event names.
Parameters:
eventName: K - The name of the event for which to retrieve listeners.
Returns:
Exclude>>,
K, Events>>["listener"], undefined,>[] - An array of listener functions registered for the event, or an empty array if no listeners are found. The return type excludes 'undefined' to ensure only valid listener functions are returned.
Inherited from AsyncEventEmitter.listeners
```
--------------------------------
### ClassCollection Constructor
Source: https://revolt.js.org/classes/ClassCollection
Initializes a new instance of the `ClassCollection` with a client. This generic class collection is backed by a store and extends `StoreCollection`.
```APIDOC
constructor(client: Client): ClassCollection
- Description: Create generic class collection
- Type Parameters: T, V
- Parameters:
- client: Client (The client instance for the collection)
- Returns: ClassCollection
- Overrides: StoreCollection.constructor
- Defined in: src/collections/Collection.ts:239
```
--------------------------------
### Revolt.js Client Bot Login API
Source: https://revolt.js.org/classes/Client
Logs into the Revolt service as a bot using a provided token.
```APIDOC
loginBot(token: string): Promise
Description: Log in as a bot
Parameters:
token: string
Description: Bot token
Returns: Promise
```