@stoatx/client 0.6.4 → 0.8.0
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 +3 -113
- package/dist/index.cjs +448 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -5
- package/dist/index.d.ts +185 -5
- package/dist/index.js +453 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,10 +4,13 @@ import * as stoatApi from 'stoat-api';
|
|
|
4
4
|
export { stoatApi as API };
|
|
5
5
|
import * as util from 'node:util';
|
|
6
6
|
import util__default from 'node:util';
|
|
7
|
+
import { Readable } from 'node:stream';
|
|
8
|
+
import { EventEmitter as EventEmitter$1 } from 'node:events';
|
|
7
9
|
|
|
8
10
|
declare class GatewayManager {
|
|
9
11
|
private client;
|
|
10
12
|
private ws;
|
|
13
|
+
private wsURL;
|
|
11
14
|
private pingInterval;
|
|
12
15
|
private token;
|
|
13
16
|
private reconnectAttempts;
|
|
@@ -15,6 +18,7 @@ declare class GatewayManager {
|
|
|
15
18
|
private isIntentionalClose;
|
|
16
19
|
constructor(client: Client);
|
|
17
20
|
connect(token: string): Promise<void>;
|
|
21
|
+
setGatewayUrl(url: string): void;
|
|
18
22
|
private handleMessage;
|
|
19
23
|
private startPingLoop;
|
|
20
24
|
private send;
|
|
@@ -71,10 +75,13 @@ declare class StoatAPIError extends Error {
|
|
|
71
75
|
declare class RESTManager {
|
|
72
76
|
private client;
|
|
73
77
|
private baseURL;
|
|
78
|
+
private cdnURL;
|
|
74
79
|
private token;
|
|
75
80
|
private buckets;
|
|
76
81
|
constructor(client: Client);
|
|
77
82
|
setToken(token: string): void;
|
|
83
|
+
setBaseURL(baseURL: string): void;
|
|
84
|
+
setCDNURL(cdnURL: string): void;
|
|
78
85
|
/**
|
|
79
86
|
* Generates a local identifier for the bucket based on method and path.
|
|
80
87
|
*/
|
|
@@ -1137,6 +1144,82 @@ declare class MessageCollector extends Collector<string, Message> {
|
|
|
1137
1144
|
endReason(): string | null;
|
|
1138
1145
|
}
|
|
1139
1146
|
|
|
1147
|
+
interface AudioResourceOptions {
|
|
1148
|
+
volume?: number;
|
|
1149
|
+
inputType?: string;
|
|
1150
|
+
}
|
|
1151
|
+
type AudioSource = string | Readable;
|
|
1152
|
+
declare class AudioResource {
|
|
1153
|
+
readonly stream: Readable;
|
|
1154
|
+
private constructor();
|
|
1155
|
+
static from(source: AudioSource, options?: AudioResourceOptions): AudioResource;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
type AudioPlayerStatus = "idle" | "buffering" | "playing" | "paused" | "stopped";
|
|
1159
|
+
interface AudioPlayerEvents {
|
|
1160
|
+
stateChange: [oldStatus: AudioPlayerStatus, newStatus: AudioPlayerStatus];
|
|
1161
|
+
idle: [];
|
|
1162
|
+
error: [error: Error];
|
|
1163
|
+
}
|
|
1164
|
+
declare class AudioPlayer extends EventEmitter$1<AudioPlayerEvents> {
|
|
1165
|
+
private _status;
|
|
1166
|
+
private _resource;
|
|
1167
|
+
/** Registered VoiceConnections subscribed to this player */
|
|
1168
|
+
private readonly subscribers;
|
|
1169
|
+
get status(): AudioPlayerStatus;
|
|
1170
|
+
get resource(): AudioResource | null;
|
|
1171
|
+
play(resource: AudioResource): void;
|
|
1172
|
+
pause(): void;
|
|
1173
|
+
resume(): void;
|
|
1174
|
+
stop(): void;
|
|
1175
|
+
/** @internal */
|
|
1176
|
+
addSubscriber(conn: VoiceConnection): void;
|
|
1177
|
+
/** @internal */
|
|
1178
|
+
removeSubscriber(conn: VoiceConnection): void;
|
|
1179
|
+
private feed;
|
|
1180
|
+
private transition;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
interface VoiceConnectionEvents {
|
|
1184
|
+
ready: [];
|
|
1185
|
+
disconnect: [];
|
|
1186
|
+
error: [error: Error];
|
|
1187
|
+
}
|
|
1188
|
+
type VoiceConnectionStatus = "connecting" | "ready" | "disconnecting" | "disconnected";
|
|
1189
|
+
declare class VoiceConnection extends EventEmitter$1<VoiceConnectionEvents> {
|
|
1190
|
+
readonly channelId: string;
|
|
1191
|
+
readonly guildId: string | undefined;
|
|
1192
|
+
private readonly room;
|
|
1193
|
+
private _status;
|
|
1194
|
+
private _player;
|
|
1195
|
+
private _audioSource;
|
|
1196
|
+
private _audioTrack;
|
|
1197
|
+
constructor(channelId: string, guildId?: string);
|
|
1198
|
+
get status(): VoiceConnectionStatus;
|
|
1199
|
+
get player(): AudioPlayer | null;
|
|
1200
|
+
/** @internal */
|
|
1201
|
+
connect(url: string, token: string): Promise<void>;
|
|
1202
|
+
subscribe(player: AudioPlayer): void;
|
|
1203
|
+
unsubscribe(): void;
|
|
1204
|
+
_feedStream(stream: Readable): Promise<void>;
|
|
1205
|
+
disconnect(): Promise<void>;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
declare class VoiceManager {
|
|
1209
|
+
private readonly connections;
|
|
1210
|
+
private readonly client;
|
|
1211
|
+
constructor(client: Client);
|
|
1212
|
+
join(channelId: string, guildId?: string): Promise<VoiceConnection>;
|
|
1213
|
+
get(channelId: string): VoiceConnection | undefined;
|
|
1214
|
+
leave(channelId: string): Promise<void>;
|
|
1215
|
+
leaveAll(): Promise<void>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
declare class VoiceChannel extends TextChannel {
|
|
1219
|
+
join(): Promise<VoiceConnection>;
|
|
1220
|
+
leave(): Promise<void>;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1140
1223
|
type ChannelType = "SavedMessages" | "DirectMessage" | "Group" | "TextChannel";
|
|
1141
1224
|
interface ChannelCreateOptions {
|
|
1142
1225
|
name: string;
|
|
@@ -1244,6 +1327,7 @@ declare abstract class BaseChannel extends Base {
|
|
|
1244
1327
|
isText(): this is TextChannel;
|
|
1245
1328
|
isDM(): this is DMChannel;
|
|
1246
1329
|
isGroup(): this is GroupChannel;
|
|
1330
|
+
isVoice(): this is VoiceChannel;
|
|
1247
1331
|
}
|
|
1248
1332
|
|
|
1249
1333
|
declare class ServerChannelManager {
|
|
@@ -1652,20 +1736,109 @@ declare class Emoji extends Base {
|
|
|
1652
1736
|
nsfw: boolean;
|
|
1653
1737
|
constructor(client: Client, data: Emoji$1);
|
|
1654
1738
|
_patch(data: Emoji$1): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Fetch this emoji from the API or resolves it from the local cache.
|
|
1741
|
+
* @param force Whether to skip the cache check and force a direct API request. Defaults to false.
|
|
1742
|
+
* @returns A promise that resolves to the fetched {@link Emoji} object.
|
|
1743
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1744
|
+
* @example
|
|
1745
|
+
* // Force fetch emoji to update its data
|
|
1746
|
+
* await emoji.fetch(true);
|
|
1747
|
+
*/
|
|
1748
|
+
fetch(force?: boolean): Promise<Emoji>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Deletes this emoji from the server.
|
|
1751
|
+
* @returns A promise that resolves when the emoji has been deleted.
|
|
1752
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1753
|
+
* @example
|
|
1754
|
+
* // Delete an emoji from the server
|
|
1755
|
+
* await emoji.delete();
|
|
1756
|
+
*/
|
|
1757
|
+
delete(): Promise<void>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Edits this emoji's properties.
|
|
1760
|
+
* @param options The options to edit the emoji with.
|
|
1761
|
+
* @returns A promise that resolves to the edited {@link Emoji} object.
|
|
1762
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1763
|
+
* @example
|
|
1764
|
+
* // Edit an emoji's name
|
|
1765
|
+
* await emoji.edit({ name: "new_name" });
|
|
1766
|
+
*/
|
|
1767
|
+
edit(options: EmojiEditOptions): Promise<Emoji>;
|
|
1655
1768
|
}
|
|
1656
1769
|
|
|
1770
|
+
interface EmojiCreateOptions {
|
|
1771
|
+
emoji: string | AttachmentBuilder;
|
|
1772
|
+
name: string;
|
|
1773
|
+
nsfw?: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface EmojiEditOptions {
|
|
1776
|
+
name: string;
|
|
1777
|
+
}
|
|
1778
|
+
type EmojiResolvable = string | Emoji;
|
|
1657
1779
|
declare class EmojiManager extends BaseManager<string, Emoji> {
|
|
1658
1780
|
server?: Server | undefined;
|
|
1659
1781
|
constructor(client: Client, server?: Server | undefined, limit?: number);
|
|
1660
1782
|
/**
|
|
1661
1783
|
* Tell BaseManager how to find the ID for Emojis
|
|
1662
1784
|
*/
|
|
1663
|
-
protected extractId(data:
|
|
1785
|
+
protected extractId(data: Emoji$1): string;
|
|
1664
1786
|
/**
|
|
1665
1787
|
* Tell BaseManager how to build an Emoji
|
|
1666
1788
|
*/
|
|
1667
|
-
protected construct(data:
|
|
1668
|
-
|
|
1789
|
+
protected construct(data: Emoji$1): Emoji;
|
|
1790
|
+
/**
|
|
1791
|
+
* Fetch an Emoji from the API or resolves it from the local cache.
|
|
1792
|
+
* @param emoji The ID, mention, or {@link Emoji} object to fetch
|
|
1793
|
+
* @param force Whether to skip the cache check and force a direct API request. Defaults to false.
|
|
1794
|
+
* @returns A promise that resolves to the fetched {@link Emoji} object.
|
|
1795
|
+
* @throws {TypeError} If an invalid {@link EmojiResolvable} is provided.
|
|
1796
|
+
* @throws {Error} If the API request fails.
|
|
1797
|
+
* @example
|
|
1798
|
+
* // Fetch a channel, bypassing cache
|
|
1799
|
+
* const channel = await client.channels.fetch("01H...", true);
|
|
1800
|
+
*/
|
|
1801
|
+
fetch(emoji: EmojiResolvable, force?: boolean): Promise<Emoji>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Resolves a {@link EmojiResolvable} to a {@link Emoji} object from the cache.
|
|
1804
|
+
* @param emoji The {@link EmojiResolvable} to resolve.
|
|
1805
|
+
* @returns The resolved {@link Emoji} object, or undefined if not found.
|
|
1806
|
+
*/
|
|
1807
|
+
resolve(emoji: EmojiResolvable): Emoji | undefined;
|
|
1808
|
+
/**
|
|
1809
|
+
* Extracts ID from a {@link EmojiResolvable}.
|
|
1810
|
+
* @param emoji The {@link EmojiResolvable} to extract the ID from.
|
|
1811
|
+
* @returns The extracted {@link Emoji} ID.
|
|
1812
|
+
* @throws {TypeError} If an invalid type is provided.
|
|
1813
|
+
*/
|
|
1814
|
+
resolveId(emoji: EmojiResolvable): string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Create a new emoji
|
|
1817
|
+
* @param options The options for creating the emoji
|
|
1818
|
+
* @returns A promise that resolves to the created {@link Emoji} object.
|
|
1819
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager} or if the emoji attachment cannot be resolved.
|
|
1820
|
+
* @example
|
|
1821
|
+
* const emoji = await client.emojis.create(server, { emoji: "path/to/emoji.png", name: "myEmoji" });
|
|
1822
|
+
*/
|
|
1823
|
+
crate(options: EmojiCreateOptions): Promise<Emoji>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Delete an emoji
|
|
1826
|
+
* @param emoji The {@link EmojiResolvable} to delete
|
|
1827
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager}.
|
|
1828
|
+
* @example
|
|
1829
|
+
* await client.emojis.delete(emoji);
|
|
1830
|
+
*/
|
|
1831
|
+
delete(emoji: EmojiResolvable): Promise<void>;
|
|
1832
|
+
/**
|
|
1833
|
+
* Edit an emoji
|
|
1834
|
+
* @param emoji The {@link EmojiResolvable} to edit
|
|
1835
|
+
* @param options The options to edit the emoji with
|
|
1836
|
+
* @returns A promise that resolves to the edited {@link Emoji} object.
|
|
1837
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager}.
|
|
1838
|
+
* @example
|
|
1839
|
+
* const editedEmoji = await client.emojis.edit(emoji, { name: "newName" });
|
|
1840
|
+
*/
|
|
1841
|
+
edit(emoji: EmojiResolvable, options: EmojiEditOptions): Promise<Emoji>;
|
|
1669
1842
|
[util.inspect.custom](): Collection<string, Emoji>;
|
|
1670
1843
|
}
|
|
1671
1844
|
|
|
@@ -2131,9 +2304,13 @@ interface ClientOptions {
|
|
|
2131
2304
|
channels?: number;
|
|
2132
2305
|
emojis?: number;
|
|
2133
2306
|
};
|
|
2307
|
+
apiURL?: string;
|
|
2308
|
+
overrides?: {
|
|
2309
|
+
wsURL?: string;
|
|
2310
|
+
cdnURL?: string;
|
|
2311
|
+
};
|
|
2134
2312
|
}
|
|
2135
2313
|
declare class Client extends EventEmitter {
|
|
2136
|
-
options: ClientOptions;
|
|
2137
2314
|
rest: RESTManager;
|
|
2138
2315
|
gateway: GatewayManager;
|
|
2139
2316
|
channels: ChannelManager;
|
|
@@ -2142,11 +2319,14 @@ declare class Client extends EventEmitter {
|
|
|
2142
2319
|
sweepers: SweeperManager;
|
|
2143
2320
|
emojis: EmojiManager;
|
|
2144
2321
|
user: ClientUser | null;
|
|
2322
|
+
options: ClientOptions;
|
|
2323
|
+
readonly voice: VoiceManager;
|
|
2145
2324
|
constructor(options?: ClientOptions);
|
|
2146
2325
|
/**
|
|
2147
2326
|
* Connects the bot to the Stoat Gateway
|
|
2148
2327
|
*/
|
|
2149
2328
|
login(token: string): Promise<any>;
|
|
2329
|
+
private fetchConfig;
|
|
2150
2330
|
on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
2151
2331
|
once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
2152
2332
|
emit<K extends keyof ClientEvents>(event: K, ...args: ClientEvents[K]): boolean;
|
|
@@ -2159,4 +2339,4 @@ declare class UnknownChannel extends BaseChannel {
|
|
|
2159
2339
|
constructor(client: Client, data: Channel);
|
|
2160
2340
|
}
|
|
2161
2341
|
|
|
2162
|
-
export { Attachment, AttachmentBuilder, type AttachmentMetadata, Base, BaseChannel, BitField, type BitFieldResolvable, type BotInformation, type CDNTag, type ChannelCreateOptions, type ChannelEditOptions, ChannelManager, type ChannelResolvable, type ChannelRolePermissionOptions, type ChannelType, Client, type ClientEvents, type ClientOptions, ClientUser, Collection, Collector, type CollectorOptions, DMChannel, EmbedBuilder, Emoji, EmojiManager, type EmojiParent, type FetchMembersOptions, GatewayManager, GroupChannel, type Interaction, type Masquerade, Member, type MemberBanOptions, type MemberEditOptions, MemberManager, type MemberResolvable, Message, MessageCollector, type MessageCollectorOptions, type MessageFetchOptions, MessageManager, type MessageOptions, MessageReaction, type MessageResolvable, PermissionFlags, type PermissionResolvable, type PermissionString, Permissions, RESTManager, type RawDMChannel, type RawGroupChannel, type RawTextChannel, ReactionCollector, type ReactionCollectorOptions, type ReplyIntent, Role, type RoleCreateOptions, type RoleEditOptions, RoleManager, type RolePermissionOptions, type RoleResolvable, Server, ServerChannelManager, type ServerEditOptions, ServerManager, StoatAPIError, SweeperManager, type SweeperOptions, TextChannel, type TextEmbedData, UnknownChannel, User, type UserEditOptions, UserManager, type UserPresence, type UserProfile, type UserRelationShip, type UserResolvable, type UserStatus };
|
|
2342
|
+
export { Attachment, AttachmentBuilder, type AttachmentMetadata, AudioPlayer, type AudioPlayerEvents, type AudioPlayerStatus, AudioResource, type AudioResourceOptions, type AudioSource, Base, BaseChannel, BitField, type BitFieldResolvable, type BotInformation, type CDNTag, type ChannelCreateOptions, type ChannelEditOptions, ChannelManager, type ChannelResolvable, type ChannelRolePermissionOptions, type ChannelType, Client, type ClientEvents, type ClientOptions, ClientUser, Collection, Collector, type CollectorOptions, DMChannel, EmbedBuilder, Emoji, type EmojiCreateOptions, type EmojiEditOptions, EmojiManager, type EmojiParent, type EmojiResolvable, type FetchMembersOptions, GatewayManager, GroupChannel, type Interaction, type Masquerade, Member, type MemberBanOptions, type MemberEditOptions, MemberManager, type MemberResolvable, Message, MessageCollector, type MessageCollectorOptions, type MessageFetchOptions, MessageManager, type MessageOptions, MessageReaction, type MessageResolvable, PermissionFlags, type PermissionResolvable, type PermissionString, Permissions, RESTManager, type RawDMChannel, type RawGroupChannel, type RawTextChannel, ReactionCollector, type ReactionCollectorOptions, type ReplyIntent, Role, type RoleCreateOptions, type RoleEditOptions, RoleManager, type RolePermissionOptions, type RoleResolvable, Server, ServerChannelManager, type ServerEditOptions, ServerManager, StoatAPIError, SweeperManager, type SweeperOptions, TextChannel, type TextEmbedData, UnknownChannel, User, type UserEditOptions, UserManager, type UserPresence, type UserProfile, type UserRelationShip, type UserResolvable, type UserStatus, VoiceConnection, type VoiceConnectionEvents, type VoiceConnectionStatus, VoiceManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,13 @@ import * as stoatApi from 'stoat-api';
|
|
|
4
4
|
export { stoatApi as API };
|
|
5
5
|
import * as util from 'node:util';
|
|
6
6
|
import util__default from 'node:util';
|
|
7
|
+
import { Readable } from 'node:stream';
|
|
8
|
+
import { EventEmitter as EventEmitter$1 } from 'node:events';
|
|
7
9
|
|
|
8
10
|
declare class GatewayManager {
|
|
9
11
|
private client;
|
|
10
12
|
private ws;
|
|
13
|
+
private wsURL;
|
|
11
14
|
private pingInterval;
|
|
12
15
|
private token;
|
|
13
16
|
private reconnectAttempts;
|
|
@@ -15,6 +18,7 @@ declare class GatewayManager {
|
|
|
15
18
|
private isIntentionalClose;
|
|
16
19
|
constructor(client: Client);
|
|
17
20
|
connect(token: string): Promise<void>;
|
|
21
|
+
setGatewayUrl(url: string): void;
|
|
18
22
|
private handleMessage;
|
|
19
23
|
private startPingLoop;
|
|
20
24
|
private send;
|
|
@@ -71,10 +75,13 @@ declare class StoatAPIError extends Error {
|
|
|
71
75
|
declare class RESTManager {
|
|
72
76
|
private client;
|
|
73
77
|
private baseURL;
|
|
78
|
+
private cdnURL;
|
|
74
79
|
private token;
|
|
75
80
|
private buckets;
|
|
76
81
|
constructor(client: Client);
|
|
77
82
|
setToken(token: string): void;
|
|
83
|
+
setBaseURL(baseURL: string): void;
|
|
84
|
+
setCDNURL(cdnURL: string): void;
|
|
78
85
|
/**
|
|
79
86
|
* Generates a local identifier for the bucket based on method and path.
|
|
80
87
|
*/
|
|
@@ -1137,6 +1144,82 @@ declare class MessageCollector extends Collector<string, Message> {
|
|
|
1137
1144
|
endReason(): string | null;
|
|
1138
1145
|
}
|
|
1139
1146
|
|
|
1147
|
+
interface AudioResourceOptions {
|
|
1148
|
+
volume?: number;
|
|
1149
|
+
inputType?: string;
|
|
1150
|
+
}
|
|
1151
|
+
type AudioSource = string | Readable;
|
|
1152
|
+
declare class AudioResource {
|
|
1153
|
+
readonly stream: Readable;
|
|
1154
|
+
private constructor();
|
|
1155
|
+
static from(source: AudioSource, options?: AudioResourceOptions): AudioResource;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
type AudioPlayerStatus = "idle" | "buffering" | "playing" | "paused" | "stopped";
|
|
1159
|
+
interface AudioPlayerEvents {
|
|
1160
|
+
stateChange: [oldStatus: AudioPlayerStatus, newStatus: AudioPlayerStatus];
|
|
1161
|
+
idle: [];
|
|
1162
|
+
error: [error: Error];
|
|
1163
|
+
}
|
|
1164
|
+
declare class AudioPlayer extends EventEmitter$1<AudioPlayerEvents> {
|
|
1165
|
+
private _status;
|
|
1166
|
+
private _resource;
|
|
1167
|
+
/** Registered VoiceConnections subscribed to this player */
|
|
1168
|
+
private readonly subscribers;
|
|
1169
|
+
get status(): AudioPlayerStatus;
|
|
1170
|
+
get resource(): AudioResource | null;
|
|
1171
|
+
play(resource: AudioResource): void;
|
|
1172
|
+
pause(): void;
|
|
1173
|
+
resume(): void;
|
|
1174
|
+
stop(): void;
|
|
1175
|
+
/** @internal */
|
|
1176
|
+
addSubscriber(conn: VoiceConnection): void;
|
|
1177
|
+
/** @internal */
|
|
1178
|
+
removeSubscriber(conn: VoiceConnection): void;
|
|
1179
|
+
private feed;
|
|
1180
|
+
private transition;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
interface VoiceConnectionEvents {
|
|
1184
|
+
ready: [];
|
|
1185
|
+
disconnect: [];
|
|
1186
|
+
error: [error: Error];
|
|
1187
|
+
}
|
|
1188
|
+
type VoiceConnectionStatus = "connecting" | "ready" | "disconnecting" | "disconnected";
|
|
1189
|
+
declare class VoiceConnection extends EventEmitter$1<VoiceConnectionEvents> {
|
|
1190
|
+
readonly channelId: string;
|
|
1191
|
+
readonly guildId: string | undefined;
|
|
1192
|
+
private readonly room;
|
|
1193
|
+
private _status;
|
|
1194
|
+
private _player;
|
|
1195
|
+
private _audioSource;
|
|
1196
|
+
private _audioTrack;
|
|
1197
|
+
constructor(channelId: string, guildId?: string);
|
|
1198
|
+
get status(): VoiceConnectionStatus;
|
|
1199
|
+
get player(): AudioPlayer | null;
|
|
1200
|
+
/** @internal */
|
|
1201
|
+
connect(url: string, token: string): Promise<void>;
|
|
1202
|
+
subscribe(player: AudioPlayer): void;
|
|
1203
|
+
unsubscribe(): void;
|
|
1204
|
+
_feedStream(stream: Readable): Promise<void>;
|
|
1205
|
+
disconnect(): Promise<void>;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
declare class VoiceManager {
|
|
1209
|
+
private readonly connections;
|
|
1210
|
+
private readonly client;
|
|
1211
|
+
constructor(client: Client);
|
|
1212
|
+
join(channelId: string, guildId?: string): Promise<VoiceConnection>;
|
|
1213
|
+
get(channelId: string): VoiceConnection | undefined;
|
|
1214
|
+
leave(channelId: string): Promise<void>;
|
|
1215
|
+
leaveAll(): Promise<void>;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
declare class VoiceChannel extends TextChannel {
|
|
1219
|
+
join(): Promise<VoiceConnection>;
|
|
1220
|
+
leave(): Promise<void>;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1140
1223
|
type ChannelType = "SavedMessages" | "DirectMessage" | "Group" | "TextChannel";
|
|
1141
1224
|
interface ChannelCreateOptions {
|
|
1142
1225
|
name: string;
|
|
@@ -1244,6 +1327,7 @@ declare abstract class BaseChannel extends Base {
|
|
|
1244
1327
|
isText(): this is TextChannel;
|
|
1245
1328
|
isDM(): this is DMChannel;
|
|
1246
1329
|
isGroup(): this is GroupChannel;
|
|
1330
|
+
isVoice(): this is VoiceChannel;
|
|
1247
1331
|
}
|
|
1248
1332
|
|
|
1249
1333
|
declare class ServerChannelManager {
|
|
@@ -1652,20 +1736,109 @@ declare class Emoji extends Base {
|
|
|
1652
1736
|
nsfw: boolean;
|
|
1653
1737
|
constructor(client: Client, data: Emoji$1);
|
|
1654
1738
|
_patch(data: Emoji$1): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Fetch this emoji from the API or resolves it from the local cache.
|
|
1741
|
+
* @param force Whether to skip the cache check and force a direct API request. Defaults to false.
|
|
1742
|
+
* @returns A promise that resolves to the fetched {@link Emoji} object.
|
|
1743
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1744
|
+
* @example
|
|
1745
|
+
* // Force fetch emoji to update its data
|
|
1746
|
+
* await emoji.fetch(true);
|
|
1747
|
+
*/
|
|
1748
|
+
fetch(force?: boolean): Promise<Emoji>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Deletes this emoji from the server.
|
|
1751
|
+
* @returns A promise that resolves when the emoji has been deleted.
|
|
1752
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1753
|
+
* @example
|
|
1754
|
+
* // Delete an emoji from the server
|
|
1755
|
+
* await emoji.delete();
|
|
1756
|
+
*/
|
|
1757
|
+
delete(): Promise<void>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Edits this emoji's properties.
|
|
1760
|
+
* @param options The options to edit the emoji with.
|
|
1761
|
+
* @returns A promise that resolves to the edited {@link Emoji} object.
|
|
1762
|
+
* @throws {Error} If the API request fails or if the emoji is detached.
|
|
1763
|
+
* @example
|
|
1764
|
+
* // Edit an emoji's name
|
|
1765
|
+
* await emoji.edit({ name: "new_name" });
|
|
1766
|
+
*/
|
|
1767
|
+
edit(options: EmojiEditOptions): Promise<Emoji>;
|
|
1655
1768
|
}
|
|
1656
1769
|
|
|
1770
|
+
interface EmojiCreateOptions {
|
|
1771
|
+
emoji: string | AttachmentBuilder;
|
|
1772
|
+
name: string;
|
|
1773
|
+
nsfw?: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface EmojiEditOptions {
|
|
1776
|
+
name: string;
|
|
1777
|
+
}
|
|
1778
|
+
type EmojiResolvable = string | Emoji;
|
|
1657
1779
|
declare class EmojiManager extends BaseManager<string, Emoji> {
|
|
1658
1780
|
server?: Server | undefined;
|
|
1659
1781
|
constructor(client: Client, server?: Server | undefined, limit?: number);
|
|
1660
1782
|
/**
|
|
1661
1783
|
* Tell BaseManager how to find the ID for Emojis
|
|
1662
1784
|
*/
|
|
1663
|
-
protected extractId(data:
|
|
1785
|
+
protected extractId(data: Emoji$1): string;
|
|
1664
1786
|
/**
|
|
1665
1787
|
* Tell BaseManager how to build an Emoji
|
|
1666
1788
|
*/
|
|
1667
|
-
protected construct(data:
|
|
1668
|
-
|
|
1789
|
+
protected construct(data: Emoji$1): Emoji;
|
|
1790
|
+
/**
|
|
1791
|
+
* Fetch an Emoji from the API or resolves it from the local cache.
|
|
1792
|
+
* @param emoji The ID, mention, or {@link Emoji} object to fetch
|
|
1793
|
+
* @param force Whether to skip the cache check and force a direct API request. Defaults to false.
|
|
1794
|
+
* @returns A promise that resolves to the fetched {@link Emoji} object.
|
|
1795
|
+
* @throws {TypeError} If an invalid {@link EmojiResolvable} is provided.
|
|
1796
|
+
* @throws {Error} If the API request fails.
|
|
1797
|
+
* @example
|
|
1798
|
+
* // Fetch a channel, bypassing cache
|
|
1799
|
+
* const channel = await client.channels.fetch("01H...", true);
|
|
1800
|
+
*/
|
|
1801
|
+
fetch(emoji: EmojiResolvable, force?: boolean): Promise<Emoji>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Resolves a {@link EmojiResolvable} to a {@link Emoji} object from the cache.
|
|
1804
|
+
* @param emoji The {@link EmojiResolvable} to resolve.
|
|
1805
|
+
* @returns The resolved {@link Emoji} object, or undefined if not found.
|
|
1806
|
+
*/
|
|
1807
|
+
resolve(emoji: EmojiResolvable): Emoji | undefined;
|
|
1808
|
+
/**
|
|
1809
|
+
* Extracts ID from a {@link EmojiResolvable}.
|
|
1810
|
+
* @param emoji The {@link EmojiResolvable} to extract the ID from.
|
|
1811
|
+
* @returns The extracted {@link Emoji} ID.
|
|
1812
|
+
* @throws {TypeError} If an invalid type is provided.
|
|
1813
|
+
*/
|
|
1814
|
+
resolveId(emoji: EmojiResolvable): string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Create a new emoji
|
|
1817
|
+
* @param options The options for creating the emoji
|
|
1818
|
+
* @returns A promise that resolves to the created {@link Emoji} object.
|
|
1819
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager} or if the emoji attachment cannot be resolved.
|
|
1820
|
+
* @example
|
|
1821
|
+
* const emoji = await client.emojis.create(server, { emoji: "path/to/emoji.png", name: "myEmoji" });
|
|
1822
|
+
*/
|
|
1823
|
+
crate(options: EmojiCreateOptions): Promise<Emoji>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Delete an emoji
|
|
1826
|
+
* @param emoji The {@link EmojiResolvable} to delete
|
|
1827
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager}.
|
|
1828
|
+
* @example
|
|
1829
|
+
* await client.emojis.delete(emoji);
|
|
1830
|
+
*/
|
|
1831
|
+
delete(emoji: EmojiResolvable): Promise<void>;
|
|
1832
|
+
/**
|
|
1833
|
+
* Edit an emoji
|
|
1834
|
+
* @param emoji The {@link EmojiResolvable} to edit
|
|
1835
|
+
* @param options The options to edit the emoji with
|
|
1836
|
+
* @returns A promise that resolves to the edited {@link Emoji} object.
|
|
1837
|
+
* @throws {Error} If no server is registered in the {@link EmojiManager}.
|
|
1838
|
+
* @example
|
|
1839
|
+
* const editedEmoji = await client.emojis.edit(emoji, { name: "newName" });
|
|
1840
|
+
*/
|
|
1841
|
+
edit(emoji: EmojiResolvable, options: EmojiEditOptions): Promise<Emoji>;
|
|
1669
1842
|
[util.inspect.custom](): Collection<string, Emoji>;
|
|
1670
1843
|
}
|
|
1671
1844
|
|
|
@@ -2131,9 +2304,13 @@ interface ClientOptions {
|
|
|
2131
2304
|
channels?: number;
|
|
2132
2305
|
emojis?: number;
|
|
2133
2306
|
};
|
|
2307
|
+
apiURL?: string;
|
|
2308
|
+
overrides?: {
|
|
2309
|
+
wsURL?: string;
|
|
2310
|
+
cdnURL?: string;
|
|
2311
|
+
};
|
|
2134
2312
|
}
|
|
2135
2313
|
declare class Client extends EventEmitter {
|
|
2136
|
-
options: ClientOptions;
|
|
2137
2314
|
rest: RESTManager;
|
|
2138
2315
|
gateway: GatewayManager;
|
|
2139
2316
|
channels: ChannelManager;
|
|
@@ -2142,11 +2319,14 @@ declare class Client extends EventEmitter {
|
|
|
2142
2319
|
sweepers: SweeperManager;
|
|
2143
2320
|
emojis: EmojiManager;
|
|
2144
2321
|
user: ClientUser | null;
|
|
2322
|
+
options: ClientOptions;
|
|
2323
|
+
readonly voice: VoiceManager;
|
|
2145
2324
|
constructor(options?: ClientOptions);
|
|
2146
2325
|
/**
|
|
2147
2326
|
* Connects the bot to the Stoat Gateway
|
|
2148
2327
|
*/
|
|
2149
2328
|
login(token: string): Promise<any>;
|
|
2329
|
+
private fetchConfig;
|
|
2150
2330
|
on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
2151
2331
|
once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
2152
2332
|
emit<K extends keyof ClientEvents>(event: K, ...args: ClientEvents[K]): boolean;
|
|
@@ -2159,4 +2339,4 @@ declare class UnknownChannel extends BaseChannel {
|
|
|
2159
2339
|
constructor(client: Client, data: Channel);
|
|
2160
2340
|
}
|
|
2161
2341
|
|
|
2162
|
-
export { Attachment, AttachmentBuilder, type AttachmentMetadata, Base, BaseChannel, BitField, type BitFieldResolvable, type BotInformation, type CDNTag, type ChannelCreateOptions, type ChannelEditOptions, ChannelManager, type ChannelResolvable, type ChannelRolePermissionOptions, type ChannelType, Client, type ClientEvents, type ClientOptions, ClientUser, Collection, Collector, type CollectorOptions, DMChannel, EmbedBuilder, Emoji, EmojiManager, type EmojiParent, type FetchMembersOptions, GatewayManager, GroupChannel, type Interaction, type Masquerade, Member, type MemberBanOptions, type MemberEditOptions, MemberManager, type MemberResolvable, Message, MessageCollector, type MessageCollectorOptions, type MessageFetchOptions, MessageManager, type MessageOptions, MessageReaction, type MessageResolvable, PermissionFlags, type PermissionResolvable, type PermissionString, Permissions, RESTManager, type RawDMChannel, type RawGroupChannel, type RawTextChannel, ReactionCollector, type ReactionCollectorOptions, type ReplyIntent, Role, type RoleCreateOptions, type RoleEditOptions, RoleManager, type RolePermissionOptions, type RoleResolvable, Server, ServerChannelManager, type ServerEditOptions, ServerManager, StoatAPIError, SweeperManager, type SweeperOptions, TextChannel, type TextEmbedData, UnknownChannel, User, type UserEditOptions, UserManager, type UserPresence, type UserProfile, type UserRelationShip, type UserResolvable, type UserStatus };
|
|
2342
|
+
export { Attachment, AttachmentBuilder, type AttachmentMetadata, AudioPlayer, type AudioPlayerEvents, type AudioPlayerStatus, AudioResource, type AudioResourceOptions, type AudioSource, Base, BaseChannel, BitField, type BitFieldResolvable, type BotInformation, type CDNTag, type ChannelCreateOptions, type ChannelEditOptions, ChannelManager, type ChannelResolvable, type ChannelRolePermissionOptions, type ChannelType, Client, type ClientEvents, type ClientOptions, ClientUser, Collection, Collector, type CollectorOptions, DMChannel, EmbedBuilder, Emoji, type EmojiCreateOptions, type EmojiEditOptions, EmojiManager, type EmojiParent, type EmojiResolvable, type FetchMembersOptions, GatewayManager, GroupChannel, type Interaction, type Masquerade, Member, type MemberBanOptions, type MemberEditOptions, MemberManager, type MemberResolvable, Message, MessageCollector, type MessageCollectorOptions, type MessageFetchOptions, MessageManager, type MessageOptions, MessageReaction, type MessageResolvable, PermissionFlags, type PermissionResolvable, type PermissionString, Permissions, RESTManager, type RawDMChannel, type RawGroupChannel, type RawTextChannel, ReactionCollector, type ReactionCollectorOptions, type ReplyIntent, Role, type RoleCreateOptions, type RoleEditOptions, RoleManager, type RolePermissionOptions, type RoleResolvable, Server, ServerChannelManager, type ServerEditOptions, ServerManager, StoatAPIError, SweeperManager, type SweeperOptions, TextChannel, type TextEmbedData, UnknownChannel, User, type UserEditOptions, UserManager, type UserPresence, type UserProfile, type UserRelationShip, type UserResolvable, type UserStatus, VoiceConnection, type VoiceConnectionEvents, type VoiceConnectionStatus, VoiceManager };
|