mindcraft/utils/skill_library.js

20 lines
903 B
JavaScript
Raw Normal View History

import * as skills from './skills.js';
2023-11-07 20:21:19 -08:00
import * as world from './world.js';
export function getSkillDocs() {
let docstring = "\n*SKILL DOCS\nThese skills are javascript functions that can be called with a js function by writing a code block. Ex: '```// write description comment and code here```' \n\
Your code block should return a bool indicating if the task was completed successfully. It will return true if you don't write a return statement.\n";
2023-11-07 20:21:19 -08:00
for (let skillFunc of Object.values(world).concat(Object.values(skills))) {
let str = skillFunc.toString();
2023-11-07 20:21:19 -08:00
if (str.includes('/**')){
docstring += skillFunc.name;
docstring += str.substring(str.indexOf('/**')+3, str.indexOf('**/')) + '\n';
}
}
return docstring + '*\n';
}
export function containsCodeBlock(message) {
return message.indexOf('```') !== -1;
}