Skip to content

plugin-gateway: complete manager parity with discord.js (tracking) #216

Open

Description

@RedStar071

Context

Tracking issue for complete manager parity between @wolfstar/plugin-gateway and discord.js' packages/discord.js/src/managers (40 files on main). Until now the manager work was split in sub-projects (cache core, collection results, scoped managers, structure contracts), each shipping part of the picture, and the remaining gaps are only spread across individual issues (#207, #208, #209) or not tracked at all. This issue lists every manager that is still missing or only partly ported, so the work can be planned and closed against a single checklist.

The comparison below was made file by file and method by method against discord.js main and the current packages/plugin-gateway/src/managers. Parity here means coverage of managers, methods and access paths, not identical signatures: the cache stays pluggable (CachedManager, synchronous or asynchronous), so a few discord.js shapes keep their Awaitable equivalents.

Already at parity

BaseManager, DataManager, CachedManager, ChannelManager, GuildManager, GuildMemberManager, GuildMemberRoleManager, GuildEmojiManager, GuildEmojiRoleManager, GuildStickerManager, GuildSoundboardSoundManager, GuildScheduledEventManager, GuildInviteManager, GuildBanManager, AutoModerationRuleManager, StageInstanceManager, RoleManager, PermissionOverwriteManager, PresenceManager, VoiceStateManager, ReactionManager, ReactionUserManager, ThreadManager, ThreadMemberManager, UserManager, MessageManager, plus the guild/channel/thread/message scoped variants (ChannelMessageManager, ChannelThreadManager, ThreadChannelMemberManager) and the manager-only extras this package already adds (GuildIntegrationManager, GuildTemplateManager, WebhookManager).

Gaps

1. Application managers (already tracked)

discord.js Status
ApplicationCommandManager, GuildApplicationCommandManager, ApplicationCommandPermissionsManager missing, tracked in #209
ApplicationEmojiManager missing, tracked in #207
ClientApplication (client.application), prerequisite of both missing, tracked in #208

2. Monetization managers (not tracked yet)

discord.js Status
EntitlementManager: fetch() (one, or many with userId, skuIds, excludeEnded, excludeDeleted, guildId, before/after/limit), createTest(), deleteTest(), consume() missing; only the EntitlementResolvable type exists
SubscriptionManager: fetch() (one by ID, or the SKU's subscriptions with userId, before/after/limit) missing
structures they return: Entitlement, Subscription, SKU missing

client.application.entitlements and sku.subscriptions hang off ClientApplication (#208) and SKU, so this part depends on #208.

3. Access paths still missing

discord.js reaches these managers from the structure they belong to. Here several exist only as client-level managers, or not at all:

discord.js plugin-gateway
guild.members (GuildMemberManager) only client.members
guild.roles (RoleManager) only client.roles
guild.presences (PresenceManager) no guild-scoped access
guild.voiceStates (VoiceStateManager) no guild-scoped access
guild.commands (GuildApplicationCommandManager) missing, see #209
category.children (CategoryChannelChildManager) missing, see below
answer.voters (PollAnswerVoterManager#fetch) only message.fetchPollAnswerVoters() and a method on PollAnswer

CategoryChannelChildManager (category.children)

Ported from CategoryChannelChildManager.js. In discord.js it is a DataManager of GuildChannels that is not backed by its own cache:

  • channel: the category it belongs to, and guild: channel.guild.
  • cache: the guild's cached channels filtered by parentId === category.id, returned as a Collection. Here the guild channel cache is pluggable, so with an asynchronous cache (Redis) this read has to follow the same rule as the other derived getters: a promise built from the cache alone, typed through CacheRead<T>.
  • create(options): guild.channels.create({ ...options, parent: category.id }). CategoryCreateChannelOptions is GuildChannelCreateOptions minus parent, and a category cannot be created inside a category (ChannelType.GuildCategory is rejected by the type and at runtime).
  • Inherited resolve() and resolveId() from DataManager.

Wiring: a children getter on CategoryChannel (structures/channels/CategoryChannel.ts) returning the manager, created lazily like ChannelThreadsMixin#threads. It depends on GuildChannelManager#create (already present) and on the parentId field exposed by ChannelParentMixin.

Scoped managers already shipped (guild.emojis, guild.stickers, guild.channels, guild.invites, guild.bans, guild.scheduledEvents, guild.stageInstances, guild.soundboardSounds, guild.integrations, guild.autoModerationRules, channel.messages, channel.threads, channel.permissionOverwrites, thread.members, member.roles, message.reactions) are not part of this list.

4. Missing methods on managers that otherwise exist

discord.js Where Status
GuildManager#fetchSoundboardSounds(guildIds) (gateway request for the sounds of several guilds) GuildManager missing
GuildManager#widgetImageURL(guild, style?) GuildManager missing
GuildChannelManager#channelCountWithoutThreads GuildChannelManager missing
GuildChannelManager#rawFetchGuildActiveThreads() GuildChannelManager missing (ChannelThreadManager#fetchActive covers the public part)
DataManager#valueOf() DataManager missing
GuildEmojiManager#resolveIdentifier() GuildEmojiManager missing (only the reaction helper exists)

5. To verify before closing

  • GuildTextThreadManager and GuildForumThreadManager are separate classes in discord.js (create() takes different options for text and forum channels); here ChannelThreadManager#create is shared. Check that the forum options (message, appliedTags, rateLimitPerUser) are typed and validated per channel type.
  • DMMessageManager and PartialGroupDMMessageManager are thin subclasses of MessageManager (DMChannel#messages, group DM channels). Check that ChannelMessageManager behaves the same for DM channels, including the missing crosspost and guild-only paths.
  • GuildMessageManager#crosspost and ChannelManager#createMessage are covered by ChannelMessageManager and MessageManager; confirm the typings match.

Proposal

Work the list in this order, one PR per group, each with tests and a changeset (feat(plugin-gateway)):

  1. Access paths and small methods (sections 3 and 4, without the application parts): guild.members, guild.roles, guild.presences, guild.voiceStates, category.children, answer.voters, and the missing methods. No new REST surface, so this can ship first.
  2. Application layer: plugin-gateway: add ClientApplication and client.application (discord.js parity) #208, then plugin-gateway: port ApplicationEmoji (with its manager) and ApplicationCommand (discord.js parity) #207 and plugin-gateway: port ApplicationCommandManager and ApplicationCommandPermissionsManager (discord.js parity) #209.
  3. Monetization managers (section 2) once ClientApplication exists.
  4. Verification pass (section 5), turning any finding into a fix or a documented difference.

Questions

Out of scope

  • Interaction structures and their resolvers, builders, and collectors, which @wolfstar/http-framework and @discordjs/builders already own.
  • Signature-level parity of the cache API; the pluggable cache keeps Awaitable where discord.js is synchronous.
  • Event coverage for the new entities beyond what each manager needs to stay fresh.

Activity

  1. added
    enhancement
    packages:plugin-gateway
    on Oct 6, 2026
  2. pullfrog commented on Oct 6, 2026

    @pullfrog
    Contributor

    Assessment

    The issue is actionable. I checked its claims against packages/plugin-gateway/src and the existing specs. The gap list is mostly accurate, with a few details to correct before planning PRs.

    Verified against the code

    • Guild-scoped access paths are missing. Guild has scoped getters for emojis, stickers, channels, invites, bans, integrations, scheduledEvents, stageInstances, soundboardSounds and autoModerationRules. It has none for members, roles, presences or voiceStates.
    • The client-level managers are not thin to scope. GatewayClient has members, roles, presences and voiceStates as readonly fields, and they are composite-keyed (resolveKey(guildId, id)). That is different from guild.emojis, which uses a per-guild manager that shares the cache.
    • category.children is missing. CategoryChannel is a mixin composition with no children manager.
    • PollAnswerVoterManager is missing. Voters are reachable only via MessageManager#fetchPollAnswerVoters and PollAnswer#fetchVoters.
    • Missing methods are confirmed. I found no fetchSoundboardSounds(guildIds), channelCountWithoutThreads, rawFetchGuildActiveThreads, GuildEmojiManager#resolveIdentifier, or DataManager#valueOf.
    • No monetization or application code exists (Entitlement, Subscription, SKU, ClientApplication).

    Corrections to the issue

    1. widgetImageURL is trivial. Widget#imageURL(style = Shield) already exists in structures/guilds/Widget.ts. GuildManager#widgetImageURL(guild, style?) is only a URL builder over Routes.guildWidgetImage, with no REST call.
    2. DataManager#valueOf is not missing. Structure#valueOf exists, but the managers have no valueOf, so the gap is real for managers. discord.js returns the manager's cache.
    3. ChannelThreadManager#create does branch on message. It creates a forum post when message is set and a plain thread otherwise, so section 5's first check is only partly open. The remaining question is whether forum-only options (message, appliedTags) are rejected on text channels. Today appliedTags is silently ignored without message, and type/invitable are ignored with it. There is no per-channel-type validation.
    4. fetchSoundboardSounds(guildIds) needs a new gateway opcode. This is opcode 31, REQUEST_SOUNDBOARD_SOUNDS. It replies via the SoundboardSounds dispatch, which already exists in util/dispatch.ts. So it is not a small method: it follows the GuildMemberManager#request template (shard id from the guild id, send, timeout after send, settle from the dispatch). It does not belong in the "no new REST surface" PR.

    Answers to the issue's open questions

    • guild.members and guild.roles: thin scoped views or distinct managers? I recommend thin scoped views, like guild.emojis and guild.channels.
      • The architecture shares one manager.cache per entity, memoized in GatewayClient.CacheConstructor. A distinct manager with its own cacheConstructor and cacheOptions would split that cache and break the sweepers and client.cache.
      • Each view should extend or wrap the client manager with guildId pre-filled, build a new instance per access, and expose cache as a guild-filtered view.
      • discord.js's per-guild cacheOptions stay out of scope.
    • Entitlements and subscriptions: cached or fetch-only? I recommend event-driven caching for entitlements only.
      • ENTITLEMENT_CREATE/UPDATE/DELETE carry full payloads, which makes them cheap to cache.
      • The Subscription events (SUBSCRIPTION_*) are not yet in the discord-api-types version this repo uses, so they should be verified first; if absent, subscriptions stay fetch-only.
      • This needs a MemoryEntityCache-style unmanaged store, as the learnings note for entitlements and subscriptions, plus plugin-cache operations and a plugin-cache changeset.
      • Handlers with a before need DispatchStateCodecs entries.

    Proposed PR sequence

    Each PR needs tests, a changeset, and a feat(plugin-gateway): ... title. They follow the issue's order, with PR 1 split in two because of the opcode finding.

    1. Guild-scoped views and trivial methods.
      • Add guild.members, guild.roles, guild.presences and guild.voiceStates, as GuildMemberManager-style scoped classes with guildId pre-filled.
      • Add DataManager#valueOf, GuildEmojiManager#resolveIdentifier, GuildManager#widgetImageURL, and GuildChannelManager#channelCountWithoutThreads (synchronous count over a cached channel list, with a CacheRead twin).
      • Add rawFetchGuildActiveThreads only if it has a consumer, because ChannelThreadManager#fetchActive already covers the public part.
      • Add tests for sync cache modes and async cache modes, and a type-level consumption test.
    2. category.children and answer.voters.
      • Add CategoryChannelChildManager (cache, guild, create() with parent_id injected) as a getter on CategoryChannel.
      • Add PollAnswerVoterManager#fetch delegating to MessageManager#fetchPollAnswerVoters, exposed as answer.voters. The existing PollAnswer#fetchVoters stays.
    3. GuildManager#fetchSoundboardSounds(guildIds). This is the opcode 31 request, following the GuildMemberManager#request template, with new errors in errors/Messages.ts and util/errors.ts.
    4. Application layer. plugin-gateway: add ClientApplication and client.application (discord.js parity) #208 first (ClientApplication, client.application), then plugin-gateway: port ApplicationEmoji (with its manager) and ApplicationCommand (discord.js parity) #207 and plugin-gateway: port ApplicationCommandManager and ApplicationCommandPermissionsManager (discord.js parity) #209. These are already scoped on their own issues.
    5. Monetization. Entitlement, Subscription and SKU structures, EntitlementManager and SubscriptionManager, hung off client.application.entitlements and sku.subscriptions. This is blocked on plugin-gateway: add ClientApplication and client.application (discord.js parity) #208.
    6. Verification pass for section 5.
      • Forum and text thread options: either per-type validation in ThreadManager#create, or typed overloads. Keeping one shared class and documenting the difference is the cheaper option.
      • DM behaviour of ChannelMessageManager, with tests on DM channels.
      • Typing checks for crosspost and createMessage.

    Suggestions

    • Split the tracking issue's checklist to match the six PRs above, and add the opcode finding to the checklist.
    • Docs and specs. Add a design spec under docs/superpowers/specs/ for PR 1 (the scoped-view decision), since 2026-10-01-manager-api-parity-design.md predates the manager.cache architecture.
    • Out-of-scope items stay out of scope. Interaction structures and builders belong to @wolfstar/http-framework and @discordjs/builders.
    • Confirm the section 3 list. guild.commands stays with plugin-gateway: port ApplicationCommandManager and ApplicationCommandPermissionsManager (discord.js parity) #209.

    I haven't started any implementation. When you want to start, /implement-issue handles PR 1 once the scoped-view decision is confirmed.

    Pullfrog  | Implement plan ➔ | View workflow run | via Pullfrog | Using claude-sonnet-5-5 | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discordjsenhancementpackages:plugin-gateway

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions