lunibee 0.2.1 → 0.2.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/README.md +6 -6
- package/dist/builders/attachment.d.ts +5 -1
- package/dist/builders/commands.d.ts +136 -47
- package/dist/builders/components.d.ts +164 -45
- package/dist/builders/embed.d.ts +5 -1
- package/dist/builders/index.d.ts +9 -4
- package/dist/builders/index.js +206 -105
- package/dist/builders/index.js.map +8 -8
- package/dist/core/events.d.ts +28 -12
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +377 -150
- package/dist/core/index.js.map +25 -25
- package/dist/core/permissions.d.ts +6 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +662 -268
- package/dist/index.js.map +33 -32
- package/dist/managers/base.d.ts +4 -0
- package/dist/managers/emoji.d.ts +7 -1
- package/dist/managers/guild-resources.d.ts +11 -3
- package/dist/managers/guild.d.ts +13 -5
- package/dist/managers/index.d.ts +31 -14
- package/dist/managers/index.js +167 -80
- package/dist/managers/index.js.map +18 -18
- package/dist/managers/member.d.ts +5 -3
- package/dist/managers/message.d.ts +7 -3
- package/dist/managers/role.d.ts +13 -1
- package/dist/rest/error-codes.d.ts +48 -0
- package/dist/rest/errors.d.ts +1 -0
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.js +53 -3
- package/dist/rest/index.js.map +7 -6
- package/dist/rest/routes.d.ts +4 -2
- package/dist/sharding/index.js +7 -6
- package/dist/sharding/index.js.map +6 -6
- package/dist/structures/base.d.ts +18 -9
- package/dist/structures/index.d.ts +15 -9
- package/dist/structures/index.js +198 -68
- package/dist/structures/index.js.map +12 -12
- package/dist/structures/interactions.d.ts +85 -11
- package/dist/structures/resources.d.ts +11 -1
- package/dist/types/gateway.d.ts +14 -0
- package/dist/types/index.d.ts +204 -16
- package/dist/types/index.js +37 -10
- package/dist/types/index.js.map +4 -4
- package/dist/voice/index.js +4 -3
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/index.js +2 -1
- package/dist/ws/index.js.map +5 -5
- package/package.json +15 -15
package/dist/managers/base.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Collection } from "@lunibee/collection";
|
|
2
|
+
/** Splits the audit-log `reason` off an options object, so it becomes a header, not a body field. */
|
|
3
|
+
export declare function splitReason<T extends {
|
|
4
|
+
reason?: string;
|
|
5
|
+
}>(options: T): [Omit<T, "reason">, string | undefined];
|
|
2
6
|
/** Generic cache manager. @typeParam K Cache key type. @typeParam V Cached value type. */
|
|
3
7
|
export declare class Manager<K, V> {
|
|
4
8
|
#private;
|
package/dist/managers/emoji.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { Emoji } from "@lunibee/structures";
|
|
|
3
3
|
import { type REST } from "@lunibee/rest";
|
|
4
4
|
/** Strict payload for creating a custom guild emoji. */
|
|
5
5
|
export interface EmojiCreateOptions {
|
|
6
|
+
/** Audit-log reason. */
|
|
7
|
+
reason?: string;
|
|
6
8
|
/** Emoji name (1-32 chars, alphanumeric + underscores). */
|
|
7
9
|
name: string;
|
|
8
10
|
/** Base64-encoded 128x128 image data URI. */
|
|
@@ -12,6 +14,8 @@ export interface EmojiCreateOptions {
|
|
|
12
14
|
}
|
|
13
15
|
/** Strict payload for editing a custom guild emoji. */
|
|
14
16
|
export interface EmojiEditOptions {
|
|
17
|
+
/** Audit-log reason. */
|
|
18
|
+
reason?: string;
|
|
15
19
|
/** New emoji name. */
|
|
16
20
|
name?: string;
|
|
17
21
|
/** Role IDs allowed to use the emoji. */
|
|
@@ -29,7 +33,9 @@ export declare class EmojiManager extends Manager<string, Emoji> {
|
|
|
29
33
|
create(options: EmojiCreateOptions): Promise<Emoji>;
|
|
30
34
|
/** Edits an existing custom emoji. */
|
|
31
35
|
edit(emojiId: string, options: EmojiEditOptions): Promise<Emoji>;
|
|
32
|
-
/** Deletes a custom emoji. */
|
|
36
|
+
/** Deletes a custom emoji. @param reason Audit-log reason. */
|
|
37
|
+
remove(emojiId: string, reason?: string): Promise<void>;
|
|
38
|
+
/** @deprecated Use {@link EmojiManager.remove}, which also takes an audit-log reason. Removed in 0.3.0. */
|
|
33
39
|
deleteEmoji(emojiId: string): Promise<void>;
|
|
34
40
|
/** Upserts an emoji into the manager cache. Custom emojis are keyed by their
|
|
35
41
|
* snowflake ID; unicode emojis (no ID) are keyed by `unicode:${name}` so repeated
|
|
@@ -32,7 +32,10 @@ export declare class GuildBanManager extends Manager<string, APIBan> {
|
|
|
32
32
|
remove(userId: string, reason?: string): Promise<void>;
|
|
33
33
|
}
|
|
34
34
|
/** Fields accepted when creating or editing a scheduled event. */
|
|
35
|
-
export type GuildScheduledEventOptions = Partial<Omit<APIGuildScheduledEvent, "id" | "guild_id" | "creator" | "user_count">> & Record<string, unknown
|
|
35
|
+
export type GuildScheduledEventOptions = Partial<Omit<APIGuildScheduledEvent, "id" | "guild_id" | "creator" | "user_count">> & Record<string, unknown> & {
|
|
36
|
+
/** Audit-log reason. */
|
|
37
|
+
reason?: string;
|
|
38
|
+
};
|
|
36
39
|
/** Manages a guild's scheduled events, cached by event ID. Discord.js-familiar. */
|
|
37
40
|
export declare class GuildScheduledEventManager extends Manager<string, APIGuildScheduledEvent> {
|
|
38
41
|
#private;
|
|
@@ -50,8 +53,8 @@ export declare class GuildScheduledEventManager extends Manager<string, APIGuild
|
|
|
50
53
|
create(options: GuildScheduledEventOptions, reason?: string): Promise<APIGuildScheduledEvent>;
|
|
51
54
|
/** Edits an event. */
|
|
52
55
|
edit(eventId: string, options: GuildScheduledEventOptions, reason?: string): Promise<APIGuildScheduledEvent>;
|
|
53
|
-
/** Deletes an event. */
|
|
54
|
-
remove(eventId: string): Promise<void>;
|
|
56
|
+
/** Deletes an event. @param reason Audit-log reason. */
|
|
57
|
+
remove(eventId: string, reason?: string): Promise<void>;
|
|
55
58
|
/** Fetches users subscribed to an event (`limit` 1-100). */
|
|
56
59
|
fetchSubscribers(eventId: string, options?: {
|
|
57
60
|
limit?: number;
|
|
@@ -65,6 +68,8 @@ export declare class GuildScheduledEventManager extends Manager<string, APIGuild
|
|
|
65
68
|
}
|
|
66
69
|
/** Options for creating a stage instance. */
|
|
67
70
|
export interface StageInstanceCreateOptions {
|
|
71
|
+
/** Audit-log reason. */
|
|
72
|
+
reason?: string;
|
|
68
73
|
topic: string;
|
|
69
74
|
privacyLevel?: number;
|
|
70
75
|
sendStartNotification?: boolean;
|
|
@@ -82,6 +87,7 @@ export declare class StageInstanceManager extends Manager<string, APIStageInstan
|
|
|
82
87
|
edit(channelId: string, options: {
|
|
83
88
|
topic?: string;
|
|
84
89
|
privacyLevel?: number;
|
|
90
|
+
reason?: string;
|
|
85
91
|
}, reason?: string): Promise<APIStageInstance>;
|
|
86
92
|
/** Ends a stage instance. */
|
|
87
93
|
remove(channelId: string, reason?: string): Promise<void>;
|
|
@@ -90,6 +96,8 @@ export declare class StageInstanceManager extends Manager<string, APIStageInstan
|
|
|
90
96
|
export type PermissionOverwriteTargetType = 0 | 1;
|
|
91
97
|
/** Permission values accepted by {@link PermissionOverwriteManager.edit}. */
|
|
92
98
|
export interface PermissionOverwriteOptions {
|
|
99
|
+
/** Audit-log reason. */
|
|
100
|
+
reason?: string;
|
|
93
101
|
/** Target type: 0 = role, 1 = member. */
|
|
94
102
|
type: PermissionOverwriteTargetType;
|
|
95
103
|
/** Allowed permission bits. */
|
package/dist/managers/guild.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface GuildCreateOptions extends Record<string, unknown> {
|
|
|
12
12
|
name: string;
|
|
13
13
|
}
|
|
14
14
|
export interface GuildEditOptions extends Record<string, unknown> {
|
|
15
|
+
/** Audit-log reason. */
|
|
16
|
+
reason?: string;
|
|
15
17
|
}
|
|
16
18
|
export declare class GuildManager extends ResourceManager<string, Guild> {
|
|
17
19
|
#private;
|
|
@@ -46,7 +48,9 @@ export declare class GuildManager extends ResourceManager<string, Guild> {
|
|
|
46
48
|
create(options: GuildCreateOptions): Promise<Guild>;
|
|
47
49
|
/** Modifies a guild's settings. */
|
|
48
50
|
edit(id: string, options: GuildEditOptions): Promise<Guild>;
|
|
49
|
-
/** Deletes a guild permanently.
|
|
51
|
+
/** Deletes a guild permanently. The bot must own it. */
|
|
52
|
+
remove(id: string): Promise<void>;
|
|
53
|
+
/** @deprecated Use {@link GuildManager.remove}. Removed in 0.3.0. */
|
|
50
54
|
deleteGuild(id: string): Promise<void>;
|
|
51
55
|
/** Fetches a guild's preview (even if the bot is not in the guild). */
|
|
52
56
|
fetchPreview(id: string): Promise<APIGuildPreview>;
|
|
@@ -87,11 +91,15 @@ export declare class GuildManager extends ResourceManager<string, Guild> {
|
|
|
87
91
|
/** Fetches a single auto moderation rule. */
|
|
88
92
|
fetchAutoModerationRule(guildId: string, ruleId: string): Promise<AutoModerationRule>;
|
|
89
93
|
/** Creates a new auto moderation rule. */
|
|
90
|
-
createAutoModerationRule(guildId: string, options: Record<string, unknown>
|
|
94
|
+
createAutoModerationRule(guildId: string, options: Record<string, unknown> & {
|
|
95
|
+
reason?: string;
|
|
96
|
+
}): Promise<AutoModerationRule>;
|
|
91
97
|
/** Modifies an existing auto moderation rule. */
|
|
92
|
-
editAutoModerationRule(guildId: string, ruleId: string, options: Record<string, unknown>
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
editAutoModerationRule(guildId: string, ruleId: string, options: Record<string, unknown> & {
|
|
99
|
+
reason?: string;
|
|
100
|
+
}): Promise<AutoModerationRule>;
|
|
101
|
+
/** Deletes an auto moderation rule. @param reason Audit-log reason. */
|
|
102
|
+
deleteAutoModerationRule(guildId: string, ruleId: string, reason?: string): Promise<void>;
|
|
95
103
|
}
|
|
96
104
|
/** A single audit log entry as returned by the Discord API. */
|
|
97
105
|
export interface AuditLogEntry {
|
package/dist/managers/index.d.ts
CHANGED
|
@@ -33,18 +33,27 @@ export interface ReactionFetchOptions {
|
|
|
33
33
|
after?: string;
|
|
34
34
|
}
|
|
35
35
|
export interface ChannelCreateOptions extends Record<string, unknown> {
|
|
36
|
+
/** Audit-log reason. */
|
|
37
|
+
reason?: string;
|
|
36
38
|
name: string;
|
|
37
39
|
type: number;
|
|
38
40
|
guild_id?: string;
|
|
39
41
|
parent_id?: string | null;
|
|
40
42
|
}
|
|
41
|
-
export type ChannelEditOptions = Record<string, unknown
|
|
43
|
+
export type ChannelEditOptions = Record<string, unknown> & {
|
|
44
|
+
/** Audit-log reason. */
|
|
45
|
+
reason?: string;
|
|
46
|
+
};
|
|
42
47
|
import { PermissionOverwriteManager } from "./guild-resources.js";
|
|
43
48
|
export declare class ChannelManager extends Manager<string, Channel> {
|
|
44
49
|
#private;
|
|
45
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @param options.messageCache Enables a bounded per-channel message cache; messages are not cached by default.
|
|
52
|
+
* @param options.allowedMentions Default `allowed_mentions` for sends and edits without their own.
|
|
53
|
+
*/
|
|
46
54
|
constructor(rest: REST, options?: {
|
|
47
55
|
messageCache?: MessageCacheOptions;
|
|
56
|
+
allowedMentions?: unknown;
|
|
48
57
|
});
|
|
49
58
|
messages(channelId: string): MessageManager;
|
|
50
59
|
/** Permission overwrite manager for a channel. */
|
|
@@ -73,27 +82,32 @@ export declare class ChannelManager extends Manager<string, Channel> {
|
|
|
73
82
|
cachedMessages(channelId: string): MessageManager | undefined;
|
|
74
83
|
create(guildId: string, options: ChannelCreateOptions): Promise<Channel>;
|
|
75
84
|
edit(channelId: string, options: ChannelEditOptions): Promise<Channel>;
|
|
85
|
+
/** Deletes a channel (or closes a DM). @param reason Audit-log reason. */
|
|
86
|
+
remove(channelId: string, reason?: string): Promise<void>;
|
|
87
|
+
/** @deprecated Use {@link ChannelManager.remove}, which also takes an audit-log reason. Removed in 0.3.0. */
|
|
76
88
|
deleteChannel(channelId: string): Promise<void>;
|
|
77
89
|
/** Evicts a channel, dropping its per-channel message manager with it.
|
|
78
90
|
* Overrides {@link Manager.delete} so cache eviction driven by a Gateway
|
|
79
91
|
* `CHANNEL_DELETE`/`THREAD_DELETE` — which calls `delete` rather than
|
|
80
|
-
* {@link
|
|
92
|
+
* {@link remove} — releases the message manager and its cached
|
|
81
93
|
* messages too, instead of retaining them for the client's lifetime. */
|
|
82
94
|
delete(channelId: string): boolean;
|
|
83
95
|
send(channelId: string, options: MessageCreateOptions): Promise<Message>;
|
|
96
|
+
/** @deprecated Use {@link ChannelManager.send}. Removed in 0.3.0. */
|
|
84
97
|
sendMessage(channelId: string, options: MessageCreateOptions): Promise<Message>;
|
|
85
98
|
fetchMessage(channelId: string, messageId: string, options?: MessageFetchOptions): Promise<Message>;
|
|
86
99
|
fetchMessages(channelId: string, query: MessageQueryOptions | Iterable<string>): Promise<Message[]>;
|
|
87
100
|
upsertMessage(data: ConstructorParameters<typeof Message>[0]): Message;
|
|
88
101
|
editMessage(channelId: string, messageId: string, options: MessageEditOptions): Promise<Message>;
|
|
89
|
-
|
|
102
|
+
/** Deletes a message. @param reason Audit-log reason (shown when deleting someone else's message). */
|
|
103
|
+
deleteMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
90
104
|
deleteCachedMessage(channelId: string, messageId: string): boolean;
|
|
91
105
|
crosspostMessage(channelId: string, messageId: string): Promise<Message>;
|
|
92
106
|
/** Bulk-deletes messages in a channel. Duplicate IDs are ignored and a
|
|
93
107
|
* single ID falls back to a normal delete.
|
|
94
108
|
* @throws {RangeError} If no IDs or more than 100 are provided, or any
|
|
95
109
|
* message is older than 14 days (Discord refuses to bulk-delete those). */
|
|
96
|
-
bulkDeleteMessages(channelId: string, messageIds: Iterable<string
|
|
110
|
+
bulkDeleteMessages(channelId: string, messageIds: Iterable<string>, reason?: string): Promise<void>;
|
|
97
111
|
/**
|
|
98
112
|
* Iterates a channel's history newest-first, 100 messages per request,
|
|
99
113
|
* starting before `before` (or the latest message) and stopping after
|
|
@@ -108,9 +122,18 @@ export declare class ChannelManager extends Manager<string, Channel> {
|
|
|
108
122
|
removeOwnReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
|
|
109
123
|
removeReaction(channelId: string, messageId: string, emoji: string, userId: string): Promise<void>;
|
|
110
124
|
removeAllReactions(channelId: string, messageId: string): Promise<void>;
|
|
125
|
+
/** Fetches the newest pinned messages (one page, up to 50, like the endpoint it replaces). */
|
|
111
126
|
fetchPinnedMessages(channelId: string): Promise<Message[]>;
|
|
112
|
-
|
|
113
|
-
|
|
127
|
+
/** Pins a message. @param reason Audit-log reason. */
|
|
128
|
+
pinMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
129
|
+
/** Unpins a message. @param reason Audit-log reason. */
|
|
130
|
+
unpinMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
|
|
131
|
+
/** Creates a webhook in a channel. @param options Name, optional avatar data URI, and audit-log `reason`. */
|
|
132
|
+
createWebhook(channelId: string, options: {
|
|
133
|
+
name: string;
|
|
134
|
+
avatar?: string | null;
|
|
135
|
+
reason?: string;
|
|
136
|
+
}): Promise<import("@lunibee/types").APIWebhook>;
|
|
114
137
|
createThreadFromMessage(channelId: string, messageId: string, options: MessageThreadOptions): Promise<Channel>;
|
|
115
138
|
/**
|
|
116
139
|
* Fetches a page of messages with cursor metadata.
|
|
@@ -124,13 +147,7 @@ export declare class ChannelManager extends Manager<string, Channel> {
|
|
|
124
147
|
after?: string;
|
|
125
148
|
hasMore: boolean;
|
|
126
149
|
}>;
|
|
127
|
-
/**
|
|
128
|
-
* Bulk-deletes 2–100 messages from a channel.
|
|
129
|
-
* Only messages younger than 14 days are accepted by Discord.
|
|
130
|
-
* @param channelId Channel to delete from.
|
|
131
|
-
* @param messageIds Array of message IDs to delete.
|
|
132
|
-
* @throws {RangeError} If fewer than 2 or more than 100 IDs are provided.
|
|
133
|
-
*/
|
|
150
|
+
/** @deprecated Use {@link ChannelManager.bulkDeleteMessages}, which also takes an audit-log reason. Removed in 0.3.0. */
|
|
134
151
|
bulkDelete(channelId: string, messageIds: string[]): Promise<void>;
|
|
135
152
|
clear(): void;
|
|
136
153
|
}
|