a fun bot for the hc slack
at main 893 B view raw
1import setupCommands from "./setup/commands"; 2import setupActions from "./setup/actions"; 3import { validateAndFixUserTotals } from "../../libs/userTotals"; 4import * as Sentry from "@sentry/bun"; 5 6const takes = async () => { 7 setupCommands(); 8 setupActions(); 9 10 // Validate and fix user totals on startup 11 try { 12 const result = await validateAndFixUserTotals(); 13 if (result.fixed > 0) { 14 console.log(`Fixed ${result.fixed} users with total takes time drift`); 15 } 16 if (result.errors.length > 0) { 17 console.error(`Failed to fix ${result.errors.length} users`); 18 Sentry.captureMessage("Failed to fix some user totals", { 19 level: "warning", 20 extra: { errors: result.errors } 21 }); 22 } 23 } catch (error) { 24 console.error("Error while validating user totals:", error); 25 Sentry.captureException(error, { 26 tags: { type: "user_totals_validation" } 27 }); 28 } 29}; 30 31export default takes;