From 4059ea1ddf6c8f6297741cd7cba7cc2bfe895b04 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Sat, 30 May 2026 22:13:13 +0200 Subject: [PATCH] chore(discord-bot): remove all migration related code --- apps/discord-bot/src/modes/bot.ts | 4 +--- apps/discord-bot/src/reporting.ts | 33 ------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/apps/discord-bot/src/modes/bot.ts b/apps/discord-bot/src/modes/bot.ts index cf0db16..ee8ef3a 100644 --- a/apps/discord-bot/src/modes/bot.ts +++ b/apps/discord-bot/src/modes/bot.ts @@ -4,14 +4,12 @@ import { env } from "~/env"; import { questCheckCron } from "~/quests"; import { trackingCron } from "~/tracking"; import { commands } from "~/commands"; -import { handleReportButton, handleReportModal, handleEditButton, handleDeleteButton, handleEditModal, migrateReportEmbeds, REPORT_BUTTON_ID, REPORT_MODAL_ID, REPORT_EDIT_BUTTON_PREFIX, REPORT_DELETE_BUTTON_PREFIX, REPORT_EDIT_MODAL_PREFIX } from "~/reporting"; +import { handleReportButton, handleReportModal, handleEditButton, handleDeleteButton, handleEditModal, REPORT_BUTTON_ID, REPORT_MODAL_ID, REPORT_EDIT_BUTTON_PREFIX, REPORT_DELETE_BUTTON_PREFIX, REPORT_EDIT_MODAL_PREFIX } from "~/reporting"; const onReady = async (client: Client) => { logger.info(`Client ready`); logger.info(`Connected as @${client.user.username}`); - void migrateReportEmbeds(client); - await questCheckCron(client); setInterval(() => void questCheckCron(client), env.WOV_FETCH_INTERVAL); diff --git a/apps/discord-bot/src/reporting.ts b/apps/discord-bot/src/reporting.ts index fe253ba..e6654cf 100644 --- a/apps/discord-bot/src/reporting.ts +++ b/apps/discord-bot/src/reporting.ts @@ -248,39 +248,6 @@ export const handleDeleteButton = async (interaction: ButtonInteraction, reportI await interaction.editReply({ content: "Signalement supprimé." }); }; -export const migrateReportEmbeds = async (client: Client) => { - const reports = await db.select().from(tables.reports); - let migrated = 0; - let failed = 0; - - for (const report of reports) { - if (!report.messageLink) continue; - - const parts = report.messageLink.split("/"); - const channelId = parts.at(-2); - const messageId = parts.at(-1); - if (!channelId || !messageId) continue; - - try { - const channel = await client.channels.fetch(channelId); - if (channel?.type !== ChannelType.GuildText) continue; - - const message = await channel.messages.fetch(messageId); - await message.edit({ - embeds: [buildReportEmbed(report)], - components: [reportActionRow(report.id)], - }); - migrated++; - } catch { - logger.warn(`Embed migration failed for report ${report.id}`); - failed++; - } - - await new Promise(resolve => setTimeout(resolve, 500)); - } - - logger.info(`Embed migration complete: ${migrated} updated, ${failed} failed`); -}; export const handleEditModal = async (interaction: ModalSubmitInteraction, client: Client, reportId: string, channelId: string, messageId: string) => { const reason = interaction.fields.getTextInputValue("reason");