import type { RowDataPacket } from 'mysql2' import { db, DB } from './db' /** Nombre del reino desde acore_auth.realmlist (LIMIT 1, por si hay varios). */ export async function getRealmName(): Promise { try { const [rows] = await db(DB.auth).query( 'SELECT name FROM realmlist ORDER BY id LIMIT 1', ) return rows[0]?.name || 'NightSpire' } catch { return 'NightSpire' } } /** Slug del reino para la URL (p. ej. «Night Spire» → «nightspire», «Trinity» → «trinity»). */ export function realmSlug(name: string): string { return name.toLowerCase().replace(/[^a-z0-9]/g, '') }