Repository navigation
feat(plugin-gateway): add ApplicationEmoji and ApplicationEmojiManager - #250
Conversation
Architecture Inside the changed components — 1 viewComponent view — Application emojis Internal structure and API flow for application-owned emojis within plugin-gateway Data flow Review1 finding · reviewed
|
There was a problem hiding this comment.
ℹ️ No critical issues — two small nits inline.
Reviewed changes
Reviewed the full diff of the single commit: new structure, manager, wiring, docs, changeset and tests.
ApplicationEmoji— extendsEmojiwithauthor,application,edit,setName,delete,fetchAuthorand anequalsthat compares only ID, name andanimated. It follows theGuildEmojishapes (editpatches viakPatch(toJSON()),deletereturnsthis,dropRelations("author")on patch).ApplicationEmojiManager— fetch-onlyBaseManageroverclient.api.applications, withfetch,create,edit,delete,fetchAuthorandhydrate. It matchesGuildEmojiManagerfor image resolution and author resolution.ClientApplication#emojis— lazily created, memoized manager getter.- Docs, changeset, tests — README section, a minor changeset, runtime tests on mocked REST and a type-level test.
claude-sonnet-5-5 | 𝕏
@wolfstar/plugin-api
@wolfstar/plugin-broker
@wolfstar/plugin-cache
@wolfstar/plugin-gateway
@wolfstar/plugin-i18next
@wolfstar/plugin-logger
@wolfstar/plugin-scheduled-tasks
@wolfstar/plugin-sharder
@wolfstar/plugin-subcommands-advanced
commit: |
e2001b7 to
64f62f3
Compare
64f62f3 to
2777f41
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the PR after the rebase onto main (post #252) and the follow-up tidy commit, checking the two nits from the prior review against the current diff.
- Import order —
ApplicationEmojiManagernow sits with the other../../managersimports inClientApplication.ts, directly afterApplicationCommandManager. - Test patch symbol —
tests/application-emojis.test.tsimportskPatchfrom../src/index.jsand callsexisting[kPatch](...), replacing theSymbol.for("djs.structures.patch") as neverlookup. - Rebase — the
ApplicationEmojistructure,ApplicationEmojiManager,ClientApplication#emojisgetter, README section, changeset and tests are otherwise unchanged and still consistent with the surroundingGuildEmoji/GuildEmojiManagerconventions.
claude-sonnet-5-5 | 𝕏

🔗 Linked issue
Refs #207 (
ApplicationCommandand its managers remain, so this does not close it).🧭 Context
#207 asks to port discord.js's
ApplicationEmojiandApplicationCommandintoplugin-gateway. Pullfrog's plan splits it in three:ClientApplication(merged, #238), the emoji half (this PR), and the command half (a separate PR). This one is only the emoji half.📚 Description
Adds
ApplicationEmojiandApplicationEmojiManager, reachable asclient.application.emojis. Application emojis belong to the application rather than a guild, so the bot can use them in any guild.Following Pullfrog's recommendations:
BaseManagerand fetch-only, likeWebhookManager. Discord sends no gateway event for application emojis, so a cache would go stale with nothing to repair it, and no newplugin-cacheentity is added.ApplicationEmoji#equals()compares only what the payload carries.APIApplicationEmojihasid,name,animatedanduser, but nomanaged,requires_colons,availableorroles, so I did not port discord.js's defaults for them:equals()compares the ID, name andanimated, against anApplicationEmojior a raw emoji. Anything else returnsfalse, including aGuildEmojior anotherEmoji, as in plugin-gateway: structure compatibility of equals() across structures (discord.js parity) #203/feat(plugin-gateway)!: align equals() with discord.js across structures #218. This is stated in the TSDoc and the README.@discordjs/core'sApplicationsAPI(getEmojisreturns{ items }, whichfetch()turns into aCollection). Those endpoints take no audit-logreason, so neither do the methods here. No newGatewayErrorcodes were needed.Deviations from the plan: none beyond the above.
client.applicationalready existed (#238) and is nevernull, soclient.application.emojisis a lazily created manager on it, with no placeholder.Key changes
src/structures/emojis/ApplicationEmoji.tsEmoji, withauthor,application,edit(),setName(),delete(),fetchAuthor(),equals()src/managers/ApplicationEmojiManager.tsfetch(id?),create()(reusesresolveImage),edit(),delete(),fetchAuthor(),hydrate()src/structures/applications/ClientApplication.tsemojisgettersrc/structures/emojis/index.ts,src/managers/index.tstests/application-emojis.test.ts,tests/types/application-emojis.tsREADME.md,.changeset/gateway-application-emoji.md@wolfstar/plugin-gatewayType of Change
Pre-flight Checklist
pnpm changeset(orpnpm changeset add --emptyif no release is needed). See .changeset/README.md.Verification:
pnpm build,pnpm typecheckandpnpm test(122 files, 1726 tests) pass.pnpm lint:oxlintreports only warnings that predate this change;oxfmt --checkpasses on the changed files (on a Windows checkout with CRLF line endings it flags every file, so I checked the changed ones as LF).