privage.js 0.21.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +503 -0
  3. package/dist/Client.d.ts +192 -0
  4. package/dist/Client.js +904 -0
  5. package/dist/attachments.d.ts +41 -0
  6. package/dist/attachments.js +63 -0
  7. package/dist/collectors.d.ts +41 -0
  8. package/dist/collectors.js +52 -0
  9. package/dist/commands.d.ts +108 -0
  10. package/dist/commands.js +216 -0
  11. package/dist/compat.d.ts +72 -0
  12. package/dist/compat.js +75 -0
  13. package/dist/components.d.ts +137 -0
  14. package/dist/components.js +226 -0
  15. package/dist/embeds.d.ts +97 -0
  16. package/dist/embeds.js +125 -0
  17. package/dist/errors.d.ts +32 -0
  18. package/dist/errors.js +48 -0
  19. package/dist/formatters.d.ts +16 -0
  20. package/dist/formatters.js +43 -0
  21. package/dist/index.d.ts +33 -0
  22. package/dist/index.js +101 -0
  23. package/dist/intents.d.ts +28 -0
  24. package/dist/intents.js +33 -0
  25. package/dist/modals.d.ts +96 -0
  26. package/dist/modals.js +162 -0
  27. package/dist/rest.d.ts +208 -0
  28. package/dist/rest.js +356 -0
  29. package/dist/structures/Channel.d.ts +25 -0
  30. package/dist/structures/Channel.js +34 -0
  31. package/dist/structures/Interaction.d.ts +149 -0
  32. package/dist/structures/Interaction.js +170 -0
  33. package/dist/structures/Member.d.ts +35 -0
  34. package/dist/structures/Member.js +55 -0
  35. package/dist/structures/Message.d.ts +181 -0
  36. package/dist/structures/Message.js +191 -0
  37. package/dist/structures/Role.d.ts +17 -0
  38. package/dist/structures/Role.js +20 -0
  39. package/dist/structures/Server.d.ts +29 -0
  40. package/dist/structures/Server.js +36 -0
  41. package/dist/structures/ServerChannels.d.ts +24 -0
  42. package/dist/structures/ServerChannels.js +50 -0
  43. package/dist/types.d.ts +195 -0
  44. package/dist/types.js +2 -0
  45. package/package.json +49 -0
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Message = exports.TextChannel = void 0;
4
+ const Member_1 = require("./Member");
5
+ const Channel_1 = require("./Channel");
6
+ Object.defineProperty(exports, "TextChannel", { enumerable: true, get: function () { return Channel_1.TextChannel; } });
7
+ function parseAuthor(a) {
8
+ return {
9
+ id: String(a?.id ?? ''),
10
+ username: a?.username ?? 'unknown',
11
+ displayName: a?.display_name ?? null,
12
+ avatarUrl: a?.avatar_url ?? null,
13
+ bot: a?.type === 'bot',
14
+ };
15
+ }
16
+ function parseAttachment(a) {
17
+ return {
18
+ id: String(a?.id ?? ''),
19
+ filename: a?.filename ?? '',
20
+ url: a?.url ?? '',
21
+ mimeType: a?.mime_type ?? '',
22
+ size: Number(a?.size || 0),
23
+ width: a?.width != null ? Number(a.width) : null,
24
+ height: a?.height != null ? Number(a.height) : null,
25
+ spoiler: a?.spoiler === true,
26
+ createdAt: a?.created_at ? new Date(a.created_at) : null,
27
+ };
28
+ }
29
+ function parseEmbed(e) {
30
+ // Rich-embed extras (fields/footer/timestamp) ride a JSON column that
31
+ // some payloads deliver pre-parsed and others as a string.
32
+ let rich = e?.raw_data ?? null;
33
+ if (typeof rich === 'string') {
34
+ try {
35
+ rich = JSON.parse(rich);
36
+ }
37
+ catch {
38
+ rich = null;
39
+ }
40
+ }
41
+ return {
42
+ id: String(e?.id ?? ''),
43
+ type: e?.type ?? 'link',
44
+ url: e?.url ?? null,
45
+ title: e?.title ?? null,
46
+ description: e?.description ?? null,
47
+ color: e?.color ?? null,
48
+ thumbnail: e?.thumbnail ?? null,
49
+ authorName: e?.author_name ?? null,
50
+ authorUrl: e?.author_url ?? null,
51
+ icon: e?.icon ?? null,
52
+ siteName: e?.site_name ?? null,
53
+ provider: e?.provider ?? null,
54
+ videoUrl: e?.video_url ?? null,
55
+ width: e?.width != null ? Number(e.width) : null,
56
+ height: e?.height != null ? Number(e.height) : null,
57
+ fields: Array.isArray(rich?.fields)
58
+ ? rich.fields.map((f) => ({
59
+ name: String(f?.name ?? ''),
60
+ value: String(f?.value ?? ''),
61
+ inline: f?.inline === true,
62
+ }))
63
+ : [],
64
+ footer: rich?.footer?.text != null ? { text: String(rich.footer.text) } : null,
65
+ timestamp: rich?.timestamp ?? null,
66
+ createdAt: e?.created_at ? new Date(e.created_at) : null,
67
+ };
68
+ }
69
+ /** A received message. */
70
+ class Message {
71
+ constructor(client, data) {
72
+ this.client = client;
73
+ this.raw = data;
74
+ this.id = String(data.id);
75
+ this.channelId = String(data.channel_id);
76
+ this.serverId = data.server_id != null ? String(data.server_id) : null;
77
+ this.content = data.content ?? '';
78
+ const a = data.author ?? {};
79
+ this.author = parseAuthor({ ...a, id: a.id ?? data.author_id });
80
+ this.createdAt = data.created_at ? new Date(data.created_at) : null;
81
+ this.editedAt = data.updated_at ? new Date(data.updated_at) : null;
82
+ this.mentions = Array.isArray(data.mentions)
83
+ ? data.mentions.map((u) => ({ id: String(u?.id ?? u?.user_id ?? ''), username: u?.username ?? null }))
84
+ : [];
85
+ this.mentionRoleIds = Array.isArray(data.mention_role_ids) ? data.mention_role_ids.map(String) : [];
86
+ this.mentionEveryone = !!data.mention_everyone;
87
+ this.attachments = Array.isArray(data.attachments) ? data.attachments.map(parseAttachment) : [];
88
+ this.embeds = Array.isArray(data.embeds) ? data.embeds.map(parseEmbed) : [];
89
+ this.pinned = data.pinned === true;
90
+ const ref = data.reference;
91
+ if (ref && typeof ref === 'object' && ref.message_id != null) {
92
+ const reference = {
93
+ type: ref.type,
94
+ messageId: String(ref.message_id),
95
+ channelId: ref.channel_id != null ? String(ref.channel_id) : null,
96
+ serverId: ref.server_id != null ? String(ref.server_id) : null,
97
+ };
98
+ if ('message' in ref) {
99
+ const m = ref.message;
100
+ reference.message = m
101
+ ? {
102
+ id: String(m.id ?? reference.messageId),
103
+ content: m.content ?? '',
104
+ author: m.author ? parseAuthor(m.author) : null,
105
+ createdAt: m.created_at ? new Date(m.created_at) : null,
106
+ attachments: Array.isArray(m.attachments) ? m.attachments.map(parseAttachment) : [],
107
+ embeds: Array.isArray(m.embeds) ? m.embeds.map(parseEmbed) : [],
108
+ }
109
+ : null;
110
+ }
111
+ this.reference = reference;
112
+ }
113
+ else {
114
+ this.reference = null;
115
+ }
116
+ const t = data.thread;
117
+ this.thread =
118
+ t && typeof t === 'object'
119
+ ? {
120
+ id: t.id != null ? String(t.id) : null,
121
+ replyCount: Number(t.reply_count || 0),
122
+ lastActivityAt: t.last_activity_at ? new Date(t.last_activity_at) : null,
123
+ deletedAt: t.deleted_at ? new Date(t.deleted_at) : null,
124
+ }
125
+ : null;
126
+ }
127
+ /**
128
+ * Compat alias (discord.js-style): the id of the message this one replies
129
+ * to, or `null`. Derived from {@link reference} — prefer that for new code;
130
+ * forwards and pins are not surfaced here.
131
+ */
132
+ get replyToId() {
133
+ return this.reference?.type === 'reply' ? this.reference.messageId : null;
134
+ }
135
+ /**
136
+ * The channel this message was sent in. Resolved from the SDK's name
137
+ * cache when available (`.name` populated); falls back to a minimal
138
+ * handle (`.name === null`) that still supports `.send()` while the
139
+ * cache lazily fills in the background.
140
+ */
141
+ get channel() {
142
+ return this.client.channels.get(this.channelId) ?? new Channel_1.Channel(this.client, { id: this.channelId, server_id: this.serverId });
143
+ }
144
+ /** The server this message was sent in, or `null` in a DM. Resolved from the SDK's cache. */
145
+ get server() {
146
+ return this.serverId ? this.client.servers.get(this.serverId) ?? null : null;
147
+ }
148
+ /** Reply to this message (threads it via `reply_to`). */
149
+ reply(content) {
150
+ const data = typeof content === 'string' ? { content } : content;
151
+ return this.client.rest.sendMessage(this.channelId, { ...data, replyTo: this.id });
152
+ }
153
+ /** Delete this message (needs MANAGE_MESSAGES, or it's the bot's own). */
154
+ delete() {
155
+ return this.client.deleteMessage(this.id);
156
+ }
157
+ /** React to this message. */
158
+ react(emoji) {
159
+ return this.client.react(this.id, emoji);
160
+ }
161
+ /** Remove the bot's own reaction from this message. */
162
+ removeReaction(emoji) {
163
+ return this.client.removeReaction(this.id, emoji);
164
+ }
165
+ /** Edit this message's content. Own messages only (403 otherwise). */
166
+ edit(content) {
167
+ return this.client.editMessage(this.id, content);
168
+ }
169
+ /** Pin this message. */
170
+ pin() {
171
+ return this.client.pinMessage(this.id);
172
+ }
173
+ /** Unpin this message. */
174
+ unpin() {
175
+ return this.client.unpinMessage(this.id);
176
+ }
177
+ /** The author as a server member (with `addRole`/`removeRole`), or null in DMs. */
178
+ get member() {
179
+ if (!this.serverId)
180
+ return null;
181
+ return new Member_1.Member(this.client, {
182
+ user_id: this.author.id,
183
+ username: this.author.username,
184
+ display_name: this.author.displayName,
185
+ avatar_url: this.author.avatarUrl,
186
+ is_bot: this.author.bot,
187
+ server_id: this.serverId,
188
+ });
189
+ }
190
+ }
191
+ exports.Message = Message;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A server role. Populated from `GET /servers/:serverId/roles` — see
3
+ * `Client#fetchRoles`/`Server#fetchRoles`. `permissions` is the raw decimal
4
+ * string bitmask as returned by the backend; parse it with `BigInt(...)` and
5
+ * test bits yourself (symbolic permission decoding isn't part of the SDK yet).
6
+ */
7
+ export declare class Role {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ readonly color: string | null;
11
+ /** Decimal string bitmask — parse with `BigInt(role.permissions)` if you need to test bits. */
12
+ readonly permissions: string;
13
+ readonly position: number;
14
+ /** The raw wire/REST payload, for anything the typed surface doesn't expose yet. */
15
+ readonly raw: any;
16
+ constructor(data: any);
17
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Role = void 0;
4
+ /**
5
+ * A server role. Populated from `GET /servers/:serverId/roles` — see
6
+ * `Client#fetchRoles`/`Server#fetchRoles`. `permissions` is the raw decimal
7
+ * string bitmask as returned by the backend; parse it with `BigInt(...)` and
8
+ * test bits yourself (symbolic permission decoding isn't part of the SDK yet).
9
+ */
10
+ class Role {
11
+ constructor(data) {
12
+ this.raw = data;
13
+ this.id = String(data.id ?? '');
14
+ this.name = data.name ?? '';
15
+ this.color = data.color ?? null;
16
+ this.permissions = data.permissions != null ? String(data.permissions) : '0';
17
+ this.position = typeof data.position === 'number' ? data.position : Number(data.position ?? 0);
18
+ }
19
+ }
20
+ exports.Role = Role;
@@ -0,0 +1,29 @@
1
+ import type { Client } from '../Client';
2
+ import type { Member } from './Member';
3
+ import type { Role } from './Role';
4
+ import type { FetchMembersOptions } from '../rest';
5
+ import { ServerChannels } from './ServerChannels';
6
+ /**
7
+ * A server (guild) the bot belongs to. Populated from `GET /servers` on
8
+ * connect and kept fresh by `server-meta-updated`/`server-deleted` events
9
+ * (requires `Intents.Servers`) — see `Client`'s server/channel name cache.
10
+ */
11
+ export declare class Server {
12
+ private readonly client;
13
+ readonly id: string;
14
+ readonly name: string | null;
15
+ readonly iconUrl: string | null;
16
+ readonly ownerId: string | null;
17
+ /** The raw server row, for anything the typed surface doesn't expose yet. */
18
+ readonly raw: any;
19
+ constructor(client: Client, data: any);
20
+ /** List this server's members. */
21
+ fetchMembers(opts?: FetchMembersOptions): Promise<Member[]>;
22
+ /** List this server's roles. */
23
+ fetchRoles(): Promise<Role[]>;
24
+ /**
25
+ * This server's channels, from the SDK's cache (see {@link ServerChannels}
26
+ * — reflects cached state, not an authoritative fetch).
27
+ */
28
+ get channels(): ServerChannels;
29
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Server = void 0;
4
+ const ServerChannels_1 = require("./ServerChannels");
5
+ /**
6
+ * A server (guild) the bot belongs to. Populated from `GET /servers` on
7
+ * connect and kept fresh by `server-meta-updated`/`server-deleted` events
8
+ * (requires `Intents.Servers`) — see `Client`'s server/channel name cache.
9
+ */
10
+ class Server {
11
+ constructor(client, data) {
12
+ this.client = client;
13
+ this.raw = data;
14
+ this.id = String(data.id ?? data._id ?? '');
15
+ this.name = data.name ?? null;
16
+ this.iconUrl = data.icon_url ?? data.iconUrl ?? null;
17
+ this.ownerId =
18
+ data.owner_id != null ? String(data.owner_id) : data.ownerId != null ? String(data.ownerId) : null;
19
+ }
20
+ /** List this server's members. */
21
+ fetchMembers(opts) {
22
+ return this.client.fetchMembers(this.id, opts);
23
+ }
24
+ /** List this server's roles. */
25
+ fetchRoles() {
26
+ return this.client.fetchRoles(this.id);
27
+ }
28
+ /**
29
+ * This server's channels, from the SDK's cache (see {@link ServerChannels}
30
+ * — reflects cached state, not an authoritative fetch).
31
+ */
32
+ get channels() {
33
+ return new ServerChannels_1.ServerChannels(this.client, this.id);
34
+ }
35
+ }
36
+ exports.Server = Server;
@@ -0,0 +1,24 @@
1
+ import type { Client } from '../Client';
2
+ import type { Channel } from './Channel';
3
+ /**
4
+ * A lightweight, read-only view over the SDK's channel name cache
5
+ * (`Client#channels`), scoped to a single server. Backed entirely by
6
+ * whatever's currently cached — hydrated on connect and kept fresh via
7
+ * `channel-created`/`channel-updated`/`channel-deleted` events (see
8
+ * `Client#hydrateChannels`/`ensureChannel`) — **not** an authoritative,
9
+ * always-up-to-date fetch. A brand-new channel may be briefly absent until
10
+ * the cache catches up.
11
+ */
12
+ export declare class ServerChannels {
13
+ private readonly client;
14
+ private readonly serverId;
15
+ constructor(client: Client, serverId: string);
16
+ /** Look up a cached channel by id, scoped to this server. */
17
+ get(id: string): Channel | undefined;
18
+ /** Find the first cached channel in this server with the given name. */
19
+ find(name: string): Channel | undefined;
20
+ /** All cached channels belonging to this server. */
21
+ all(): Channel[];
22
+ /** Count of cached channels belonging to this server. */
23
+ get size(): number;
24
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerChannels = void 0;
4
+ /**
5
+ * A lightweight, read-only view over the SDK's channel name cache
6
+ * (`Client#channels`), scoped to a single server. Backed entirely by
7
+ * whatever's currently cached — hydrated on connect and kept fresh via
8
+ * `channel-created`/`channel-updated`/`channel-deleted` events (see
9
+ * `Client#hydrateChannels`/`ensureChannel`) — **not** an authoritative,
10
+ * always-up-to-date fetch. A brand-new channel may be briefly absent until
11
+ * the cache catches up.
12
+ */
13
+ class ServerChannels {
14
+ constructor(client, serverId) {
15
+ this.client = client;
16
+ this.serverId = serverId;
17
+ }
18
+ /** Look up a cached channel by id, scoped to this server. */
19
+ get(id) {
20
+ const channel = this.client.channels.get(id);
21
+ return channel && channel.serverId === this.serverId ? channel : undefined;
22
+ }
23
+ /** Find the first cached channel in this server with the given name. */
24
+ find(name) {
25
+ for (const channel of this.client.channels.values()) {
26
+ if (channel.serverId === this.serverId && channel.name === name)
27
+ return channel;
28
+ }
29
+ return undefined;
30
+ }
31
+ /** All cached channels belonging to this server. */
32
+ all() {
33
+ const result = [];
34
+ for (const channel of this.client.channels.values()) {
35
+ if (channel.serverId === this.serverId)
36
+ result.push(channel);
37
+ }
38
+ return result;
39
+ }
40
+ /** Count of cached channels belonging to this server. */
41
+ get size() {
42
+ let count = 0;
43
+ for (const channel of this.client.channels.values()) {
44
+ if (channel.serverId === this.serverId)
45
+ count += 1;
46
+ }
47
+ return count;
48
+ }
49
+ }
50
+ exports.ServerChannels = ServerChannels;
@@ -0,0 +1,195 @@
1
+ import type { Intent } from './intents';
2
+ import type { Message } from './structures/Message';
3
+ import type { Member } from './structures/Member';
4
+ import type { Channel } from './structures/Channel';
5
+ import type { Role } from './structures/Role';
6
+ import type { PrivageConnectionError } from './errors';
7
+ import type { Interaction } from './structures/Interaction';
8
+ export interface ClientOptions {
9
+ /** Which event categories to receive. Declare only what you handle. */
10
+ intents: Intent[];
11
+ /** REST base. Defaults to `$PRIVAGE_API` or production (`https://api.privage.xyz`). Set for self-hosted/local dev. */
12
+ api?: string;
13
+ /** WebSocket base. Defaults to `$PRIVAGE_WS`, or production (`wss://ws.privage.xyz/socket`); with a custom `api` it's derived from it. */
14
+ ws?: string;
15
+ /** Emit raw wire frames and lifecycle detail on the `debug` event. */
16
+ debug?: boolean;
17
+ }
18
+ export interface BotUser {
19
+ id: string;
20
+ username: string;
21
+ }
22
+ export interface ReadyPayload {
23
+ user: BotUser;
24
+ }
25
+ export interface Author {
26
+ id: string;
27
+ username: string;
28
+ displayName: string | null;
29
+ avatarUrl: string | null;
30
+ /** True when this author is a bot — use it to guard against replying to yourself/other bots. */
31
+ bot: boolean;
32
+ }
33
+ export interface MessageDelete {
34
+ id: string;
35
+ channelId: string;
36
+ serverId: string | null;
37
+ }
38
+ export interface MessageDeleteBulk {
39
+ ids: string[];
40
+ channelId: string;
41
+ serverId: string | null;
42
+ }
43
+ export interface ReactionUpdate {
44
+ messageId: string;
45
+ channelId: string | null;
46
+ /** Current reaction summary for the message. */
47
+ reactions: unknown[];
48
+ }
49
+ /** A single reaction add/remove — who reacted with which emoji. */
50
+ export interface ReactionAction {
51
+ messageId: string;
52
+ channelId: string | null;
53
+ emoji: string;
54
+ userId: string;
55
+ }
56
+ export interface MemberLeave {
57
+ userId: string;
58
+ serverId: string | null;
59
+ }
60
+ /** A role added to / removed from a member. */
61
+ export interface RoleChange {
62
+ serverId: string;
63
+ userId: string;
64
+ roleId: string;
65
+ }
66
+ /**
67
+ * A partial member profile update. The wire `member-updated` and
68
+ * `nickname-updated` events each carry a different subset of fields — every
69
+ * field beyond `serverId`/`userId` is optional; read only what you need.
70
+ */
71
+ export interface MemberUpdate {
72
+ serverId: string;
73
+ userId: string;
74
+ displayName?: string;
75
+ avatarUrl?: string;
76
+ nickname?: string;
77
+ }
78
+ /** A member was banned or unbanned. */
79
+ export interface MemberBan {
80
+ serverId: string;
81
+ userId: string;
82
+ username: string;
83
+ displayName: string;
84
+ }
85
+ /** A member was timed out. */
86
+ export interface MemberTimeout {
87
+ serverId: string;
88
+ userId: string;
89
+ until: Date | null;
90
+ moderatorId: string | null;
91
+ reason: string | null;
92
+ }
93
+ /** A member's timeout was lifted. */
94
+ export interface MemberUntimeout {
95
+ serverId: string;
96
+ userId: string;
97
+ }
98
+ /** A message was pinned or unpinned. */
99
+ export interface MessagePin {
100
+ messageId: string;
101
+ channelId: string;
102
+ }
103
+ /** A typing indicator started or stopped. */
104
+ export interface TypingEvent {
105
+ userId: string;
106
+ channelId: string;
107
+ }
108
+ /** A channel was deleted. */
109
+ export interface ChannelDelete {
110
+ channelId: string;
111
+ serverId: string | null;
112
+ }
113
+ /** A role was deleted. */
114
+ export interface RoleDelete {
115
+ roleId: string;
116
+ serverId: string | null;
117
+ }
118
+ /** A member voted in a poll. */
119
+ export interface PollVote {
120
+ pollId: string;
121
+ messageId: string;
122
+ voterId: string;
123
+ optionIdx: number;
124
+ totalVotes: number;
125
+ }
126
+ /** A poll closed. */
127
+ export interface PollClose {
128
+ pollId: string;
129
+ messageId: string;
130
+ totalVotes: number;
131
+ }
132
+ /** Typed event map for `client.on(...)`. */
133
+ export interface ClientEvents {
134
+ /** Fired once, after the first successful connect. */
135
+ ready: [ReadyPayload];
136
+ messageCreate: [Message];
137
+ messageUpdate: [Message];
138
+ messageDelete: [MessageDelete];
139
+ messageDeleteBulk: [MessageDeleteBulk];
140
+ reactionUpdate: [ReactionUpdate];
141
+ /** A specific user added a reaction (granular; needs the backend reaction delta). */
142
+ reactionAdd: [ReactionAction];
143
+ /** A specific user removed a reaction. */
144
+ reactionRemove: [ReactionAction];
145
+ memberJoin: [Member];
146
+ memberLeave: [MemberLeave];
147
+ /** A role was added to a member. */
148
+ roleAdd: [RoleChange];
149
+ /** A role was removed from a member. */
150
+ roleRemove: [RoleChange];
151
+ /** A member's profile changed (display name, avatar, and/or nickname — partial). */
152
+ memberUpdate: [MemberUpdate];
153
+ /** A member was banned. */
154
+ memberBan: [MemberBan];
155
+ /** A member's ban was lifted. */
156
+ memberUnban: [MemberBan];
157
+ /** A member was timed out. */
158
+ memberTimeout: [MemberTimeout];
159
+ /** A member's timeout was lifted. */
160
+ memberUntimeout: [MemberUntimeout];
161
+ /** A message was pinned. */
162
+ messagePin: [MessagePin];
163
+ /** A message was unpinned. */
164
+ messageUnpin: [MessagePin];
165
+ /** A user started typing in a channel. */
166
+ typingStart: [TypingEvent];
167
+ /** A user stopped typing in a channel. */
168
+ typingStop: [TypingEvent];
169
+ /** A channel was created. */
170
+ channelCreate: [Channel];
171
+ /** A channel was updated. */
172
+ channelUpdate: [Channel];
173
+ /** A channel was deleted. */
174
+ channelDelete: [ChannelDelete];
175
+ /** A role was created. */
176
+ roleCreate: [Role];
177
+ /** A role was updated. */
178
+ roleUpdate: [Role];
179
+ /** A role was deleted. */
180
+ roleDelete: [RoleDelete];
181
+ /** A member voted in a poll. */
182
+ pollVote: [PollVote];
183
+ /** A poll closed. */
184
+ pollClose: [PollClose];
185
+ /**
186
+ * A user interacted with the bot — button click, select-menu choice,
187
+ * slash-command invocation, or modal submission. Discriminate with
188
+ * `interaction.kind` (`'button' | 'select' | 'command' | 'modal_submit'`).
189
+ */
190
+ interaction: [Interaction];
191
+ /** Recoverable transport failure — the client is reconnecting. */
192
+ connectionError: [PrivageConnectionError];
193
+ warn: [string];
194
+ debug: [string];
195
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "privage.js",
3
+ "version": "0.21.0",
4
+ "description": "Official SDK for building Privage bots.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "vitest run",
10
+ "test:watch": "vitest",
11
+ "prepublishOnly": "npm run build && npm test"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "keywords": [
18
+ "privage",
19
+ "bot",
20
+ "sdk",
21
+ "gateway",
22
+ "chat"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/privage-io/privage-sdk.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/privage-io/privage-sdk/issues"
30
+ },
31
+ "homepage": "https://github.com/privage-io/privage-sdk#readme",
32
+ "author": "Privage",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "phoenix": "^1.7.14",
36
+ "ws": "^8.16.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.11.30",
40
+ "@types/phoenix": "^1.6.5",
41
+ "@types/ws": "^8.5.10",
42
+ "dotenv": "^17.4.2",
43
+ "typescript": "^5.4.5",
44
+ "vitest": "^3.2.4"
45
+ },
46
+ "engines": {
47
+ "node": ">=18"
48
+ }
49
+ }