lunibee 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builders/attachment.d.ts +1 -0
- package/dist/builders/clone.d.ts +10 -0
- package/dist/builders/commands.d.ts +1 -1
- package/dist/builders/components.d.ts +24 -5
- package/dist/builders/index.js +64 -17
- package/dist/builders/index.js.map +10 -9
- package/dist/collection/index.d.ts +1 -0
- package/dist/collection/index.js +297 -19
- package/dist/collection/index.js.map +5 -4
- package/dist/collection/redis.d.ts +98 -0
- package/dist/core/collector.d.ts +8 -0
- package/dist/core/events.d.ts +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +6242 -4733
- package/dist/core/index.js.map +47 -40
- package/dist/core/permissions.d.ts +3 -402
- package/dist/core/redis-cache.d.ts +85 -0
- package/dist/formatters/index.d.ts +5 -1
- package/dist/formatters/index.js +7 -3
- package/dist/formatters/index.js.map +3 -3
- package/dist/handlers/index.js +11 -2
- package/dist/handlers/index.js.map +3 -3
- package/dist/index.js +8688 -6136
- package/dist/index.js.map +67 -59
- package/dist/managers/application.d.ts +10 -6
- package/dist/managers/base.d.ts +11 -1
- package/dist/managers/guild.d.ts +3 -1
- package/dist/managers/index.d.ts +6 -1
- package/dist/managers/index.js +383 -109
- package/dist/managers/index.js.map +20 -23
- package/dist/managers/member.d.ts +3 -1
- package/dist/managers/message.d.ts +13 -4
- package/dist/managers/thread.d.ts +3 -3
- package/dist/rest/decoder.d.ts +2 -0
- package/dist/rest/errors.d.ts +5 -2
- package/dist/rest/headers.d.ts +31 -0
- package/dist/rest/identity.d.ts +31 -0
- package/dist/rest/index.d.ts +97 -6
- package/dist/rest/index.js +1355 -220
- package/dist/rest/index.js.map +16 -13
- package/dist/rest/limiter.d.ts +75 -10
- package/dist/rest/redis.d.ts +103 -22
- package/dist/rest/scheduler.d.ts +13 -0
- package/dist/rest/store.d.ts +135 -12
- package/dist/rest/telemetry.d.ts +151 -0
- package/dist/rest/webhook.d.ts +18 -6
- package/dist/sharding/bus.d.ts +4 -2
- package/dist/sharding/cluster.d.ts +29 -1
- package/dist/sharding/health.d.ts +1 -1
- package/dist/sharding/host.d.ts +13 -2
- package/dist/sharding/identify.d.ts +2 -0
- package/dist/sharding/index.d.ts +8 -0
- package/dist/sharding/index.js +579 -65
- package/dist/sharding/index.js.map +17 -15
- package/dist/sharding/leader.d.ts +34 -0
- package/dist/sharding/remote.d.ts +36 -2
- package/dist/sharding/supervisor.d.ts +1 -1
- package/dist/sharding/thread.d.ts +30 -0
- package/dist/sharding/transport.d.ts +6 -5
- package/dist/sharding/worker.d.ts +11 -1
- package/dist/structures/base.d.ts +16 -5
- package/dist/structures/index.d.ts +1 -1
- package/dist/structures/index.js +57 -91
- package/dist/structures/index.js.map +10 -18
- package/dist/structures/options.d.ts +3 -2
- package/dist/structures/permissions.d.ts +409 -0
- package/dist/structures/resources.d.ts +4 -1
- package/dist/types/gateway.d.ts +4 -0
- package/dist/types/index.d.ts +14 -4
- package/dist/types/index.js.map +3 -3
- package/dist/utils/args.d.ts +3 -1
- package/dist/utils/index.d.ts +6 -1
- package/dist/utils/index.js +17 -10
- package/dist/utils/index.js.map +4 -4
- package/dist/voice/index.d.ts +7 -1
- package/dist/voice/index.js +33 -10
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/index.d.ts +2 -0
- package/dist/ws/index.js +32 -4
- package/dist/ws/index.js.map +5 -5
- package/package.json +21 -17
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { REST } from "@lunibee/rest";
|
|
2
2
|
import type { APIApplicationCommand, ApplicationCommandData } from "@lunibee/types";
|
|
3
|
+
/** Command data, or a builder such as `CreateSlashCommand` (its `toJSON()` is sent). */
|
|
4
|
+
export type ApplicationCommandInput = ApplicationCommandData | {
|
|
5
|
+
toJSON(): Record<string, unknown>;
|
|
6
|
+
};
|
|
3
7
|
/** Manages global and guild-scoped application commands for a Discord application. */
|
|
4
8
|
export declare class ApplicationCommandManager {
|
|
5
9
|
#private;
|
|
@@ -8,21 +12,21 @@ export declare class ApplicationCommandManager {
|
|
|
8
12
|
/** Fetches all global application commands. @returns Array of registered commands. */
|
|
9
13
|
fetch(): Promise<APIApplicationCommand[]>;
|
|
10
14
|
/** Creates a single global application command. @param data Command data. @returns Created command. */
|
|
11
|
-
create(data:
|
|
15
|
+
create(data: ApplicationCommandInput): Promise<APIApplicationCommand>;
|
|
12
16
|
/** Overwrites all global application commands atomically. @param commands Array of command data. @returns New full command list. */
|
|
13
|
-
set(commands:
|
|
17
|
+
set(commands: readonly ApplicationCommandInput[]): Promise<APIApplicationCommand[]>;
|
|
14
18
|
/** Edits a global application command. @param commandId Command identifier. @param data Partial command data. @returns Updated command. */
|
|
15
|
-
edit(commandId: string, data: Partial<ApplicationCommandData>): Promise<APIApplicationCommand>;
|
|
19
|
+
edit(commandId: string, data: Partial<ApplicationCommandData> | ApplicationCommandInput): Promise<APIApplicationCommand>;
|
|
16
20
|
/** Deletes a global application command. @param commandId Command identifier. @returns Nothing. */
|
|
17
21
|
delete(commandId: string): Promise<void>;
|
|
18
22
|
/** Fetches all guild-scoped application commands. @param guildId Guild identifier. @returns Array of registered guild commands. */
|
|
19
23
|
fetchGuild(guildId: string): Promise<APIApplicationCommand[]>;
|
|
20
24
|
/** Creates a single guild-scoped application command. @param guildId Guild identifier. @param data Command data. @returns Created command. */
|
|
21
|
-
createGuild(guildId: string, data:
|
|
25
|
+
createGuild(guildId: string, data: ApplicationCommandInput): Promise<APIApplicationCommand>;
|
|
22
26
|
/** Overwrites all guild-scoped application commands atomically. @param guildId Guild identifier. @param commands Array of command data. @returns New full command list. */
|
|
23
|
-
setGuild(guildId: string, commands:
|
|
27
|
+
setGuild(guildId: string, commands: readonly ApplicationCommandInput[]): Promise<APIApplicationCommand[]>;
|
|
24
28
|
/** Edits a guild-scoped application command. @param guildId Guild identifier. @param commandId Command identifier. @param data Partial command data. @returns Updated command. */
|
|
25
|
-
editGuild(guildId: string, commandId: string, data: Partial<ApplicationCommandData>): Promise<APIApplicationCommand>;
|
|
29
|
+
editGuild(guildId: string, commandId: string, data: Partial<ApplicationCommandData> | ApplicationCommandInput): Promise<APIApplicationCommand>;
|
|
26
30
|
/** Deletes a guild-scoped application command. @param guildId Guild identifier. @param commandId Command identifier. @returns Nothing. */
|
|
27
31
|
deleteGuild(guildId: string, commandId: string): Promise<void>;
|
|
28
32
|
}
|
package/dist/managers/base.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Collection } from "@lunibee/collection";
|
|
2
|
+
/**
|
|
3
|
+
* Copies a structure's own fields onto the cached instance. A key loop: on Bun,
|
|
4
|
+
* Object.assign into an existing object is about twice as slow, on every event.
|
|
5
|
+
* Structures hold no symbol-keyed fields.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function assignFields<T extends object>(into: T, from: T): T;
|
|
2
9
|
/** Splits the audit-log `reason` off an options object, so it becomes a header, not a body field. */
|
|
3
10
|
export declare function splitReason<T extends {
|
|
4
11
|
reason?: string;
|
|
@@ -8,6 +15,8 @@ export declare class Manager<K, V> {
|
|
|
8
15
|
#private;
|
|
9
16
|
/** Authoritative resource state. Entries never expire: see {@link Manager.set}. */
|
|
10
17
|
readonly cache: Collection<K, V>;
|
|
18
|
+
/** @param maxSize Most entries kept; the least recently used go first. Default: unbounded. */
|
|
19
|
+
constructor(maxSize?: number);
|
|
11
20
|
/** Gets a cached value. @param id Cache key. @returns Cached value. */
|
|
12
21
|
get(id: K): V | undefined;
|
|
13
22
|
/** Checks whether a value is cached. @param id Cache key. @returns True when cached. */
|
|
@@ -41,8 +50,9 @@ export declare class Manager<K, V> {
|
|
|
41
50
|
/** Generic REST-backed resource manager. @typeParam K Resource key type. @typeParam V Resource type. */
|
|
42
51
|
export declare class ResourceManager<K, V> extends Manager<K, V> {
|
|
43
52
|
#private;
|
|
44
|
-
constructor(fetcher: (id: K) => Promise<V>, key: (value: V) => K);
|
|
53
|
+
constructor(fetcher: (id: K) => Promise<V>, key: (value: V) => K, maxSize?: number);
|
|
45
54
|
resolve(id: K): Promise<V>;
|
|
55
|
+
/** Fetches from Discord; a cached instance is updated in place, so references to it stay current. */
|
|
46
56
|
fetch(id: K): Promise<V>;
|
|
47
57
|
fetchMany(ids: Iterable<K>): Promise<V[]>;
|
|
48
58
|
/** Stores a resource, merging into the cached instance when there is one so existing references stay current. @returns The canonical instance. */
|
package/dist/managers/guild.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export declare class GuildManager extends ResourceManager<string, Guild> {
|
|
|
19
19
|
#private;
|
|
20
20
|
/** Lets members from this manager act through a client (`member.kick()`...). Called by the client. */
|
|
21
21
|
attachContext(context: ResourceContext): void;
|
|
22
|
-
constructor(rest: REST
|
|
22
|
+
constructor(rest: REST, options?: {
|
|
23
|
+
maxMembers?: number;
|
|
24
|
+
});
|
|
23
25
|
/** Ban manager for a guild (one instance per guild). */
|
|
24
26
|
bans(guildId: string): GuildBanManager;
|
|
25
27
|
/** Scheduled-event manager for a guild (one instance per guild). */
|
package/dist/managers/index.d.ts
CHANGED
|
@@ -12,20 +12,24 @@ export { GuildManager } from "./guild.js";
|
|
|
12
12
|
export type { AuditLogEntry, AuditLogResponse } from "./guild.js";
|
|
13
13
|
export { AuditLogEvent } from "./guild.js";
|
|
14
14
|
export type { MessageCreateOptions, MessageEditOptions } from "./message.js";
|
|
15
|
+
/** Options for fetching one message; `cache: false` skips storing it. */
|
|
15
16
|
export interface MessageFetchOptions {
|
|
16
17
|
cache?: boolean;
|
|
17
18
|
}
|
|
19
|
+
/** Pagination for fetching a channel's messages: `before`, `after` or `around` an ID, and a `limit`. */
|
|
18
20
|
export interface MessageQueryOptions {
|
|
19
21
|
before?: string;
|
|
20
22
|
after?: string;
|
|
21
23
|
around?: string;
|
|
22
24
|
limit?: number;
|
|
23
25
|
}
|
|
26
|
+
/** Options for starting a thread from a message. */
|
|
24
27
|
export interface MessageThreadOptions {
|
|
25
28
|
name: string;
|
|
26
29
|
autoArchiveDuration?: 60 | 1440 | 4320 | 10080;
|
|
27
30
|
rateLimitPerUser?: number;
|
|
28
31
|
}
|
|
32
|
+
/** Pagination for listing the users who reacted with an emoji. */
|
|
29
33
|
export interface ReactionFetchOptions {
|
|
30
34
|
limit?: number;
|
|
31
35
|
after?: string;
|
|
@@ -159,12 +163,13 @@ export declare class ChannelManager extends Manager<string, Channel> {
|
|
|
159
163
|
}>;
|
|
160
164
|
clear(): void;
|
|
161
165
|
}
|
|
166
|
+
/** Discord.js-familiar name for `MessageCreateOptions`. */
|
|
162
167
|
export type CreateMessageOptions = MessageCreateOptions;
|
|
163
168
|
export { MessageManager, toRequest, type MessageCacheOptions, type MessageFile, } from "./message.js";
|
|
164
169
|
export { ThreadManager } from "./thread.js";
|
|
165
170
|
export { RoleManager, type RoleCreateOptions, type RoleEditOptions, } from "./role.js";
|
|
166
171
|
export { GuildMemberManager, type MemberEditOptions, type BanOptions, } from "./member.js";
|
|
167
|
-
export { ApplicationCommandManager } from "./application.js";
|
|
172
|
+
export { ApplicationCommandManager, type ApplicationCommandInput, } from "./application.js";
|
|
168
173
|
export { GuildBanManager, GuildScheduledEventManager, StageInstanceManager, PermissionOverwriteManager, type APIBan, type GuildBanCreateOptions, type GuildScheduledEventOptions, type StageInstanceCreateOptions, type PermissionOverwriteOptions, type PermissionOverwriteTargetType, type PermissionOverwriteUpdate, } from "./guild-resources.js";
|
|
169
174
|
export { EmojiManager, type EmojiCreateOptions, type EmojiEditOptions, } from "./emoji.js";
|
|
170
175
|
export { GuildStickerManager, GuildSoundboardManager, MonetizationManager, ApplicationEmojiManager, type APIEntitlement, type APISKU, type APISoundboardSound, type APISubscription, type EntitlementQuery, type GuildStickerCreateOptions, type SoundboardSoundCreateOptions, } from "./advanced.js";
|