Basic bot support and option to change opening text

This commit is contained in:
Cam Spry committed 2026-03-01 08:10:35 -05:00
1 parent 7bc9d67544
commit 499a5954f5
7 files changed
+264 -13

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
const RandomBot = require('./RandomBot');
const LLMBot = require('./LLMBot');
const fs = require('fs');
const path = require('path');
class BotFactory {
static createBot(type) {
switch (type.toLowerCase()) {
case 'random':
return new RandomBot();
case 'llm':
return new LLMBot();
default:
throw new Error(`Unknown bot type: ${type}`);
}
}
static generateBotName() {
const names = fs.readFileSync(path.join(__dirname, 'bot_names.txt'), 'utf8')
.split('\n')
.map(name => name.trim())
.filter(name => name.length > 0);
if (names.length === 0) {
return 'DefaultBot'; // Fallback if no names are found
}
const randomIndex = Math.floor(Math.random() * names.length);
return names[randomIndex];
}
static getAvailableBotTypes() {
return ['random'];
}
}
module.exports = BotFactory;