@furlow/discord 0.1.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/dist/client/index.d.ts +79 -0
- package/dist/client/index.js +236 -0
- package/dist/client/index.js.map +1 -0
- package/dist/gateway/index.d.ts +62 -0
- package/dist/gateway/index.js +128 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1089 -0
- package/dist/index.js.map +1 -0
- package/dist/interactions/index.d.ts +89 -0
- package/dist/interactions/index.js +266 -0
- package/dist/interactions/index.js.map +1 -0
- package/dist/video/index.d.ts +94 -0
- package/dist/video/index.js +209 -0
- package/dist/video/index.js.map +1 -0
- package/dist/voice/index.d.ts +136 -0
- package/dist/voice/index.js +258 -0
- package/dist/voice/index.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ClientEvents, Client } from 'discord.js';
|
|
2
|
+
import { FurlowSpec } from '@furlow/schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Discord client wrapper
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface FurlowClientOptions {
|
|
9
|
+
token: string;
|
|
10
|
+
spec: FurlowSpec;
|
|
11
|
+
}
|
|
12
|
+
declare class FurlowClient {
|
|
13
|
+
private client;
|
|
14
|
+
private token;
|
|
15
|
+
private spec;
|
|
16
|
+
constructor(options: FurlowClientOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Resolve intents from spec
|
|
19
|
+
*/
|
|
20
|
+
private resolveIntents;
|
|
21
|
+
/**
|
|
22
|
+
* Auto-detect required intents from spec
|
|
23
|
+
*/
|
|
24
|
+
private autoDetectIntents;
|
|
25
|
+
/**
|
|
26
|
+
* Start the client
|
|
27
|
+
*/
|
|
28
|
+
start(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Stop the client
|
|
31
|
+
*/
|
|
32
|
+
stop(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Apply bot identity
|
|
35
|
+
*/
|
|
36
|
+
private applyIdentity;
|
|
37
|
+
/**
|
|
38
|
+
* Apply presence
|
|
39
|
+
*/
|
|
40
|
+
private applyPresence;
|
|
41
|
+
/**
|
|
42
|
+
* Get Discord.js activity type
|
|
43
|
+
*/
|
|
44
|
+
private getActivityType;
|
|
45
|
+
/**
|
|
46
|
+
* Register event listener
|
|
47
|
+
*/
|
|
48
|
+
on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
49
|
+
/**
|
|
50
|
+
* Register one-time event listener
|
|
51
|
+
*/
|
|
52
|
+
once<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => void): this;
|
|
53
|
+
/**
|
|
54
|
+
* Get the underlying Discord.js client
|
|
55
|
+
*/
|
|
56
|
+
getClient(): Client;
|
|
57
|
+
/**
|
|
58
|
+
* Get the spec
|
|
59
|
+
*/
|
|
60
|
+
getSpec(): FurlowSpec;
|
|
61
|
+
/**
|
|
62
|
+
* Check if client is ready
|
|
63
|
+
*/
|
|
64
|
+
isReady(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Get guild count
|
|
67
|
+
*/
|
|
68
|
+
get guildCount(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Get user count (approximate)
|
|
71
|
+
*/
|
|
72
|
+
get userCount(): number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a FURLOW client
|
|
76
|
+
*/
|
|
77
|
+
declare function createClient(options: FurlowClientOptions): FurlowClient;
|
|
78
|
+
|
|
79
|
+
export { FurlowClient, type FurlowClientOptions, createClient };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// src/client/index.ts
|
|
2
|
+
import {
|
|
3
|
+
Client,
|
|
4
|
+
GatewayIntentBits,
|
|
5
|
+
Partials
|
|
6
|
+
} from "discord.js";
|
|
7
|
+
var INTENT_MAP = {
|
|
8
|
+
guilds: GatewayIntentBits.Guilds,
|
|
9
|
+
guild_members: GatewayIntentBits.GuildMembers,
|
|
10
|
+
guild_moderation: GatewayIntentBits.GuildModeration,
|
|
11
|
+
guild_emojis_and_stickers: GatewayIntentBits.GuildEmojisAndStickers,
|
|
12
|
+
guild_integrations: GatewayIntentBits.GuildIntegrations,
|
|
13
|
+
guild_webhooks: GatewayIntentBits.GuildWebhooks,
|
|
14
|
+
guild_invites: GatewayIntentBits.GuildInvites,
|
|
15
|
+
guild_voice_states: GatewayIntentBits.GuildVoiceStates,
|
|
16
|
+
guild_presences: GatewayIntentBits.GuildPresences,
|
|
17
|
+
guild_messages: GatewayIntentBits.GuildMessages,
|
|
18
|
+
guild_message_reactions: GatewayIntentBits.GuildMessageReactions,
|
|
19
|
+
guild_message_typing: GatewayIntentBits.GuildMessageTyping,
|
|
20
|
+
direct_messages: GatewayIntentBits.DirectMessages,
|
|
21
|
+
direct_message_reactions: GatewayIntentBits.DirectMessageReactions,
|
|
22
|
+
direct_message_typing: GatewayIntentBits.DirectMessageTyping,
|
|
23
|
+
message_content: GatewayIntentBits.MessageContent,
|
|
24
|
+
guild_scheduled_events: GatewayIntentBits.GuildScheduledEvents,
|
|
25
|
+
auto_moderation_configuration: GatewayIntentBits.AutoModerationConfiguration,
|
|
26
|
+
auto_moderation_execution: GatewayIntentBits.AutoModerationExecution
|
|
27
|
+
};
|
|
28
|
+
var FurlowClient = class {
|
|
29
|
+
client;
|
|
30
|
+
token;
|
|
31
|
+
spec;
|
|
32
|
+
constructor(options) {
|
|
33
|
+
this.token = options.token;
|
|
34
|
+
this.spec = options.spec;
|
|
35
|
+
const intents = this.resolveIntents(options.spec.intents);
|
|
36
|
+
const clientOptions = {
|
|
37
|
+
intents,
|
|
38
|
+
partials: [
|
|
39
|
+
Partials.Message,
|
|
40
|
+
Partials.Channel,
|
|
41
|
+
Partials.Reaction,
|
|
42
|
+
Partials.User,
|
|
43
|
+
Partials.GuildMember
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
this.client = new Client(clientOptions);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve intents from spec
|
|
50
|
+
*/
|
|
51
|
+
resolveIntents(config) {
|
|
52
|
+
if (!config) {
|
|
53
|
+
return [
|
|
54
|
+
GatewayIntentBits.Guilds,
|
|
55
|
+
GatewayIntentBits.GuildMessages,
|
|
56
|
+
GatewayIntentBits.GuildMembers,
|
|
57
|
+
GatewayIntentBits.MessageContent
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
if (config.auto) {
|
|
61
|
+
return this.autoDetectIntents();
|
|
62
|
+
}
|
|
63
|
+
if (config.explicit) {
|
|
64
|
+
return config.explicit.map((intent) => INTENT_MAP[intent]).filter((i) => i !== void 0);
|
|
65
|
+
}
|
|
66
|
+
return [GatewayIntentBits.Guilds];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Auto-detect required intents from spec
|
|
70
|
+
*/
|
|
71
|
+
autoDetectIntents() {
|
|
72
|
+
const intents = /* @__PURE__ */ new Set();
|
|
73
|
+
intents.add(GatewayIntentBits.Guilds);
|
|
74
|
+
if (this.spec.events) {
|
|
75
|
+
for (const handler of this.spec.events) {
|
|
76
|
+
switch (handler.event) {
|
|
77
|
+
case "message_create":
|
|
78
|
+
case "message":
|
|
79
|
+
case "message_update":
|
|
80
|
+
case "message_delete":
|
|
81
|
+
intents.add(GatewayIntentBits.GuildMessages);
|
|
82
|
+
intents.add(GatewayIntentBits.MessageContent);
|
|
83
|
+
break;
|
|
84
|
+
case "guild_member_add":
|
|
85
|
+
case "guild_member_remove":
|
|
86
|
+
case "guild_member_update":
|
|
87
|
+
case "member_join":
|
|
88
|
+
case "member_leave":
|
|
89
|
+
intents.add(GatewayIntentBits.GuildMembers);
|
|
90
|
+
break;
|
|
91
|
+
case "voice_state_update":
|
|
92
|
+
case "voice_join":
|
|
93
|
+
case "voice_leave":
|
|
94
|
+
intents.add(GatewayIntentBits.GuildVoiceStates);
|
|
95
|
+
break;
|
|
96
|
+
case "message_reaction_add":
|
|
97
|
+
case "message_reaction_remove":
|
|
98
|
+
intents.add(GatewayIntentBits.GuildMessageReactions);
|
|
99
|
+
break;
|
|
100
|
+
case "presence_update":
|
|
101
|
+
intents.add(GatewayIntentBits.GuildPresences);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (this.spec.commands?.length) {
|
|
107
|
+
intents.add(GatewayIntentBits.GuildMessages);
|
|
108
|
+
}
|
|
109
|
+
if (this.spec.voice) {
|
|
110
|
+
intents.add(GatewayIntentBits.GuildVoiceStates);
|
|
111
|
+
}
|
|
112
|
+
return [...intents];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Start the client
|
|
116
|
+
*/
|
|
117
|
+
async start() {
|
|
118
|
+
await this.client.login(this.token);
|
|
119
|
+
if (!this.client.isReady()) {
|
|
120
|
+
await new Promise((resolve) => {
|
|
121
|
+
this.client.once("ready", () => resolve());
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
await this.applyIdentity();
|
|
125
|
+
await this.applyPresence();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Stop the client
|
|
129
|
+
*/
|
|
130
|
+
async stop() {
|
|
131
|
+
await this.client.destroy();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Apply bot identity
|
|
135
|
+
*/
|
|
136
|
+
async applyIdentity() {
|
|
137
|
+
if (!this.spec.identity) return;
|
|
138
|
+
const identity = this.spec.identity;
|
|
139
|
+
if (identity.name && this.client.user?.username !== identity.name) {
|
|
140
|
+
try {
|
|
141
|
+
await this.client.user?.setUsername(identity.name);
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (identity.avatar) {
|
|
146
|
+
try {
|
|
147
|
+
await this.client.user?.setAvatar(identity.avatar);
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Apply presence
|
|
154
|
+
*/
|
|
155
|
+
async applyPresence() {
|
|
156
|
+
if (!this.spec.presence) return;
|
|
157
|
+
const presence = this.spec.presence;
|
|
158
|
+
this.client.user?.setPresence({
|
|
159
|
+
status: presence.status ?? "online",
|
|
160
|
+
activities: presence.activity ? [
|
|
161
|
+
{
|
|
162
|
+
type: this.getActivityType(presence.activity.type),
|
|
163
|
+
name: presence.activity.text,
|
|
164
|
+
url: presence.activity.url,
|
|
165
|
+
state: presence.activity.state
|
|
166
|
+
}
|
|
167
|
+
] : void 0
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get Discord.js activity type
|
|
172
|
+
*/
|
|
173
|
+
getActivityType(type) {
|
|
174
|
+
const types = {
|
|
175
|
+
playing: 0,
|
|
176
|
+
streaming: 1,
|
|
177
|
+
listening: 2,
|
|
178
|
+
watching: 3,
|
|
179
|
+
custom: 4,
|
|
180
|
+
competing: 5
|
|
181
|
+
};
|
|
182
|
+
return types[type] ?? 0;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Register event listener
|
|
186
|
+
*/
|
|
187
|
+
on(event, listener) {
|
|
188
|
+
this.client.on(event, listener);
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Register one-time event listener
|
|
193
|
+
*/
|
|
194
|
+
once(event, listener) {
|
|
195
|
+
this.client.once(event, listener);
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get the underlying Discord.js client
|
|
200
|
+
*/
|
|
201
|
+
getClient() {
|
|
202
|
+
return this.client;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get the spec
|
|
206
|
+
*/
|
|
207
|
+
getSpec() {
|
|
208
|
+
return this.spec;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Check if client is ready
|
|
212
|
+
*/
|
|
213
|
+
isReady() {
|
|
214
|
+
return this.client.isReady();
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get guild count
|
|
218
|
+
*/
|
|
219
|
+
get guildCount() {
|
|
220
|
+
return this.client.guilds.cache.size;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get user count (approximate)
|
|
224
|
+
*/
|
|
225
|
+
get userCount() {
|
|
226
|
+
return this.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
function createClient(options) {
|
|
230
|
+
return new FurlowClient(options);
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
FurlowClient,
|
|
234
|
+
createClient
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/client/index.ts"],"sourcesContent":["/**\n * Discord client wrapper\n */\n\nimport {\n Client,\n GatewayIntentBits,\n Partials,\n type ClientOptions,\n type ClientEvents,\n} from 'discord.js';\nimport type { FurlowSpec, IntentsConfig, GatewayConfig, Identity, Presence } from '@furlow/schema';\n\nexport interface FurlowClientOptions {\n token: string;\n spec: FurlowSpec;\n}\n\nconst INTENT_MAP: Record<string, GatewayIntentBits> = {\n guilds: GatewayIntentBits.Guilds,\n guild_members: GatewayIntentBits.GuildMembers,\n guild_moderation: GatewayIntentBits.GuildModeration,\n guild_emojis_and_stickers: GatewayIntentBits.GuildEmojisAndStickers,\n guild_integrations: GatewayIntentBits.GuildIntegrations,\n guild_webhooks: GatewayIntentBits.GuildWebhooks,\n guild_invites: GatewayIntentBits.GuildInvites,\n guild_voice_states: GatewayIntentBits.GuildVoiceStates,\n guild_presences: GatewayIntentBits.GuildPresences,\n guild_messages: GatewayIntentBits.GuildMessages,\n guild_message_reactions: GatewayIntentBits.GuildMessageReactions,\n guild_message_typing: GatewayIntentBits.GuildMessageTyping,\n direct_messages: GatewayIntentBits.DirectMessages,\n direct_message_reactions: GatewayIntentBits.DirectMessageReactions,\n direct_message_typing: GatewayIntentBits.DirectMessageTyping,\n message_content: GatewayIntentBits.MessageContent,\n guild_scheduled_events: GatewayIntentBits.GuildScheduledEvents,\n auto_moderation_configuration: GatewayIntentBits.AutoModerationConfiguration,\n auto_moderation_execution: GatewayIntentBits.AutoModerationExecution,\n};\n\nexport class FurlowClient {\n private client: Client;\n private token: string;\n private spec: FurlowSpec;\n\n constructor(options: FurlowClientOptions) {\n this.token = options.token;\n this.spec = options.spec;\n\n const intents = this.resolveIntents(options.spec.intents);\n\n const clientOptions: ClientOptions = {\n intents,\n partials: [\n Partials.Message,\n Partials.Channel,\n Partials.Reaction,\n Partials.User,\n Partials.GuildMember,\n ],\n };\n\n this.client = new Client(clientOptions);\n }\n\n /**\n * Resolve intents from spec\n */\n private resolveIntents(config?: IntentsConfig): GatewayIntentBits[] {\n if (!config) {\n // Default intents\n return [\n GatewayIntentBits.Guilds,\n GatewayIntentBits.GuildMessages,\n GatewayIntentBits.GuildMembers,\n GatewayIntentBits.MessageContent,\n ];\n }\n\n if (config.auto) {\n // Auto-detect required intents from spec\n return this.autoDetectIntents();\n }\n\n if (config.explicit) {\n return config.explicit\n .map((intent) => INTENT_MAP[intent])\n .filter((i): i is GatewayIntentBits => i !== undefined);\n }\n\n return [GatewayIntentBits.Guilds];\n }\n\n /**\n * Auto-detect required intents from spec\n */\n private autoDetectIntents(): GatewayIntentBits[] {\n const intents = new Set<GatewayIntentBits>();\n\n // Always need Guilds\n intents.add(GatewayIntentBits.Guilds);\n\n // Check events\n if (this.spec.events) {\n for (const handler of this.spec.events) {\n switch (handler.event) {\n case 'message_create':\n case 'message':\n case 'message_update':\n case 'message_delete':\n intents.add(GatewayIntentBits.GuildMessages);\n intents.add(GatewayIntentBits.MessageContent);\n break;\n case 'guild_member_add':\n case 'guild_member_remove':\n case 'guild_member_update':\n case 'member_join':\n case 'member_leave':\n intents.add(GatewayIntentBits.GuildMembers);\n break;\n case 'voice_state_update':\n case 'voice_join':\n case 'voice_leave':\n intents.add(GatewayIntentBits.GuildVoiceStates);\n break;\n case 'message_reaction_add':\n case 'message_reaction_remove':\n intents.add(GatewayIntentBits.GuildMessageReactions);\n break;\n case 'presence_update':\n intents.add(GatewayIntentBits.GuildPresences);\n break;\n }\n }\n }\n\n // Check if commands exist\n if (this.spec.commands?.length) {\n intents.add(GatewayIntentBits.GuildMessages);\n }\n\n // Check if voice features are used\n if (this.spec.voice) {\n intents.add(GatewayIntentBits.GuildVoiceStates);\n }\n\n return [...intents];\n }\n\n /**\n * Start the client\n */\n async start(): Promise<void> {\n await this.client.login(this.token);\n\n // Wait for ready\n if (!this.client.isReady()) {\n await new Promise<void>((resolve) => {\n this.client.once('ready', () => resolve());\n });\n }\n\n // Apply identity\n await this.applyIdentity();\n\n // Apply presence\n await this.applyPresence();\n }\n\n /**\n * Stop the client\n */\n async stop(): Promise<void> {\n await this.client.destroy();\n }\n\n /**\n * Apply bot identity\n */\n private async applyIdentity(): Promise<void> {\n if (!this.spec.identity) return;\n\n const identity = this.spec.identity;\n\n // Set username if different\n if (identity.name && this.client.user?.username !== identity.name) {\n try {\n await this.client.user?.setUsername(identity.name);\n } catch {\n // Username changes are rate limited\n }\n }\n\n // Set avatar\n if (identity.avatar) {\n try {\n await this.client.user?.setAvatar(identity.avatar);\n } catch {\n // Avatar might be rate limited\n }\n }\n }\n\n /**\n * Apply presence\n */\n private async applyPresence(): Promise<void> {\n if (!this.spec.presence) return;\n\n const presence = this.spec.presence;\n\n this.client.user?.setPresence({\n status: presence.status ?? 'online',\n activities: presence.activity\n ? [\n {\n type: this.getActivityType(presence.activity.type),\n name: presence.activity.text,\n url: presence.activity.url,\n state: presence.activity.state,\n },\n ]\n : undefined,\n });\n }\n\n /**\n * Get Discord.js activity type\n */\n private getActivityType(type: string): number {\n const types: Record<string, number> = {\n playing: 0,\n streaming: 1,\n listening: 2,\n watching: 3,\n custom: 4,\n competing: 5,\n };\n return types[type] ?? 0;\n }\n\n /**\n * Register event listener\n */\n on<K extends keyof ClientEvents>(\n event: K,\n listener: (...args: ClientEvents[K]) => void\n ): this {\n this.client.on(event, listener);\n return this;\n }\n\n /**\n * Register one-time event listener\n */\n once<K extends keyof ClientEvents>(\n event: K,\n listener: (...args: ClientEvents[K]) => void\n ): this {\n this.client.once(event, listener);\n return this;\n }\n\n /**\n * Get the underlying Discord.js client\n */\n getClient(): Client {\n return this.client;\n }\n\n /**\n * Get the spec\n */\n getSpec(): FurlowSpec {\n return this.spec;\n }\n\n /**\n * Check if client is ready\n */\n isReady(): boolean {\n return this.client.isReady();\n }\n\n /**\n * Get guild count\n */\n get guildCount(): number {\n return this.client.guilds.cache.size;\n }\n\n /**\n * Get user count (approximate)\n */\n get userCount(): number {\n return this.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);\n }\n}\n\n/**\n * Create a FURLOW client\n */\nexport function createClient(options: FurlowClientOptions): FurlowClient {\n return new FurlowClient(options);\n}\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQP,IAAM,aAAgD;AAAA,EACpD,QAAQ,kBAAkB;AAAA,EAC1B,eAAe,kBAAkB;AAAA,EACjC,kBAAkB,kBAAkB;AAAA,EACpC,2BAA2B,kBAAkB;AAAA,EAC7C,oBAAoB,kBAAkB;AAAA,EACtC,gBAAgB,kBAAkB;AAAA,EAClC,eAAe,kBAAkB;AAAA,EACjC,oBAAoB,kBAAkB;AAAA,EACtC,iBAAiB,kBAAkB;AAAA,EACnC,gBAAgB,kBAAkB;AAAA,EAClC,yBAAyB,kBAAkB;AAAA,EAC3C,sBAAsB,kBAAkB;AAAA,EACxC,iBAAiB,kBAAkB;AAAA,EACnC,0BAA0B,kBAAkB;AAAA,EAC5C,uBAAuB,kBAAkB;AAAA,EACzC,iBAAiB,kBAAkB;AAAA,EACnC,wBAAwB,kBAAkB;AAAA,EAC1C,+BAA+B,kBAAkB;AAAA,EACjD,2BAA2B,kBAAk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AAK,OAAO,OAAO,MAAM;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,YAAoB;AACtB,WAAO,KAAK,OAAO,OAAO,MAAM,OAAO,CAAC,KAAK,UAAU,MAAM,MAAM,aAAa,CAAC;AAAA,EACnF;AACF;AAKO,SAAS,aAAa,SAA4C;AACvE,SAAO,IAAI,aAAa,OAAO;AACjC;","names":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Client } from 'discord.js';
|
|
2
|
+
import { GatewayConfig } from '@furlow/schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gateway connection management
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface GatewayManagerOptions {
|
|
9
|
+
config?: GatewayConfig;
|
|
10
|
+
onReconnect?: () => void;
|
|
11
|
+
onDisconnect?: () => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
}
|
|
14
|
+
declare class GatewayManager {
|
|
15
|
+
private client;
|
|
16
|
+
private config;
|
|
17
|
+
private reconnectAttempts;
|
|
18
|
+
private maxReconnectAttempts;
|
|
19
|
+
private baseDelay;
|
|
20
|
+
private maxDelay;
|
|
21
|
+
private backoffStrategy;
|
|
22
|
+
constructor(client: Client, options?: GatewayManagerOptions);
|
|
23
|
+
private setupListeners;
|
|
24
|
+
/**
|
|
25
|
+
* Get the delay for the next reconnection attempt
|
|
26
|
+
*/
|
|
27
|
+
getReconnectDelay(): number;
|
|
28
|
+
/**
|
|
29
|
+
* Check if we should attempt reconnection
|
|
30
|
+
*/
|
|
31
|
+
shouldReconnect(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get current reconnect attempt count
|
|
34
|
+
*/
|
|
35
|
+
getReconnectAttempts(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Reset reconnect counter
|
|
38
|
+
*/
|
|
39
|
+
resetReconnectAttempts(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get gateway latency (ping)
|
|
42
|
+
*/
|
|
43
|
+
getPing(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Get shard info
|
|
46
|
+
*/
|
|
47
|
+
getShardInfo(): Array<{
|
|
48
|
+
id: number;
|
|
49
|
+
status: string;
|
|
50
|
+
ping: number;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Parse duration string to milliseconds
|
|
54
|
+
*/
|
|
55
|
+
private parseDuration;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a gateway manager
|
|
59
|
+
*/
|
|
60
|
+
declare function createGatewayManager(client: Client, options?: GatewayManagerOptions): GatewayManager;
|
|
61
|
+
|
|
62
|
+
export { GatewayManager, type GatewayManagerOptions, createGatewayManager };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// src/gateway/index.ts
|
|
2
|
+
var GatewayManager = class {
|
|
3
|
+
client;
|
|
4
|
+
config;
|
|
5
|
+
reconnectAttempts = 0;
|
|
6
|
+
maxReconnectAttempts;
|
|
7
|
+
baseDelay;
|
|
8
|
+
maxDelay;
|
|
9
|
+
backoffStrategy;
|
|
10
|
+
constructor(client, options = {}) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this.config = options.config ?? {};
|
|
13
|
+
const reconnect = this.config.reconnect ?? {};
|
|
14
|
+
this.maxReconnectAttempts = reconnect.max_retries ?? 10;
|
|
15
|
+
const baseDelay = reconnect.base_delay ?? "1s";
|
|
16
|
+
const maxDelay = reconnect.max_delay ?? "60s";
|
|
17
|
+
this.baseDelay = typeof baseDelay === "number" ? baseDelay : this.parseDuration(baseDelay);
|
|
18
|
+
this.maxDelay = typeof maxDelay === "number" ? maxDelay : this.parseDuration(maxDelay);
|
|
19
|
+
this.backoffStrategy = reconnect.backoff ?? "exponential";
|
|
20
|
+
this.setupListeners(options);
|
|
21
|
+
}
|
|
22
|
+
setupListeners(options) {
|
|
23
|
+
this.client.on("shardReady", (shardId) => {
|
|
24
|
+
console.log(`Shard ${shardId} ready`);
|
|
25
|
+
this.reconnectAttempts = 0;
|
|
26
|
+
});
|
|
27
|
+
this.client.on("shardDisconnect", (event, shardId) => {
|
|
28
|
+
console.log(`Shard ${shardId} disconnected: ${event.code}`);
|
|
29
|
+
options.onDisconnect?.();
|
|
30
|
+
});
|
|
31
|
+
this.client.on("shardReconnecting", (shardId) => {
|
|
32
|
+
console.log(`Shard ${shardId} reconnecting...`);
|
|
33
|
+
this.reconnectAttempts++;
|
|
34
|
+
options.onReconnect?.();
|
|
35
|
+
});
|
|
36
|
+
this.client.on("shardError", (error, shardId) => {
|
|
37
|
+
console.error(`Shard ${shardId} error:`, error);
|
|
38
|
+
options.onError?.(error);
|
|
39
|
+
});
|
|
40
|
+
this.client.on("shardResume", (shardId, replayedEvents) => {
|
|
41
|
+
console.log(`Shard ${shardId} resumed, replayed ${replayedEvents} events`);
|
|
42
|
+
this.reconnectAttempts = 0;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the delay for the next reconnection attempt
|
|
47
|
+
*/
|
|
48
|
+
getReconnectDelay() {
|
|
49
|
+
switch (this.backoffStrategy) {
|
|
50
|
+
case "exponential":
|
|
51
|
+
return Math.min(
|
|
52
|
+
this.baseDelay * Math.pow(2, this.reconnectAttempts),
|
|
53
|
+
this.maxDelay
|
|
54
|
+
);
|
|
55
|
+
case "linear":
|
|
56
|
+
return Math.min(
|
|
57
|
+
this.baseDelay * (this.reconnectAttempts + 1),
|
|
58
|
+
this.maxDelay
|
|
59
|
+
);
|
|
60
|
+
case "fixed":
|
|
61
|
+
default:
|
|
62
|
+
return this.baseDelay;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if we should attempt reconnection
|
|
67
|
+
*/
|
|
68
|
+
shouldReconnect() {
|
|
69
|
+
return this.reconnectAttempts < this.maxReconnectAttempts;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get current reconnect attempt count
|
|
73
|
+
*/
|
|
74
|
+
getReconnectAttempts() {
|
|
75
|
+
return this.reconnectAttempts;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Reset reconnect counter
|
|
79
|
+
*/
|
|
80
|
+
resetReconnectAttempts() {
|
|
81
|
+
this.reconnectAttempts = 0;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get gateway latency (ping)
|
|
85
|
+
*/
|
|
86
|
+
getPing() {
|
|
87
|
+
return this.client.ws.ping;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get shard info
|
|
91
|
+
*/
|
|
92
|
+
getShardInfo() {
|
|
93
|
+
return [...this.client.ws.shards.values()].map((shard) => ({
|
|
94
|
+
id: shard.id,
|
|
95
|
+
status: shard.status.toString(),
|
|
96
|
+
ping: shard.ping
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Parse duration string to milliseconds
|
|
101
|
+
*/
|
|
102
|
+
parseDuration(duration) {
|
|
103
|
+
const match = duration.match(/^(\d+)(ms|s|m|h)?$/);
|
|
104
|
+
if (!match) return 1e3;
|
|
105
|
+
const value = parseInt(match[1], 10);
|
|
106
|
+
const unit = match[2] ?? "s";
|
|
107
|
+
switch (unit) {
|
|
108
|
+
case "ms":
|
|
109
|
+
return value;
|
|
110
|
+
case "s":
|
|
111
|
+
return value * 1e3;
|
|
112
|
+
case "m":
|
|
113
|
+
return value * 60 * 1e3;
|
|
114
|
+
case "h":
|
|
115
|
+
return value * 60 * 60 * 1e3;
|
|
116
|
+
default:
|
|
117
|
+
return value * 1e3;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
function createGatewayManager(client, options) {
|
|
122
|
+
return new GatewayManager(client, options);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
GatewayManager,
|
|
126
|
+
createGatewayManager
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/gateway/index.ts"],"sourcesContent":["/**\n * Gateway connection management\n */\n\nimport type { Client, ClientEvents } from 'discord.js';\nimport type { GatewayConfig } from '@furlow/schema';\n\nexport interface GatewayManagerOptions {\n config?: GatewayConfig;\n onReconnect?: () => void;\n onDisconnect?: () => void;\n onError?: (error: Error) => void;\n}\n\nexport class GatewayManager {\n private client: Client;\n private config: GatewayConfig;\n private reconnectAttempts = 0;\n private maxReconnectAttempts: number;\n private baseDelay: number;\n private maxDelay: number;\n private backoffStrategy: 'exponential' | 'linear' | 'fixed';\n\n constructor(client: Client, options: GatewayManagerOptions = {}) {\n this.client = client;\n this.config = options.config ?? {};\n\n const reconnect = this.config.reconnect ?? {};\n this.maxReconnectAttempts = reconnect.max_retries ?? 10;\n const baseDelay = reconnect.base_delay ?? '1s';\n const maxDelay = reconnect.max_delay ?? '60s';\n this.baseDelay = typeof baseDelay === 'number' ? baseDelay : this.parseDuration(baseDelay);\n this.maxDelay = typeof maxDelay === 'number' ? maxDelay : this.parseDuration(maxDelay);\n this.backoffStrategy = reconnect.backoff ?? 'exponential';\n\n this.setupListeners(options);\n }\n\n private setupListeners(options: GatewayManagerOptions): void {\n this.client.on('shardReady', (shardId) => {\n console.log(`Shard ${shardId} ready`);\n this.reconnectAttempts = 0;\n });\n\n this.client.on('shardDisconnect', (event, shardId) => {\n console.log(`Shard ${shardId} disconnected: ${event.code}`);\n options.onDisconnect?.();\n });\n\n this.client.on('shardReconnecting', (shardId) => {\n console.log(`Shard ${shardId} reconnecting...`);\n this.reconnectAttempts++;\n options.onReconnect?.();\n });\n\n this.client.on('shardError', (error, shardId) => {\n console.error(`Shard ${shardId} error:`, error);\n options.onError?.(error);\n });\n\n this.client.on('shardResume', (shardId, replayedEvents) => {\n console.log(`Shard ${shardId} resumed, replayed ${replayedEvents} events`);\n this.reconnectAttempts = 0;\n });\n }\n\n /**\n * Get the delay for the next reconnection attempt\n */\n getReconnectDelay(): number {\n switch (this.backoffStrategy) {\n case 'exponential':\n return Math.min(\n this.baseDelay * Math.pow(2, this.reconnectAttempts),\n this.maxDelay\n );\n case 'linear':\n return Math.min(\n this.baseDelay * (this.reconnectAttempts + 1),\n this.maxDelay\n );\n case 'fixed':\n default:\n return this.baseDelay;\n }\n }\n\n /**\n * Check if we should attempt reconnection\n */\n shouldReconnect(): boolean {\n return this.reconnectAttempts < this.maxReconnectAttempts;\n }\n\n /**\n * Get current reconnect attempt count\n */\n getReconnectAttempts(): number {\n return this.reconnectAttempts;\n }\n\n /**\n * Reset reconnect counter\n */\n resetReconnectAttempts(): void {\n this.reconnectAttempts = 0;\n }\n\n /**\n * Get gateway latency (ping)\n */\n getPing(): number {\n return this.client.ws.ping;\n }\n\n /**\n * Get shard info\n */\n getShardInfo(): Array<{ id: number; status: string; ping: number }> {\n return [...this.client.ws.shards.values()].map((shard) => ({\n id: shard.id,\n status: shard.status.toString(),\n ping: shard.ping,\n }));\n }\n\n /**\n * Parse duration string to milliseconds\n */\n private parseDuration(duration: string): number {\n const match = duration.match(/^(\\d+)(ms|s|m|h)?$/);\n if (!match) return 1000;\n\n const value = parseInt(match[1]!, 10);\n const unit = match[2] ?? 's';\n\n switch (unit) {\n case 'ms':\n return value;\n case 's':\n return value * 1000;\n case 'm':\n return value * 60 * 1000;\n case 'h':\n return value * 60 * 60 * 1000;\n default:\n return value * 1000;\n }\n }\n}\n\n/**\n * Create a gateway manager\n */\nexport function createGatewayManager(\n client: Client,\n options?: GatewayManagerOptions\n): GatewayManager {\n return new GatewayManager(client, options);\n}\n"],"mappings":";AAcO,IAAM,iBAAN,MAAqB;AAAA,EAClB;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAAgB,UAAiC,CAAC,GAAG;AAC/D,SAAK,SAAS;AACd,SAAK,SAAS,QAAQ,UAAU,CAAC;AAEjC,UAAM,YAAY,KAAK,OAAO,aAAa,CAAC;AAC5C,SAAK,uBAA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Client, FurlowClientOptions, createClient } from './client/index.js';
|
|
2
|
+
export { GatewayManager, GatewayManagerOptions, createGatewayManager } from './gateway/index.js';
|
|
3
|
+
export { InteractionCallback, InteractionHandler, InteractionHandlerOptions, createInteractionHandler } from './interactions/index.js';
|
|
4
|
+
export { AudioFilter, GuildVoiceState, QueueItem, QueueLoopMode, VoiceConfig, VoiceManager, createVoiceManager } from './voice/index.js';
|
|
5
|
+
export { StreamEvent, StreamEventCallback, StreamInfo, VideoManager, createVideoManager } from './video/index.js';
|
|
6
|
+
import 'discord.js';
|
|
7
|
+
import '@furlow/schema';
|
|
8
|
+
import '@discordjs/voice';
|