Priority: Medium
Type: Technical Debt / Performance
Description
Currently, useTextContent.ts loads all locale files synchronously at module import time using readFileSync. This blocks the Node.js event loop during bot startup and prevents proper async error handling.
Current Problem
// Runs immediately when module is imported
for (let locale in Locale) {
translationFiles[locale] = JSON.parse(readFileSync(path, 'utf-8'));
}
Issues
- Blocks event loop during module load
- No graceful degradation if files are slow to read
- Harder to implement hot-reloading or dynamic locale updates
- Not idiomatic for Node.js/Discord.js applications
Proposed Solution
- Create Async Initialization Function
- Call During Bot Startup
- Add Safety Check in Hook
Acceptance Criteria
All locale files load asynchronously
Bot startup is non-blocking
Error handling preserves current fallback behavior
useTextContent throws clear error if called before initialization
No regression in translation functionality