lunibee 0.1.4 → 0.1.6

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.
Files changed (42) hide show
  1. package/README.md +12 -23
  2. package/dist/builders/components.d.ts +108 -0
  3. package/dist/builders/index.d.ts +1 -1
  4. package/dist/builders/index.js +178 -2
  5. package/dist/builders/index.js.map +3 -3
  6. package/dist/collection/index.d.ts +6 -0
  7. package/dist/collection/index.js +33 -2
  8. package/dist/collection/index.js.map +4 -4
  9. package/dist/core/events.d.ts +67 -3
  10. package/dist/core/index.d.ts +120 -90
  11. package/dist/core/index.js +816 -1021
  12. package/dist/core/index.js.map +20 -21
  13. package/dist/formatters/index.js.map +1 -1
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.js +2215 -1392
  16. package/dist/index.js.map +29 -26
  17. package/dist/managers/guild.d.ts +30 -0
  18. package/dist/managers/index.d.ts +56 -75
  19. package/dist/managers/index.js +339 -48
  20. package/dist/managers/index.js.map +16 -12
  21. package/dist/managers/message.d.ts +7 -12
  22. package/dist/managers/user.d.ts +20 -0
  23. package/dist/rest/index.d.ts +83 -1
  24. package/dist/rest/index.js +48 -8
  25. package/dist/rest/index.js.map +4 -4
  26. package/dist/rest/routes.d.ts +4 -1
  27. package/dist/sharding/index.js +4 -1
  28. package/dist/sharding/index.js.map +4 -4
  29. package/dist/structures/base.d.ts +99 -48
  30. package/dist/structures/embed.d.ts +65 -0
  31. package/dist/structures/index.d.ts +45 -25
  32. package/dist/structures/index.js +569 -36
  33. package/dist/structures/index.js.map +10 -8
  34. package/dist/structures/interactions.d.ts +72 -17
  35. package/dist/structures/resources.d.ts +9 -5
  36. package/dist/types/index.d.ts +530 -85
  37. package/dist/types/index.js +71 -1
  38. package/dist/types/index.js.map +3 -3
  39. package/dist/voice/index.js.map +1 -1
  40. package/dist/ws/index.js +4 -1
  41. package/dist/ws/index.js.map +4 -4
  42. package/package.json +15 -15
@@ -0,0 +1,30 @@
1
+ import { ResourceManager } from "./base.js";
2
+ import { Guild } from "@lunibee/structures";
3
+ import { type REST } from "@lunibee/rest";
4
+ import { type APIChannel, type APIGuildPreview, type APIInvite, type APIWebhook } from "@lunibee/types";
5
+ export interface GuildCreateOptions extends Record<string, unknown> {
6
+ name: string;
7
+ }
8
+ export interface GuildEditOptions extends Record<string, unknown> {
9
+ }
10
+ export declare class GuildManager extends ResourceManager<string, Guild> {
11
+ #private;
12
+ constructor(rest: REST);
13
+ /** Creates a new guild. (Bot must be in fewer than 10 guilds). */
14
+ create(options: GuildCreateOptions): Promise<Guild>;
15
+ /** Modifies a guild's settings. */
16
+ edit(id: string, options: GuildEditOptions): Promise<Guild>;
17
+ /** Deletes a guild permanently. User must be the owner. */
18
+ deleteGuild(id: string): Promise<void>;
19
+ /** Fetches a guild's preview (even if the bot is not in the guild). */
20
+ fetchPreview(id: string): Promise<APIGuildPreview>;
21
+ /** Fetches all active threads in the guild. */
22
+ fetchActiveThreads(id: string): Promise<{
23
+ threads: APIChannel[];
24
+ members: unknown[];
25
+ }>;
26
+ /** Fetches all webhooks in the guild. */
27
+ fetchWebhooks(id: string): Promise<APIWebhook[]>;
28
+ /** Fetches all invites in the guild. */
29
+ fetchInvites(id: string): Promise<APIInvite[]>;
30
+ }
@@ -1,95 +1,76 @@
1
- import { Manager, ResourceManager } from "./base.js";
1
+ import { Manager } from "./base.js";
2
2
  export { Manager, ResourceManager } from "./base.js";
3
3
  import { REST } from "@lunibee/rest";
4
- import { Channel, Message, User, Guild } from "@lunibee/structures";
5
- import { MessageManager } from "./message.js";
4
+ import { Channel, Message, User } from "@lunibee/structures";
5
+ import { MessageManager, type MessageCreateOptions as ManagerMessageCreateOptions } from "./message.js";
6
6
  import { ThreadManager } from "./thread.js";
7
- /** Manages users. */
8
- export declare class UserManager extends ResourceManager<string, User> {
9
- /** Creates a user manager. @param rest REST transport. */ constructor(rest: REST);
10
- }
11
- /** Manages guilds. */
12
- export declare class GuildManager extends ResourceManager<string, Guild> {
13
- /** Creates a guild manager. @param rest REST transport. */ constructor(rest: REST);
14
- }
15
- /** Message creation options. */
16
- export interface MessageCreateOptions {
17
- /** Message content. */ content?: string;
18
- }
19
- /** Message edit options. */
20
- export interface MessageEditOptions {
21
- /** New message content. */ content?: string;
22
- }
23
- /** Message fetch options. */
7
+ export { UserManager } from "./user.js";
8
+ export { GuildManager } from "./guild.js";
9
+ export type MessageCreateOptions = ManagerMessageCreateOptions;
10
+ export type MessageEditOptions = Record<string, unknown> & {
11
+ content?: string;
12
+ };
24
13
  export interface MessageFetchOptions {
25
- /** Whether to use cache. */ cache?: boolean;
14
+ cache?: boolean;
26
15
  }
27
- /** Message list query options. */
28
16
  export interface MessageQueryOptions {
29
- /** Message before this ID. */ before?: string;
30
- /** Message after this ID. */ after?: string;
31
- /** Message around this ID. */ around?: string;
32
- /** Maximum number of messages. */ limit?: number;
17
+ before?: string;
18
+ after?: string;
19
+ around?: string;
20
+ limit?: number;
33
21
  }
34
- /** Message thread creation options. */
35
22
  export interface MessageThreadOptions {
36
- /** Thread name. */ name: string;
37
- /** Auto archive duration. */ autoArchiveDuration?: 60 | 1440 | 4320 | 10080;
38
- /** Slowmode duration. */ rateLimitPerUser?: number;
23
+ name: string;
24
+ autoArchiveDuration?: 60 | 1440 | 4320 | 10080;
25
+ rateLimitPerUser?: number;
39
26
  }
40
- /** Reaction list options. */
41
27
  export interface ReactionFetchOptions {
42
- /** Maximum reactions. */ limit?: number;
43
- /** Reaction pagination cursor. */ after?: string;
28
+ limit?: number;
29
+ after?: string;
30
+ }
31
+ export interface ChannelCreateOptions extends Record<string, unknown> {
32
+ name: string;
33
+ type: number;
34
+ guild_id?: string;
35
+ parent_id?: string | null;
44
36
  }
45
- /** Runtime compatibility placeholders for legacy value imports. */
46
- export declare const MessageCreateOptions: undefined;
47
- /** Runtime compatibility placeholder. */
48
- export declare const MessageEditOptions: undefined;
49
- /** Runtime compatibility placeholder. */
50
- export declare const MessageFetchOptions: undefined;
51
- /** Runtime compatibility placeholder. */
52
- export declare const MessageThreadOptions: undefined;
53
- /** Runtime compatibility placeholder. */
54
- export declare const ReactionFetchOptions: undefined;
55
- /** Manages Discord channels and their message APIs. */
37
+ export type ChannelEditOptions = Record<string, unknown>;
56
38
  export declare class ChannelManager extends Manager<string, Channel> {
57
39
  #private;
58
- /** Creates a channel manager. @param rest REST transport. */
59
40
  constructor(rest: REST);
60
- /** Gets the canonical message manager for a channel. @param channelId Channel ID. @returns Message manager. */ messages(channelId: string): MessageManager;
61
- /** Creates a thread manager. @param channelId Channel ID. @returns Thread manager. */ threads(channelId: string): ThreadManager;
62
- /** Fetches a channel. @param channelId Channel ID. @returns Channel. */ fetch(channelId: string): Promise<Channel>;
63
- /** Resolves a channel. @param channelId Channel ID. @returns Canonical channel. */ resolve(channelId: string): Promise<Channel>;
64
- /** Inserts or updates a channel. @param data Channel payload. @returns Canonical channel. */ upsert(data: ConstructorParameters<typeof Channel>[0]): Channel;
65
- /** Updates a channel. @param channel Channel. @returns This manager. */ update(channel: Channel): this;
66
- /** Sends a message. @param channelId Channel ID. @param options Message options. @returns Created message. */ send(channelId: string, options: MessageCreateOptions): Promise<Message>;
67
- /** Alias for send. @param channelId Channel ID. @param options Message options. @returns Created message. */ sendMessage(channelId: string, options: MessageCreateOptions): Promise<Message>;
68
- /** Fetches one message. @param channelId Channel ID. @param messageId Message ID. @param options Fetch options. @returns Message. */ fetchMessage(channelId: string, messageId: string, options?: MessageFetchOptions): Promise<Message>;
69
- /** Fetches messages by query or by iterable IDs. @param channelId Channel ID. @param query Query options or message IDs. @returns Messages. */ fetchMessages(channelId: string, query: MessageQueryOptions | Iterable<string>): Promise<Message[]>;
70
- /** Inserts a message through the canonical cache path. @param data Message payload. @returns Canonical message. */ upsertMessage(data: ConstructorParameters<typeof Message>[0]): Message;
71
- /** Edits a message. @param channelId Channel ID. @param messageId Message ID. @param options Edit options. @returns Updated message. */ editMessage(channelId: string, messageId: string, options: MessageEditOptions): Promise<Message>;
72
- /** Deletes a message. @param channelId Channel ID. @param messageId Message ID. @returns Nothing. */ deleteMessage(channelId: string, messageId: string): Promise<void>;
73
- /** Deletes a cached message. @param channelId Channel ID. @param messageId Message ID. @returns Whether removed. */ deleteCachedMessage(channelId: string, messageId: string): boolean;
74
- /** Crossposts a message. @param channelId Channel ID. @param messageId Message ID. @returns Crossposted message. */ crosspostMessage(channelId: string, messageId: string): Promise<Message>;
75
- /** Bulk deletes messages. @param channelId Channel ID. @param messageIds Message IDs. @returns Nothing. */ bulkDeleteMessages(channelId: string, messageIds: Iterable<string>): Promise<void>;
76
- /** Adds a reaction. @param channelId Channel ID. @param messageId Message ID. @param emoji Emoji identifier. @returns Nothing. */ addReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
77
- /** Fetches users who reacted. @param channelId Channel ID. @param messageId Message ID. @param emoji Emoji identifier. @param options Query options. @returns Users. */ fetchReactions(channelId: string, messageId: string, emoji: string, options?: ReactionFetchOptions): Promise<User[]>;
78
- /** Removes the current bot user's reaction. @param channelId Channel ID. @param messageId Message ID. @param emoji Emoji identifier. @returns Nothing. */ removeOwnReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
79
- /** Removes a user's reaction. @param channelId Channel ID. @param messageId Message ID. @param emoji Emoji identifier. @param userId User ID. @returns Nothing. */ removeReaction(channelId: string, messageId: string, emoji: string, userId: string): Promise<void>;
80
- /** Removes all reactions. @param channelId Channel ID. @param messageId Message ID. @returns Nothing. */ removeAllReactions(channelId: string, messageId: string): Promise<void>;
81
- /** Fetches pinned messages. @param channelId Channel ID. @returns Pinned messages. */ fetchPinnedMessages(channelId: string): Promise<Message[]>;
82
- /** Pins a message. @param channelId Channel ID. @param messageId Message ID. @returns Nothing. */ pinMessage(channelId: string, messageId: string): Promise<void>;
83
- /** Unpins a message. @param channelId Channel ID. @param messageId Message ID. @returns Nothing. */ unpinMessage(channelId: string, messageId: string): Promise<void>;
84
- /** Creates a thread from a message. @param channelId Channel ID. @param messageId Message ID. @param options Thread options. @returns Created thread channel. */ createThreadFromMessage(channelId: string, messageId: string, options: MessageThreadOptions): Promise<Channel>;
85
- /** Deletes a channel and its message manager. @param channelId Channel ID. @returns Whether removed. */ delete(channelId: string): boolean;
86
- /** Clears all channels and message managers. @returns Nothing. */ clear(): void;
41
+ messages(channelId: string): MessageManager;
42
+ threads(channelId: string): ThreadManager;
43
+ fetch(channelId: string): Promise<Channel>;
44
+ resolve(channelId: string): Promise<Channel>;
45
+ upsert(data: ConstructorParameters<typeof Channel>[0]): Channel;
46
+ update(channel: Channel): this;
47
+ create(guildId: string, options: ChannelCreateOptions): Promise<Channel>;
48
+ edit(channelId: string, options: ChannelEditOptions): Promise<Channel>;
49
+ deleteChannel(channelId: string): Promise<void>;
50
+ send(channelId: string, options: MessageCreateOptions): Promise<Message>;
51
+ sendMessage(channelId: string, options: MessageCreateOptions): Promise<Message>;
52
+ fetchMessage(channelId: string, messageId: string, options?: MessageFetchOptions): Promise<Message>;
53
+ fetchMessages(channelId: string, query: MessageQueryOptions | Iterable<string>): Promise<Message[]>;
54
+ upsertMessage(data: ConstructorParameters<typeof Message>[0]): Message;
55
+ editMessage(channelId: string, messageId: string, options: MessageEditOptions): Promise<Message>;
56
+ deleteMessage(channelId: string, messageId: string): Promise<void>;
57
+ deleteCachedMessage(channelId: string, messageId: string): boolean;
58
+ crosspostMessage(channelId: string, messageId: string): Promise<Message>;
59
+ bulkDeleteMessages(channelId: string, messageIds: Iterable<string>): Promise<void>;
60
+ addReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
61
+ fetchReactions(channelId: string, messageId: string, emoji: string, options?: ReactionFetchOptions): Promise<User[]>;
62
+ removeOwnReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
63
+ removeReaction(channelId: string, messageId: string, emoji: string, userId: string): Promise<void>;
64
+ removeAllReactions(channelId: string, messageId: string): Promise<void>;
65
+ fetchPinnedMessages(channelId: string): Promise<Message[]>;
66
+ pinMessage(channelId: string, messageId: string): Promise<void>;
67
+ unpinMessage(channelId: string, messageId: string): Promise<void>;
68
+ createThreadFromMessage(channelId: string, messageId: string, options: MessageThreadOptions): Promise<Channel>;
69
+ delete(channelId: string): boolean;
70
+ clear(): void;
87
71
  }
88
- /** Backward-compatible message option alias. */
89
72
  export type CreateMessageOptions = MessageCreateOptions;
90
- /** Exposes the message manager class. */
91
73
  export { MessageManager } from "./message.js";
92
- /** Exposes the thread manager class. */
93
74
  export { ThreadManager } from "./thread.js";
94
75
  export { RoleManager, type RoleCreateOptions, type RoleEditOptions, } from "./role.js";
95
76
  export { GuildMemberManager, type MemberEditOptions, type BanOptions, } from "./member.js";