@impulsedev/chameleon 1.6.0 → 2.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 +7 -7
- package/diff.txt +3086 -0
- package/dist/builders-CCZQJXF6.js +60 -0
- package/dist/chunk-F2RRJ7OJ.js +850 -0
- package/dist/index.d.ts +171 -142
- package/dist/index.js +451 -925
- package/media/discordchameleon.png +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1652,7 +1652,7 @@ declare class ChameleonGateway {
|
|
|
1652
1652
|
* Send a payload to the Gateway.
|
|
1653
1653
|
*/
|
|
1654
1654
|
send(op: number, d: unknown): void;
|
|
1655
|
-
pendingPresence: Record<string,
|
|
1655
|
+
pendingPresence: Record<string, unknown> | null;
|
|
1656
1656
|
/**
|
|
1657
1657
|
* Update the presence/status for this shard
|
|
1658
1658
|
*/
|
|
@@ -2091,8 +2091,8 @@ interface OptionDef<T extends OptionType, R extends boolean> {
|
|
|
2091
2091
|
}[];
|
|
2092
2092
|
}
|
|
2093
2093
|
type ResolveOptionType<T extends OptionType> = T extends 'string' ? string : T extends 'integer' | 'number' ? number : T extends 'boolean' ? boolean : T extends 'user' ? User : T extends 'channel' ? Channel : T extends 'role' ? Role : never;
|
|
2094
|
-
type ResolveOption<O extends OptionDef<
|
|
2095
|
-
type ResolveOptions<O extends Record<string, OptionDef<
|
|
2094
|
+
type ResolveOption<O extends OptionDef<OptionType, boolean>> = O['required'] extends true ? ResolveOptionType<O['type']> : ResolveOptionType<O['type']> | undefined;
|
|
2095
|
+
type ResolveOptions<O extends Record<string, OptionDef<OptionType, boolean>>> = {
|
|
2096
2096
|
[K in keyof O]: ResolveOption<O[K]>;
|
|
2097
2097
|
};
|
|
2098
2098
|
declare const opt: {
|
|
@@ -2139,12 +2139,17 @@ declare const opt: {
|
|
|
2139
2139
|
|
|
2140
2140
|
type InteractionReplyOptions = string | {
|
|
2141
2141
|
content?: string;
|
|
2142
|
-
embeds?:
|
|
2143
|
-
|
|
2142
|
+
embeds?: (Embed | {
|
|
2143
|
+
toJSON(): Record<string, unknown>;
|
|
2144
|
+
} | Record<string, unknown>)[];
|
|
2145
|
+
components?: (MessageComponent | {
|
|
2146
|
+
build?(): MessageComponent;
|
|
2147
|
+
} | {
|
|
2148
|
+
toJSON(): Record<string, unknown>;
|
|
2149
|
+
} | Record<string, unknown>)[];
|
|
2144
2150
|
ephemeral?: boolean;
|
|
2145
2151
|
};
|
|
2146
|
-
declare class
|
|
2147
|
-
options: Options;
|
|
2152
|
+
declare class BaseInteractionContext {
|
|
2148
2153
|
user: User;
|
|
2149
2154
|
guild?: Guild | {
|
|
2150
2155
|
id: string;
|
|
@@ -2154,109 +2159,84 @@ declare class CommandContext<Options = Record<string, any>> {
|
|
|
2154
2159
|
} | undefined;
|
|
2155
2160
|
interactionId: string;
|
|
2156
2161
|
interactionToken: string;
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
constructor(client: Client,
|
|
2162
|
+
protected _client: Client;
|
|
2163
|
+
protected _deferred: boolean;
|
|
2164
|
+
protected _replied: boolean;
|
|
2165
|
+
constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
|
|
2161
2166
|
id: string;
|
|
2162
2167
|
}, channel?: Channel | {
|
|
2163
2168
|
id: string;
|
|
2164
2169
|
});
|
|
2165
2170
|
get replied(): boolean;
|
|
2166
2171
|
get deferred(): boolean;
|
|
2172
|
+
protected _resolvePayload(payload: InteractionReplyOptions): Record<string, unknown>;
|
|
2167
2173
|
reply(payload: InteractionReplyOptions): Promise<void>;
|
|
2168
2174
|
defer(options?: {
|
|
2169
2175
|
ephemeral?: boolean;
|
|
2170
2176
|
}): Promise<void>;
|
|
2171
2177
|
followUp(payload: InteractionReplyOptions): Promise<void>;
|
|
2172
|
-
showModal(modal:
|
|
2178
|
+
showModal(modal: Record<string, unknown>): Promise<void>;
|
|
2179
|
+
}
|
|
2180
|
+
declare class CommandContext<Options = Record<string, unknown>> extends BaseInteractionContext {
|
|
2181
|
+
options: Options;
|
|
2182
|
+
constructor(client: Client, rawInteraction: Record<string, unknown>, parsedOptions: Options, user: User, guild?: Guild | {
|
|
2183
|
+
id: string;
|
|
2184
|
+
}, channel?: Channel | {
|
|
2185
|
+
id: string;
|
|
2186
|
+
});
|
|
2173
2187
|
}
|
|
2174
2188
|
|
|
2175
|
-
type ExecuteFunction<O extends Record<string, OptionDef<
|
|
2176
|
-
interface Subcommand<O extends Record<string, OptionDef<
|
|
2189
|
+
type ExecuteFunction<O extends Record<string, OptionDef<OptionType, boolean>>> = (ctx: CommandContext<ResolveOptions<O>>) => void | Promise<void>;
|
|
2190
|
+
interface Subcommand<O extends Record<string, OptionDef<OptionType, boolean>> = Record<string, never>> {
|
|
2177
2191
|
description: string;
|
|
2178
2192
|
options?: O;
|
|
2179
2193
|
execute: ExecuteFunction<O>;
|
|
2180
2194
|
}
|
|
2181
|
-
declare function defineSubcommand<O extends Record<string, OptionDef<
|
|
2182
|
-
type CommandDef<O extends Record<string, OptionDef<
|
|
2195
|
+
declare function defineSubcommand<O extends Record<string, OptionDef<OptionType, boolean>>>(def: Subcommand<O>): Subcommand<O>;
|
|
2196
|
+
type CommandDef<O extends Record<string, OptionDef<OptionType, boolean>> = Record<string, never>, S extends Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>> = Record<string, never>> = {
|
|
2183
2197
|
name: string;
|
|
2184
2198
|
description: string;
|
|
2185
2199
|
options?: O;
|
|
2186
2200
|
subcommands?: S;
|
|
2187
2201
|
execute?: ExecuteFunction<O>;
|
|
2188
2202
|
};
|
|
2189
|
-
|
|
2203
|
+
type AnyCommandDef = CommandDef<Record<string, OptionDef<OptionType, boolean>>, Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>>>;
|
|
2204
|
+
declare function defineCommand<O extends Record<string, OptionDef<OptionType, boolean>>, S extends Record<string, Subcommand<Record<string, OptionDef<OptionType, boolean>>>>>(def: CommandDef<O, S>): CommandDef<O, S>;
|
|
2190
2205
|
|
|
2191
|
-
declare class
|
|
2206
|
+
declare class ModalContext extends BaseInteractionContext {
|
|
2192
2207
|
customId: string;
|
|
2193
|
-
|
|
2194
|
-
guild?: Guild | {
|
|
2195
|
-
id: string;
|
|
2196
|
-
} | undefined;
|
|
2197
|
-
channel?: Channel | {
|
|
2198
|
-
id: string;
|
|
2199
|
-
} | undefined;
|
|
2200
|
-
message?: Record<string, unknown>;
|
|
2201
|
-
interactionId: string;
|
|
2202
|
-
interactionToken: string;
|
|
2203
|
-
private _client;
|
|
2204
|
-
private _deferred;
|
|
2205
|
-
private _replied;
|
|
2206
|
-
constructor(client: Client, raw: Record<string, any>, user: User, guild?: Guild | {
|
|
2208
|
+
private _fields;
|
|
2209
|
+
constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
|
|
2207
2210
|
id: string;
|
|
2208
2211
|
}, channel?: Channel | {
|
|
2209
2212
|
id: string;
|
|
2210
2213
|
});
|
|
2211
|
-
get replied(): boolean;
|
|
2212
|
-
get deferred(): boolean;
|
|
2213
|
-
/** Values from a select menu interaction */
|
|
2214
2214
|
get values(): string[];
|
|
2215
|
-
|
|
2216
|
-
deferUpdate(): Promise<void>;
|
|
2217
|
-
update(payload: InteractionReplyOptions): Promise<void>;
|
|
2218
|
-
followUp(payload: InteractionReplyOptions): Promise<void>;
|
|
2215
|
+
get fields(): Record<string, string>;
|
|
2219
2216
|
}
|
|
2220
|
-
|
|
2217
|
+
|
|
2218
|
+
declare class ComponentContext<Values = unknown, Fields = unknown> extends BaseInteractionContext {
|
|
2221
2219
|
customId: string;
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
channel?: Channel | {
|
|
2227
|
-
id: string;
|
|
2228
|
-
} | undefined;
|
|
2229
|
-
interactionId: string;
|
|
2230
|
-
interactionToken: string;
|
|
2231
|
-
private _fields;
|
|
2232
|
-
private _client;
|
|
2233
|
-
private _replied;
|
|
2234
|
-
private _deferred;
|
|
2235
|
-
constructor(client: Client, raw: Record<string, any>, user: User, guild?: Guild | {
|
|
2220
|
+
message?: Record<string, unknown>;
|
|
2221
|
+
values: Values;
|
|
2222
|
+
fields: Fields;
|
|
2223
|
+
constructor(client: Client, raw: Record<string, unknown>, user: User, guild?: Guild | {
|
|
2236
2224
|
id: string;
|
|
2237
2225
|
}, channel?: Channel | {
|
|
2238
2226
|
id: string;
|
|
2239
2227
|
});
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
/** Get a text input value by its customId */
|
|
2243
|
-
getField(customId: string): string | undefined;
|
|
2244
|
-
/** Get all field values as a plain object */
|
|
2245
|
-
get fields(): Record<string, string>;
|
|
2246
|
-
reply(payload: InteractionReplyOptions): Promise<void>;
|
|
2247
|
-
defer(options?: {
|
|
2248
|
-
ephemeral?: boolean;
|
|
2249
|
-
}): Promise<void>;
|
|
2250
|
-
followUp(payload: InteractionReplyOptions): Promise<void>;
|
|
2228
|
+
deferUpdate(): Promise<void>;
|
|
2229
|
+
update(payload: InteractionReplyOptions): Promise<void>;
|
|
2251
2230
|
}
|
|
2252
2231
|
|
|
2253
2232
|
interface ComponentHandler {
|
|
2254
|
-
|
|
2255
|
-
|
|
2233
|
+
type?: string;
|
|
2234
|
+
customId?: string | RegExp;
|
|
2235
|
+
execute?: (ctx: ComponentContext) => unknown | Promise<unknown>;
|
|
2256
2236
|
}
|
|
2257
2237
|
interface ModalHandler {
|
|
2258
2238
|
customId: string | RegExp;
|
|
2259
|
-
execute: (ctx: ModalContext) =>
|
|
2239
|
+
execute: (ctx: ModalContext) => unknown | Promise<unknown>;
|
|
2260
2240
|
}
|
|
2261
2241
|
declare class CommandManager {
|
|
2262
2242
|
private _commands;
|
|
@@ -2264,55 +2244,17 @@ declare class CommandManager {
|
|
|
2264
2244
|
private _modals;
|
|
2265
2245
|
private _client;
|
|
2266
2246
|
constructor(client: Client);
|
|
2267
|
-
register(...commands:
|
|
2247
|
+
register(...commands: AnyCommandDef[]): void;
|
|
2268
2248
|
registerComponent(handler: ComponentHandler): void;
|
|
2269
2249
|
registerModal(handler: ModalHandler): void;
|
|
2270
2250
|
load(directory: string): Promise<void>;
|
|
2271
2251
|
private _deployCommands;
|
|
2272
2252
|
private _transformCommand;
|
|
2273
|
-
handleInteraction(raw:
|
|
2253
|
+
handleInteraction(raw: Record<string, unknown>): Promise<void>;
|
|
2274
2254
|
private _handleComponentInteraction;
|
|
2275
2255
|
private _handleModalInteraction;
|
|
2276
2256
|
}
|
|
2277
2257
|
|
|
2278
|
-
declare class ComponentContext<Values = any, Fields = any> {
|
|
2279
|
-
user: User;
|
|
2280
|
-
guild?: Guild | {
|
|
2281
|
-
id: string;
|
|
2282
|
-
} | undefined;
|
|
2283
|
-
channel?: Channel | {
|
|
2284
|
-
id: string;
|
|
2285
|
-
} | undefined;
|
|
2286
|
-
interactionId: string;
|
|
2287
|
-
interactionToken: string;
|
|
2288
|
-
customId: string;
|
|
2289
|
-
values: Values;
|
|
2290
|
-
fields: Fields;
|
|
2291
|
-
private _client;
|
|
2292
|
-
private _deferred;
|
|
2293
|
-
private _replied;
|
|
2294
|
-
constructor(client: Client, rawInteraction: Record<string, any>, user: User, guild?: Guild | {
|
|
2295
|
-
id: string;
|
|
2296
|
-
}, channel?: Channel | {
|
|
2297
|
-
id: string;
|
|
2298
|
-
});
|
|
2299
|
-
get replied(): boolean;
|
|
2300
|
-
get deferred(): boolean;
|
|
2301
|
-
reply(payload: InteractionReplyOptions): Promise<void>;
|
|
2302
|
-
defer(options?: {
|
|
2303
|
-
ephemeral?: boolean;
|
|
2304
|
-
}): Promise<void>;
|
|
2305
|
-
update(payload: InteractionReplyOptions): Promise<void>;
|
|
2306
|
-
deferUpdate(): Promise<void>;
|
|
2307
|
-
followUp(payload: InteractionReplyOptions): Promise<void>;
|
|
2308
|
-
showModal(modal: any): Promise<void>;
|
|
2309
|
-
}
|
|
2310
|
-
declare function buildModalPayload(def: any): {
|
|
2311
|
-
custom_id: any;
|
|
2312
|
-
title: any;
|
|
2313
|
-
components: any;
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
2258
|
declare enum COMPONENT_TYPES {
|
|
2317
2259
|
ACTION_ROW = 1,
|
|
2318
2260
|
BUTTON = 2,
|
|
@@ -2430,23 +2372,38 @@ declare const field: {
|
|
|
2430
2372
|
id: ID;
|
|
2431
2373
|
};
|
|
2432
2374
|
};
|
|
2433
|
-
type ResolveModalFields<F extends ReadonlyArray<ModalFieldDef<
|
|
2375
|
+
type ResolveModalFields<F extends ReadonlyArray<ModalFieldDef<boolean>>> = {
|
|
2434
2376
|
[K in F[number] as K['id']]: K['required'] extends false ? string | undefined : string;
|
|
2435
2377
|
};
|
|
2436
|
-
interface ModalDef<F extends ReadonlyArray<ModalFieldDef<
|
|
2378
|
+
interface ModalDef<F extends ReadonlyArray<ModalFieldDef<boolean>>> {
|
|
2437
2379
|
customId: string;
|
|
2438
2380
|
title: string;
|
|
2439
2381
|
fields: F;
|
|
2440
2382
|
execute: (ctx: ComponentContext<never, ResolveModalFields<F>>) => void | Promise<void>;
|
|
2441
2383
|
}
|
|
2442
|
-
declare function defineModal<F extends ReadonlyArray<ModalFieldDef<
|
|
2384
|
+
declare function defineModal<F extends ReadonlyArray<ModalFieldDef<boolean>>>(def: ModalDef<F>): ModalDef<F> & {
|
|
2443
2385
|
type: 'modal';
|
|
2444
2386
|
};
|
|
2445
2387
|
|
|
2388
|
+
type ComponentInput = (ButtonDef & {
|
|
2389
|
+
type: 'button';
|
|
2390
|
+
}) | (StringSelectDef & {
|
|
2391
|
+
type: 'string_select';
|
|
2392
|
+
}) | (UserSelectDef & {
|
|
2393
|
+
type: 'user_select';
|
|
2394
|
+
}) | (RoleSelectDef & {
|
|
2395
|
+
type: 'role_select';
|
|
2396
|
+
}) | (MentionableSelectDef & {
|
|
2397
|
+
type: 'mentionable_select';
|
|
2398
|
+
}) | (ChannelSelectDef & {
|
|
2399
|
+
type: 'channel_select';
|
|
2400
|
+
}) | (ModalFieldDef & {
|
|
2401
|
+
id: string;
|
|
2402
|
+
}) | Record<string, unknown>;
|
|
2446
2403
|
declare const ActionRow: {
|
|
2447
|
-
of: (...components:
|
|
2404
|
+
of: (...components: ComponentInput[]) => {
|
|
2448
2405
|
type: COMPONENT_TYPES;
|
|
2449
|
-
components:
|
|
2406
|
+
components: Record<string, unknown>[];
|
|
2450
2407
|
};
|
|
2451
2408
|
};
|
|
2452
2409
|
|
|
@@ -2454,8 +2411,8 @@ declare class ComponentManager {
|
|
|
2454
2411
|
private client;
|
|
2455
2412
|
private handlers;
|
|
2456
2413
|
constructor(client: Client);
|
|
2457
|
-
register(...components:
|
|
2458
|
-
handleInteraction(raw: Record<string,
|
|
2414
|
+
register(...components: ComponentHandler[]): void;
|
|
2415
|
+
handleInteraction(raw: Record<string, unknown>): Promise<void>;
|
|
2459
2416
|
}
|
|
2460
2417
|
|
|
2461
2418
|
declare abstract class BaseManager<T extends {
|
|
@@ -2511,7 +2468,7 @@ declare class ButtonBuilder {
|
|
|
2511
2468
|
setDisabled(disabled?: boolean): this;
|
|
2512
2469
|
setURL(url: string): this;
|
|
2513
2470
|
build(): MessageComponent;
|
|
2514
|
-
toJSON():
|
|
2471
|
+
toJSON(): Record<string, unknown>;
|
|
2515
2472
|
}
|
|
2516
2473
|
declare class SelectMenuBuilder {
|
|
2517
2474
|
private data;
|
|
@@ -2524,7 +2481,7 @@ declare class SelectMenuBuilder {
|
|
|
2524
2481
|
addOption(option: SelectOption): this;
|
|
2525
2482
|
addOptions(...options: SelectOption[]): this;
|
|
2526
2483
|
build(): MessageComponent;
|
|
2527
|
-
toJSON():
|
|
2484
|
+
toJSON(): Record<string, unknown>;
|
|
2528
2485
|
}
|
|
2529
2486
|
declare class TextInputBuilder {
|
|
2530
2487
|
private data;
|
|
@@ -2541,22 +2498,22 @@ declare class TextInputBuilder {
|
|
|
2541
2498
|
setRequired(required?: boolean): this;
|
|
2542
2499
|
setValue(value: string): this;
|
|
2543
2500
|
build(): MessageComponent;
|
|
2544
|
-
toJSON():
|
|
2501
|
+
toJSON(): Record<string, unknown>;
|
|
2545
2502
|
}
|
|
2546
2503
|
declare class ActionRowBuilder {
|
|
2547
2504
|
private data;
|
|
2548
2505
|
addComponent(component: MessageComponent | {
|
|
2549
2506
|
build(): MessageComponent;
|
|
2550
2507
|
} | {
|
|
2551
|
-
toJSON():
|
|
2508
|
+
toJSON(): Record<string, unknown>;
|
|
2552
2509
|
}): this;
|
|
2553
2510
|
addComponents(...components: (MessageComponent | {
|
|
2554
2511
|
build(): MessageComponent;
|
|
2555
2512
|
} | {
|
|
2556
|
-
toJSON():
|
|
2513
|
+
toJSON(): Record<string, unknown>;
|
|
2557
2514
|
})[]): this;
|
|
2558
2515
|
build(): MessageComponent;
|
|
2559
|
-
toJSON():
|
|
2516
|
+
toJSON(): Record<string, unknown>;
|
|
2560
2517
|
}
|
|
2561
2518
|
declare class ModalBuilder {
|
|
2562
2519
|
private _title;
|
|
@@ -2567,24 +2524,48 @@ declare class ModalBuilder {
|
|
|
2567
2524
|
addComponent(component: MessageComponent | {
|
|
2568
2525
|
build(): MessageComponent;
|
|
2569
2526
|
} | {
|
|
2570
|
-
toJSON():
|
|
2527
|
+
toJSON(): Record<string, unknown>;
|
|
2571
2528
|
}): this;
|
|
2572
2529
|
addComponents(...components: (MessageComponent | {
|
|
2573
2530
|
build(): MessageComponent;
|
|
2574
2531
|
} | {
|
|
2575
|
-
toJSON():
|
|
2532
|
+
toJSON(): Record<string, unknown>;
|
|
2576
2533
|
})[]): this;
|
|
2577
2534
|
build(): {
|
|
2578
2535
|
title: string;
|
|
2579
2536
|
custom_id: string;
|
|
2580
|
-
components:
|
|
2537
|
+
components: (MessageComponent | {
|
|
2538
|
+
build(): MessageComponent;
|
|
2539
|
+
} | {
|
|
2540
|
+
toJSON(): Record<string, unknown>;
|
|
2541
|
+
})[];
|
|
2581
2542
|
};
|
|
2582
2543
|
toJSON(): {
|
|
2583
2544
|
title: string;
|
|
2584
2545
|
custom_id: string;
|
|
2585
|
-
components:
|
|
2546
|
+
components: (MessageComponent | Record<string, unknown> | {
|
|
2547
|
+
build(): MessageComponent;
|
|
2548
|
+
} | {
|
|
2549
|
+
toJSON(): Record<string, unknown>;
|
|
2550
|
+
})[];
|
|
2586
2551
|
};
|
|
2587
2552
|
}
|
|
2553
|
+
declare function serializeComponent(component: MessageComponent | {
|
|
2554
|
+
build?(): MessageComponent;
|
|
2555
|
+
} | {
|
|
2556
|
+
toJSON?(): Record<string, unknown>;
|
|
2557
|
+
} | Record<string, unknown>): Record<string, unknown>;
|
|
2558
|
+
|
|
2559
|
+
declare function buildStageInstance(raw: Record<string, unknown>): StageInstance;
|
|
2560
|
+
declare function buildScheduledEvent(raw: Record<string, unknown>): GuildScheduledEvent;
|
|
2561
|
+
declare function buildAutoModRule(raw: Record<string, unknown>): AutoModerationRule;
|
|
2562
|
+
declare function buildIntegration(raw: Record<string, unknown>): Integration;
|
|
2563
|
+
declare function buildEmoji(raw: Record<string, unknown>): Emoji;
|
|
2564
|
+
declare function buildSticker(raw: Record<string, unknown>): Sticker;
|
|
2565
|
+
declare function buildStickerItem(raw: Record<string, unknown>): StickerItem;
|
|
2566
|
+
declare function buildVoiceState(raw: Record<string, unknown>, cache?: TongueStore): Voice;
|
|
2567
|
+
declare function buildEntitlement(raw: Record<string, unknown>): Entitlement;
|
|
2568
|
+
declare function buildInteraction(raw: Record<string, unknown>, cache?: TongueStore): Interaction;
|
|
2588
2569
|
|
|
2589
2570
|
declare function buildUser(raw: Record<string, unknown>): User;
|
|
2590
2571
|
declare function buildChannel(raw: Record<string, unknown>, guildId?: string): Channel;
|
|
@@ -2592,29 +2573,57 @@ declare function buildGuild(raw: Record<string, unknown>): Guild;
|
|
|
2592
2573
|
declare function buildRole(raw: Record<string, unknown>): Role;
|
|
2593
2574
|
declare function buildMember(raw: Record<string, unknown>, guildId: string, cache: TongueStore): Member;
|
|
2594
2575
|
declare function buildMessage(raw: Record<string, unknown>, cache: TongueStore, oldMessage?: Message): Message;
|
|
2595
|
-
declare function resolveChannel(channelId: string,
|
|
2576
|
+
declare function resolveChannel(channelId: string, client: Client): Channel | {
|
|
2596
2577
|
id: string;
|
|
2578
|
+
fetch: () => Promise<ChameleonAPIResult<Channel>>;
|
|
2597
2579
|
};
|
|
2598
|
-
declare function resolveGuild(guildId: string,
|
|
2580
|
+
declare function resolveGuild(guildId: string, client: Client): Guild | {
|
|
2599
2581
|
id: string;
|
|
2582
|
+
fetch: () => Promise<ChameleonAPIResult<Guild>>;
|
|
2600
2583
|
};
|
|
2601
|
-
declare function resolveUser(userId: string,
|
|
2584
|
+
declare function resolveUser(userId: string, client: Client): User | {
|
|
2602
2585
|
id: string;
|
|
2586
|
+
fetch: () => Promise<ChameleonAPIResult<User>>;
|
|
2603
2587
|
};
|
|
2604
|
-
declare function resolveRole(roleId: string,
|
|
2588
|
+
declare function resolveRole(roleId: string, client: Client, guildId?: string): Role | {
|
|
2605
2589
|
id: string;
|
|
2590
|
+
fetch?: () => Promise<ChameleonAPIResult<Role>>;
|
|
2606
2591
|
};
|
|
2607
2592
|
|
|
2608
2593
|
declare class UserManager extends BaseManager<User> {
|
|
2609
2594
|
protected storeKey: "users";
|
|
2610
2595
|
protected endpoint(id: string): string;
|
|
2611
2596
|
protected build: typeof buildUser;
|
|
2597
|
+
createDM(userId: string): Promise<ChameleonAPIResult<Channel>>;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
declare class RoleManager {
|
|
2601
|
+
protected rest: ChameleonREST;
|
|
2602
|
+
protected store: TongueStore;
|
|
2603
|
+
protected guildId: string;
|
|
2604
|
+
constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
|
|
2605
|
+
fetch(roleId: string, force?: boolean): Promise<ChameleonAPIResult<Role>>;
|
|
2606
|
+
list(): Promise<ChameleonAPIResult<Role[]>>;
|
|
2607
|
+
create(payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
|
|
2608
|
+
edit(roleId: string, payload: Partial<Role>, reason?: string): Promise<ChameleonAPIResult<Role>>;
|
|
2609
|
+
delete(roleId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
declare class MemberManager {
|
|
2613
|
+
protected rest: ChameleonREST;
|
|
2614
|
+
protected store: TongueStore;
|
|
2615
|
+
private guildId;
|
|
2616
|
+
constructor(rest: ChameleonREST, store: TongueStore, guildId: string);
|
|
2617
|
+
fetch(userId: string, force?: boolean): Promise<ChameleonAPIResult<Member>>;
|
|
2618
|
+
edit(userId: string, payload: Partial<Member>, reason?: string): Promise<ChameleonAPIResult<Member>>;
|
|
2612
2619
|
}
|
|
2613
2620
|
|
|
2614
2621
|
declare class GuildManager extends BaseManager<Guild> {
|
|
2615
2622
|
protected storeKey: "guilds";
|
|
2616
2623
|
protected endpoint(id: string): string;
|
|
2617
2624
|
protected build: typeof buildGuild;
|
|
2625
|
+
roles(guildId: string): RoleManager;
|
|
2626
|
+
members(guildId: string): MemberManager;
|
|
2618
2627
|
fetchChannels(guildId: string): Promise<ChameleonAPIResult<Channel[]>>;
|
|
2619
2628
|
ban(guildId: string, userId: string, options?: {
|
|
2620
2629
|
deleteMessageSeconds?: number;
|
|
@@ -2622,30 +2631,50 @@ declare class GuildManager extends BaseManager<Guild> {
|
|
|
2622
2631
|
}): Promise<ChameleonAPIResult<void>>;
|
|
2623
2632
|
unban(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2624
2633
|
kick(guildId: string, userId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2634
|
+
edit(guildId: string, payload: Partial<Guild>, reason?: string): Promise<ChameleonAPIResult<Guild>>;
|
|
2635
|
+
delete(guildId: string): Promise<ChameleonAPIResult<void>>;
|
|
2625
2636
|
}
|
|
2626
2637
|
|
|
2627
2638
|
declare class ChannelManager extends BaseManager<Channel> {
|
|
2628
2639
|
protected storeKey: "channels";
|
|
2629
2640
|
protected endpoint(id: string): string;
|
|
2630
2641
|
protected build: typeof buildChannel;
|
|
2642
|
+
create(guildId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
|
|
2643
|
+
edit(channelId: string, payload: Partial<Channel>, reason?: string): Promise<ChameleonAPIResult<Channel>>;
|
|
2644
|
+
delete(channelId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2645
|
+
updatePermissions(channelId: string, overwriteId: string, payload: Partial<Overwrite>, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2646
|
+
deletePermission(channelId: string, overwriteId: string, reason?: string): Promise<ChameleonAPIResult<void>>;
|
|
2631
2647
|
}
|
|
2632
2648
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2649
|
+
type MessageCreateOptions = string | {
|
|
2650
|
+
content?: string;
|
|
2651
|
+
embeds?: (Embed | {
|
|
2652
|
+
toJSON(): Record<string, unknown>;
|
|
2653
|
+
} | Record<string, unknown>)[];
|
|
2654
|
+
components?: (MessageComponent | {
|
|
2655
|
+
build?(): MessageComponent;
|
|
2656
|
+
} | {
|
|
2657
|
+
toJSON(): Record<string, unknown>;
|
|
2658
|
+
} | Record<string, unknown>)[];
|
|
2659
|
+
reply?: {
|
|
2660
|
+
messageId: string;
|
|
2661
|
+
failIfNotExists?: boolean;
|
|
2662
|
+
};
|
|
2663
|
+
};
|
|
2641
2664
|
declare class MessageManager {
|
|
2642
2665
|
protected rest: ChameleonREST;
|
|
2643
2666
|
protected store: TongueStore;
|
|
2644
2667
|
constructor(rest: ChameleonREST, store: TongueStore);
|
|
2645
2668
|
fetch(channelId: string, messageId: string, force?: boolean): Promise<ChameleonAPIResult<Message>>;
|
|
2646
|
-
send(channelId: string, payload:
|
|
2647
|
-
edit(channelId: string, messageId: string, payload:
|
|
2669
|
+
send(channelId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
|
|
2670
|
+
edit(channelId: string, messageId: string, payload: MessageCreateOptions): Promise<ChameleonAPIResult<Message>>;
|
|
2648
2671
|
delete(channelId: string, messageId: string): Promise<ChameleonAPIResult<void>>;
|
|
2672
|
+
list(channelId: string, options?: {
|
|
2673
|
+
limit?: number;
|
|
2674
|
+
before?: string;
|
|
2675
|
+
after?: string;
|
|
2676
|
+
around?: string;
|
|
2677
|
+
}): Promise<ChameleonAPIResult<Message[]>>;
|
|
2649
2678
|
}
|
|
2650
2679
|
|
|
2651
2680
|
interface AwaitMessagesOptions {
|
|
@@ -2654,7 +2683,7 @@ interface AwaitMessagesOptions {
|
|
|
2654
2683
|
time?: number;
|
|
2655
2684
|
}
|
|
2656
2685
|
interface AwaitComponentOptions {
|
|
2657
|
-
filter?: (ctx: ComponentContext
|
|
2686
|
+
filter?: (ctx: ComponentContext) => boolean;
|
|
2658
2687
|
time?: number;
|
|
2659
2688
|
}
|
|
2660
2689
|
declare class CollectorManager {
|
|
@@ -2669,7 +2698,7 @@ declare class CollectorManager {
|
|
|
2669
2698
|
* waits for a single component interaction on a specific message,
|
|
2670
2699
|
* resolves with the ComponentContext if successful, or null if it timed out
|
|
2671
2700
|
*/
|
|
2672
|
-
awaitComponent(messageId: string, options?: AwaitComponentOptions): Promise<ComponentContext
|
|
2701
|
+
awaitComponent(messageId: string, options?: AwaitComponentOptions): Promise<ComponentContext | null>;
|
|
2673
2702
|
}
|
|
2674
2703
|
|
|
2675
2704
|
interface ClientOptions<TIntents extends readonly IntentResolvable[]> {
|
|
@@ -2802,4 +2831,4 @@ declare class Chameleon {
|
|
|
2802
2831
|
};
|
|
2803
2832
|
}
|
|
2804
2833
|
|
|
2805
|
-
export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, BaseManager, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, Client, type ClientOptions, type Collectibles, CollectorManager, Colors, CommandContext, type CommandDef, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementType, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, type InteractionReplyOptions, type Invite, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessageReference, MessageReferenceType, type MessageSnapshot, MessageType, type MiddlewareFn, ModalBuilder, type ModalDef, type ModalFieldDef, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, SelectMenuBuilder, type SelectOption, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardSound, type StageInstance, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TextInputBuilder, type ThreadMember, type ThreadMetadata, Tongue, TongueStore, type User, UserFlag, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildChannel, buildGuild, buildMember, buildMessage,
|
|
2834
|
+
export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type AnyCommandDef, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, BaseInteractionContext, BaseManager, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, Client, type ClientOptions, type Collectibles, CollectorManager, Colors, CommandContext, type CommandDef, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementType, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, type InteractionReplyOptions, type Invite, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessageReference, MessageReferenceType, type MessageSnapshot, MessageType, type MiddlewareFn, ModalBuilder, type ModalDef, type ModalFieldDef, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, RoleManager, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, SelectMenuBuilder, type SelectOption, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardSound, type StageInstance, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TextInputBuilder, type ThreadMember, type ThreadMetadata, Tongue, TongueStore, type User, UserFlag, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildAutoModRule, buildChannel, buildEmoji, buildEntitlement, buildGuild, buildIntegration, buildInteraction, buildMember, buildMessage, buildRole, buildScheduledEvent, buildStageInstance, buildSticker, buildStickerItem, buildUser, buildVoiceState, combinePermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser, serializeComponent };
|