From 32649b002506a7992724f581b392b05ee5688470 Mon Sep 17 00:00:00 2001 From: Matt Jackson Date: Sat, 7 Mar 2026 23:13:37 +0000 Subject: [PATCH] Multi-account support: credentials keyed by account name - prompts.json now has account field per prompt - bot.js looks up env vars by account prefix (e.g. THEJUNIPERSKY_USER) - .env restructured with account-prefixed credentials - Adding a new Twitter account = new env vars + new prompt blocks Co-Authored-By: Claude Opus 4.6 --- bot.js | 13 +++++++------ prompts.json | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bot.js b/bot.js index a669fa9..138db45 100644 --- a/bot.js +++ b/bot.js @@ -105,11 +105,12 @@ async function readPage(kernel, sessionId) { return result.result; } -async function login(kernel, sessionId) { - const xAcct = JSON.stringify(process.env.X_ACCT); - const xPw = JSON.stringify(process.env.X_PW); - const xEmail = JSON.stringify(process.env.X_EMAIL); - const xPhone = JSON.stringify(process.env.X_PHONE); +async function login(kernel, sessionId, account) { + const prefix = account.toUpperCase(); + const xAcct = JSON.stringify(process.env[`${prefix}_USER`]); + const xPw = JSON.stringify(process.env[`${prefix}_PW`]); + const xEmail = JSON.stringify(process.env[`${prefix}_EMAIL`]); + const xPhone = JSON.stringify(process.env[`${prefix}_PHONE`]); await exec(kernel, sessionId, ` await page.goto('https://x.com/login', { waitUntil: 'networkidle' }); @@ -232,7 +233,7 @@ async function main() { console.log(`[${promptName}] Session: ${sessionId}`); try { - const url = await login(kernel, sessionId); + const url = await login(kernel, sessionId, promptConfig.account); if (!url.includes("x.com/home")) { throw new Error("Login didn't reach home page: " + url); } diff --git a/prompts.json b/prompts.json index d3f4285..c5bfd3a 100644 --- a/prompts.json +++ b/prompts.json @@ -12,7 +12,8 @@ 20 ], "minDays": 2 - } + }, + "account": "thejunipersky" }, { "name": "personality", @@ -28,6 +29,7 @@ 3 ], "minGapHours": 4 - } + }, + "account": "thejunipersky" } ]