cletus/bot/states/Observe.js
roberts 2a9f9159bd
All checks were successful
Deploy Cletus Bot / deploy (push) Successful in 26s
Massive Overhaul. Added state machine.
2025-05-10 12:24:59 -05:00

16 lines
No EOL
589 B
JavaScript

// states/Observe.js
const { getBot } = require('../core/context');
const { chatWithAI } = require('../lib/ai-helper');
const config = require('../config.json');
module.exports = async function Observe() {
const bot = getBot();
console.log('[STATE] Observe');
// Example: count nearby entities. I will need to add way more to this observe file later.
const entities = Object.values(bot.entities).filter(e => e.type === 'mob');
const msg = `I see ${entities.length} mobs nearby. What should I do?`;
const response = await chatWithAI(msg, config.ai);
bot.chat(response);
};