export async function showActiveCharSwitching(interaction: ButtonInteraction): Promise { const userId = interaction.user.id; const member = interaction.guild!.members.cache.get(userId) ?? await interaction.guild!.members.fetch(userId); const user = await resolveUser(member); const impersonating = getImpersonation(userId); const voteId = impersonating ? `impersonated:${impersonating}` : userId; const clicks = clickCounts.get(voteId)!; const votedYes = interaction.customId === "tg_yes"; const clickCount = votedYes ? clicks.yes : clicks.no; const locked = clickCount >= LOCK_AT; // Yes vote companion — show active char + switch buttons if (votedYes && user.userKey && !locked) { const { char, borrowedFrom } = getEffectiveCharacter(user.userKey); if (char) { const starEmoji = process.env.ACTIVE_CHAR_EMOJI || "⭐"; const borrowNote = borrowedFrom ? ` 🔗` : ""; const buttons = buildCharSelectButtons(user.userKey, { customIdPrefix: `companion_switch:${user.userKey}`, excludeCharName: char.name, appendToCustomId: ":yes", }); if (buttons.length > 0) { await interaction.followUp({ content: `${starEmoji} ${format.char(char)}${borrowNote}`, components: buttons, ephemeral: true, }); } } } }