@wordbombio/sdk 0.0.0-stage → 0.2.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/AGENTS.md +374 -0
- package/LICENSE +21 -0
- package/README.md +173 -2
- package/dist/cli.js +4062 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +3166 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1043 -0
- package/dist/index.d.ts +1043 -0
- package/dist/index.js +3113 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
import { Room, Client } from '@colyseus/sdk';
|
|
2
|
+
|
|
3
|
+
type ButtonStyle = 1 | 2 | 3 | 4;
|
|
4
|
+
interface BotButton {
|
|
5
|
+
type?: 2;
|
|
6
|
+
style: ButtonStyle;
|
|
7
|
+
label: string;
|
|
8
|
+
custom_id: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface BotActionRow {
|
|
12
|
+
type?: 1;
|
|
13
|
+
components: BotButton[];
|
|
14
|
+
}
|
|
15
|
+
interface BotEmbedField {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
inline?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface BotEmbed {
|
|
21
|
+
title?: string;
|
|
22
|
+
url?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
author?: {
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
fields?: BotEmbedField[];
|
|
28
|
+
thumbnail?: {
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
image?: {
|
|
32
|
+
url: string;
|
|
33
|
+
};
|
|
34
|
+
footer?: {
|
|
35
|
+
text: string;
|
|
36
|
+
};
|
|
37
|
+
components?: BotActionRow[];
|
|
38
|
+
}
|
|
39
|
+
interface BotMessage {
|
|
40
|
+
text?: string;
|
|
41
|
+
embed?: BotEmbed;
|
|
42
|
+
}
|
|
43
|
+
interface BotReply extends BotMessage {
|
|
44
|
+
ephemeral?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Listener<T> = (payload: T) => unknown;
|
|
48
|
+
declare class Emitter<Events extends object> {
|
|
49
|
+
private readonly listeners;
|
|
50
|
+
on<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
51
|
+
once<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
52
|
+
off<K extends keyof Events>(event: K, fn: Listener<Events[K]>): void;
|
|
53
|
+
protected emit<K extends keyof Events>(event: K, payload: Events[K]): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface CandidateOptions {
|
|
57
|
+
match?: "contains" | "startsWith";
|
|
58
|
+
used?: ReadonlySet<string>;
|
|
59
|
+
minLength?: number;
|
|
60
|
+
}
|
|
61
|
+
declare class WordList {
|
|
62
|
+
readonly locale: string;
|
|
63
|
+
private readonly words;
|
|
64
|
+
constructor(words?: Iterable<string>, locale?: string);
|
|
65
|
+
static fromFile(path: string, locale?: string): Promise<WordList>;
|
|
66
|
+
static fromSpec(spec: string, defaultLocale?: string): Promise<WordList[]>;
|
|
67
|
+
get size(): number;
|
|
68
|
+
normalize(word: string): string;
|
|
69
|
+
add(word: string): boolean;
|
|
70
|
+
remove(word: string): boolean;
|
|
71
|
+
has(word: string): boolean;
|
|
72
|
+
candidates(prompt: string, opts?: CandidateOptions): string[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface AutoplayOptions {
|
|
76
|
+
words: WordList | WordList[] | Iterable<string>;
|
|
77
|
+
cpm?: number;
|
|
78
|
+
thinkMs?: [number, number];
|
|
79
|
+
learn?: boolean;
|
|
80
|
+
forgetInvalid?: boolean;
|
|
81
|
+
attempts?: number;
|
|
82
|
+
pickLanguage?: boolean;
|
|
83
|
+
}
|
|
84
|
+
declare class Autoplayer {
|
|
85
|
+
readonly room: GameRoom;
|
|
86
|
+
private readonly opts;
|
|
87
|
+
readonly lists: Map<string, WordList>;
|
|
88
|
+
cpm: number;
|
|
89
|
+
private readonly offs;
|
|
90
|
+
private running;
|
|
91
|
+
private syncing;
|
|
92
|
+
constructor(room: GameRoom, opts: AutoplayOptions);
|
|
93
|
+
get isRunning(): boolean;
|
|
94
|
+
get languages(): string[];
|
|
95
|
+
get canPlay(): boolean;
|
|
96
|
+
listFor(locale: string): WordList | undefined;
|
|
97
|
+
stop(): void;
|
|
98
|
+
private syncLanguage;
|
|
99
|
+
private play;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface Target {
|
|
103
|
+
game: string;
|
|
104
|
+
gameWs: string;
|
|
105
|
+
social: string;
|
|
106
|
+
player: string;
|
|
107
|
+
ws2: string;
|
|
108
|
+
}
|
|
109
|
+
declare const TARGETS: {
|
|
110
|
+
local: {
|
|
111
|
+
game: string;
|
|
112
|
+
gameWs: string;
|
|
113
|
+
social: string;
|
|
114
|
+
player: string;
|
|
115
|
+
ws2: string;
|
|
116
|
+
};
|
|
117
|
+
prod: {
|
|
118
|
+
game: string;
|
|
119
|
+
gameWs: string;
|
|
120
|
+
social: string;
|
|
121
|
+
player: string;
|
|
122
|
+
ws2: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
type TargetName = keyof typeof TARGETS;
|
|
126
|
+
declare function resolveTarget(target: TargetName | Target): Target;
|
|
127
|
+
|
|
128
|
+
interface Me {
|
|
129
|
+
id: string;
|
|
130
|
+
name: string;
|
|
131
|
+
data: Record<string, unknown>;
|
|
132
|
+
}
|
|
133
|
+
type BotKind = "bot" | "app";
|
|
134
|
+
declare class Session {
|
|
135
|
+
readonly target: Target;
|
|
136
|
+
private readonly onError;
|
|
137
|
+
private readonly onBanned;
|
|
138
|
+
token: string;
|
|
139
|
+
kind: BotKind;
|
|
140
|
+
readonly me: Me;
|
|
141
|
+
private readonly key;
|
|
142
|
+
private readonly listeners;
|
|
143
|
+
private inflight;
|
|
144
|
+
private timer;
|
|
145
|
+
private closed;
|
|
146
|
+
constructor(target: Target, key: string, onError: (e: Error) => void, onBanned: () => void);
|
|
147
|
+
onToken(fn: (token: string) => void): void;
|
|
148
|
+
refresh(): Promise<void>;
|
|
149
|
+
close(): void;
|
|
150
|
+
private exchange;
|
|
151
|
+
private schedule;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
type Service = "game" | "social" | "player";
|
|
155
|
+
interface RequestOptions {
|
|
156
|
+
method?: string;
|
|
157
|
+
body?: unknown;
|
|
158
|
+
}
|
|
159
|
+
declare class Http {
|
|
160
|
+
private readonly session;
|
|
161
|
+
constructor(session: Session);
|
|
162
|
+
request<T>(service: Service, route: string, init?: RequestOptions): Promise<T>;
|
|
163
|
+
get<T>(service: Service, route: string): Promise<T>;
|
|
164
|
+
post<T>(service: Service, route: string, body?: unknown): Promise<T>;
|
|
165
|
+
put<T>(service: Service, route: string, body?: unknown): Promise<T>;
|
|
166
|
+
delete<T>(service: Service, route: string, body?: unknown): Promise<T>;
|
|
167
|
+
private send;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
type CommandOptionType = "string" | "number" | "player" | "message" | "choice";
|
|
171
|
+
interface CommandOptionDef {
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
type: CommandOptionType;
|
|
175
|
+
required?: boolean;
|
|
176
|
+
choices?: string[];
|
|
177
|
+
}
|
|
178
|
+
interface CommandDef {
|
|
179
|
+
name: string;
|
|
180
|
+
description: string;
|
|
181
|
+
options?: CommandOptionDef[];
|
|
182
|
+
}
|
|
183
|
+
declare class Commands {
|
|
184
|
+
private readonly http;
|
|
185
|
+
private readonly session;
|
|
186
|
+
private current;
|
|
187
|
+
private readonly byName;
|
|
188
|
+
private v;
|
|
189
|
+
private queue;
|
|
190
|
+
constructor(http: Http, session: Session);
|
|
191
|
+
get all(): readonly CommandDef[];
|
|
192
|
+
get version(): number;
|
|
193
|
+
get(name: string): CommandDef | null;
|
|
194
|
+
set(defs: readonly CommandDef[]): Promise<number>;
|
|
195
|
+
private sync;
|
|
196
|
+
private remote;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface RealtimeEvents {
|
|
200
|
+
event: {
|
|
201
|
+
e: string;
|
|
202
|
+
d: unknown;
|
|
203
|
+
};
|
|
204
|
+
up: void;
|
|
205
|
+
down: {
|
|
206
|
+
code: number;
|
|
207
|
+
retryInMs: number;
|
|
208
|
+
};
|
|
209
|
+
banned: void;
|
|
210
|
+
replaced: void;
|
|
211
|
+
closed: void;
|
|
212
|
+
}
|
|
213
|
+
declare class Realtime extends Emitter<RealtimeEvents> {
|
|
214
|
+
private readonly session;
|
|
215
|
+
private readonly clientId;
|
|
216
|
+
private ws;
|
|
217
|
+
private seq;
|
|
218
|
+
private readonly waiting;
|
|
219
|
+
private backoff;
|
|
220
|
+
private fastRetryUsed;
|
|
221
|
+
private retry;
|
|
222
|
+
private closed;
|
|
223
|
+
constructor(session: Session, clientId: string);
|
|
224
|
+
get isOpen(): boolean;
|
|
225
|
+
connect(): void;
|
|
226
|
+
send(e: string, d: unknown): boolean;
|
|
227
|
+
request<T>(e: string, d: unknown): Promise<T>;
|
|
228
|
+
private opened;
|
|
229
|
+
close(): void;
|
|
230
|
+
private failAll;
|
|
231
|
+
private receive;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface UserRef {
|
|
235
|
+
id: string;
|
|
236
|
+
name: string;
|
|
237
|
+
}
|
|
238
|
+
interface Player {
|
|
239
|
+
sessionId: string;
|
|
240
|
+
id: string;
|
|
241
|
+
name: string;
|
|
242
|
+
avatar: string;
|
|
243
|
+
hearts: number;
|
|
244
|
+
eliminated: boolean;
|
|
245
|
+
spectating: boolean;
|
|
246
|
+
isHost: boolean;
|
|
247
|
+
isMe: boolean;
|
|
248
|
+
isTurn: boolean;
|
|
249
|
+
isGuest: boolean;
|
|
250
|
+
isBot: boolean;
|
|
251
|
+
language: string;
|
|
252
|
+
}
|
|
253
|
+
interface RoomConfig {
|
|
254
|
+
mode: number;
|
|
255
|
+
language: string;
|
|
256
|
+
multiLanguage: boolean;
|
|
257
|
+
locked: boolean;
|
|
258
|
+
hearts: number;
|
|
259
|
+
maxPlayers: number;
|
|
260
|
+
guests: boolean;
|
|
261
|
+
botAccounts: boolean;
|
|
262
|
+
scenario: number;
|
|
263
|
+
teamMode: boolean;
|
|
264
|
+
chainStyle: number;
|
|
265
|
+
title: string;
|
|
266
|
+
}
|
|
267
|
+
interface RoomListing {
|
|
268
|
+
id: string;
|
|
269
|
+
name: string;
|
|
270
|
+
players: number;
|
|
271
|
+
mode: number;
|
|
272
|
+
eventRoom: boolean;
|
|
273
|
+
multiLanguage: boolean;
|
|
274
|
+
language: string;
|
|
275
|
+
started: boolean;
|
|
276
|
+
guestsAllowed: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface FriendRoom {
|
|
279
|
+
id: string;
|
|
280
|
+
locked: boolean;
|
|
281
|
+
started: boolean;
|
|
282
|
+
players: number;
|
|
283
|
+
}
|
|
284
|
+
interface Friend extends UserRef {
|
|
285
|
+
online: boolean;
|
|
286
|
+
status: string | null;
|
|
287
|
+
room: FriendRoom | null;
|
|
288
|
+
}
|
|
289
|
+
interface Profile extends UserRef {
|
|
290
|
+
username: string;
|
|
291
|
+
avatar: string;
|
|
292
|
+
avatarUrl: string | null;
|
|
293
|
+
about: string;
|
|
294
|
+
exp: number;
|
|
295
|
+
wins: number;
|
|
296
|
+
score: number;
|
|
297
|
+
wp: number;
|
|
298
|
+
clan: string | null;
|
|
299
|
+
isFriend: boolean;
|
|
300
|
+
raw: Record<string, unknown>;
|
|
301
|
+
}
|
|
302
|
+
interface Conversation {
|
|
303
|
+
chatId: string;
|
|
304
|
+
group: boolean;
|
|
305
|
+
with: UserRef | null;
|
|
306
|
+
unread: number;
|
|
307
|
+
last: {
|
|
308
|
+
senderId: string;
|
|
309
|
+
kind: string;
|
|
310
|
+
text: string | null;
|
|
311
|
+
} | null;
|
|
312
|
+
}
|
|
313
|
+
interface HistoryMessage {
|
|
314
|
+
senderId: string;
|
|
315
|
+
mine: boolean;
|
|
316
|
+
kind: string;
|
|
317
|
+
text: string | null;
|
|
318
|
+
}
|
|
319
|
+
type NotificationKind = "profile_comment" | "comment_reply" | "achievement" | "gift" | "other";
|
|
320
|
+
interface Notification {
|
|
321
|
+
at: number;
|
|
322
|
+
kind: NotificationKind;
|
|
323
|
+
type: string;
|
|
324
|
+
key: string;
|
|
325
|
+
text: string;
|
|
326
|
+
from: UserRef | null;
|
|
327
|
+
data: Record<string, unknown>;
|
|
328
|
+
}
|
|
329
|
+
type CosmeticKind = "bomb" | "heart" | "ghost" | "streak" | "letter" | "explosion" | "combo";
|
|
330
|
+
type ImageKind = "avatar" | "banner" | "background";
|
|
331
|
+
declare const MODES: Record<number, string>;
|
|
332
|
+
declare function modeName(mode: number): string;
|
|
333
|
+
|
|
334
|
+
type OptionValue = string | number | Player;
|
|
335
|
+
interface CommandInteraction<R = GameRoom> {
|
|
336
|
+
id: string;
|
|
337
|
+
room: R;
|
|
338
|
+
name: string;
|
|
339
|
+
user: Player;
|
|
340
|
+
options: Readonly<Record<string, OptionValue>>;
|
|
341
|
+
string(name: string): string | null;
|
|
342
|
+
number(name: string): number | null;
|
|
343
|
+
player(name: string): Player | null;
|
|
344
|
+
reply(message: BotReply): Promise<string>;
|
|
345
|
+
}
|
|
346
|
+
interface ButtonInteraction<R = GameRoom> {
|
|
347
|
+
id: string;
|
|
348
|
+
room: R;
|
|
349
|
+
messageId: string;
|
|
350
|
+
customId: string;
|
|
351
|
+
user: Player;
|
|
352
|
+
reply(message: BotReply): Promise<string>;
|
|
353
|
+
update(message: BotMessage): Promise<string>;
|
|
354
|
+
}
|
|
355
|
+
interface InteractionRoom {
|
|
356
|
+
readonly id: string;
|
|
357
|
+
readonly isOpen: boolean;
|
|
358
|
+
readonly players: Player[];
|
|
359
|
+
}
|
|
360
|
+
interface InteractionSink<R> {
|
|
361
|
+
command(interaction: CommandInteraction<R>): void;
|
|
362
|
+
button(interaction: ButtonInteraction<R>): void;
|
|
363
|
+
}
|
|
364
|
+
interface RoomChannel {
|
|
365
|
+
sync(key: string): void;
|
|
366
|
+
post(message: BotMessage): Promise<string>;
|
|
367
|
+
close(): void;
|
|
368
|
+
}
|
|
369
|
+
declare class Interactions {
|
|
370
|
+
private readonly realtime;
|
|
371
|
+
private readonly session;
|
|
372
|
+
private readonly commands;
|
|
373
|
+
private readonly links;
|
|
374
|
+
constructor(realtime: Realtime | null, session: Session, commands: Commands);
|
|
375
|
+
attach<R extends InteractionRoom>(room: R, sink: InteractionSink<R>, subscribe: boolean): RoomChannel;
|
|
376
|
+
resubscribe(): void;
|
|
377
|
+
receive(e: string, d: unknown): void;
|
|
378
|
+
private deliver;
|
|
379
|
+
private answerer;
|
|
380
|
+
private ownAvatar;
|
|
381
|
+
private say;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
interface SchemaMap<T> {
|
|
385
|
+
get(key: string): T | undefined;
|
|
386
|
+
forEach(fn: (value: T, key: string) => void): void;
|
|
387
|
+
}
|
|
388
|
+
interface RawPlayer {
|
|
389
|
+
auth_id?: string;
|
|
390
|
+
username?: string;
|
|
391
|
+
avatar?: string;
|
|
392
|
+
heart?: number;
|
|
393
|
+
eliminated?: boolean;
|
|
394
|
+
spectating?: boolean;
|
|
395
|
+
type?: number;
|
|
396
|
+
bot?: boolean;
|
|
397
|
+
lang?: string;
|
|
398
|
+
}
|
|
399
|
+
interface RawState {
|
|
400
|
+
players?: SchemaMap<RawPlayer>;
|
|
401
|
+
host?: string;
|
|
402
|
+
started?: boolean;
|
|
403
|
+
currentPlayerSessionId?: string;
|
|
404
|
+
letter?: string;
|
|
405
|
+
turn?: number;
|
|
406
|
+
time?: number;
|
|
407
|
+
mode?: number;
|
|
408
|
+
locale?: string;
|
|
409
|
+
mlang?: boolean;
|
|
410
|
+
locked?: boolean;
|
|
411
|
+
title?: string;
|
|
412
|
+
cs?: number;
|
|
413
|
+
heart?: number;
|
|
414
|
+
maxp?: number;
|
|
415
|
+
guests?: boolean;
|
|
416
|
+
ba?: boolean;
|
|
417
|
+
sc?: number;
|
|
418
|
+
teamMode?: boolean;
|
|
419
|
+
bk?: string;
|
|
420
|
+
}
|
|
421
|
+
type SubmitOutcome = {
|
|
422
|
+
ok: true;
|
|
423
|
+
word: string;
|
|
424
|
+
} | {
|
|
425
|
+
ok: false;
|
|
426
|
+
word: string;
|
|
427
|
+
reason: MissReason;
|
|
428
|
+
};
|
|
429
|
+
interface PlayOptions {
|
|
430
|
+
cpm?: number;
|
|
431
|
+
}
|
|
432
|
+
interface Turn {
|
|
433
|
+
room: GameRoom;
|
|
434
|
+
prompt: string;
|
|
435
|
+
locale: string;
|
|
436
|
+
masked: boolean;
|
|
437
|
+
mode: number;
|
|
438
|
+
match: "contains" | "startsWith";
|
|
439
|
+
deadline: number;
|
|
440
|
+
used: ReadonlySet<string>;
|
|
441
|
+
timeLeftMs(): number;
|
|
442
|
+
active(): boolean;
|
|
443
|
+
matches(word: string): boolean;
|
|
444
|
+
submit(word: string): Promise<SubmitOutcome>;
|
|
445
|
+
play(word: string, opts?: PlayOptions): Promise<SubmitOutcome>;
|
|
446
|
+
}
|
|
447
|
+
interface ChatMessage {
|
|
448
|
+
room: GameRoom;
|
|
449
|
+
from: Player | null;
|
|
450
|
+
text: string;
|
|
451
|
+
whisper: boolean;
|
|
452
|
+
team: boolean;
|
|
453
|
+
mentionsMe: boolean;
|
|
454
|
+
reply(text: string): void;
|
|
455
|
+
whisperBack(text: string): void;
|
|
456
|
+
}
|
|
457
|
+
type LeaveReason = "left" | "closed" | "kicked" | "banned" | "joinTooFast" | "botsNotAllowed" | "disconnected" | "restart";
|
|
458
|
+
interface RestartInfo {
|
|
459
|
+
roomId: string;
|
|
460
|
+
locale: string;
|
|
461
|
+
mode: number;
|
|
462
|
+
multiLanguage: boolean;
|
|
463
|
+
locked: boolean;
|
|
464
|
+
guests: boolean;
|
|
465
|
+
botAccounts: boolean;
|
|
466
|
+
chainStyle: number;
|
|
467
|
+
scenario: number;
|
|
468
|
+
}
|
|
469
|
+
interface RoomClosed {
|
|
470
|
+
room: GameRoom;
|
|
471
|
+
reason: LeaveReason;
|
|
472
|
+
code: number;
|
|
473
|
+
}
|
|
474
|
+
interface RoomEvents {
|
|
475
|
+
"room.ready": {
|
|
476
|
+
room: GameRoom;
|
|
477
|
+
};
|
|
478
|
+
"room.state": {
|
|
479
|
+
room: GameRoom;
|
|
480
|
+
};
|
|
481
|
+
"room.closed": RoomClosed;
|
|
482
|
+
"room.player.joined": PlayerEvent;
|
|
483
|
+
"room.player.left": PlayerEvent;
|
|
484
|
+
"room.host": PlayerEvent;
|
|
485
|
+
"room.language": PlayerEvent;
|
|
486
|
+
"room.settings": {
|
|
487
|
+
room: GameRoom;
|
|
488
|
+
};
|
|
489
|
+
"room.server": {
|
|
490
|
+
room: GameRoom;
|
|
491
|
+
text: string;
|
|
492
|
+
args: Array<string | number>;
|
|
493
|
+
};
|
|
494
|
+
"room.system": {
|
|
495
|
+
room: GameRoom;
|
|
496
|
+
text: string;
|
|
497
|
+
};
|
|
498
|
+
"room.popup": {
|
|
499
|
+
room: GameRoom;
|
|
500
|
+
title: string;
|
|
501
|
+
text: string;
|
|
502
|
+
};
|
|
503
|
+
"room.afk": {
|
|
504
|
+
room: GameRoom;
|
|
505
|
+
seconds: number;
|
|
506
|
+
extended: boolean;
|
|
507
|
+
};
|
|
508
|
+
"chat.message": ChatMessage;
|
|
509
|
+
"love.received": {
|
|
510
|
+
room: GameRoom;
|
|
511
|
+
from: Player | null;
|
|
512
|
+
};
|
|
513
|
+
"game.start": GameStart;
|
|
514
|
+
"game.turn": Turn;
|
|
515
|
+
"game.solve": Solve;
|
|
516
|
+
"game.miss": Miss;
|
|
517
|
+
"game.hurt": Hurt;
|
|
518
|
+
"game.eliminated": Eliminated;
|
|
519
|
+
"game.end": GameEnd;
|
|
520
|
+
"game.stop": {
|
|
521
|
+
room: GameRoom;
|
|
522
|
+
};
|
|
523
|
+
command: CommandInteraction;
|
|
524
|
+
button: ButtonInteraction;
|
|
525
|
+
}
|
|
526
|
+
declare const ROOM_EVENTS: Array<keyof RoomEvents>;
|
|
527
|
+
interface RoomSettings {
|
|
528
|
+
mode?: number;
|
|
529
|
+
language?: string;
|
|
530
|
+
multiLanguage?: boolean;
|
|
531
|
+
locked?: boolean;
|
|
532
|
+
hearts?: number;
|
|
533
|
+
timer?: number;
|
|
534
|
+
maxPlayers?: number;
|
|
535
|
+
guests?: boolean;
|
|
536
|
+
botAccounts?: boolean;
|
|
537
|
+
[key: string]: unknown;
|
|
538
|
+
}
|
|
539
|
+
interface GameRoomContext {
|
|
540
|
+
myName(): string;
|
|
541
|
+
keepAlive: boolean;
|
|
542
|
+
channel(room: GameRoom, sink: InteractionSink<GameRoom>): RoomChannel;
|
|
543
|
+
restarting(info: RestartInfo): void;
|
|
544
|
+
}
|
|
545
|
+
declare class GameRoom extends Emitter<RoomEvents> {
|
|
546
|
+
readonly raw: Room<RawState>;
|
|
547
|
+
private readonly ctx;
|
|
548
|
+
readonly used: Set<string>;
|
|
549
|
+
private readonly channel;
|
|
550
|
+
private readonly feedHost;
|
|
551
|
+
private botKey;
|
|
552
|
+
private known;
|
|
553
|
+
private hostSession;
|
|
554
|
+
private configKey;
|
|
555
|
+
private turnKey;
|
|
556
|
+
private turnSerial;
|
|
557
|
+
private pending;
|
|
558
|
+
private ready;
|
|
559
|
+
private open;
|
|
560
|
+
private closing;
|
|
561
|
+
private leaving;
|
|
562
|
+
private restartPending;
|
|
563
|
+
constructor(raw: Room<RawState>, ctx: GameRoomContext);
|
|
564
|
+
get id(): string;
|
|
565
|
+
get sessionId(): string;
|
|
566
|
+
get isOpen(): boolean;
|
|
567
|
+
get title(): string;
|
|
568
|
+
get mode(): number;
|
|
569
|
+
get locale(): string;
|
|
570
|
+
get multiLanguage(): boolean;
|
|
571
|
+
get myLocale(): string;
|
|
572
|
+
get config(): RoomConfig;
|
|
573
|
+
get locked(): boolean;
|
|
574
|
+
get started(): boolean;
|
|
575
|
+
get prompt(): string;
|
|
576
|
+
get players(): Player[];
|
|
577
|
+
get me(): Player | null;
|
|
578
|
+
get host(): Player | null;
|
|
579
|
+
get isHost(): boolean;
|
|
580
|
+
get currentPlayer(): Player | null;
|
|
581
|
+
player(ref: string): Player;
|
|
582
|
+
post(message: BotMessage): Promise<string>;
|
|
583
|
+
settled(timeoutMs?: number): Promise<void>;
|
|
584
|
+
say(text: string): void;
|
|
585
|
+
whisper(ref: string | Player, text: string): void;
|
|
586
|
+
love(ref: string | Player): void;
|
|
587
|
+
toggleSpectate(): void;
|
|
588
|
+
start(): void;
|
|
589
|
+
end(): void;
|
|
590
|
+
kick(ref: string | Player): void;
|
|
591
|
+
ban(ref: string | Player): void;
|
|
592
|
+
giveHost(ref: string | Player): void;
|
|
593
|
+
setTitle(title: string): void;
|
|
594
|
+
settings(patch: RoomSettings): Promise<void>;
|
|
595
|
+
setLanguage(locale: string): Promise<boolean>;
|
|
596
|
+
clearInput(): void;
|
|
597
|
+
type(text: string, opts?: PlayOptions): Promise<boolean>;
|
|
598
|
+
submit(word: string): Promise<SubmitOutcome>;
|
|
599
|
+
play(word: string, opts?: PlayOptions): Promise<SubmitOutcome>;
|
|
600
|
+
autoplay(opts: AutoplayOptions): Autoplayer;
|
|
601
|
+
leave(): Promise<void>;
|
|
602
|
+
private typeFor;
|
|
603
|
+
private submitFor;
|
|
604
|
+
private playFor;
|
|
605
|
+
private get state();
|
|
606
|
+
private send;
|
|
607
|
+
private assertOpen;
|
|
608
|
+
private resolve;
|
|
609
|
+
private upper;
|
|
610
|
+
private toPlayer;
|
|
611
|
+
private lookup;
|
|
612
|
+
private snapshot;
|
|
613
|
+
private bind;
|
|
614
|
+
private sink;
|
|
615
|
+
private onState;
|
|
616
|
+
private diff;
|
|
617
|
+
private checkTurn;
|
|
618
|
+
private endTurn;
|
|
619
|
+
private settle;
|
|
620
|
+
private onChat;
|
|
621
|
+
private onLeave;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
type MissReason = "wrong" | "used" | "tooShort" | "noPrompt" | "notAWord" | "selfSolve" | "wrongStart" | "notInCategory" | "bannedLetter" | "wrongLength" | "wrongEnd" | "timeout" | "turnOver" | "busy" | "left";
|
|
625
|
+
interface PlayerEvent<R = GameRoom> {
|
|
626
|
+
room: R;
|
|
627
|
+
player: Player;
|
|
628
|
+
}
|
|
629
|
+
interface Solve<R = GameRoom> {
|
|
630
|
+
room: R;
|
|
631
|
+
player: Player | null;
|
|
632
|
+
word: string;
|
|
633
|
+
mine: boolean;
|
|
634
|
+
}
|
|
635
|
+
interface Miss<R = GameRoom> {
|
|
636
|
+
room: R;
|
|
637
|
+
player: Player | null;
|
|
638
|
+
word: string;
|
|
639
|
+
reason: MissReason;
|
|
640
|
+
mine: boolean;
|
|
641
|
+
}
|
|
642
|
+
interface Hurt<R = GameRoom> {
|
|
643
|
+
room: R;
|
|
644
|
+
player: Player | null;
|
|
645
|
+
hearts: number;
|
|
646
|
+
prompt: string;
|
|
647
|
+
mine: boolean;
|
|
648
|
+
}
|
|
649
|
+
interface Eliminated<R = GameRoom> {
|
|
650
|
+
room: R;
|
|
651
|
+
player: Player | null;
|
|
652
|
+
mine: boolean;
|
|
653
|
+
}
|
|
654
|
+
interface GameStart<R = GameRoom> {
|
|
655
|
+
room: R;
|
|
656
|
+
mode: number;
|
|
657
|
+
playing: number;
|
|
658
|
+
meIn: boolean;
|
|
659
|
+
}
|
|
660
|
+
interface PodiumEntry {
|
|
661
|
+
place: number;
|
|
662
|
+
name: string;
|
|
663
|
+
sessionId: string;
|
|
664
|
+
}
|
|
665
|
+
interface GameEnd<R = GameRoom> {
|
|
666
|
+
room: R;
|
|
667
|
+
podium: PodiumEntry[];
|
|
668
|
+
myPlace: number | null;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
type AnyRoom = GameRoom | AppRoom;
|
|
672
|
+
interface AppRoomEvents {
|
|
673
|
+
"room.ready": {
|
|
674
|
+
room: AppRoom;
|
|
675
|
+
};
|
|
676
|
+
"room.state": {
|
|
677
|
+
room: AppRoom;
|
|
678
|
+
};
|
|
679
|
+
"room.close": {
|
|
680
|
+
room: AppRoom;
|
|
681
|
+
};
|
|
682
|
+
"room.player.joined": PlayerEvent<AppRoom>;
|
|
683
|
+
"room.player.left": PlayerEvent<AppRoom>;
|
|
684
|
+
"game.start": GameStart<AppRoom>;
|
|
685
|
+
"game.solve": Solve<AppRoom>;
|
|
686
|
+
"game.miss": Miss<AppRoom>;
|
|
687
|
+
"game.hurt": Hurt<AppRoom>;
|
|
688
|
+
"game.eliminated": Eliminated<AppRoom>;
|
|
689
|
+
"game.end": GameEnd<AppRoom>;
|
|
690
|
+
"game.stop": {
|
|
691
|
+
room: AppRoom;
|
|
692
|
+
};
|
|
693
|
+
command: CommandInteraction<AppRoom>;
|
|
694
|
+
button: ButtonInteraction<AppRoom>;
|
|
695
|
+
}
|
|
696
|
+
declare const APP_ROOM_EVENTS: Array<keyof AppRoomEvents>;
|
|
697
|
+
interface AppEvents extends AppRoomEvents {
|
|
698
|
+
"room.open": {
|
|
699
|
+
room: AppRoom;
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
interface AppRoomControls {
|
|
703
|
+
apply(lines: string[]): void;
|
|
704
|
+
close(): void;
|
|
705
|
+
}
|
|
706
|
+
interface AppRoomContext {
|
|
707
|
+
channel(room: AppRoom, sink: InteractionSink<AppRoom>): RoomChannel;
|
|
708
|
+
bind(room: AppRoom, controls: AppRoomControls): void;
|
|
709
|
+
}
|
|
710
|
+
declare class AppRoom extends Emitter<AppRoomEvents> {
|
|
711
|
+
readonly id: string;
|
|
712
|
+
readonly used: Set<string>;
|
|
713
|
+
private readonly seats;
|
|
714
|
+
private readonly gone;
|
|
715
|
+
private readonly channel;
|
|
716
|
+
private readonly feedHost;
|
|
717
|
+
private readonly sink;
|
|
718
|
+
private modeId;
|
|
719
|
+
private lang;
|
|
720
|
+
private running;
|
|
721
|
+
private turnSession;
|
|
722
|
+
private letters;
|
|
723
|
+
private ready;
|
|
724
|
+
private open;
|
|
725
|
+
constructor(id: string, ctx: AppRoomContext);
|
|
726
|
+
get isOpen(): boolean;
|
|
727
|
+
get mode(): number;
|
|
728
|
+
get locale(): string;
|
|
729
|
+
get started(): boolean;
|
|
730
|
+
get prompt(): string;
|
|
731
|
+
get players(): Player[];
|
|
732
|
+
get currentPlayer(): Player | null;
|
|
733
|
+
player(ref: string): Player;
|
|
734
|
+
post(message: BotMessage): Promise<string>;
|
|
735
|
+
private toPlayer;
|
|
736
|
+
private lookup;
|
|
737
|
+
private feed;
|
|
738
|
+
private close;
|
|
739
|
+
private apply;
|
|
740
|
+
}
|
|
741
|
+
declare class Apps extends Emitter<AppEvents> {
|
|
742
|
+
private readonly interactions;
|
|
743
|
+
private readonly open;
|
|
744
|
+
private readonly unconfirmed;
|
|
745
|
+
private recheckTimer;
|
|
746
|
+
constructor(interactions: Interactions, realtime: Realtime | null);
|
|
747
|
+
get all(): AppRoom[];
|
|
748
|
+
get(id: string): AppRoom | null;
|
|
749
|
+
private recheck;
|
|
750
|
+
private stopRecheck;
|
|
751
|
+
private closeAll;
|
|
752
|
+
private onRoom;
|
|
753
|
+
private onEvents;
|
|
754
|
+
private ensure;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
interface JoinOptions {
|
|
758
|
+
spectate?: boolean;
|
|
759
|
+
language?: string;
|
|
760
|
+
}
|
|
761
|
+
interface CreateRoomOptions {
|
|
762
|
+
mode?: number;
|
|
763
|
+
language?: string;
|
|
764
|
+
multiLanguage?: boolean;
|
|
765
|
+
private?: boolean;
|
|
766
|
+
hearts?: number;
|
|
767
|
+
timer?: number;
|
|
768
|
+
maxPlayers?: number;
|
|
769
|
+
config?: Record<string, unknown>;
|
|
770
|
+
}
|
|
771
|
+
interface RoomsContext extends Omit<GameRoomContext, "restarting"> {
|
|
772
|
+
locale: string;
|
|
773
|
+
rejoin: boolean;
|
|
774
|
+
isApp(): boolean;
|
|
775
|
+
adopted(room: GameRoom): void;
|
|
776
|
+
failed(e: unknown): void;
|
|
777
|
+
}
|
|
778
|
+
declare class Lobby {
|
|
779
|
+
private readonly client;
|
|
780
|
+
private readonly locale;
|
|
781
|
+
constructor(client: Client, locale: string);
|
|
782
|
+
rooms(): Promise<RoomListing[]>;
|
|
783
|
+
send(type: string, payload: unknown): Promise<void>;
|
|
784
|
+
private with;
|
|
785
|
+
}
|
|
786
|
+
declare class Rooms {
|
|
787
|
+
private readonly client;
|
|
788
|
+
private readonly ctx;
|
|
789
|
+
private readonly open;
|
|
790
|
+
private readonly rejoins;
|
|
791
|
+
private queue;
|
|
792
|
+
constructor(client: Client, ctx: RoomsContext);
|
|
793
|
+
get all(): GameRoom[];
|
|
794
|
+
get(roomId: string): GameRoom | null;
|
|
795
|
+
join(roomId: string, opts?: JoinOptions): Promise<GameRoom>;
|
|
796
|
+
create(opts?: CreateRoomOptions): Promise<GameRoom>;
|
|
797
|
+
leave(roomId: string): Promise<void>;
|
|
798
|
+
leaveAll(): Promise<void>;
|
|
799
|
+
private serial;
|
|
800
|
+
private connectById;
|
|
801
|
+
private connectNew;
|
|
802
|
+
private later;
|
|
803
|
+
private recover;
|
|
804
|
+
private reconnect;
|
|
805
|
+
private adopt;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
declare const COSMETIC_KINDS: CosmeticKind[];
|
|
809
|
+
declare class Cosmetics {
|
|
810
|
+
private readonly session;
|
|
811
|
+
private readonly rooms;
|
|
812
|
+
private readonly lobby;
|
|
813
|
+
constructor(session: Session, rooms: Rooms, lobby: Lobby);
|
|
814
|
+
owned(kind: CosmeticKind): number[];
|
|
815
|
+
equipped(kind: CosmeticKind): number;
|
|
816
|
+
equip(kind: CosmeticKind, id: number): Promise<void>;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
type ImageInput = string | Uint8Array | ArrayBuffer;
|
|
820
|
+
declare class ImageSlot {
|
|
821
|
+
private readonly http;
|
|
822
|
+
readonly kind: ImageKind;
|
|
823
|
+
constructor(http: Http, kind: ImageKind);
|
|
824
|
+
upload(input: ImageInput): Promise<string>;
|
|
825
|
+
}
|
|
826
|
+
declare function avatarUrl(userId: string, avatar: string): string | null;
|
|
827
|
+
|
|
828
|
+
declare class Notifications {
|
|
829
|
+
private readonly http;
|
|
830
|
+
private lastSeen;
|
|
831
|
+
private running;
|
|
832
|
+
private again;
|
|
833
|
+
constructor(http: Http);
|
|
834
|
+
list(): Promise<Notification[]>;
|
|
835
|
+
prime(): Promise<void>;
|
|
836
|
+
poll(deliver: (fresh: Notification[]) => void): Promise<void>;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
type UserLike = string | UserRef;
|
|
840
|
+
declare class Users {
|
|
841
|
+
private readonly http;
|
|
842
|
+
private readonly byName;
|
|
843
|
+
private readonly names;
|
|
844
|
+
constructor(http: Http);
|
|
845
|
+
resolve(ref: UserLike): Promise<string>;
|
|
846
|
+
get(ref: UserLike): Promise<Profile>;
|
|
847
|
+
remember(id: string, name: string): void;
|
|
848
|
+
nameOf(id: string): string;
|
|
849
|
+
}
|
|
850
|
+
interface DirectMessage {
|
|
851
|
+
chatId: string;
|
|
852
|
+
group: boolean;
|
|
853
|
+
from: UserRef;
|
|
854
|
+
kind: string;
|
|
855
|
+
text: string | null;
|
|
856
|
+
reply(text: string): Promise<void>;
|
|
857
|
+
}
|
|
858
|
+
declare class Dms {
|
|
859
|
+
private readonly http;
|
|
860
|
+
private readonly users;
|
|
861
|
+
private readonly session;
|
|
862
|
+
constructor(http: Http, users: Users, session: Session);
|
|
863
|
+
send(to: UserLike, text: string): Promise<void>;
|
|
864
|
+
sendToChat(chatId: string, text: string): Promise<void>;
|
|
865
|
+
history(withUser: UserLike, limit?: number): Promise<HistoryMessage[]>;
|
|
866
|
+
inbox(limit?: number): Promise<Conversation[]>;
|
|
867
|
+
fromRealtime(d: unknown): DirectMessage | null;
|
|
868
|
+
}
|
|
869
|
+
interface FriendRequest {
|
|
870
|
+
from: UserRef;
|
|
871
|
+
accept(): Promise<void>;
|
|
872
|
+
decline(): Promise<void>;
|
|
873
|
+
}
|
|
874
|
+
interface Invite {
|
|
875
|
+
from: UserRef;
|
|
876
|
+
roomId: string | null;
|
|
877
|
+
}
|
|
878
|
+
interface InviteResult {
|
|
879
|
+
delivered: boolean;
|
|
880
|
+
reason: string | null;
|
|
881
|
+
}
|
|
882
|
+
declare class Friends {
|
|
883
|
+
private readonly http;
|
|
884
|
+
private readonly users;
|
|
885
|
+
private readonly realtime;
|
|
886
|
+
readonly online: Map<string, {
|
|
887
|
+
status: string;
|
|
888
|
+
room: FriendRoom | null;
|
|
889
|
+
}>;
|
|
890
|
+
constructor(http: Http, users: Users, realtime: Realtime | null);
|
|
891
|
+
list(): Promise<{
|
|
892
|
+
friends: Friend[];
|
|
893
|
+
incoming: UserRef[];
|
|
894
|
+
}>;
|
|
895
|
+
accept(user: UserLike): Promise<void>;
|
|
896
|
+
decline(user: UserLike): Promise<void>;
|
|
897
|
+
remove(user: UserLike): Promise<void>;
|
|
898
|
+
invite(user: UserLike, roomId: string | null): Promise<InviteResult>;
|
|
899
|
+
friendRequest(user: UserRef): FriendRequest;
|
|
900
|
+
}
|
|
901
|
+
interface Comment {
|
|
902
|
+
id: string;
|
|
903
|
+
profileId: string;
|
|
904
|
+
parentId: string | null;
|
|
905
|
+
author: UserRef;
|
|
906
|
+
text: string;
|
|
907
|
+
at: number;
|
|
908
|
+
pinned: boolean;
|
|
909
|
+
reply(text: string): Promise<Comment>;
|
|
910
|
+
}
|
|
911
|
+
interface CommentThread extends Comment {
|
|
912
|
+
replies: Comment[];
|
|
913
|
+
}
|
|
914
|
+
declare class Comments {
|
|
915
|
+
private readonly http;
|
|
916
|
+
private readonly users;
|
|
917
|
+
private readonly session;
|
|
918
|
+
constructor(http: Http, users: Users, session: Session);
|
|
919
|
+
list(profile?: UserLike, limit?: number): Promise<{
|
|
920
|
+
total: number;
|
|
921
|
+
canComment: boolean;
|
|
922
|
+
threads: CommentThread[];
|
|
923
|
+
}>;
|
|
924
|
+
post(profile: UserLike, text: string): Promise<Comment>;
|
|
925
|
+
reply(to: Comment, text: string): Promise<Comment>;
|
|
926
|
+
private create;
|
|
927
|
+
private toComment;
|
|
928
|
+
}
|
|
929
|
+
declare class OwnProfile {
|
|
930
|
+
private readonly http;
|
|
931
|
+
private readonly users;
|
|
932
|
+
private readonly session;
|
|
933
|
+
constructor(http: Http, users: Users, session: Session);
|
|
934
|
+
get(): Promise<Profile>;
|
|
935
|
+
update(fields: {
|
|
936
|
+
displayName?: string;
|
|
937
|
+
about?: string;
|
|
938
|
+
}): Promise<void>;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
interface ConnectOptions {
|
|
942
|
+
key: string;
|
|
943
|
+
target: TargetName | Target;
|
|
944
|
+
locale?: string;
|
|
945
|
+
realtime?: boolean;
|
|
946
|
+
keepRoomsAlive?: boolean;
|
|
947
|
+
rejoinRooms?: boolean;
|
|
948
|
+
clientId?: string;
|
|
949
|
+
}
|
|
950
|
+
interface ReceivedInvite extends Invite {
|
|
951
|
+
join(): Promise<GameRoom>;
|
|
952
|
+
}
|
|
953
|
+
interface BotEvents extends RoomEvents {
|
|
954
|
+
error: Error;
|
|
955
|
+
banned: void;
|
|
956
|
+
"realtime.up": void;
|
|
957
|
+
"realtime.down": {
|
|
958
|
+
code: number;
|
|
959
|
+
retryInMs: number;
|
|
960
|
+
};
|
|
961
|
+
"room.joined": {
|
|
962
|
+
room: GameRoom;
|
|
963
|
+
};
|
|
964
|
+
"dm.message": DirectMessage;
|
|
965
|
+
notification: Notification;
|
|
966
|
+
"profile.comment": Notification;
|
|
967
|
+
achievement: Notification;
|
|
968
|
+
"friend.request": FriendRequest;
|
|
969
|
+
"friend.request.canceled": {
|
|
970
|
+
id: string;
|
|
971
|
+
};
|
|
972
|
+
"friend.added": UserRef;
|
|
973
|
+
"friend.removed": {
|
|
974
|
+
id: string;
|
|
975
|
+
};
|
|
976
|
+
"friend.online": {
|
|
977
|
+
id: string;
|
|
978
|
+
name: string;
|
|
979
|
+
status: string;
|
|
980
|
+
};
|
|
981
|
+
"friend.offline": {
|
|
982
|
+
id: string;
|
|
983
|
+
name: string;
|
|
984
|
+
};
|
|
985
|
+
"friend.room": {
|
|
986
|
+
id: string;
|
|
987
|
+
name: string;
|
|
988
|
+
room: FriendRoom | null;
|
|
989
|
+
};
|
|
990
|
+
"invite.received": ReceivedInvite;
|
|
991
|
+
}
|
|
992
|
+
declare class WordBomb extends Emitter<BotEvents> {
|
|
993
|
+
readonly target: Target;
|
|
994
|
+
readonly http: Http;
|
|
995
|
+
readonly realtime: Realtime | null;
|
|
996
|
+
readonly users: Users;
|
|
997
|
+
readonly dm: Dms;
|
|
998
|
+
readonly friends: Friends;
|
|
999
|
+
readonly comments: Comments;
|
|
1000
|
+
readonly profile: OwnProfile;
|
|
1001
|
+
readonly notifications: Notifications;
|
|
1002
|
+
readonly lobby: Lobby;
|
|
1003
|
+
readonly rooms: Rooms;
|
|
1004
|
+
readonly apps: Apps;
|
|
1005
|
+
readonly commands: Commands;
|
|
1006
|
+
readonly cosmetics: Cosmetics;
|
|
1007
|
+
readonly avatar: ImageSlot;
|
|
1008
|
+
readonly banner: ImageSlot;
|
|
1009
|
+
readonly background: ImageSlot;
|
|
1010
|
+
private readonly session;
|
|
1011
|
+
private readonly client;
|
|
1012
|
+
private readonly interactions;
|
|
1013
|
+
private closed;
|
|
1014
|
+
private readonly requested;
|
|
1015
|
+
static connect(opts: ConnectOptions): Promise<WordBomb>;
|
|
1016
|
+
private constructor();
|
|
1017
|
+
get me(): Readonly<UserRef>;
|
|
1018
|
+
get token(): string;
|
|
1019
|
+
get kind(): BotKind;
|
|
1020
|
+
notify(user: UserLike, text: string): Promise<void>;
|
|
1021
|
+
close(): Promise<void>;
|
|
1022
|
+
private start;
|
|
1023
|
+
private fail;
|
|
1024
|
+
private adopt;
|
|
1025
|
+
private friendName;
|
|
1026
|
+
private request;
|
|
1027
|
+
private pendingRequests;
|
|
1028
|
+
private onRealtime;
|
|
1029
|
+
private userRef;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
type ErrorCode = "INVALID" | "AUTH_FAILED" | "BANNED" | "FORBIDDEN" | "NOT_FOUND" | "RATE_LIMITED" | "HTTP" | "TIMEOUT" | "REALTIME_DOWN" | "REPLACED" | "NOT_IN_ROOM" | "ROOM_NOT_FOUND" | "JOIN_FAILED" | "JOIN_TOO_FAST" | "BOTS_NOT_ALLOWED" | "ALREADY_IN_ROOM" | "BOT_ROOM_LIMIT" | "APP_NO_ROOMS" | "BOTS_DISABLED" | "KICKED" | "LINK_DROPPED";
|
|
1033
|
+
declare class WordBombError extends Error {
|
|
1034
|
+
readonly code: ErrorCode;
|
|
1035
|
+
readonly status?: number | undefined;
|
|
1036
|
+
readonly retryAfterMs?: number | undefined;
|
|
1037
|
+
readonly name = "WordBombError";
|
|
1038
|
+
constructor(code: ErrorCode, message: string, status?: number | undefined, retryAfterMs?: number | undefined);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
declare const VERSION: string;
|
|
1042
|
+
|
|
1043
|
+
export { APP_ROOM_EVENTS, type AnyRoom, type AppEvents, AppRoom, type AppRoomEvents, Apps, type AutoplayOptions, Autoplayer, type BotActionRow, type BotButton, type BotEmbed, type BotEmbedField, type BotEvents, type BotKind, type BotMessage, type BotReply, type ButtonInteraction, type ButtonStyle, COSMETIC_KINDS, type CandidateOptions, type ChatMessage, type CommandDef, type CommandInteraction, type CommandOptionDef, type CommandOptionType, Commands, type Comment, type CommentThread, Comments, type ConnectOptions, type Conversation, type CosmeticKind, Cosmetics, type CreateRoomOptions, type DirectMessage, Dms, type Eliminated, type ErrorCode, type Friend, type FriendRequest, type FriendRoom, Friends, type GameEnd, GameRoom, type GameStart, type HistoryMessage, type Hurt, type ImageInput, type ImageKind, ImageSlot, type Invite, type InviteResult, type JoinOptions, type LeaveReason, Lobby, MODES, type Miss, type MissReason, type Notification, type NotificationKind, Notifications, type OptionValue, OwnProfile, type PlayOptions, type Player, type PlayerEvent, type PodiumEntry, type Profile, ROOM_EVENTS, type ReceivedInvite, type RoomClosed, type RoomConfig, type RoomEvents, type RoomListing, type RoomSettings, Rooms, type Solve, type SubmitOutcome, TARGETS, type Target, type TargetName, type Turn, type UserLike, type UserRef, Users, VERSION, WordBomb, WordBombError, WordList, avatarUrl, modeName, resolveTarget };
|