You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consolidate moderation logs and DM forwarding onto Components V2
Third of three commits collapsing the message layers.
src/util/modlog.ts replaces five hand-built embeds across three event files.
detectspam, invitefilter and detectcryptoscam each constructed their own
near-identical entry — same colour, same author/description/Reason/footer
shape — and each repeated the same modlog-channel resolution:
const modlogId = current.modlog;
const modlogChannel = message.guild.channels.cache.get(modlogId!);
if (!modlogId || !modlogChannel || !modlogChannel.isTextBased()) return;
That lookup was also subtly wrong in two of them: it sat before the mute /
timeout log and returned early, so a guild with no modlog configured would
skip the rest of the handler rather than just skip logging. sendModLog
no-ops instead, and the caller carries on.
Rendering notes: the embed author icon becomes a Section thumbnail, which is
the closest V2 equivalent; the footer timestamp becomes Discord's <t:...:f>
markup so it still localises per viewer. Entries without an avatar render as
flat text with no Section.
forwarding.ts: the DM forwarding embed becomes a container, with attachments
as markdown links rather than embed fields.
about.ts keeps its embed, deliberately, with a comment saying why: its stats
are inline fields three to a row, and V2 has no field grid — faking one with
padded text does not survive different client widths. It is now the only
EmbedBuilder in the codebase, and the comment tells the next person that.
This closes step 4. The three ways of sending a message are down to one, plus
one documented exception:
before Messages.* embeds (54 sites) + raw EmbedBuilder (11) + djsx widgets (12)
after notices.* / modlog / plain container data, and /about
Verified: tsc and eslint clean; modlog entries render the heading, body,
reason, thumbnail and timestamp correctly in both the with-avatar and
without-avatar shapes; no event file references EmbedBuilder any more; the
loader still registers 10 commands, 3 components and 11 event listeners.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hDX4g1EjTN7424A5wnptE
0 commit comments