mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-03-28 14:56:24 +01:00
Rollback two code template.js
This commit is contained in:
parent
a458a66759
commit
485d4a6d8c
3 changed files with 17 additions and 17 deletions
10
bots/codeCheckTemplate.js
Normal file
10
bots/codeCheckTemplate.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import * as skills from '../../../src/agent/library/skills.js';
|
||||
import * as world from '../../../src/agent/library/world.js';
|
||||
import Vec3 from 'vec3';
|
||||
|
||||
const log = skills.log;
|
||||
|
||||
export async function main(bot) {
|
||||
/* CODE HERE */
|
||||
log(bot, 'Code finished.');
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"execTemplate": "(async (bot) => {\n\n /* CODE HERE */\n log(bot, 'Code finished.');\n\n});",
|
||||
"checkTemplate": "import * as skills from '../../../src/agent/library/skills.js';\nimport * as world from '../../../src/agent/library/world.js';\nimport Vec3 from 'vec3';\n\nconst log = skills.log;\n\nexport async function main(bot) {\n /* CODE HERE */\n log(bot, 'Code finished.');\n}"
|
||||
}
|
|
@ -15,19 +15,13 @@ export class Coder {
|
|||
this.code_template = '';
|
||||
this.code_check_template = '';
|
||||
|
||||
readFile('./bots/codeTemplate.json', 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading codeTemplate.json:', err);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
const templates = JSON.parse(data);
|
||||
this.code_template = templates.execTemplate;
|
||||
this.code_check_template = templates.checkTemplate;
|
||||
} catch (parseErr) {
|
||||
console.error('Error parsing codeTemplate.json:', parseErr);
|
||||
throw parseErr;
|
||||
}
|
||||
readFile('./bots/template.js', 'utf8', (err, data) => {
|
||||
if (err) throw err;
|
||||
this.code_template = data;
|
||||
});
|
||||
readFile('./bots/codeCheckTemplate.js', 'utf8', (err, data) => {
|
||||
if (err) throw err;
|
||||
this.code_check_template = data;
|
||||
});
|
||||
mkdirSync('.' + this.fp, { recursive: true });
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue