revbot.js 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +33 -17
- package/dist/index.d.ts +33 -17
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -194,7 +194,6 @@ declare class CDNClient {
|
|
|
194
194
|
* POST request.
|
|
195
195
|
* @param url The URL for the request.
|
|
196
196
|
* @param data The request body.
|
|
197
|
-
* @param query Query parameters (if applicable).
|
|
198
197
|
* @returns The API response.
|
|
199
198
|
*/
|
|
200
199
|
post<T>(url: string, data: FormData): Promise<T>;
|
|
@@ -1669,9 +1668,10 @@ declare class NotesChannel extends Channel implements TextBasedChannel {
|
|
|
1669
1668
|
get user(): User;
|
|
1670
1669
|
}
|
|
1671
1670
|
|
|
1672
|
-
type APIServerChannel
|
|
1671
|
+
type APIServerChannel = Extract<Channel$1, {
|
|
1673
1672
|
channel_type: "TextChannel" | "VoiceChannel";
|
|
1674
1673
|
}>;
|
|
1674
|
+
|
|
1675
1675
|
interface Overwrite {
|
|
1676
1676
|
allow: FullPermissions;
|
|
1677
1677
|
deny: FullPermissions;
|
|
@@ -1700,7 +1700,7 @@ declare class ServerChannel extends Channel {
|
|
|
1700
1700
|
* @param {client} client - The client instance.
|
|
1701
1701
|
* @param {APIServerChannel} data - The raw data for the server channel from the API.
|
|
1702
1702
|
*/
|
|
1703
|
-
constructor(client: client, data: APIServerChannel
|
|
1703
|
+
constructor(client: client, data: APIServerChannel);
|
|
1704
1704
|
/**
|
|
1705
1705
|
* Updates the server channel instance with new data from the API.
|
|
1706
1706
|
*
|
|
@@ -1709,7 +1709,7 @@ declare class ServerChannel extends Channel {
|
|
|
1709
1709
|
* @returns {this} The updated server channel instance.
|
|
1710
1710
|
* @protected
|
|
1711
1711
|
*/
|
|
1712
|
-
protected _patch(data: APIServerChannel
|
|
1712
|
+
protected _patch(data: APIServerChannel, clear?: FieldsChannel[]): this;
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Creates an invite for the server channel.
|
|
1715
1715
|
*
|
|
@@ -2033,6 +2033,7 @@ declare class Emoji extends Base {
|
|
|
2033
2033
|
|
|
2034
2034
|
type UserResolvable = User | User$1 | MessageStruct | string;
|
|
2035
2035
|
declare class UserManager extends BaseManager<User, User$1> {
|
|
2036
|
+
/** @private */
|
|
2036
2037
|
holds: typeof User;
|
|
2037
2038
|
/**
|
|
2038
2039
|
*
|
|
@@ -2081,10 +2082,12 @@ declare class ClientUser extends User {
|
|
|
2081
2082
|
* ```
|
|
2082
2083
|
*/
|
|
2083
2084
|
setUsername(username: string, password?: string): Promise<void>;
|
|
2085
|
+
setStatus(text?: string | null): Promise<void>;
|
|
2086
|
+
setStatus(presence?: Status): Promise<void>;
|
|
2084
2087
|
/**
|
|
2085
2088
|
* Updates the status of the client user.
|
|
2086
2089
|
*
|
|
2087
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
2090
|
+
* @param {string | null} [text] - The status text to set, or `null` to clear the status.
|
|
2088
2091
|
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
2089
2092
|
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
2090
2093
|
*
|
|
@@ -2093,14 +2096,13 @@ declare class ClientUser extends User {
|
|
|
2093
2096
|
* await clientUser.setStatus("Available", "Online");
|
|
2094
2097
|
* ```
|
|
2095
2098
|
*/
|
|
2096
|
-
setStatus(text?: string | null): Promise<void>;
|
|
2097
|
-
setStatus(presence?: Status): Promise<void>;
|
|
2098
2099
|
setStatus(text?: string | null, presence?: keyof typeof Status): Promise<void>;
|
|
2099
2100
|
}
|
|
2100
2101
|
|
|
2101
2102
|
/**
|
|
2102
2103
|
* Represents the base class for all event handlers.
|
|
2103
2104
|
* All event handlers must extend this class and implement the `handle` method.
|
|
2105
|
+
* @private
|
|
2104
2106
|
*/
|
|
2105
2107
|
declare abstract class Event {
|
|
2106
2108
|
protected readonly client: client;
|
|
@@ -2122,6 +2124,8 @@ declare abstract class Event {
|
|
|
2122
2124
|
|
|
2123
2125
|
/**
|
|
2124
2126
|
* Manages the registration and retrieval of events for the client.
|
|
2127
|
+
* @private
|
|
2128
|
+
* @extends Event
|
|
2125
2129
|
*/
|
|
2126
2130
|
declare class EventManager {
|
|
2127
2131
|
#private;
|
|
@@ -2332,14 +2336,18 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2332
2336
|
readonly cache: Map<string, Holds>;
|
|
2333
2337
|
/** Instance level max size (can be changed per manager instance). */
|
|
2334
2338
|
protected maxSize: number;
|
|
2339
|
+
/** @private */
|
|
2335
2340
|
Holds: any;
|
|
2336
2341
|
constructor(client: client, maxSize?: number);
|
|
2337
2342
|
/**
|
|
2338
2343
|
* Adds a raw object to the cache, constructing the holdable class.
|
|
2339
2344
|
* Automatically evicts oldest entries if the max size is exceeded.
|
|
2345
|
+
* @private
|
|
2340
2346
|
*/
|
|
2341
2347
|
_add(raw: R): Holds;
|
|
2342
|
-
/** Remove an entry by id.
|
|
2348
|
+
/** Remove an entry by id.
|
|
2349
|
+
* @private
|
|
2350
|
+
*/
|
|
2343
2351
|
_remove(id: string): void;
|
|
2344
2352
|
/** Adjust the maximum size for this manager at runtime. */
|
|
2345
2353
|
setMaxSize(size: number): void;
|
|
@@ -2355,7 +2363,9 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2355
2363
|
|
|
2356
2364
|
type ChannelResolvable = Channel | Channel$1 | string;
|
|
2357
2365
|
declare class ChannelManager extends BaseManager<Channel, Channel$1> {
|
|
2366
|
+
/** @private */
|
|
2358
2367
|
holds: null;
|
|
2368
|
+
/** @private */
|
|
2359
2369
|
_add(data: Channel$1): Channel;
|
|
2360
2370
|
_remove(id: string): void;
|
|
2361
2371
|
/**
|
|
@@ -2395,7 +2405,9 @@ interface EditServerOptions {
|
|
|
2395
2405
|
description?: string;
|
|
2396
2406
|
}
|
|
2397
2407
|
declare class ServerManager extends BaseManager<Server, Server$1> {
|
|
2408
|
+
/** @private */
|
|
2398
2409
|
readonly holds: typeof Server;
|
|
2410
|
+
/** @private */
|
|
2399
2411
|
_remove(id: string): void;
|
|
2400
2412
|
/**
|
|
2401
2413
|
* edits a server
|
|
@@ -2449,6 +2461,7 @@ interface MessageQueryOptions {
|
|
|
2449
2461
|
}
|
|
2450
2462
|
declare class MessageManager extends BaseManager<MessageStruct, Message> {
|
|
2451
2463
|
protected readonly channel: Channel;
|
|
2464
|
+
/** @private */
|
|
2452
2465
|
holds: typeof MessageStruct;
|
|
2453
2466
|
constructor(channel: Channel, maxSize?: number);
|
|
2454
2467
|
/**
|
|
@@ -2540,8 +2553,10 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2540
2553
|
id: string;
|
|
2541
2554
|
}> {
|
|
2542
2555
|
protected readonly server: Server;
|
|
2556
|
+
/** @private */
|
|
2543
2557
|
holds: typeof Role;
|
|
2544
2558
|
constructor(server: Server);
|
|
2559
|
+
/** @private */
|
|
2545
2560
|
_add(data: Role$1 & {
|
|
2546
2561
|
id: string;
|
|
2547
2562
|
}): Role;
|
|
@@ -2573,9 +2588,6 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2573
2588
|
edit(role: RoleResolvable, data: editableRole): Promise<Role>;
|
|
2574
2589
|
}
|
|
2575
2590
|
|
|
2576
|
-
type APIServerChannel = Extract<Channel$1, {
|
|
2577
|
-
channel_type: "TextChannel" | "VoiceChannel";
|
|
2578
|
-
}>;
|
|
2579
2591
|
type ServerChannelResolvable = ServerChannel | APIServerChannel | string;
|
|
2580
2592
|
interface CreateChannelOptions {
|
|
2581
2593
|
name: string;
|
|
@@ -2584,15 +2596,18 @@ interface CreateChannelOptions {
|
|
|
2584
2596
|
}
|
|
2585
2597
|
declare class ServerChannelManager extends BaseManager<ServerChannel> {
|
|
2586
2598
|
protected readonly server: Server;
|
|
2599
|
+
/** @private */
|
|
2587
2600
|
holds: typeof ServerChannel;
|
|
2588
2601
|
constructor(server: Server);
|
|
2602
|
+
/** @private */
|
|
2589
2603
|
_add(data: APIServerChannel): ServerChannel;
|
|
2590
2604
|
/**
|
|
2591
|
-
*
|
|
2592
|
-
* @param
|
|
2593
|
-
* @param
|
|
2594
|
-
* @param
|
|
2595
|
-
* @
|
|
2605
|
+
* Creates a new channel in the server.
|
|
2606
|
+
* @param options - Options for creating the channel.
|
|
2607
|
+
* @param options.name - The name of the channel to create.
|
|
2608
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
2609
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
2610
|
+
* @returns A promise that resolves to the created channel.
|
|
2596
2611
|
*/
|
|
2597
2612
|
create({ name, type, description, }: CreateChannelOptions): Promise<ServerChannel>;
|
|
2598
2613
|
/**
|
|
@@ -2615,6 +2630,7 @@ interface EditServerMemberOptions {
|
|
|
2615
2630
|
}
|
|
2616
2631
|
declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
2617
2632
|
protected readonly server: Server;
|
|
2633
|
+
/** @private */
|
|
2618
2634
|
holds: typeof ServerMember;
|
|
2619
2635
|
constructor(server: Server);
|
|
2620
2636
|
/**
|
|
@@ -2661,4 +2677,4 @@ declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
|
2661
2677
|
resolveId(member: ServerMemberResolvable): string | null;
|
|
2662
2678
|
}
|
|
2663
2679
|
|
|
2664
|
-
export { Attachment, type BadgeString, Badges, type BadgesResolvable, Base, BaseManager, BitField, type BitFieldResolvable, Category, Channel, ChannelManager, ChannelPermissions, type ChannelPermissionsResolvable, type ChannelPermissionsString, type ChannelResolvable, ChannelTypes, type CreateChannelOptions, DEFAULT_CLIENT_OPTIONS, DEFAULT_PERMISSION_DM, DMChannel, type EditServerMemberOptions, type EditServerOptions, type Embed, type EmbedImage, type EmbedSpecial, type EmbedVideo, Emoji, Events, FullPermissions, GroupChannel, Invite, Mentions, type MessageEditOptions, MessageEmbed, MessageManager, type MessageOptions, type MessageQueryOptions, type MessageReply, type MessageResolvable, type MessageSearchOptions, MessageStruct, NotesChannel, type Overwrite, Presence, Role, RoleManager, type RoleResolvable, SYSTEM_USER_ID, Server, ServerChannel, ServerChannelManager, type ServerChannelResolvable, ServerManager, ServerMember, ServerMemberManager, type ServerMemberResolvable, ServerPermissions, type ServerPermissionsResolvable, type ServerPermissionsString, type ServerResolvable, Status, TextChannel, UUID, User, UserManager, UserPermissions, type UserPermissionsResolvable, type UserPermissionsString, type UserResolvable, VoiceChannel, WSEvents, apiUrl, cdnUrl, client, wsUrl };
|
|
2680
|
+
export { Attachment, type BadgeString, Badges, type BadgesResolvable, Base, BaseManager, BitField, type BitFieldResolvable, Category, Channel, ChannelManager, ChannelPermissions, type ChannelPermissionsResolvable, type ChannelPermissionsString, type ChannelResolvable, ChannelTypes, type CreateChannelOptions, DEFAULT_CLIENT_OPTIONS, DEFAULT_PERMISSION_DM, DMChannel, type EditServerMemberOptions, type EditServerOptions, type Embed, type EmbedImage, type EmbedSpecial, type EmbedVideo, Emoji, Events, FullPermissions, GroupChannel, Invite, Mentions, type MessageEditOptions, MessageEmbed, MessageManager, type MessageOptions, type MessageQueryOptions, type MessageReply, type MessageResolvable, type MessageSearchOptions, MessageStruct, NotesChannel, type Overwrite, type PartialObject, Presence, Role, RoleManager, type RoleResolvable, SYSTEM_USER_ID, Server, ServerChannel, ServerChannelManager, type ServerChannelResolvable, ServerManager, ServerMember, ServerMemberManager, type ServerMemberResolvable, ServerPermissions, type ServerPermissionsResolvable, type ServerPermissionsString, type ServerResolvable, Status, TextChannel, UUID, User, UserManager, UserPermissions, type UserPermissionsResolvable, type UserPermissionsString, type UserResolvable, VoiceChannel, WSEvents, apiUrl, cdnUrl, client, wsUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,6 @@ declare class CDNClient {
|
|
|
194
194
|
* POST request.
|
|
195
195
|
* @param url The URL for the request.
|
|
196
196
|
* @param data The request body.
|
|
197
|
-
* @param query Query parameters (if applicable).
|
|
198
197
|
* @returns The API response.
|
|
199
198
|
*/
|
|
200
199
|
post<T>(url: string, data: FormData): Promise<T>;
|
|
@@ -1669,9 +1668,10 @@ declare class NotesChannel extends Channel implements TextBasedChannel {
|
|
|
1669
1668
|
get user(): User;
|
|
1670
1669
|
}
|
|
1671
1670
|
|
|
1672
|
-
type APIServerChannel
|
|
1671
|
+
type APIServerChannel = Extract<Channel$1, {
|
|
1673
1672
|
channel_type: "TextChannel" | "VoiceChannel";
|
|
1674
1673
|
}>;
|
|
1674
|
+
|
|
1675
1675
|
interface Overwrite {
|
|
1676
1676
|
allow: FullPermissions;
|
|
1677
1677
|
deny: FullPermissions;
|
|
@@ -1700,7 +1700,7 @@ declare class ServerChannel extends Channel {
|
|
|
1700
1700
|
* @param {client} client - The client instance.
|
|
1701
1701
|
* @param {APIServerChannel} data - The raw data for the server channel from the API.
|
|
1702
1702
|
*/
|
|
1703
|
-
constructor(client: client, data: APIServerChannel
|
|
1703
|
+
constructor(client: client, data: APIServerChannel);
|
|
1704
1704
|
/**
|
|
1705
1705
|
* Updates the server channel instance with new data from the API.
|
|
1706
1706
|
*
|
|
@@ -1709,7 +1709,7 @@ declare class ServerChannel extends Channel {
|
|
|
1709
1709
|
* @returns {this} The updated server channel instance.
|
|
1710
1710
|
* @protected
|
|
1711
1711
|
*/
|
|
1712
|
-
protected _patch(data: APIServerChannel
|
|
1712
|
+
protected _patch(data: APIServerChannel, clear?: FieldsChannel[]): this;
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Creates an invite for the server channel.
|
|
1715
1715
|
*
|
|
@@ -2033,6 +2033,7 @@ declare class Emoji extends Base {
|
|
|
2033
2033
|
|
|
2034
2034
|
type UserResolvable = User | User$1 | MessageStruct | string;
|
|
2035
2035
|
declare class UserManager extends BaseManager<User, User$1> {
|
|
2036
|
+
/** @private */
|
|
2036
2037
|
holds: typeof User;
|
|
2037
2038
|
/**
|
|
2038
2039
|
*
|
|
@@ -2081,10 +2082,12 @@ declare class ClientUser extends User {
|
|
|
2081
2082
|
* ```
|
|
2082
2083
|
*/
|
|
2083
2084
|
setUsername(username: string, password?: string): Promise<void>;
|
|
2085
|
+
setStatus(text?: string | null): Promise<void>;
|
|
2086
|
+
setStatus(presence?: Status): Promise<void>;
|
|
2084
2087
|
/**
|
|
2085
2088
|
* Updates the status of the client user.
|
|
2086
2089
|
*
|
|
2087
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
2090
|
+
* @param {string | null} [text] - The status text to set, or `null` to clear the status.
|
|
2088
2091
|
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
2089
2092
|
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
2090
2093
|
*
|
|
@@ -2093,14 +2096,13 @@ declare class ClientUser extends User {
|
|
|
2093
2096
|
* await clientUser.setStatus("Available", "Online");
|
|
2094
2097
|
* ```
|
|
2095
2098
|
*/
|
|
2096
|
-
setStatus(text?: string | null): Promise<void>;
|
|
2097
|
-
setStatus(presence?: Status): Promise<void>;
|
|
2098
2099
|
setStatus(text?: string | null, presence?: keyof typeof Status): Promise<void>;
|
|
2099
2100
|
}
|
|
2100
2101
|
|
|
2101
2102
|
/**
|
|
2102
2103
|
* Represents the base class for all event handlers.
|
|
2103
2104
|
* All event handlers must extend this class and implement the `handle` method.
|
|
2105
|
+
* @private
|
|
2104
2106
|
*/
|
|
2105
2107
|
declare abstract class Event {
|
|
2106
2108
|
protected readonly client: client;
|
|
@@ -2122,6 +2124,8 @@ declare abstract class Event {
|
|
|
2122
2124
|
|
|
2123
2125
|
/**
|
|
2124
2126
|
* Manages the registration and retrieval of events for the client.
|
|
2127
|
+
* @private
|
|
2128
|
+
* @extends Event
|
|
2125
2129
|
*/
|
|
2126
2130
|
declare class EventManager {
|
|
2127
2131
|
#private;
|
|
@@ -2332,14 +2336,18 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2332
2336
|
readonly cache: Map<string, Holds>;
|
|
2333
2337
|
/** Instance level max size (can be changed per manager instance). */
|
|
2334
2338
|
protected maxSize: number;
|
|
2339
|
+
/** @private */
|
|
2335
2340
|
Holds: any;
|
|
2336
2341
|
constructor(client: client, maxSize?: number);
|
|
2337
2342
|
/**
|
|
2338
2343
|
* Adds a raw object to the cache, constructing the holdable class.
|
|
2339
2344
|
* Automatically evicts oldest entries if the max size is exceeded.
|
|
2345
|
+
* @private
|
|
2340
2346
|
*/
|
|
2341
2347
|
_add(raw: R): Holds;
|
|
2342
|
-
/** Remove an entry by id.
|
|
2348
|
+
/** Remove an entry by id.
|
|
2349
|
+
* @private
|
|
2350
|
+
*/
|
|
2343
2351
|
_remove(id: string): void;
|
|
2344
2352
|
/** Adjust the maximum size for this manager at runtime. */
|
|
2345
2353
|
setMaxSize(size: number): void;
|
|
@@ -2355,7 +2363,9 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2355
2363
|
|
|
2356
2364
|
type ChannelResolvable = Channel | Channel$1 | string;
|
|
2357
2365
|
declare class ChannelManager extends BaseManager<Channel, Channel$1> {
|
|
2366
|
+
/** @private */
|
|
2358
2367
|
holds: null;
|
|
2368
|
+
/** @private */
|
|
2359
2369
|
_add(data: Channel$1): Channel;
|
|
2360
2370
|
_remove(id: string): void;
|
|
2361
2371
|
/**
|
|
@@ -2395,7 +2405,9 @@ interface EditServerOptions {
|
|
|
2395
2405
|
description?: string;
|
|
2396
2406
|
}
|
|
2397
2407
|
declare class ServerManager extends BaseManager<Server, Server$1> {
|
|
2408
|
+
/** @private */
|
|
2398
2409
|
readonly holds: typeof Server;
|
|
2410
|
+
/** @private */
|
|
2399
2411
|
_remove(id: string): void;
|
|
2400
2412
|
/**
|
|
2401
2413
|
* edits a server
|
|
@@ -2449,6 +2461,7 @@ interface MessageQueryOptions {
|
|
|
2449
2461
|
}
|
|
2450
2462
|
declare class MessageManager extends BaseManager<MessageStruct, Message> {
|
|
2451
2463
|
protected readonly channel: Channel;
|
|
2464
|
+
/** @private */
|
|
2452
2465
|
holds: typeof MessageStruct;
|
|
2453
2466
|
constructor(channel: Channel, maxSize?: number);
|
|
2454
2467
|
/**
|
|
@@ -2540,8 +2553,10 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2540
2553
|
id: string;
|
|
2541
2554
|
}> {
|
|
2542
2555
|
protected readonly server: Server;
|
|
2556
|
+
/** @private */
|
|
2543
2557
|
holds: typeof Role;
|
|
2544
2558
|
constructor(server: Server);
|
|
2559
|
+
/** @private */
|
|
2545
2560
|
_add(data: Role$1 & {
|
|
2546
2561
|
id: string;
|
|
2547
2562
|
}): Role;
|
|
@@ -2573,9 +2588,6 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2573
2588
|
edit(role: RoleResolvable, data: editableRole): Promise<Role>;
|
|
2574
2589
|
}
|
|
2575
2590
|
|
|
2576
|
-
type APIServerChannel = Extract<Channel$1, {
|
|
2577
|
-
channel_type: "TextChannel" | "VoiceChannel";
|
|
2578
|
-
}>;
|
|
2579
2591
|
type ServerChannelResolvable = ServerChannel | APIServerChannel | string;
|
|
2580
2592
|
interface CreateChannelOptions {
|
|
2581
2593
|
name: string;
|
|
@@ -2584,15 +2596,18 @@ interface CreateChannelOptions {
|
|
|
2584
2596
|
}
|
|
2585
2597
|
declare class ServerChannelManager extends BaseManager<ServerChannel> {
|
|
2586
2598
|
protected readonly server: Server;
|
|
2599
|
+
/** @private */
|
|
2587
2600
|
holds: typeof ServerChannel;
|
|
2588
2601
|
constructor(server: Server);
|
|
2602
|
+
/** @private */
|
|
2589
2603
|
_add(data: APIServerChannel): ServerChannel;
|
|
2590
2604
|
/**
|
|
2591
|
-
*
|
|
2592
|
-
* @param
|
|
2593
|
-
* @param
|
|
2594
|
-
* @param
|
|
2595
|
-
* @
|
|
2605
|
+
* Creates a new channel in the server.
|
|
2606
|
+
* @param options - Options for creating the channel.
|
|
2607
|
+
* @param options.name - The name of the channel to create.
|
|
2608
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
2609
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
2610
|
+
* @returns A promise that resolves to the created channel.
|
|
2596
2611
|
*/
|
|
2597
2612
|
create({ name, type, description, }: CreateChannelOptions): Promise<ServerChannel>;
|
|
2598
2613
|
/**
|
|
@@ -2615,6 +2630,7 @@ interface EditServerMemberOptions {
|
|
|
2615
2630
|
}
|
|
2616
2631
|
declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
2617
2632
|
protected readonly server: Server;
|
|
2633
|
+
/** @private */
|
|
2618
2634
|
holds: typeof ServerMember;
|
|
2619
2635
|
constructor(server: Server);
|
|
2620
2636
|
/**
|
|
@@ -2661,4 +2677,4 @@ declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
|
2661
2677
|
resolveId(member: ServerMemberResolvable): string | null;
|
|
2662
2678
|
}
|
|
2663
2679
|
|
|
2664
|
-
export { Attachment, type BadgeString, Badges, type BadgesResolvable, Base, BaseManager, BitField, type BitFieldResolvable, Category, Channel, ChannelManager, ChannelPermissions, type ChannelPermissionsResolvable, type ChannelPermissionsString, type ChannelResolvable, ChannelTypes, type CreateChannelOptions, DEFAULT_CLIENT_OPTIONS, DEFAULT_PERMISSION_DM, DMChannel, type EditServerMemberOptions, type EditServerOptions, type Embed, type EmbedImage, type EmbedSpecial, type EmbedVideo, Emoji, Events, FullPermissions, GroupChannel, Invite, Mentions, type MessageEditOptions, MessageEmbed, MessageManager, type MessageOptions, type MessageQueryOptions, type MessageReply, type MessageResolvable, type MessageSearchOptions, MessageStruct, NotesChannel, type Overwrite, Presence, Role, RoleManager, type RoleResolvable, SYSTEM_USER_ID, Server, ServerChannel, ServerChannelManager, type ServerChannelResolvable, ServerManager, ServerMember, ServerMemberManager, type ServerMemberResolvable, ServerPermissions, type ServerPermissionsResolvable, type ServerPermissionsString, type ServerResolvable, Status, TextChannel, UUID, User, UserManager, UserPermissions, type UserPermissionsResolvable, type UserPermissionsString, type UserResolvable, VoiceChannel, WSEvents, apiUrl, cdnUrl, client, wsUrl };
|
|
2680
|
+
export { Attachment, type BadgeString, Badges, type BadgesResolvable, Base, BaseManager, BitField, type BitFieldResolvable, Category, Channel, ChannelManager, ChannelPermissions, type ChannelPermissionsResolvable, type ChannelPermissionsString, type ChannelResolvable, ChannelTypes, type CreateChannelOptions, DEFAULT_CLIENT_OPTIONS, DEFAULT_PERMISSION_DM, DMChannel, type EditServerMemberOptions, type EditServerOptions, type Embed, type EmbedImage, type EmbedSpecial, type EmbedVideo, Emoji, Events, FullPermissions, GroupChannel, Invite, Mentions, type MessageEditOptions, MessageEmbed, MessageManager, type MessageOptions, type MessageQueryOptions, type MessageReply, type MessageResolvable, type MessageSearchOptions, MessageStruct, NotesChannel, type Overwrite, type PartialObject, Presence, Role, RoleManager, type RoleResolvable, SYSTEM_USER_ID, Server, ServerChannel, ServerChannelManager, type ServerChannelResolvable, ServerManager, ServerMember, ServerMemberManager, type ServerMemberResolvable, ServerPermissions, type ServerPermissionsResolvable, type ServerPermissionsString, type ServerResolvable, Status, TextChannel, UUID, User, UserManager, UserPermissions, type UserPermissionsResolvable, type UserPermissionsString, type UserResolvable, VoiceChannel, WSEvents, apiUrl, cdnUrl, client, wsUrl };
|
package/dist/index.js
CHANGED
|
@@ -168,6 +168,7 @@ var _BaseManager = class _BaseManager {
|
|
|
168
168
|
/**
|
|
169
169
|
* Adds a raw object to the cache, constructing the holdable class.
|
|
170
170
|
* Automatically evicts oldest entries if the max size is exceeded.
|
|
171
|
+
* @private
|
|
171
172
|
*/
|
|
172
173
|
_add(raw) {
|
|
173
174
|
if (!this.holds) throw new Error("Holds is not defined");
|
|
@@ -176,7 +177,9 @@ var _BaseManager = class _BaseManager {
|
|
|
176
177
|
this.enforceMaxSize();
|
|
177
178
|
return obj;
|
|
178
179
|
}
|
|
179
|
-
/** Remove an entry by id.
|
|
180
|
+
/** Remove an entry by id.
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
180
183
|
_remove(id) {
|
|
181
184
|
this.cache.delete(id);
|
|
182
185
|
}
|
|
@@ -2578,8 +2581,10 @@ var Emoji2 = class extends Base {
|
|
|
2578
2581
|
var ChannelManager = class extends BaseManager {
|
|
2579
2582
|
constructor() {
|
|
2580
2583
|
super(...arguments);
|
|
2584
|
+
/** @private */
|
|
2581
2585
|
this.holds = null;
|
|
2582
2586
|
}
|
|
2587
|
+
/** @private */
|
|
2583
2588
|
_add(data) {
|
|
2584
2589
|
let channel;
|
|
2585
2590
|
switch (data.channel_type) {
|
|
@@ -2673,8 +2678,10 @@ var ChannelManager = class extends BaseManager {
|
|
|
2673
2678
|
var ServerManager = class extends BaseManager {
|
|
2674
2679
|
constructor() {
|
|
2675
2680
|
super(...arguments);
|
|
2681
|
+
/** @private */
|
|
2676
2682
|
this.holds = Server2;
|
|
2677
2683
|
}
|
|
2684
|
+
/** @private */
|
|
2678
2685
|
_remove(id) {
|
|
2679
2686
|
var _a;
|
|
2680
2687
|
const server = this.cache.get(id);
|
|
@@ -2727,6 +2734,7 @@ var ServerManager = class extends BaseManager {
|
|
|
2727
2734
|
var UserManager = class extends BaseManager {
|
|
2728
2735
|
constructor() {
|
|
2729
2736
|
super(...arguments);
|
|
2737
|
+
/** @private */
|
|
2730
2738
|
this.holds = User;
|
|
2731
2739
|
}
|
|
2732
2740
|
/**
|
|
@@ -2770,6 +2778,7 @@ var MessageManager = class extends BaseManager {
|
|
|
2770
2778
|
constructor(channel, maxSize = 1e3) {
|
|
2771
2779
|
super(channel.client, maxSize);
|
|
2772
2780
|
this.channel = channel;
|
|
2781
|
+
/** @private */
|
|
2773
2782
|
this.holds = MessageStruct;
|
|
2774
2783
|
}
|
|
2775
2784
|
/**
|
|
@@ -3013,8 +3022,10 @@ var RoleManager = class extends BaseManager {
|
|
|
3013
3022
|
constructor(server) {
|
|
3014
3023
|
super(server.client);
|
|
3015
3024
|
this.server = server;
|
|
3025
|
+
/** @private */
|
|
3016
3026
|
this.holds = Role;
|
|
3017
3027
|
}
|
|
3028
|
+
/** @private */
|
|
3018
3029
|
_add(data) {
|
|
3019
3030
|
const role = new Role(this.server, data);
|
|
3020
3031
|
this.cache.set(role.id, role);
|
|
@@ -3086,8 +3097,10 @@ var ServerChannelManager = class extends BaseManager {
|
|
|
3086
3097
|
constructor(server) {
|
|
3087
3098
|
super(server.client);
|
|
3088
3099
|
this.server = server;
|
|
3100
|
+
/** @private */
|
|
3089
3101
|
this.holds = ServerChannel;
|
|
3090
3102
|
}
|
|
3103
|
+
/** @private */
|
|
3091
3104
|
_add(data) {
|
|
3092
3105
|
let channel;
|
|
3093
3106
|
switch (data.channel_type) {
|
|
@@ -3106,11 +3119,12 @@ var ServerChannelManager = class extends BaseManager {
|
|
|
3106
3119
|
return channel;
|
|
3107
3120
|
}
|
|
3108
3121
|
/**
|
|
3109
|
-
*
|
|
3110
|
-
* @param
|
|
3111
|
-
* @param
|
|
3112
|
-
* @param
|
|
3113
|
-
* @
|
|
3122
|
+
* Creates a new channel in the server.
|
|
3123
|
+
* @param options - Options for creating the channel.
|
|
3124
|
+
* @param options.name - The name of the channel to create.
|
|
3125
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
3126
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
3127
|
+
* @returns A promise that resolves to the created channel.
|
|
3114
3128
|
*/
|
|
3115
3129
|
create(_0) {
|
|
3116
3130
|
return __async(this, arguments, function* ({
|
|
@@ -3162,6 +3176,7 @@ var ServerMemberManager = class extends BaseManager {
|
|
|
3162
3176
|
constructor(server) {
|
|
3163
3177
|
super(server.client);
|
|
3164
3178
|
this.server = server;
|
|
3179
|
+
/** @private */
|
|
3165
3180
|
this.holds = ServerMember3;
|
|
3166
3181
|
}
|
|
3167
3182
|
/**
|
|
@@ -3375,7 +3390,7 @@ var RestClient = class {
|
|
|
3375
3390
|
*/
|
|
3376
3391
|
request(method, url, body, query, retry) {
|
|
3377
3392
|
return __async(this, null, function* () {
|
|
3378
|
-
var _a, _b, _c;
|
|
3393
|
+
var _a, _b, _c, _d, _e;
|
|
3379
3394
|
try {
|
|
3380
3395
|
if (!this.client.token) throw new Error("Token is required");
|
|
3381
3396
|
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
@@ -3389,7 +3404,7 @@ var RestClient = class {
|
|
|
3389
3404
|
"User-Agent": `RevBot.js/${version}`
|
|
3390
3405
|
}
|
|
3391
3406
|
}), {
|
|
3392
|
-
url: `${apiUrl}${url}`
|
|
3407
|
+
url: `${((_c = this.client.options.rest) == null ? void 0 : _c.instanceURL) ? (_d = this.client.options.rest) == null ? void 0 : _d.instanceURL : apiUrl}${url}`
|
|
3393
3408
|
});
|
|
3394
3409
|
const response = yield this.rateLimitQueue.request(config);
|
|
3395
3410
|
return response.data;
|
|
@@ -3401,7 +3416,7 @@ var RestClient = class {
|
|
|
3401
3416
|
}
|
|
3402
3417
|
if (error.status) {
|
|
3403
3418
|
throw new Error(
|
|
3404
|
-
`API call failed with status ${error.status}: ${(
|
|
3419
|
+
`API call failed with status ${error.status}: ${(_e = error.response) == null ? void 0 : _e.statusText}`
|
|
3405
3420
|
);
|
|
3406
3421
|
}
|
|
3407
3422
|
}
|
|
@@ -3577,7 +3592,6 @@ var CDNClient = class {
|
|
|
3577
3592
|
* POST request.
|
|
3578
3593
|
* @param url The URL for the request.
|
|
3579
3594
|
* @param data The request body.
|
|
3580
|
-
* @param query Query parameters (if applicable).
|
|
3581
3595
|
* @returns The API response.
|
|
3582
3596
|
*/
|
|
3583
3597
|
post(url, data) {
|
|
@@ -3677,6 +3691,7 @@ var ChannelCreate = class extends Event {
|
|
|
3677
3691
|
*
|
|
3678
3692
|
* @param {API.Channel} data - The raw data for the created channel from the API.
|
|
3679
3693
|
* @returns {Promise<{ channel: unknown }>} A promise that resolves with the created channel.
|
|
3694
|
+
* @private
|
|
3680
3695
|
*/
|
|
3681
3696
|
handle(data) {
|
|
3682
3697
|
return __async(this, null, function* () {
|
|
@@ -3817,6 +3832,7 @@ var Message = class extends Event {
|
|
|
3817
3832
|
*
|
|
3818
3833
|
* @param {API.Message} data - The raw data for the message from the API.
|
|
3819
3834
|
* @returns {Promise<{ message: unknown }>} A promise that resolves with the created message, or an empty object if the channel is not text-based.
|
|
3835
|
+
* @private
|
|
3820
3836
|
*/
|
|
3821
3837
|
handle(data) {
|
|
3822
3838
|
return __async(this, null, function* () {
|
|
@@ -3886,6 +3902,7 @@ var ServerCreate = class extends Event {
|
|
|
3886
3902
|
*
|
|
3887
3903
|
* @param {API.Server} data - The raw data for the created server from the API.
|
|
3888
3904
|
* @returns {Promise<void>} A promise that resolves when the server is added and members are optionally fetched.
|
|
3905
|
+
* @private
|
|
3889
3906
|
*/
|
|
3890
3907
|
handle(data) {
|
|
3891
3908
|
return __async(this, null, function* () {
|