lunibee 0.1.6 → 0.1.8

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 (80) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +223 -223
  3. package/dist/builders/commands.d.ts +39 -0
  4. package/dist/builders/components.d.ts +37 -12
  5. package/dist/builders/embed.d.ts +3 -1
  6. package/dist/builders/index.d.ts +2 -2
  7. package/dist/builders/index.js +192 -29
  8. package/dist/builders/index.js.map +9 -7
  9. package/dist/collection/index.d.ts +30 -0
  10. package/dist/collection/index.js +79 -5
  11. package/dist/collection/index.js.map +4 -4
  12. package/dist/core/events.d.ts +88 -2
  13. package/dist/core/index.d.ts +46 -85
  14. package/dist/core/index.js +2395 -789
  15. package/dist/core/index.js.map +44 -22
  16. package/dist/core/permissions.d.ts +112 -53
  17. package/dist/formatters/index.d.ts +43 -3
  18. package/dist/formatters/index.js +64 -1
  19. package/dist/formatters/index.js.map +3 -3
  20. package/dist/handlers/index.js.map +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +3783 -1009
  23. package/dist/index.js.map +63 -38
  24. package/dist/managers/emoji.d.ts +38 -0
  25. package/dist/managers/guild-resources.d.ts +109 -0
  26. package/dist/managers/guild.d.ts +117 -1
  27. package/dist/managers/index.d.ts +37 -1
  28. package/dist/managers/index.js +1125 -81
  29. package/dist/managers/index.js.map +25 -20
  30. package/dist/rest/decoder.d.ts +23 -0
  31. package/dist/rest/errors.d.ts +20 -0
  32. package/dist/rest/index.d.ts +119 -25
  33. package/dist/rest/index.js +676 -204
  34. package/dist/rest/index.js.map +14 -6
  35. package/dist/rest/limiter.d.ts +42 -0
  36. package/dist/rest/redis.d.ts +54 -0
  37. package/dist/rest/route.d.ts +31 -0
  38. package/dist/rest/routes.d.ts +24 -0
  39. package/dist/rest/scheduler.d.ts +42 -0
  40. package/dist/rest/store.d.ts +67 -0
  41. package/dist/rest/transport.d.ts +40 -0
  42. package/dist/rest/webhook.d.ts +2 -2
  43. package/dist/sharding/bus.d.ts +31 -0
  44. package/dist/sharding/cluster.d.ts +71 -0
  45. package/dist/sharding/index.d.ts +18 -2
  46. package/dist/sharding/index.js +1202 -317
  47. package/dist/sharding/index.js.map +18 -7
  48. package/dist/structures/audit-log.d.ts +26 -0
  49. package/dist/structures/base.d.ts +40 -0
  50. package/dist/structures/channels.d.ts +56 -0
  51. package/dist/structures/index.d.ts +30 -1
  52. package/dist/structures/index.js +963 -87
  53. package/dist/structures/index.js.map +17 -10
  54. package/dist/structures/interactions.d.ts +12 -52
  55. package/dist/structures/options.d.ts +55 -0
  56. package/dist/structures/resources.d.ts +194 -6
  57. package/dist/types/gateway-events.d.ts +132 -0
  58. package/dist/types/gateway.d.ts +181 -0
  59. package/dist/types/index.d.ts +78 -263
  60. package/dist/types/index.js +44 -2
  61. package/dist/types/index.js.map +5 -4
  62. package/dist/utils/index.js.map +2 -2
  63. package/dist/voice/index.d.ts +116 -0
  64. package/dist/voice/index.js +261 -10
  65. package/dist/voice/index.js.map +3 -3
  66. package/dist/ws/close-codes.d.ts +23 -0
  67. package/dist/ws/decoder.d.ts +58 -0
  68. package/dist/ws/heartbeat.d.ts +87 -0
  69. package/dist/ws/index.d.ts +24 -32
  70. package/dist/ws/index.js +920 -318
  71. package/dist/ws/index.js.map +15 -5
  72. package/dist/ws/opcodes.d.ts +14 -0
  73. package/dist/ws/protocol.d.ts +110 -0
  74. package/dist/ws/reconnect.d.ts +108 -0
  75. package/dist/ws/send-budget.d.ts +17 -0
  76. package/dist/ws/session.d.ts +100 -0
  77. package/dist/ws/state.d.ts +27 -0
  78. package/dist/ws/transport.d.ts +80 -0
  79. package/package.json +23 -22
  80. package/dist/structures/permissions.d.ts +0 -73
@@ -0,0 +1,26 @@
1
+ import { BaseStructure } from "./base.js";
2
+ import type { APIAuditLog, APIAuditLogEntry, APIAuditLogChange, APIAuditLogOptions } from "@lunibee/types";
3
+ /** Represents a single entry in a Discord audit log. */
4
+ export declare class AuditLogEntry extends BaseStructure {
5
+ /** The ID of the affected entity. */
6
+ readonly targetId: string | null;
7
+ /** The ID of the user who made the changes. */
8
+ readonly userId: string | null;
9
+ /** The action type of this entry. */
10
+ readonly actionType: number;
11
+ /** The changes made to the target. */
12
+ readonly changes: APIAuditLogChange[];
13
+ /** Additional info for certain action types. */
14
+ readonly options: APIAuditLogOptions | null;
15
+ /** The reason for the change, if any. */
16
+ readonly reason: string | null;
17
+ /** Creates an audit log entry. */
18
+ constructor(data: APIAuditLogEntry);
19
+ }
20
+ /** Represents a Discord audit log. */
21
+ export declare class AuditLog {
22
+ /** The entries in the audit log. */
23
+ readonly entries: Map<string, AuditLogEntry>;
24
+ /** Creates an audit log. */
25
+ constructor(data: APIAuditLog);
26
+ }
@@ -25,12 +25,18 @@ export interface ResourceContext {
25
25
  pinMessage?(channelId: string, messageId: string): Promise<void>;
26
26
  unpinMessage?(channelId: string, messageId: string): Promise<void>;
27
27
  }
28
+ export declare const CDN_BASE = "https://cdn.discordapp.com";
28
29
  /** Options for CDN image URLs. */
29
30
  export interface ImageURLOptions {
30
31
  extension?: "png" | "jpg" | "webp" | "gif" | "jpeg";
31
32
  size?: 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
32
33
  forceStatic?: boolean;
33
34
  }
35
+ /** Builds a Discord CDN asset URL from a directory path and asset hash, applying
36
+ * animated-hash (`a_`) gif detection, extension and size options. Shared by all
37
+ * hash-backed asset accessors (user/member/role/webhook) to avoid duplicating the logic.
38
+ * @param path CDN directory path, e.g. `/role-icons/{id}`. @param hash Asset hash. @param options Image URL options. */
39
+ export declare function cdnURL(path: string, hash: string, options?: ImageURLOptions): string;
34
40
  export declare class User extends BaseStructure {
35
41
  username: string;
36
42
  globalName: string | null;
@@ -83,6 +89,14 @@ export declare class Channel extends BaseStructure {
83
89
  delete(): Promise<void>;
84
90
  /** Updates this channel using the same resource operation as edit. @param options Channel fields to change. @returns The updated channel. @throws {Error} If the channel is not attached to a client. */
85
91
  update(options: Record<string, unknown>): Promise<Channel>;
92
+ /** Whether this is a thread (announcement, public or private). */
93
+ isThread(): boolean;
94
+ /** Whether messages can be sent in this channel (text, DM, announcement, voice, stage, threads). */
95
+ isTextBased(): boolean;
96
+ /** Whether this is a voice or stage channel. */
97
+ isVoiceBased(): boolean;
98
+ /** Whether this is a direct-message channel (DM or group DM). */
99
+ isDMBased(): boolean;
86
100
  /** Returns the Discord channel mention string. Used automatically in template literals. */
87
101
  toString(): string;
88
102
  }
@@ -104,6 +118,20 @@ export declare class Guild extends BaseStructure {
104
118
  vanityUrlCode: string | null;
105
119
  nsfwLevel: number;
106
120
  discoverySplash: string | null;
121
+ /** ID of the rules channel for Community guilds. */
122
+ rulesChannelId: string | null;
123
+ /** ID of the system messages channel. */
124
+ systemChannelId: string | null;
125
+ /** Bitfield of system channel flags. */
126
+ systemChannelFlags: number;
127
+ /** Maximum number of members the guild can have. */
128
+ maxMembers: number;
129
+ /** Required MFA level for administrators. */
130
+ mfaLevel: number;
131
+ /** Explicit content filter level. */
132
+ explicitContentFilter: number;
133
+ /** Default notification level for new members. */
134
+ defaultMessageNotifications: number;
107
135
  constructor(data: import("@lunibee/types").APIGuild);
108
136
  /** Returns the guild icon URL, or null if no icon is set. */
109
137
  iconURL(options?: ImageURLOptions): string | null;
@@ -113,10 +141,22 @@ export declare class Guild extends BaseStructure {
113
141
  bannerURL(options?: ImageURLOptions): string | null;
114
142
  /** Returns the guild discovery splash URL, or null if none. */
115
143
  discoverySplashURL(options?: ImageURLOptions): string | null;
144
+ /** Returns a widget image URL for the guild.
145
+ * @param style Widget style: shield (default), banner1, banner2, banner3, banner4.
146
+ */
147
+ widgetImageURL(style?: "shield" | "banner1" | "banner2" | "banner3" | "banner4"): string;
116
148
  /** Whether the guild has a given feature flag. @param feature Feature string, e.g. "COMMUNITY". */
117
149
  hasFeature(feature: string): boolean;
118
150
  /** Whether the guild is a Community server. */
119
151
  get isCommunity(): boolean;
152
+ /** Whether the guild is an official Discord Partner. */
153
+ get isPartnered(): boolean;
154
+ /** Whether the guild is verified by Discord. */
155
+ get isVerified(): boolean;
156
+ /** Whether the guild has any active boost subscriptions. */
157
+ get isBoosted(): boolean;
158
+ /** Alias for premiumTier — the guild's current Nitro boost level (0–3). */
159
+ get boostLevel(): number;
120
160
  /** Whether the guild has a vanity URL. */
121
161
  get hasVanityUrl(): boolean;
122
162
  /** Returns the guild's vanity invite URL, or null if none. */
@@ -0,0 +1,56 @@
1
+ import { Channel, User, type ResourceContext } from "./base.js";
2
+ import { TextChannel } from "./resources.js";
3
+ import type { APIChannel, APIForumTag, APIPartialEmoji, APIThreadMetadata } from "@lunibee/types";
4
+ /** A guild announcement (news) channel. */
5
+ export declare class NewsChannel extends TextChannel {
6
+ }
7
+ /** A direct-message or group DM channel. */
8
+ export declare class DMChannel extends Channel {
9
+ /** Users in the conversation. */ readonly recipients: User[];
10
+ /** Owner of a group DM. */ readonly ownerId: string | null;
11
+ constructor(data: APIChannel, context?: ResourceContext);
12
+ }
13
+ /** A guild voice channel. */
14
+ export declare class VoiceChannel extends Channel {
15
+ /** Bitrate in bits per second. */ bitrate: number;
16
+ /** User limit (0 = unlimited). */ userLimit: number;
17
+ /** Voice region override, or null for automatic. */ rtcRegion: string | null;
18
+ /** Camera video quality mode. */ videoQualityMode: number;
19
+ constructor(data: APIChannel, context?: ResourceContext);
20
+ }
21
+ /** A guild stage channel. */
22
+ export declare class StageChannel extends VoiceChannel {
23
+ }
24
+ /** A guild category. */
25
+ export declare class CategoryChannel extends Channel {
26
+ }
27
+ /** A thread (announcement, public or private). */
28
+ export declare class ThreadChannel extends Channel {
29
+ /** User who created the thread. */ readonly ownerId: string | null;
30
+ /** Approximate message count. */ messageCount: number;
31
+ /** Approximate member count (stops counting at 50). */ memberCount: number;
32
+ /** Thread metadata. */ metadata: APIThreadMetadata | null;
33
+ constructor(data: APIChannel, context?: ResourceContext);
34
+ /** Whether the thread is archived. */
35
+ get archived(): boolean;
36
+ /** Whether the thread is locked. */
37
+ get locked(): boolean;
38
+ /** Minutes of inactivity before the thread auto-archives. */
39
+ get autoArchiveDuration(): number | null;
40
+ }
41
+ /** A guild forum channel. */
42
+ export declare class ForumChannel extends Channel {
43
+ /** Tags that threads can apply. */ availableTags: APIForumTag[];
44
+ /** Default reaction for new threads. */ defaultReactionEmoji: APIPartialEmoji | null;
45
+ /** Default slowmode for new threads. */ defaultThreadRateLimitPerUser: number;
46
+ /** Default auto-archive duration for new threads. */ defaultAutoArchiveDuration: number | null;
47
+ constructor(data: APIChannel, context?: ResourceContext);
48
+ }
49
+ /** A guild media channel. */
50
+ export declare class MediaChannel extends ForumChannel {
51
+ }
52
+ /**
53
+ * Builds the most specific channel class for a payload's `type`, falling back
54
+ * to {@link Channel} for types without a dedicated class.
55
+ */
56
+ export declare function createChannel(data: APIChannel, context?: ResourceContext): Channel;
@@ -27,6 +27,12 @@ export declare class Message extends BaseStructure {
27
27
  constructor(data: import("@lunibee/types").APIMessage, context?: ResourceContext);
28
28
  /** Whether embeds are suppressed on this message. */
29
29
  get embedsSuppressed(): boolean;
30
+ /** Unix timestamp (ms) at which the message was created — discord.js parity.
31
+ * Derived from the message `timestamp`, which itself falls back to the id snowflake. */
32
+ get createdTimestamp(): number;
33
+ /** Date at which the message was created — discord.js parity. Overrides the
34
+ * snowflake-only `BaseStructure.createdAt` to honour the message `timestamp`. */
35
+ get createdAt(): Date;
30
36
  /** Edits this message. @param options Message fields to change. @returns The updated message. @throws {Error} If the message is not attached to a client. */
31
37
  edit(options: Record<string, unknown> & {
32
38
  content?: string;
@@ -53,7 +59,30 @@ export declare class Message extends BaseStructure {
53
59
  pin(): Promise<void>;
54
60
  /** Unpins this message. @returns A promise fulfilled when the message is unpinned. @throws {Error} If pin operations are unavailable. */
55
61
  unpin(): Promise<void>;
62
+ /** Whether this message was sent ephemerally (only visible to the recipient). */
63
+ get isEphemeral(): boolean;
64
+ /** Whether this message is currently pinned in its channel. */
65
+ get isPinned(): boolean;
66
+ /** Whether this is a system-generated message (join, boost, etc). Mirrors
67
+ * discord.js: a message is "system" unless its type is one of the user-authored
68
+ * types — Default (0), Reply (19), ChatInputCommand (20) or ContextMenuCommand (23). */
69
+ get isSystemMessage(): boolean;
70
+ /** Whether this message was crossposted from an announcement channel. */
71
+ get isCrosspost(): boolean;
72
+ /** Whether this message has file attachments. */
73
+ get hasAttachments(): boolean;
74
+ /** Whether this message contains embeds. */
75
+ get hasEmbeds(): boolean;
76
+ /** Whether this message contains interactive components. */
77
+ get hasComponents(): boolean;
78
+ /** Edits this message to suppress its embeds. @returns The updated message. */
79
+ suppressEmbeds(): Promise<Message>;
80
+ /** Returns a plain-object snapshot of all message fields. */
81
+ toJSON(): Record<string, unknown>;
56
82
  }
57
- export { GuildMember, Role, TextChannel } from "./resources.js";
83
+ export { GuildMember, Role, TextChannel, Invite, Webhook, WebhookType, Emoji, AutoModerationRule, WelcomeScreenChannel, GuildWelcomeScreen, OnboardingPromptOption, OnboardingPrompt, GuildOnboarding, } from "./resources.js";
84
+ export { NewsChannel, DMChannel, VoiceChannel, StageChannel, CategoryChannel, ThreadChannel, ForumChannel, MediaChannel, createChannel, } from "./channels.js";
58
85
  export * from "./interactions.js";
59
86
  export { Embed } from "./embed.js";
87
+ export { AuditLog, AuditLogEntry } from "./audit-log.js";
88
+ export { PermissionsBitField } from "@lunibee/core";