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 <noreply@anthropic.com>
This commit is contained in:
Matt Jackson
2026-03-07 23:13:37 +00:00
parent d2ca2d23ba
commit 32649b0025
2 changed files with 11 additions and 8 deletions

13
bot.js
View File

@@ -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);
}

View File

@@ -12,7 +12,8 @@
20
],
"minDays": 2
}
},
"account": "thejunipersky"
},
{
"name": "personality",
@@ -28,6 +29,7 @@
3
],
"minGapHours": 4
}
},
"account": "thejunipersky"
}
]