novaapp-sdk 1.0.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 +329 -0
- package/dist/index.d.mts +535 -0
- package/dist/index.d.ts +535 -0
- package/dist/index.js +463 -0
- package/dist/index.mjs +430 -0
- package/package.json +35 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight HTTP client for the Nova Bot API.
|
|
5
|
+
* Uses the native fetch API (Node 18+).
|
|
6
|
+
*/
|
|
7
|
+
declare class HttpClient {
|
|
8
|
+
readonly baseUrl: string;
|
|
9
|
+
private readonly token;
|
|
10
|
+
constructor(baseUrl: string, token: string);
|
|
11
|
+
private request;
|
|
12
|
+
get<T>(path: string): Promise<T>;
|
|
13
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
14
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
15
|
+
delete<T>(path: string): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface BotUser {
|
|
19
|
+
id: string;
|
|
20
|
+
username: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
avatar: string | null;
|
|
23
|
+
isBot: true;
|
|
24
|
+
}
|
|
25
|
+
interface BotApplication {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description: string | null;
|
|
29
|
+
avatar: string | null;
|
|
30
|
+
category: string | null;
|
|
31
|
+
isPublic: boolean;
|
|
32
|
+
isVerified: boolean;
|
|
33
|
+
callbackUrl: string | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
botUser: BotUser;
|
|
36
|
+
scopes: string[];
|
|
37
|
+
}
|
|
38
|
+
interface NovaServer {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
icon: string | null;
|
|
42
|
+
description: string | null;
|
|
43
|
+
memberCount: number;
|
|
44
|
+
channelCount: number;
|
|
45
|
+
joinedAt: string;
|
|
46
|
+
}
|
|
47
|
+
interface Member {
|
|
48
|
+
role: 'OWNER' | 'ADMIN' | 'MEMBER';
|
|
49
|
+
joinedAt: string;
|
|
50
|
+
user: {
|
|
51
|
+
id: string;
|
|
52
|
+
username: string;
|
|
53
|
+
displayName: string;
|
|
54
|
+
avatar: string | null;
|
|
55
|
+
status: 'ONLINE' | 'IDLE' | 'DND' | 'OFFLINE';
|
|
56
|
+
isBot: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
interface Attachment {
|
|
60
|
+
id: string;
|
|
61
|
+
url: string;
|
|
62
|
+
filename: string;
|
|
63
|
+
mimeType: string;
|
|
64
|
+
size: number;
|
|
65
|
+
}
|
|
66
|
+
interface Reaction {
|
|
67
|
+
emoji: string;
|
|
68
|
+
count: number;
|
|
69
|
+
userIds: string[];
|
|
70
|
+
}
|
|
71
|
+
interface EmbedField {
|
|
72
|
+
name: string;
|
|
73
|
+
value: string;
|
|
74
|
+
inline?: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface Embed {
|
|
77
|
+
title?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
url?: string;
|
|
80
|
+
color?: number;
|
|
81
|
+
thumbnail?: string;
|
|
82
|
+
image?: string;
|
|
83
|
+
footer?: string;
|
|
84
|
+
fields?: EmbedField[];
|
|
85
|
+
timestamp?: string;
|
|
86
|
+
}
|
|
87
|
+
interface MessageComponent {
|
|
88
|
+
type: 'button' | 'select';
|
|
89
|
+
customId: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
style?: 'primary' | 'secondary' | 'success' | 'danger';
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
options?: Array<{
|
|
94
|
+
label: string;
|
|
95
|
+
value: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
}>;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface Message {
|
|
101
|
+
id: string;
|
|
102
|
+
content: string;
|
|
103
|
+
channelId: string;
|
|
104
|
+
author: BotUser | {
|
|
105
|
+
id: string;
|
|
106
|
+
username: string;
|
|
107
|
+
displayName: string;
|
|
108
|
+
avatar: string | null;
|
|
109
|
+
isBot: boolean;
|
|
110
|
+
};
|
|
111
|
+
embed?: Embed | null;
|
|
112
|
+
components?: MessageComponent[] | null;
|
|
113
|
+
replyToId?: string | null;
|
|
114
|
+
attachments: Attachment[];
|
|
115
|
+
reactions: Reaction[];
|
|
116
|
+
createdAt: string;
|
|
117
|
+
editedAt?: string | null;
|
|
118
|
+
deletedAt?: string | null;
|
|
119
|
+
}
|
|
120
|
+
type InteractionType = 'SLASH_COMMAND' | 'BUTTON_CLICK' | 'SELECT_MENU' | 'MODAL_SUBMIT' | 'AUTOCOMPLETE' | 'CONTEXT_MENU' | 'PREFIX_COMMAND';
|
|
121
|
+
interface Interaction {
|
|
122
|
+
id: string;
|
|
123
|
+
type: InteractionType;
|
|
124
|
+
commandName?: string | null;
|
|
125
|
+
customId?: string | null;
|
|
126
|
+
data?: unknown;
|
|
127
|
+
userId: string;
|
|
128
|
+
channelId: string;
|
|
129
|
+
serverId?: string | null;
|
|
130
|
+
triggerMsgId?: string | null;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
}
|
|
133
|
+
interface SlashCommandOption {
|
|
134
|
+
name: string;
|
|
135
|
+
description: string;
|
|
136
|
+
type: 'STRING' | 'INTEGER' | 'BOOLEAN' | 'USER' | 'CHANNEL' | 'ROLE';
|
|
137
|
+
required?: boolean;
|
|
138
|
+
choices?: Array<{
|
|
139
|
+
name: string;
|
|
140
|
+
value: string | number;
|
|
141
|
+
}>;
|
|
142
|
+
}
|
|
143
|
+
interface SlashCommandDefinition {
|
|
144
|
+
name: string;
|
|
145
|
+
description: string;
|
|
146
|
+
options?: SlashCommandOption[];
|
|
147
|
+
}
|
|
148
|
+
interface PrefixCommandDefinition {
|
|
149
|
+
prefix: string;
|
|
150
|
+
name: string;
|
|
151
|
+
description: string;
|
|
152
|
+
options?: SlashCommandOption[];
|
|
153
|
+
guildId?: string | null;
|
|
154
|
+
}
|
|
155
|
+
interface ContextCommandDefinition {
|
|
156
|
+
name: string;
|
|
157
|
+
target: 'MESSAGE' | 'USER';
|
|
158
|
+
guildId?: string | null;
|
|
159
|
+
}
|
|
160
|
+
interface RegisteredSlashCommand {
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
description: string;
|
|
164
|
+
options: SlashCommandOption[];
|
|
165
|
+
guildId: string | null;
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
}
|
|
169
|
+
interface RegisteredPrefixCommand {
|
|
170
|
+
id: string;
|
|
171
|
+
prefix: string;
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
options: SlashCommandOption[];
|
|
175
|
+
guildId: string | null;
|
|
176
|
+
enabled: boolean;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
}
|
|
179
|
+
interface RegisteredContextCommand {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
target: 'MESSAGE' | 'USER';
|
|
183
|
+
guildId: string | null;
|
|
184
|
+
enabled: boolean;
|
|
185
|
+
createdAt: string;
|
|
186
|
+
}
|
|
187
|
+
type BotEventType = 'message.created' | 'message.edited' | 'message.deleted' | 'message.reaction_added' | 'message.reaction_removed' | 'message.pinned' | 'user.joined_server' | 'user.left_server' | 'user.updated_profile' | 'user.banned' | 'user.unbanned' | 'user.role_added' | 'user.role_removed' | 'user.started_typing' | 'user.voice_joined' | 'user.voice_left' | 'interaction.slash_command' | 'interaction.button_click' | 'interaction.select_menu' | 'interaction.modal_submit' | 'interaction.autocomplete' | 'server.updated' | 'channel.created' | 'channel.deleted' | 'channel.updated' | 'role.created' | 'role.deleted';
|
|
188
|
+
interface BotEvent<T = unknown> {
|
|
189
|
+
type: BotEventType;
|
|
190
|
+
data: T;
|
|
191
|
+
timestamp: string;
|
|
192
|
+
}
|
|
193
|
+
interface SendMessageOptions {
|
|
194
|
+
content?: string;
|
|
195
|
+
embed?: Embed;
|
|
196
|
+
components?: MessageComponent[];
|
|
197
|
+
replyToId?: string;
|
|
198
|
+
}
|
|
199
|
+
interface EditMessageOptions {
|
|
200
|
+
content?: string;
|
|
201
|
+
embed?: Embed;
|
|
202
|
+
components?: MessageComponent[];
|
|
203
|
+
}
|
|
204
|
+
interface RespondInteractionOptions {
|
|
205
|
+
content?: string;
|
|
206
|
+
embed?: Embed;
|
|
207
|
+
components?: MessageComponent[];
|
|
208
|
+
ephemeral?: boolean;
|
|
209
|
+
}
|
|
210
|
+
interface FetchMessagesOptions {
|
|
211
|
+
limit?: number;
|
|
212
|
+
before?: string;
|
|
213
|
+
}
|
|
214
|
+
interface FetchMembersOptions {
|
|
215
|
+
limit?: number;
|
|
216
|
+
}
|
|
217
|
+
interface PollInteractionsOptions {
|
|
218
|
+
limit?: number;
|
|
219
|
+
since?: string;
|
|
220
|
+
}
|
|
221
|
+
interface NovaClientOptions {
|
|
222
|
+
/** Your bot token — starts with "nova_bot_" */
|
|
223
|
+
token: string;
|
|
224
|
+
/**
|
|
225
|
+
* Base URL of the Nova server.
|
|
226
|
+
* @default "https://api.nova.chat"
|
|
227
|
+
*/
|
|
228
|
+
baseUrl?: string;
|
|
229
|
+
}
|
|
230
|
+
interface NovaClientEvents {
|
|
231
|
+
/** Fired when the bot successfully connects and is identified. */
|
|
232
|
+
ready: (bot: BotApplication) => void;
|
|
233
|
+
/** Fired for every bot:event from the gateway. */
|
|
234
|
+
event: (event: BotEvent) => void;
|
|
235
|
+
/** Fired when an interaction is created (slash command, button, etc.). */
|
|
236
|
+
interactionCreate: (interaction: Interaction) => void;
|
|
237
|
+
/** Fired when the gateway connection is lost. */
|
|
238
|
+
disconnect: (reason: string) => void;
|
|
239
|
+
/** Fired on gateway/API errors. */
|
|
240
|
+
error: (err: {
|
|
241
|
+
code: number;
|
|
242
|
+
message: string;
|
|
243
|
+
}) => void;
|
|
244
|
+
/** A message was sent in a channel the bot is in. */
|
|
245
|
+
messageCreate: (data: BotEvent['data']) => void;
|
|
246
|
+
/** A message was edited. */
|
|
247
|
+
messageUpdate: (data: BotEvent['data']) => void;
|
|
248
|
+
/** A message was deleted. */
|
|
249
|
+
messageDelete: (data: BotEvent['data']) => void;
|
|
250
|
+
/** A reaction was added to a message. */
|
|
251
|
+
reactionAdd: (data: BotEvent['data']) => void;
|
|
252
|
+
/** A reaction was removed from a message. */
|
|
253
|
+
reactionRemove: (data: BotEvent['data']) => void;
|
|
254
|
+
/** A user joined a server the bot is in. */
|
|
255
|
+
memberAdd: (data: BotEvent['data']) => void;
|
|
256
|
+
/** A user left a server the bot is in. */
|
|
257
|
+
memberRemove: (data: BotEvent['data']) => void;
|
|
258
|
+
/** A user started typing. */
|
|
259
|
+
typingStart: (data: BotEvent['data']) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare class MessagesAPI {
|
|
263
|
+
private readonly http;
|
|
264
|
+
constructor(http: HttpClient);
|
|
265
|
+
/**
|
|
266
|
+
* Send a message to a channel.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* await client.messages.send('channel-id', { content: 'Hello!' })
|
|
270
|
+
* await client.messages.send('channel-id', {
|
|
271
|
+
* embed: { title: 'Report', description: 'Everything is fine.' }
|
|
272
|
+
* })
|
|
273
|
+
*/
|
|
274
|
+
send(channelId: string, options: SendMessageOptions): Promise<Message>;
|
|
275
|
+
/**
|
|
276
|
+
* Edit a message previously sent by this bot.
|
|
277
|
+
*/
|
|
278
|
+
edit(messageId: string, options: EditMessageOptions): Promise<Message>;
|
|
279
|
+
/**
|
|
280
|
+
* Delete a message previously sent by this bot.
|
|
281
|
+
*/
|
|
282
|
+
delete(messageId: string): Promise<{
|
|
283
|
+
ok: true;
|
|
284
|
+
}>;
|
|
285
|
+
/**
|
|
286
|
+
* Fetch recent messages from a channel.
|
|
287
|
+
*/
|
|
288
|
+
fetch(channelId: string, options?: FetchMessagesOptions): Promise<Message[]>;
|
|
289
|
+
/**
|
|
290
|
+
* Send a typing indicator in a channel (appears for ~5 seconds).
|
|
291
|
+
*/
|
|
292
|
+
typing(channelId: string): Promise<{
|
|
293
|
+
ok: true;
|
|
294
|
+
}>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare class CommandsAPI {
|
|
298
|
+
private readonly http;
|
|
299
|
+
constructor(http: HttpClient);
|
|
300
|
+
/**
|
|
301
|
+
* Register (or fully replace) slash commands.
|
|
302
|
+
* Pass `guildId` to register guild-specific commands; omit for global.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* await client.commands.setSlash([
|
|
306
|
+
* { name: 'ping', description: 'Responds with pong!' },
|
|
307
|
+
* { name: 'ban', description: 'Ban a user', options: [
|
|
308
|
+
* { name: 'user', description: 'User to ban', type: 'USER', required: true }
|
|
309
|
+
* ]}
|
|
310
|
+
* ])
|
|
311
|
+
*/
|
|
312
|
+
setSlash(commands: SlashCommandDefinition[], guildId?: string): Promise<{
|
|
313
|
+
registered: number;
|
|
314
|
+
}>;
|
|
315
|
+
/**
|
|
316
|
+
* Fetch all registered slash commands.
|
|
317
|
+
*/
|
|
318
|
+
getSlash(guildId?: string): Promise<RegisteredSlashCommand[]>;
|
|
319
|
+
/**
|
|
320
|
+
* Delete a slash command by name.
|
|
321
|
+
*/
|
|
322
|
+
deleteSlash(name: string): Promise<{
|
|
323
|
+
ok: true;
|
|
324
|
+
}>;
|
|
325
|
+
/**
|
|
326
|
+
* Register (or fully replace) prefix commands.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* await client.commands.setPrefix([
|
|
330
|
+
* { prefix: '!', name: 'help', description: 'Show help' },
|
|
331
|
+
* { prefix: '!', name: 'kick', description: 'Kick a user' },
|
|
332
|
+
* ])
|
|
333
|
+
*/
|
|
334
|
+
setPrefix(commands: PrefixCommandDefinition[]): Promise<{
|
|
335
|
+
created: number;
|
|
336
|
+
}>;
|
|
337
|
+
/**
|
|
338
|
+
* Fetch all registered prefix commands.
|
|
339
|
+
*/
|
|
340
|
+
getPrefix(): Promise<RegisteredPrefixCommand[]>;
|
|
341
|
+
/**
|
|
342
|
+
* Delete a prefix command.
|
|
343
|
+
*/
|
|
344
|
+
deletePrefix(prefix: string, name: string): Promise<{
|
|
345
|
+
ok: true;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Register (or fully replace) context menu commands.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* await client.commands.setContext([
|
|
352
|
+
* { name: 'Report message', target: 'MESSAGE' },
|
|
353
|
+
* { name: 'View profile', target: 'USER' },
|
|
354
|
+
* ])
|
|
355
|
+
*/
|
|
356
|
+
setContext(commands: ContextCommandDefinition[]): Promise<{
|
|
357
|
+
created: number;
|
|
358
|
+
}>;
|
|
359
|
+
/**
|
|
360
|
+
* Fetch all registered context menu commands.
|
|
361
|
+
*/
|
|
362
|
+
getContext(): Promise<RegisteredContextCommand[]>;
|
|
363
|
+
/**
|
|
364
|
+
* Delete a context menu command by name.
|
|
365
|
+
*/
|
|
366
|
+
deleteContext(name: string): Promise<{
|
|
367
|
+
ok: true;
|
|
368
|
+
}>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
declare class MembersAPI {
|
|
372
|
+
private readonly http;
|
|
373
|
+
constructor(http: HttpClient);
|
|
374
|
+
/**
|
|
375
|
+
* Fetch members of a server the bot is in.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* const members = await client.members.list('server-id', { limit: 50 })
|
|
379
|
+
*/
|
|
380
|
+
list(serverId: string, options?: FetchMembersOptions): Promise<Member[]>;
|
|
381
|
+
/**
|
|
382
|
+
* Kick a member from a server.
|
|
383
|
+
* Bots cannot kick owners or admins (403 will be thrown).
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* await client.members.kick('server-id', 'user-id')
|
|
387
|
+
*/
|
|
388
|
+
kick(serverId: string, userId: string): Promise<{
|
|
389
|
+
ok: true;
|
|
390
|
+
}>;
|
|
391
|
+
/**
|
|
392
|
+
* Ban a member from a server.
|
|
393
|
+
* Bots cannot ban owners or admins (403 will be thrown).
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* await client.members.ban('server-id', 'user-id', 'Spamming')
|
|
397
|
+
*/
|
|
398
|
+
ban(serverId: string, userId: string, reason?: string): Promise<{
|
|
399
|
+
ok: true;
|
|
400
|
+
}>;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
declare class ServersAPI {
|
|
404
|
+
private readonly http;
|
|
405
|
+
constructor(http: HttpClient);
|
|
406
|
+
/**
|
|
407
|
+
* Fetch all servers the bot is currently a member of.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* const servers = await client.servers.list()
|
|
411
|
+
* console.log(`Bot is in ${servers.length} servers`)
|
|
412
|
+
*/
|
|
413
|
+
list(): Promise<NovaServer[]>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class InteractionsAPI {
|
|
417
|
+
private readonly http;
|
|
418
|
+
constructor(http: HttpClient);
|
|
419
|
+
/**
|
|
420
|
+
* Acknowledge an interaction without sending a visible response.
|
|
421
|
+
* Shows a loading state to the user. You must follow up with `respond()`.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* client.on('interactionCreate', async (interaction) => {
|
|
425
|
+
* await client.interactions.ack(interaction.id)
|
|
426
|
+
* // ... do work ...
|
|
427
|
+
* await client.interactions.respond(interaction.id, { content: 'Done!' })
|
|
428
|
+
* })
|
|
429
|
+
*/
|
|
430
|
+
ack(interactionId: string): Promise<{
|
|
431
|
+
ok: true;
|
|
432
|
+
}>;
|
|
433
|
+
/**
|
|
434
|
+
* Respond to an interaction with a message.
|
|
435
|
+
* Set `ephemeral: true` to only show the response to the triggering user.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* await client.interactions.respond(interaction.id, {
|
|
439
|
+
* content: 'Pong!',
|
|
440
|
+
* ephemeral: true,
|
|
441
|
+
* })
|
|
442
|
+
*/
|
|
443
|
+
respond(interactionId: string, options: RespondInteractionOptions): Promise<Message | {
|
|
444
|
+
ok: true;
|
|
445
|
+
ephemeral: true;
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* Poll for pending (unacknowledged) interactions.
|
|
449
|
+
* Useful when not using the WebSocket gateway.
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* const pending = await client.interactions.poll({ limit: 20 })
|
|
453
|
+
* for (const i of pending) {
|
|
454
|
+
* await client.interactions.respond(i.id, { content: 'Got it!' })
|
|
455
|
+
* }
|
|
456
|
+
*/
|
|
457
|
+
poll(options?: PollInteractionsOptions): Promise<Interaction[]>;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* The main Nova bot client.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* import { NovaClient } from 'nova-bot-sdk'
|
|
465
|
+
*
|
|
466
|
+
* const client = new NovaClient({ token: 'nova_bot_...' })
|
|
467
|
+
*
|
|
468
|
+
* client.on('ready', (bot) => {
|
|
469
|
+
* console.log(`Logged in as ${bot.botUser.username}`)
|
|
470
|
+
* })
|
|
471
|
+
*
|
|
472
|
+
* client.on('interactionCreate', async (interaction) => {
|
|
473
|
+
* if (interaction.commandName === 'ping') {
|
|
474
|
+
* await client.interactions.respond(interaction.id, { content: 'Pong!' })
|
|
475
|
+
* }
|
|
476
|
+
* })
|
|
477
|
+
*
|
|
478
|
+
* await client.connect()
|
|
479
|
+
*/
|
|
480
|
+
declare class NovaClient extends EventEmitter {
|
|
481
|
+
/** The authenticated bot application. Available after `ready` fires. */
|
|
482
|
+
botUser: BotApplication | null;
|
|
483
|
+
/** Send, edit, delete and fetch messages. */
|
|
484
|
+
readonly messages: MessagesAPI;
|
|
485
|
+
/** Register and manage slash, prefix, and context menu commands. */
|
|
486
|
+
readonly commands: CommandsAPI;
|
|
487
|
+
/** List, kick and ban server members. */
|
|
488
|
+
readonly members: MembersAPI;
|
|
489
|
+
/** List servers the bot is a member of. */
|
|
490
|
+
readonly servers: ServersAPI;
|
|
491
|
+
/** Acknowledge and respond to interactions. */
|
|
492
|
+
readonly interactions: InteractionsAPI;
|
|
493
|
+
private socket;
|
|
494
|
+
private readonly http;
|
|
495
|
+
private readonly options;
|
|
496
|
+
constructor(options: NovaClientOptions);
|
|
497
|
+
/**
|
|
498
|
+
* Connect to the Nova WebSocket gateway.
|
|
499
|
+
* Resolves when the `ready` event is received.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* await client.connect()
|
|
503
|
+
*/
|
|
504
|
+
connect(): Promise<void>;
|
|
505
|
+
/**
|
|
506
|
+
* Disconnect from the gateway and clean up.
|
|
507
|
+
*/
|
|
508
|
+
disconnect(): void;
|
|
509
|
+
/**
|
|
510
|
+
* Send a message via the WebSocket gateway (lower latency than HTTP).
|
|
511
|
+
* Requires the `messages.write` scope.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* client.wsSend('channel-id', 'Hello from the gateway!')
|
|
515
|
+
*/
|
|
516
|
+
wsSend(channelId: string, content: string): void;
|
|
517
|
+
/**
|
|
518
|
+
* Start a typing indicator via WebSocket.
|
|
519
|
+
*/
|
|
520
|
+
wsTypingStart(channelId: string): void;
|
|
521
|
+
/**
|
|
522
|
+
* Stop a typing indicator via WebSocket.
|
|
523
|
+
*/
|
|
524
|
+
wsTypingStop(channelId: string): void;
|
|
525
|
+
on<K extends keyof NovaClientEvents>(event: K, listener: NovaClientEvents[K]): this;
|
|
526
|
+
on(event: string | symbol, listener: (...args: unknown[]) => void): this;
|
|
527
|
+
once<K extends keyof NovaClientEvents>(event: K, listener: NovaClientEvents[K]): this;
|
|
528
|
+
once(event: string | symbol, listener: (...args: unknown[]) => void): this;
|
|
529
|
+
off<K extends keyof NovaClientEvents>(event: K, listener: NovaClientEvents[K]): this;
|
|
530
|
+
off(event: string | symbol, listener: (...args: unknown[]) => void): this;
|
|
531
|
+
emit<K extends keyof NovaClientEvents>(event: K, ...args: Parameters<NovaClientEvents[K]>): boolean;
|
|
532
|
+
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export { type Attachment, type BotApplication, type BotEvent, type BotEventType, type BotUser, CommandsAPI, type ContextCommandDefinition, type EditMessageOptions, type Embed, type EmbedField, type FetchMembersOptions, type FetchMessagesOptions, HttpClient, type Interaction, type InteractionType, InteractionsAPI, type Member, MembersAPI, type Message, type MessageComponent, MessagesAPI, NovaClient, type NovaClientEvents, type NovaClientOptions, type NovaServer, type PollInteractionsOptions, type PrefixCommandDefinition, type Reaction, type RegisteredContextCommand, type RegisteredPrefixCommand, type RegisteredSlashCommand, type RespondInteractionOptions, type SendMessageOptions, ServersAPI, type SlashCommandDefinition, type SlashCommandOption };
|