|
| 1 | +import { Colors, EmbedBuilder, time, TimestampStyles } from 'discord.js'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Temporary cutover comms for the move to the new ticket-based ModMail (ChatSift/ChatSift#313). |
| 5 | + * |
| 6 | + * This whole file and its two call sites (`events/ready.ts` for the bot status, `util/handleThreadManagement.ts` |
| 7 | + * for the in-thread notice) are meant to be deleted once the new bot is live -- everything here is hardcoded |
| 8 | + * on purpose rather than plumbed through `struct/Env.ts`, since it has a known expiry date. |
| 9 | + * |
| 10 | + * The owner announcement DMs (`scripts/announce-modmail-migration.mjs` over in ChatSift/ChatSift) only reach 21 |
| 11 | + * guild owners; the moderators who actually run the bot day to day never see them, which is what the in-thread |
| 12 | + * notice is for. |
| 13 | + */ |
| 14 | + |
| 15 | +/** |
| 16 | + * Start of the freeze window, in seconds: Mon 2026-08-24 18:00 EEST, i.e. `2026-08-24T15:00:00Z`. |
| 17 | + * |
| 18 | + * The announcement DMs are generated from the same instant (`MIGRATION_START_ISO=2026-08-24T15:00:00Z` passed to |
| 19 | + * the script named above) -- if this ever moves, both have to move together, or owners and moderators end up |
| 20 | + * looking at two different dates. |
| 21 | + */ |
| 22 | +export const MIGRATION_START_TS = 1_787_583_600; |
| 23 | + |
| 24 | +/** |
| 25 | + * End of the freeze window and the point the migration itself runs: 48h after {@link MIGRATION_START_TS}, i.e. |
| 26 | + * `2026-08-26T15:00:00Z`. Same 48h arithmetic the announcement script does. |
| 27 | + */ |
| 28 | +export const FREEZE_END_TS = MIGRATION_START_TS + 48 * 60 * 60; |
| 29 | + |
| 30 | +/** |
| 31 | + * Custom status shown on the bot's profile. Discord doesn't render `<t:...>` markup in a presence, so unlike the |
| 32 | + * embed below this has to spell the date out. |
| 33 | + */ |
| 34 | +export const MIGRATION_STATUS_TEXT = '⚠️ New ModMail on Aug 24 — 48h thread freeze'; |
| 35 | + |
| 36 | +/** |
| 37 | + * Posted as the first embed of every newly opened thread, ahead of the usual "who is this" info embed. Yellow |
| 38 | + * rather than the info embed's `NotQuiteBlack` so the two don't read as one block. |
| 39 | + */ |
| 40 | +export function buildMigrationNoticeEmbed(): EmbedBuilder { |
| 41 | + const start = time(MIGRATION_START_TS, TimestampStyles.LongDateTime); |
| 42 | + const startRelative = time(MIGRATION_START_TS, TimestampStyles.RelativeTime); |
| 43 | + const freezeEnd = time(FREEZE_END_TS, TimestampStyles.LongDateTime); |
| 44 | + |
| 45 | + return new EmbedBuilder() |
| 46 | + .setColor(Colors.Yellow) |
| 47 | + .setTitle('⚠️ ModMail is moving to a new system') |
| 48 | + .setDescription( |
| 49 | + [ |
| 50 | + `On **${start}** (${startRelative}), ModMail switches to a new ticket-based system with a full web dashboard.`, |
| 51 | + '', |
| 52 | + '• For **48 hours** from that moment, **no new threads can be opened**. Threads already open keep working as normal.', |
| 53 | + `• At **${freezeEnd}**, we force-close every open thread and migrate your full history over — nothing gets left behind.`, |
| 54 | + "• After that you're live on the new ModMail. **Configuring a panel on the dashboard will be mandatory** to keep using the bot.", |
| 55 | + '', |
| 56 | + 'Questions? Join the support server: https://discord.gg/tgZ2pSgXXv', |
| 57 | + ].join('\n'), |
| 58 | + ); |
| 59 | +} |
0 commit comments