29 lines
760 B
JavaScript
29 lines
760 B
JavaScript
// core/context.js
|
|
let bot = null;
|
|
let stateMachine = null;
|
|
let lastChat = null;
|
|
let activeTask = null;
|
|
let combatLocked = false;
|
|
|
|
module.exports = {
|
|
setBot: (instance) => { bot = instance; },
|
|
getBot: () => bot,
|
|
|
|
setStateMachine: (machine) => { stateMachine = machine; },
|
|
getStateMachine: () => stateMachine,
|
|
|
|
setLastChat: (chat) => { lastChat = chat; },
|
|
getLastChat: () => lastChat,
|
|
|
|
setDB: (dbInstance) => { db = dbInstance; },
|
|
getDB: () => db,
|
|
|
|
getContextSnapshot: () => ({ bot, lastChat }),
|
|
|
|
setActiveTask: (taskName) => { activeTask = taskName; },
|
|
clearActiveTask: () => { activeTask = null; },
|
|
getActiveTask: () => activeTask,
|
|
|
|
setCombatLock: (value) => { combatLocked = value; },
|
|
isCombatLocked: () => combatLocked
|
|
};
|