Skip to content

feat: bring gateway threads to discord.js parity - #107

Merged
RedStar071 merged 2 commits into
feat/webhooksfrom
feat/threads
Sep 25, 2026
Merged

RedStar071 merged 2 commits into
feat/webhooksfrom
feat/threads

Conversation

@RedStar071

Copy link
Copy Markdown
Member

Stacked on #106.

🔗 Linked issue

Related to #54 (phase 9 of the roadmap).

🧭 Context

Threads could be read and started from a message, but not created on their own, archived, locked, joined or listed. Thread members only existed as raw cache entries. The thread list and thread member dispatches only reached raw.

📚 Description

Threads now follow discord.js:

  • channel.threads on text, announcement, forum and media channels (ChannelThreadsMixin):
    • create makes a public or private thread, or a post with its first message in forums;
    • fetchActive and fetchArchived list threads (public, private, or the joined private ones);
    • guild.fetchActiveThreads() lists a guild's active threads.
  • Thread actions: setArchived, setLocked, setInvitable, setAutoArchiveDuration, setAppliedTags, join, leave, fetchStarterMessage and fetchOwner.
  • Thread members: ThreadMember, client.threadMembers (a CachedManager on the existing threadMembers cache) and thread.members. They resolve their guild member from the cache.
  • Events: threadListSync, threadMemberUpdate and threadMembersUpdate. The removed members are the ones the cache held before the dispatch.

Things worth a look:

  • Editing a thread through client.channels.edit used to land it in the wrong cache. ChannelManager._add read and wrote the channel cache, while threads live in the thread cache. It now hands threads to client.threads._add. A test checks that an archived thread stays in the thread cache only.
  • fetchActive on a channel filters the guild's list, since Discord only lists active threads per guild.
  • REST thread members don't carry the guild's ID. The manager reads it from the cached thread, so it can resolve their guild member.

Key changes

Area Change
Structures ThreadMember; thread setters and actions; ChannelThreadsMixin; AppliedTagsMixin#setAppliedTags; Guild#fetchActiveThreads
Managers ThreadManager create/fetchActive/fetchArchived, ThreadMemberManager (client.threadMembers), ChannelThreadManager, ThreadChannelMemberManager; ChannelManager._add routes threads
Events threadListSync, threadMemberUpdate, threadMembersUpdate

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Workflow / CI change

Pre-flight Checklist

  • I have read the Contributing Guidelines (if applicable)
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I added a changeset with pnpm changeset (or pnpm changeset add --empty if no release is needed). See .changeset/README.md.

🤖 AI disclosure: Wolfstar Agent Kit modified this description. My AI open-source policy.

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

◈ PR Lens

PR Lens paused analysis for this repository — the fair-use limit was reached. It resumes automatically at 2026-09-25T18:00:00.000Z.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Thread creation silently defaults to the wrong visibility, and a documented withMember fetch path is unreachable. Both are addressable without touching the rest of the design.

Reviewed changes

Reviewed the full diff of PR #107, which brings packages/plugin-gateway threads to discord.js parity.

  • channel.threads (ChannelThreadsMixin) on Text/Announcement/Forum/Media channels: create, fetchActive, fetchArchived, backed by a new ThreadManager.create/fetchActive/fetchArchived/storeList.
  • Thread actions on ThreadChannelMixin: setArchived, setLocked, setInvitable, setAutoArchiveDuration, join, leave, fetchStarterMessage, fetchOwner, and a new members accessor (ThreadChannelMemberManager).
  • ThreadMember structure and client.threadMembers (ThreadMemberManager, a CachedManager), resolving guildMember from client.members.
  • New events: threadListSync, threadMemberUpdate, threadMembersUpdate, wired into util/dispatch.ts/util/events.ts (the cache-write side already existed in plugin-cache).
  • Cache-routing fix: ChannelManager._add now hands thread payloads to client.threads._add instead of caching them under channels, fixing client.channels.edit landing threads in the wrong store — covered by a dedicated test.
  • AppliedTagsMixin#setAppliedTags for forum/media thread tags.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using Claude Sonnet | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@wolfstar/plugin-api

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-api@107

@wolfstar/plugin-cache

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-cache@107

@wolfstar/plugin-gateway

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-gateway@107

@wolfstar/plugin-i18next

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-i18next@107

@wolfstar/plugin-logger

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-logger@107

@wolfstar/plugin-subcommands-advanced

pnpm add https://pkg.pr.new/wolfstar-project/plugins/@wolfstar/plugin-subcommands-advanced@107

commit: 57cd2f5

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed commit 3de5e0f, pushed since the prior Pullfrog review, which fixes both findings raised against 18cfc4e.

  • Resolved thread-type default: ThreadManager.create() now resolves the thread type client-side via a new defaultThreadType() helper (cache-first channels.fetch()) instead of forwarding options.type unresolved — channel.threads.create({ name }) now creates a public thread (or an announcement thread in announcement channels) instead of silently landing on Discord's server-side PRIVATE_THREAD default. ThreadCreateOptions.type now includes ChannelType.AnnouncementThread, and its JSDoc was corrected to match.
  • Resolved unreachable withMember fetch: ThreadChannelMemberManager#fetch() now accepts a withMember option and routes to ThreadMemberManager.fetchWithMember() when set, so thread.members.fetch(userId, { withMember: true }) is now a working path to a thread member's resolved guild member.
  • Added tests for both: an omitted-type test asserting the sent body.type across a text and an announcement parent, and a withMember test asserting the with_member=true query param.

Verified ThreadChannelType (from discord-api-types) includes AnnouncementThread and that RESTPostAPIChannelThreadsJSONBody.type accepts it, and confirmed CachedManager.fetch() is cache-first so defaultThreadType() doesn't add a REST round-trip when the parent channel is already cached. Both prior review threads addressed and resolved.

Pullfrog  | View workflow run | Using Claude Sonnet | 𝕏

@pullfrog

pullfrog Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an ANTHROPIC_API_KEY repo secret — Pullfrog routes around an exhausted subscription automatically when one is present.

Add repo secret → · Model settings → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using Claude Sonnet | 𝕏

@pullfrog

pullfrog Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an ANTHROPIC_API_KEY repo secret — Pullfrog routes around an exhausted subscription automatically when one is present.

Add repo secret → · Model settings → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using Claude Sonnet | 𝕏

@RedStar071
RedStar071 merged commit 11d87b2 into main Sep 25, 2026
18 of 25 checks passed
@RedStar071
RedStar071 deleted the feat/threads branch September 25, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant