revbot.js 0.1.8 → 0.1.10
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/README.md +156 -133
- package/dist/index.d.mts +56 -17
- package/dist/index.d.ts +56 -17
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,9 @@ declare class UUID extends null {
|
|
|
72
72
|
static timestampOf(id: string): Date;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/** A type that can be a BitField, number, string, or an array of these types.
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
75
78
|
type BitFieldResolvable = BitField | number | string | BitFieldResolvable[];
|
|
76
79
|
/**
|
|
77
80
|
* Represents a bitfield that can be used to manage flags or permissions.
|
|
@@ -194,7 +197,6 @@ declare class CDNClient {
|
|
|
194
197
|
* POST request.
|
|
195
198
|
* @param url The URL for the request.
|
|
196
199
|
* @param data The request body.
|
|
197
|
-
* @param query Query parameters (if applicable).
|
|
198
200
|
* @returns The API response.
|
|
199
201
|
*/
|
|
200
202
|
post<T>(url: string, data: FormData): Promise<T>;
|
|
@@ -356,6 +358,7 @@ declare abstract class BaseClient extends EventEmitter {
|
|
|
356
358
|
|
|
357
359
|
/**
|
|
358
360
|
* Enum representing the client events that can be emitted.
|
|
361
|
+
* @private
|
|
359
362
|
*/
|
|
360
363
|
declare enum Events {
|
|
361
364
|
CHANNEL_CREATE = "channelCreate",
|
|
@@ -388,6 +391,7 @@ declare enum Events {
|
|
|
388
391
|
}
|
|
389
392
|
/**
|
|
390
393
|
* Enum representing the WebSocket events used for communication.
|
|
394
|
+
* @private
|
|
391
395
|
*/
|
|
392
396
|
declare enum WSEvents {
|
|
393
397
|
AUTHENTICATE = "Authenticate",
|
|
@@ -1669,9 +1673,14 @@ declare class NotesChannel extends Channel implements TextBasedChannel {
|
|
|
1669
1673
|
get user(): User;
|
|
1670
1674
|
}
|
|
1671
1675
|
|
|
1672
|
-
|
|
1676
|
+
/**
|
|
1677
|
+
* Represents a channel in the API.
|
|
1678
|
+
* @private
|
|
1679
|
+
*/
|
|
1680
|
+
type APIServerChannel = Extract<Channel$1, {
|
|
1673
1681
|
channel_type: "TextChannel" | "VoiceChannel";
|
|
1674
1682
|
}>;
|
|
1683
|
+
|
|
1675
1684
|
interface Overwrite {
|
|
1676
1685
|
allow: FullPermissions;
|
|
1677
1686
|
deny: FullPermissions;
|
|
@@ -1690,6 +1699,8 @@ declare class ServerChannel extends Channel {
|
|
|
1690
1699
|
description: string | null;
|
|
1691
1700
|
/** The icon of the channel, or `null` if none is set. */
|
|
1692
1701
|
icon: Attachment | null;
|
|
1702
|
+
/** Manages the messages in this Server channel. */
|
|
1703
|
+
messages: MessageManager;
|
|
1693
1704
|
/** The permission overwrites for the channel. */
|
|
1694
1705
|
overwrites: Map<string, Overwrite>;
|
|
1695
1706
|
/** Whether the channel is marked as NSFW (Not Safe For Work). */
|
|
@@ -1700,7 +1711,7 @@ declare class ServerChannel extends Channel {
|
|
|
1700
1711
|
* @param {client} client - The client instance.
|
|
1701
1712
|
* @param {APIServerChannel} data - The raw data for the server channel from the API.
|
|
1702
1713
|
*/
|
|
1703
|
-
constructor(client: client, data: APIServerChannel
|
|
1714
|
+
constructor(client: client, data: APIServerChannel);
|
|
1704
1715
|
/**
|
|
1705
1716
|
* Updates the server channel instance with new data from the API.
|
|
1706
1717
|
*
|
|
@@ -1709,7 +1720,7 @@ declare class ServerChannel extends Channel {
|
|
|
1709
1720
|
* @returns {this} The updated server channel instance.
|
|
1710
1721
|
* @protected
|
|
1711
1722
|
*/
|
|
1712
|
-
protected _patch(data: APIServerChannel
|
|
1723
|
+
protected _patch(data: APIServerChannel, clear?: FieldsChannel[]): this;
|
|
1713
1724
|
/**
|
|
1714
1725
|
* Creates an invite for the server channel.
|
|
1715
1726
|
*
|
|
@@ -1728,6 +1739,18 @@ declare class ServerChannel extends Channel {
|
|
|
1728
1739
|
* @returns {Server} The server instance.
|
|
1729
1740
|
*/
|
|
1730
1741
|
get server(): Server;
|
|
1742
|
+
/**
|
|
1743
|
+
* Sends a message to this Server channel.
|
|
1744
|
+
*
|
|
1745
|
+
* @param {MessageOptions | string} options - The message content or options for the message.
|
|
1746
|
+
* @returns {Promise<Message>} A promise that resolves with the sent message.
|
|
1747
|
+
*
|
|
1748
|
+
* @example
|
|
1749
|
+
* ```typescript
|
|
1750
|
+
* await serverChannel.send("Hello, world!");
|
|
1751
|
+
* ```
|
|
1752
|
+
*/
|
|
1753
|
+
send(options: MessageOptions | string): Promise<MessageStruct>;
|
|
1731
1754
|
/**
|
|
1732
1755
|
* Retrieves the category this channel belongs to, if any.
|
|
1733
1756
|
*
|
|
@@ -2033,6 +2056,7 @@ declare class Emoji extends Base {
|
|
|
2033
2056
|
|
|
2034
2057
|
type UserResolvable = User | User$1 | MessageStruct | string;
|
|
2035
2058
|
declare class UserManager extends BaseManager<User, User$1> {
|
|
2059
|
+
/** @private */
|
|
2036
2060
|
holds: typeof User;
|
|
2037
2061
|
/**
|
|
2038
2062
|
*
|
|
@@ -2081,10 +2105,12 @@ declare class ClientUser extends User {
|
|
|
2081
2105
|
* ```
|
|
2082
2106
|
*/
|
|
2083
2107
|
setUsername(username: string, password?: string): Promise<void>;
|
|
2108
|
+
setStatus(text?: string | null): Promise<void>;
|
|
2109
|
+
setStatus(presence?: Status): Promise<void>;
|
|
2084
2110
|
/**
|
|
2085
2111
|
* Updates the status of the client user.
|
|
2086
2112
|
*
|
|
2087
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
2113
|
+
* @param {string | null} [text] - The status text to set, or `null` to clear the status.
|
|
2088
2114
|
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
2089
2115
|
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
2090
2116
|
*
|
|
@@ -2093,14 +2119,13 @@ declare class ClientUser extends User {
|
|
|
2093
2119
|
* await clientUser.setStatus("Available", "Online");
|
|
2094
2120
|
* ```
|
|
2095
2121
|
*/
|
|
2096
|
-
setStatus(text?: string | null): Promise<void>;
|
|
2097
|
-
setStatus(presence?: Status): Promise<void>;
|
|
2098
2122
|
setStatus(text?: string | null, presence?: keyof typeof Status): Promise<void>;
|
|
2099
2123
|
}
|
|
2100
2124
|
|
|
2101
2125
|
/**
|
|
2102
2126
|
* Represents the base class for all event handlers.
|
|
2103
2127
|
* All event handlers must extend this class and implement the `handle` method.
|
|
2128
|
+
* @private
|
|
2104
2129
|
*/
|
|
2105
2130
|
declare abstract class Event {
|
|
2106
2131
|
protected readonly client: client;
|
|
@@ -2122,6 +2147,8 @@ declare abstract class Event {
|
|
|
2122
2147
|
|
|
2123
2148
|
/**
|
|
2124
2149
|
* Manages the registration and retrieval of events for the client.
|
|
2150
|
+
* @private
|
|
2151
|
+
* @extends Event
|
|
2125
2152
|
*/
|
|
2126
2153
|
declare class EventManager {
|
|
2127
2154
|
#private;
|
|
@@ -2332,14 +2359,18 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2332
2359
|
readonly cache: Map<string, Holds>;
|
|
2333
2360
|
/** Instance level max size (can be changed per manager instance). */
|
|
2334
2361
|
protected maxSize: number;
|
|
2362
|
+
/** @private */
|
|
2335
2363
|
Holds: any;
|
|
2336
2364
|
constructor(client: client, maxSize?: number);
|
|
2337
2365
|
/**
|
|
2338
2366
|
* Adds a raw object to the cache, constructing the holdable class.
|
|
2339
2367
|
* Automatically evicts oldest entries if the max size is exceeded.
|
|
2368
|
+
* @private
|
|
2340
2369
|
*/
|
|
2341
2370
|
_add(raw: R): Holds;
|
|
2342
|
-
/** Remove an entry by id.
|
|
2371
|
+
/** Remove an entry by id.
|
|
2372
|
+
* @private
|
|
2373
|
+
*/
|
|
2343
2374
|
_remove(id: string): void;
|
|
2344
2375
|
/** Adjust the maximum size for this manager at runtime. */
|
|
2345
2376
|
setMaxSize(size: number): void;
|
|
@@ -2355,7 +2386,9 @@ declare abstract class BaseManager<Holds extends {
|
|
|
2355
2386
|
|
|
2356
2387
|
type ChannelResolvable = Channel | Channel$1 | string;
|
|
2357
2388
|
declare class ChannelManager extends BaseManager<Channel, Channel$1> {
|
|
2389
|
+
/** @private */
|
|
2358
2390
|
holds: null;
|
|
2391
|
+
/** @private */
|
|
2359
2392
|
_add(data: Channel$1): Channel;
|
|
2360
2393
|
_remove(id: string): void;
|
|
2361
2394
|
/**
|
|
@@ -2395,7 +2428,9 @@ interface EditServerOptions {
|
|
|
2395
2428
|
description?: string;
|
|
2396
2429
|
}
|
|
2397
2430
|
declare class ServerManager extends BaseManager<Server, Server$1> {
|
|
2431
|
+
/** @private */
|
|
2398
2432
|
readonly holds: typeof Server;
|
|
2433
|
+
/** @private */
|
|
2399
2434
|
_remove(id: string): void;
|
|
2400
2435
|
/**
|
|
2401
2436
|
* edits a server
|
|
@@ -2449,6 +2484,7 @@ interface MessageQueryOptions {
|
|
|
2449
2484
|
}
|
|
2450
2485
|
declare class MessageManager extends BaseManager<MessageStruct, Message> {
|
|
2451
2486
|
protected readonly channel: Channel;
|
|
2487
|
+
/** @private */
|
|
2452
2488
|
holds: typeof MessageStruct;
|
|
2453
2489
|
constructor(channel: Channel, maxSize?: number);
|
|
2454
2490
|
/**
|
|
@@ -2540,8 +2576,10 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2540
2576
|
id: string;
|
|
2541
2577
|
}> {
|
|
2542
2578
|
protected readonly server: Server;
|
|
2579
|
+
/** @private */
|
|
2543
2580
|
holds: typeof Role;
|
|
2544
2581
|
constructor(server: Server);
|
|
2582
|
+
/** @private */
|
|
2545
2583
|
_add(data: Role$1 & {
|
|
2546
2584
|
id: string;
|
|
2547
2585
|
}): Role;
|
|
@@ -2573,9 +2611,6 @@ declare class RoleManager extends BaseManager<Role, Role$1 & {
|
|
|
2573
2611
|
edit(role: RoleResolvable, data: editableRole): Promise<Role>;
|
|
2574
2612
|
}
|
|
2575
2613
|
|
|
2576
|
-
type APIServerChannel = Extract<Channel$1, {
|
|
2577
|
-
channel_type: "TextChannel" | "VoiceChannel";
|
|
2578
|
-
}>;
|
|
2579
2614
|
type ServerChannelResolvable = ServerChannel | APIServerChannel | string;
|
|
2580
2615
|
interface CreateChannelOptions {
|
|
2581
2616
|
name: string;
|
|
@@ -2584,15 +2619,18 @@ interface CreateChannelOptions {
|
|
|
2584
2619
|
}
|
|
2585
2620
|
declare class ServerChannelManager extends BaseManager<ServerChannel> {
|
|
2586
2621
|
protected readonly server: Server;
|
|
2622
|
+
/** @private */
|
|
2587
2623
|
holds: typeof ServerChannel;
|
|
2588
2624
|
constructor(server: Server);
|
|
2625
|
+
/** @private */
|
|
2589
2626
|
_add(data: APIServerChannel): ServerChannel;
|
|
2590
2627
|
/**
|
|
2591
|
-
*
|
|
2592
|
-
* @param
|
|
2593
|
-
* @param
|
|
2594
|
-
* @param
|
|
2595
|
-
* @
|
|
2628
|
+
* Creates a new channel in the server.
|
|
2629
|
+
* @param options - Options for creating the channel.
|
|
2630
|
+
* @param options.name - The name of the channel to create.
|
|
2631
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
2632
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
2633
|
+
* @returns A promise that resolves to the created channel.
|
|
2596
2634
|
*/
|
|
2597
2635
|
create({ name, type, description, }: CreateChannelOptions): Promise<ServerChannel>;
|
|
2598
2636
|
/**
|
|
@@ -2615,6 +2653,7 @@ interface EditServerMemberOptions {
|
|
|
2615
2653
|
}
|
|
2616
2654
|
declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
2617
2655
|
protected readonly server: Server;
|
|
2656
|
+
/** @private */
|
|
2618
2657
|
holds: typeof ServerMember;
|
|
2619
2658
|
constructor(server: Server);
|
|
2620
2659
|
/**
|
|
@@ -2661,4 +2700,4 @@ declare class ServerMemberManager extends BaseManager<ServerMember, Member> {
|
|
|
2661
2700
|
resolveId(member: ServerMemberResolvable): string | null;
|
|
2662
2701
|
}
|
|
2663
2702
|
|
|
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 };
|
|
2703
|
+
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
|
}
|
|
@@ -2098,6 +2101,8 @@ var ServerChannel = class extends Channel {
|
|
|
2098
2101
|
this.description = null;
|
|
2099
2102
|
/** The icon of the channel, or `null` if none is set. */
|
|
2100
2103
|
this.icon = null;
|
|
2104
|
+
/** Manages the messages in this Server channel. */
|
|
2105
|
+
this.messages = new MessageManager(this);
|
|
2101
2106
|
/** The permission overwrites for the channel. */
|
|
2102
2107
|
this.overwrites = /* @__PURE__ */ new Map();
|
|
2103
2108
|
/** Whether the channel is marked as NSFW (Not Safe For Work). */
|
|
@@ -2168,6 +2173,20 @@ var ServerChannel = class extends Channel {
|
|
|
2168
2173
|
get server() {
|
|
2169
2174
|
return this.client.servers.cache.get(this.serverId);
|
|
2170
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Sends a message to this Server channel.
|
|
2178
|
+
*
|
|
2179
|
+
* @param {MessageOptions | string} options - The message content or options for the message.
|
|
2180
|
+
* @returns {Promise<Message>} A promise that resolves with the sent message.
|
|
2181
|
+
*
|
|
2182
|
+
* @example
|
|
2183
|
+
* ```typescript
|
|
2184
|
+
* await serverChannel.send("Hello, world!");
|
|
2185
|
+
* ```
|
|
2186
|
+
*/
|
|
2187
|
+
send(options) {
|
|
2188
|
+
return this.messages.send(options);
|
|
2189
|
+
}
|
|
2171
2190
|
/**
|
|
2172
2191
|
* Retrieves the category this channel belongs to, if any.
|
|
2173
2192
|
*
|
|
@@ -2578,8 +2597,10 @@ var Emoji2 = class extends Base {
|
|
|
2578
2597
|
var ChannelManager = class extends BaseManager {
|
|
2579
2598
|
constructor() {
|
|
2580
2599
|
super(...arguments);
|
|
2600
|
+
/** @private */
|
|
2581
2601
|
this.holds = null;
|
|
2582
2602
|
}
|
|
2603
|
+
/** @private */
|
|
2583
2604
|
_add(data) {
|
|
2584
2605
|
let channel;
|
|
2585
2606
|
switch (data.channel_type) {
|
|
@@ -2673,8 +2694,10 @@ var ChannelManager = class extends BaseManager {
|
|
|
2673
2694
|
var ServerManager = class extends BaseManager {
|
|
2674
2695
|
constructor() {
|
|
2675
2696
|
super(...arguments);
|
|
2697
|
+
/** @private */
|
|
2676
2698
|
this.holds = Server2;
|
|
2677
2699
|
}
|
|
2700
|
+
/** @private */
|
|
2678
2701
|
_remove(id) {
|
|
2679
2702
|
var _a;
|
|
2680
2703
|
const server = this.cache.get(id);
|
|
@@ -2727,6 +2750,7 @@ var ServerManager = class extends BaseManager {
|
|
|
2727
2750
|
var UserManager = class extends BaseManager {
|
|
2728
2751
|
constructor() {
|
|
2729
2752
|
super(...arguments);
|
|
2753
|
+
/** @private */
|
|
2730
2754
|
this.holds = User;
|
|
2731
2755
|
}
|
|
2732
2756
|
/**
|
|
@@ -2770,6 +2794,7 @@ var MessageManager = class extends BaseManager {
|
|
|
2770
2794
|
constructor(channel, maxSize = 1e3) {
|
|
2771
2795
|
super(channel.client, maxSize);
|
|
2772
2796
|
this.channel = channel;
|
|
2797
|
+
/** @private */
|
|
2773
2798
|
this.holds = MessageStruct;
|
|
2774
2799
|
}
|
|
2775
2800
|
/**
|
|
@@ -3013,8 +3038,10 @@ var RoleManager = class extends BaseManager {
|
|
|
3013
3038
|
constructor(server) {
|
|
3014
3039
|
super(server.client);
|
|
3015
3040
|
this.server = server;
|
|
3041
|
+
/** @private */
|
|
3016
3042
|
this.holds = Role;
|
|
3017
3043
|
}
|
|
3044
|
+
/** @private */
|
|
3018
3045
|
_add(data) {
|
|
3019
3046
|
const role = new Role(this.server, data);
|
|
3020
3047
|
this.cache.set(role.id, role);
|
|
@@ -3086,8 +3113,10 @@ var ServerChannelManager = class extends BaseManager {
|
|
|
3086
3113
|
constructor(server) {
|
|
3087
3114
|
super(server.client);
|
|
3088
3115
|
this.server = server;
|
|
3116
|
+
/** @private */
|
|
3089
3117
|
this.holds = ServerChannel;
|
|
3090
3118
|
}
|
|
3119
|
+
/** @private */
|
|
3091
3120
|
_add(data) {
|
|
3092
3121
|
let channel;
|
|
3093
3122
|
switch (data.channel_type) {
|
|
@@ -3106,11 +3135,12 @@ var ServerChannelManager = class extends BaseManager {
|
|
|
3106
3135
|
return channel;
|
|
3107
3136
|
}
|
|
3108
3137
|
/**
|
|
3109
|
-
*
|
|
3110
|
-
* @param
|
|
3111
|
-
* @param
|
|
3112
|
-
* @param
|
|
3113
|
-
* @
|
|
3138
|
+
* Creates a new channel in the server.
|
|
3139
|
+
* @param options - Options for creating the channel.
|
|
3140
|
+
* @param options.name - The name of the channel to create.
|
|
3141
|
+
* @param [options.type="Text"] - The type of the channel to create. Can be "Text" or "Voice". Defaults to "Text".
|
|
3142
|
+
* @param [options.description] - The description of the channel to create. Only used for voice channels.
|
|
3143
|
+
* @returns A promise that resolves to the created channel.
|
|
3114
3144
|
*/
|
|
3115
3145
|
create(_0) {
|
|
3116
3146
|
return __async(this, arguments, function* ({
|
|
@@ -3162,6 +3192,7 @@ var ServerMemberManager = class extends BaseManager {
|
|
|
3162
3192
|
constructor(server) {
|
|
3163
3193
|
super(server.client);
|
|
3164
3194
|
this.server = server;
|
|
3195
|
+
/** @private */
|
|
3165
3196
|
this.holds = ServerMember3;
|
|
3166
3197
|
}
|
|
3167
3198
|
/**
|
|
@@ -3277,7 +3308,7 @@ var import_node_events = require("events");
|
|
|
3277
3308
|
var import_axios4 = require("axios");
|
|
3278
3309
|
|
|
3279
3310
|
// package.json
|
|
3280
|
-
var version = "0.1.
|
|
3311
|
+
var version = "0.1.10";
|
|
3281
3312
|
|
|
3282
3313
|
// src/rest/restUtils/rateLimitQueue.ts
|
|
3283
3314
|
var import_axios3 = __toESM(require("axios"));
|
|
@@ -3375,7 +3406,7 @@ var RestClient = class {
|
|
|
3375
3406
|
*/
|
|
3376
3407
|
request(method, url, body, query, retry) {
|
|
3377
3408
|
return __async(this, null, function* () {
|
|
3378
|
-
var _a, _b, _c;
|
|
3409
|
+
var _a, _b, _c, _d, _e;
|
|
3379
3410
|
try {
|
|
3380
3411
|
if (!this.client.token) throw new Error("Token is required");
|
|
3381
3412
|
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
@@ -3389,7 +3420,7 @@ var RestClient = class {
|
|
|
3389
3420
|
"User-Agent": `RevBot.js/${version}`
|
|
3390
3421
|
}
|
|
3391
3422
|
}), {
|
|
3392
|
-
url: `${apiUrl}${url}`
|
|
3423
|
+
url: `${((_c = this.client.options.rest) == null ? void 0 : _c.instanceURL) ? (_d = this.client.options.rest) == null ? void 0 : _d.instanceURL : apiUrl}${url}`
|
|
3393
3424
|
});
|
|
3394
3425
|
const response = yield this.rateLimitQueue.request(config);
|
|
3395
3426
|
return response.data;
|
|
@@ -3401,7 +3432,7 @@ var RestClient = class {
|
|
|
3401
3432
|
}
|
|
3402
3433
|
if (error.status) {
|
|
3403
3434
|
throw new Error(
|
|
3404
|
-
`API call failed with status ${error.status}: ${(
|
|
3435
|
+
`API call failed with status ${error.status}: ${(_e = error.response) == null ? void 0 : _e.statusText}`
|
|
3405
3436
|
);
|
|
3406
3437
|
}
|
|
3407
3438
|
}
|
|
@@ -3577,7 +3608,6 @@ var CDNClient = class {
|
|
|
3577
3608
|
* POST request.
|
|
3578
3609
|
* @param url The URL for the request.
|
|
3579
3610
|
* @param data The request body.
|
|
3580
|
-
* @param query Query parameters (if applicable).
|
|
3581
3611
|
* @returns The API response.
|
|
3582
3612
|
*/
|
|
3583
3613
|
post(url, data) {
|
|
@@ -3677,6 +3707,7 @@ var ChannelCreate = class extends Event {
|
|
|
3677
3707
|
*
|
|
3678
3708
|
* @param {API.Channel} data - The raw data for the created channel from the API.
|
|
3679
3709
|
* @returns {Promise<{ channel: unknown }>} A promise that resolves with the created channel.
|
|
3710
|
+
* @private
|
|
3680
3711
|
*/
|
|
3681
3712
|
handle(data) {
|
|
3682
3713
|
return __async(this, null, function* () {
|
|
@@ -3817,6 +3848,7 @@ var Message = class extends Event {
|
|
|
3817
3848
|
*
|
|
3818
3849
|
* @param {API.Message} data - The raw data for the message from the API.
|
|
3819
3850
|
* @returns {Promise<{ message: unknown }>} A promise that resolves with the created message, or an empty object if the channel is not text-based.
|
|
3851
|
+
* @private
|
|
3820
3852
|
*/
|
|
3821
3853
|
handle(data) {
|
|
3822
3854
|
return __async(this, null, function* () {
|
|
@@ -3886,6 +3918,7 @@ var ServerCreate = class extends Event {
|
|
|
3886
3918
|
*
|
|
3887
3919
|
* @param {API.Server} data - The raw data for the created server from the API.
|
|
3888
3920
|
* @returns {Promise<void>} A promise that resolves when the server is added and members are optionally fetched.
|
|
3921
|
+
* @private
|
|
3889
3922
|
*/
|
|
3890
3923
|
handle(data) {
|
|
3891
3924
|
return __async(this, null, function* () {
|
|
@@ -4411,21 +4444,21 @@ var WebSocketClient = class {
|
|
|
4411
4444
|
this.client.users._add(user);
|
|
4412
4445
|
}
|
|
4413
4446
|
}
|
|
4414
|
-
for (const server of packet.servers) {
|
|
4415
|
-
const s = this.client.servers._add(server);
|
|
4416
|
-
if (this.client.options.fetchMembers) {
|
|
4417
|
-
promises.push(s.members.fetch());
|
|
4418
|
-
}
|
|
4419
|
-
}
|
|
4420
|
-
for (const channel of packet.channels) {
|
|
4421
|
-
this.client.channels._add(channel);
|
|
4422
|
-
}
|
|
4423
4447
|
for (const member of packet.members) {
|
|
4424
4448
|
(_a = this.client.servers.cache.get(member._id.server)) == null ? void 0 : _a.members._add(member);
|
|
4425
4449
|
}
|
|
4426
4450
|
for (const emoji of packet.emojis) {
|
|
4427
4451
|
(_b = this.client.servers.cache.get(emoji.parent.id)) == null ? void 0 : _b.emojis.set(emoji._id, __spreadProps(__spreadValues({}, emoji), { _id: emoji._id }));
|
|
4428
4452
|
}
|
|
4453
|
+
for (const channel of packet.channels) {
|
|
4454
|
+
this.client.channels._add(channel);
|
|
4455
|
+
}
|
|
4456
|
+
for (const server of packet.servers) {
|
|
4457
|
+
const s = this.client.servers._add(server);
|
|
4458
|
+
if (this.client.options.fetchMembers) {
|
|
4459
|
+
promises.push(s.members.fetch());
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4429
4462
|
this.setHeartbeatTimer(
|
|
4430
4463
|
(_d = (_c = this.client.options.ws) == null ? void 0 : _c.heartbeatInterval) != null ? _d : 3e4
|
|
4431
4464
|
);
|