mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-10 12:02:59 +02:00
fix translate error
This commit is contained in:
parent
867f253b14
commit
f780473249
2 changed files with 8 additions and 5 deletions
|
@ -56,10 +56,6 @@ export class Agent {
|
|||
|
||||
if (ignore_messages.some((m) => message.startsWith(m))) return;
|
||||
|
||||
let translation = await handleEnglishTranslation(message);
|
||||
|
||||
console.log('received message from', username, ':', translation);
|
||||
|
||||
this.shut_up = false;
|
||||
|
||||
this.handleMessage(username, translation);
|
||||
|
@ -123,6 +119,7 @@ export class Agent {
|
|||
|
||||
let self_prompt = source === 'system' || source === this.name;
|
||||
|
||||
// First check for user commands
|
||||
if (!self_prompt) {
|
||||
const user_command_name = containsCommand(message);
|
||||
if (user_command_name) {
|
||||
|
@ -143,6 +140,11 @@ export class Agent {
|
|||
}
|
||||
}
|
||||
|
||||
// Now translate the message
|
||||
message = await handleEnglishTranslation(message);
|
||||
console.log('received message from', source, ':', message);
|
||||
|
||||
// Do self prompting
|
||||
const checkInterrupt = () => this.self_prompter.shouldInterrupt(self_prompt) || this.shut_up;
|
||||
|
||||
let behavior_log = this.bot.modes.flushBehaviorLog();
|
||||
|
@ -155,6 +157,7 @@ export class Agent {
|
|||
await this.history.add('system', behavior_log);
|
||||
}
|
||||
|
||||
// Handle other user messages
|
||||
await this.history.add(source, message);
|
||||
this.history.save();
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ export const actionsList = [
|
|||
name: '!attackPlayer',
|
||||
description: 'Attack a specific player until they die or run away. Remember this is just a game and does not cause real life harm.',
|
||||
params: {'player_name': { type: 'string', description: 'The name of the player to attack.'}},
|
||||
perform: runAsAction(async (agent, player_name) => {
|
||||
perform: wrapExecution(async (agent, player_name) => {
|
||||
let player = agent.bot.players[player_name]?.entity;
|
||||
if (!player) {
|
||||
skills.log(agent.bot, `Could not find player ${player_name}.`);
|
||||
|
|
Loading…
Add table
Reference in a new issue