@theholocron/discord-client 1.58.0-alpha.11 → 1.58.0-alpha.13

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/index.d.mts CHANGED
@@ -253,6 +253,18 @@ export interface DiscordChannel {
253
253
  permission_overwrites?: DiscordPermissionOverwrite[];
254
254
  /** The tags a post in this forum channel can carry; present on forum channels only. */
255
255
  available_tags?: DiscordForumTag[];
256
+ /** The emoji offered as the first reaction on every post of a forum channel, or `null` when unset. */
257
+ default_reaction_emoji?: DiscordDefaultReaction | null;
258
+ }
259
+ /**
260
+ * A forum's default reaction: one emoji, which is either a custom emoji (`emoji_id`) or a Unicode one (`emoji_name`).
261
+ * Discord allows exactly one per forum.
262
+ */
263
+ export interface DiscordDefaultReaction {
264
+ /** The id of a custom emoji, or `null` for a Unicode one. */
265
+ emoji_id: string | null;
266
+ /** The Unicode emoji, or `null` for a custom one. */
267
+ emoji_name: string | null;
256
268
  }
257
269
  /** A tag a forum post can carry, with the emoji shown beside its name. */
258
270
  export interface DiscordForumTag {
@@ -369,6 +381,8 @@ export interface CreateChannelInput {
369
381
  permission_overwrites?: DiscordPermissionOverwrite[];
370
382
  /** The tags of a forum channel (`ChannelType.Forum`). */
371
383
  available_tags?: ForumTagInput[];
384
+ /** The default reaction of a forum channel (`ChannelType.Forum`). */
385
+ default_reaction_emoji?: DiscordDefaultReaction;
372
386
  }
373
387
  /** `null` clears `topic` or detaches the channel from its category. */
374
388
  export interface ModifyChannelInput {
@@ -382,6 +396,8 @@ export interface ModifyChannelInput {
382
396
  permission_overwrites?: DiscordPermissionOverwrite[];
383
397
  /** The full list of a forum channel's tags, replacing the existing ones; give a tag's `id` to keep it. */
384
398
  available_tags?: ForumTagInput[];
399
+ /** A forum channel's default reaction; `null` clears it. */
400
+ default_reaction_emoji?: DiscordDefaultReaction | null;
385
401
  }
386
402
  /** A member of a server. Only what provisioning needs: who they are and which roles they hold. */
387
403
  export interface DiscordGuildMember {
@@ -715,6 +731,8 @@ export declare function createDiscordBotClient(opts: DiscordBotClientOptions): {
715
731
  messages: (channelId: string, limit?: number) => Promise<DiscordChannelMessage[]>;
716
732
  /** `PUT /channels/:id/pins/:id` — pins a message; one already pinned is a no-op. */
717
733
  pin: (channelId: string, messageId: string) => Promise<void>;
734
+ /** `PUT /channels/:id/messages/:id/reactions/:emoji/@me` — the bot reacts; a reaction it already has is a no-op. `emoji` is a Unicode emoji or `name:id` for a custom one. */
735
+ addReaction: (channelId: string, messageId: string, emoji: string) => Promise<void>;
718
736
  deleteMessage: (channelId: string, messageId: string) => Promise<void>;
719
737
  createWebhook: (channelId: string, body: {
720
738
  name: string;
@@ -728,6 +746,8 @@ export declare function createDiscordBotClient(opts: DiscordBotClientOptions): {
728
746
  createForumPost: (channelId: string, body: CreateForumPostInput) => Promise<DiscordForumPost>;
729
747
  /** `PATCH /channels/:id` on a thread — its title, tags, archived or locked state. Writing to an archived post unarchives it. */
730
748
  modify: (threadId: string, body: ModifyThreadInput) => Promise<DiscordThread>;
749
+ /** `DELETE /channels/:id` on a thread — deletes the thread and its messages. A 404 counts as done, as when a retry follows a lost response. */
750
+ delete: (threadId: string) => Promise<void>;
731
751
  /** `GET /guilds/:id/threads/active` — every active thread in the server, across channels. */
732
752
  active: (guildId: string) => Promise<DiscordThread[]>;
733
753
  /** `GET /channels/:id/threads/archived/public` — one page of a channel's archived threads, newest archived first. */
package/dist/index.mjs CHANGED
@@ -320,6 +320,11 @@ function createDiscordBotClient(opts) {
320
320
  method: "PUT",
321
321
  expectNoContent: true
322
322
  }),
323
+ /** `PUT /channels/:id/messages/:id/reactions/:emoji/@me` — the bot reacts; a reaction it already has is a no-op. `emoji` is a Unicode emoji or `name:id` for a custom one. */
324
+ addReaction: (channelId, messageId, emoji) => rest.request(`/channels/${id(channelId)}/messages/${id(messageId)}/reactions/${encodeURIComponent(emoji)}/@me`, {
325
+ method: "PUT",
326
+ expectNoContent: true
327
+ }),
323
328
  deleteMessage: (channelId, messageId) => rest.request(`/channels/${id(channelId)}/messages/${id(messageId)}`, {
324
329
  method: "DELETE",
325
330
  expectNoContent: true
@@ -352,6 +357,18 @@ function createDiscordBotClient(opts) {
352
357
  body
353
358
  });
354
359
  },
360
+ /** `DELETE /channels/:id` on a thread — deletes the thread and its messages. A 404 counts as done, as when a retry follows a lost response. */
361
+ delete: async (threadId) => {
362
+ try {
363
+ await rest.request(`/channels/${id(threadId)}`, {
364
+ method: "DELETE",
365
+ expectNoContent: true
366
+ });
367
+ } catch (err) {
368
+ if (err instanceof ProviderApiError && err.status === 404) return;
369
+ throw err;
370
+ }
371
+ },
355
372
  /** `GET /guilds/:id/threads/active` — every active thread in the server, across channels. */
356
373
  active: async (guildId) => (await rest.request(`/guilds/${id(guildId)}/threads/active`)).threads,
357
374
  /** `GET /channels/:id/threads/archived/public` — one page of a channel's archived threads, newest archived first. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/discord-client",
3
- "version": "1.58.0-alpha.11",
3
+ "version": "1.58.0-alpha.13",
4
4
  "description": "A TypeScript client for the Discord webhooks API",
5
5
  "keywords": [
6
6
  "discord",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/http-client": "^1.58.0-alpha.11"
35
+ "@theholocron/http-client": "^1.58.0-alpha.13"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^26",
@@ -44,10 +44,10 @@
44
44
  "tsdown": "^0.23.4",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^5.0.5",
47
- "@theholocron/tsconfig": "^8.9.0-alpha.8",
48
- "@theholocron/tsdown-config": "^8.9.0-alpha.8",
49
- "@theholocron/vitest-config": "^8.9.0-alpha.8",
50
- "@theholocron/eslint-config": "^8.9.0-alpha.8"
47
+ "@theholocron/eslint-config": "^8.9.0-alpha.9",
48
+ "@theholocron/tsconfig": "^8.9.0-alpha.9",
49
+ "@theholocron/vitest-config": "^8.9.0-alpha.9",
50
+ "@theholocron/tsdown-config": "^8.9.0-alpha.9"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22.0.0"