diff --git a/src/commands/personality.ts b/src/commands/personality.ts index ad5f02b..bd7999e 100644 --- a/src/commands/personality.ts +++ b/src/commands/personality.ts @@ -189,9 +189,17 @@ async function switchTelegram(name: string) { body: JSON.stringify({ chat_id: chatId, text: `/personality ${displayName}` }), }); - const result = await resp.json() as { ok: boolean; description?: string }; + const result = await resp.json() as { ok: boolean; description?: string; result?: { message_id: number } }; if (result.ok) { console.log(`Sent /personality ${displayName} to chat ${chatId}`); + // Delete the message so it doesn't clutter the chat + if (result.result?.message_id) { + await fetch(`https://api.telegram.org/bot${token}/deleteMessage`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ chat_id: chatId, message_id: result.result.message_id }), + }).catch(() => {}); + } } else { console.error(`Telegram API error: ${result.description}`); process.exit(1);