chore(discord-bot): remove all migration related code
This commit is contained in:
@@ -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<true>) => {
|
||||
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);
|
||||
|
||||
|
||||
@@ -248,39 +248,6 @@ export const handleDeleteButton = async (interaction: ButtonInteraction, reportI
|
||||
await interaction.editReply({ content: "Signalement supprimé." });
|
||||
};
|
||||
|
||||
export const migrateReportEmbeds = async (client: Client<true>) => {
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user