mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-26 09:55:26 +02:00
Merge bc781b7db8
into 5fe256d10a
This commit is contained in:
commit
cc0ac7a0c6
4 changed files with 10 additions and 1 deletions
|
@ -29,6 +29,7 @@ const settings = {
|
|||
"init_message": "Respond with hello world and your name", // sends to all on spawn
|
||||
"only_chat_with": [], // users that the bots listen to and send general messages to. if empty it will chat publicly
|
||||
"speak": false, // allows all bots to speak through system text-to-speech. works on windows, mac, on linux you need to `apt install espeak`
|
||||
"chat_response": true, // enables or disables bots sending their responses to minecraft chat
|
||||
"language": "en", // translate to/from this language. Supports these language names: https://cloud.google.com/translate/docs/languages
|
||||
"show_bot_views": false, // show bot's view in browser at localhost:3000, 3001...
|
||||
|
||||
|
|
|
@ -392,7 +392,8 @@ export class Agent {
|
|||
if (settings.speak) {
|
||||
say(to_translate);
|
||||
}
|
||||
this.bot.chat(message);
|
||||
if (settings.chat_response) {this.bot.chat(message);}
|
||||
sendResponseToServer(this.name, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,3 +71,7 @@ export const serverProxy = new AgentServerProxy();
|
|||
export function sendBotChatToServer(agentName, json) {
|
||||
serverProxy.getSocket().emit('chat-message', agentName, json);
|
||||
}
|
||||
|
||||
export function sendResponseToServer(agentName, message) {
|
||||
serverProxy.getSocket().emit('response-message', agentName, message);
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@ export function createMindServer(port = 8080) {
|
|||
console.error('Error: ', error);
|
||||
}
|
||||
});
|
||||
socket.on('response-message', (agentName, message) => {
|
||||
io.emit('response-message', {agentName, message});
|
||||
});
|
||||
});
|
||||
|
||||
server.listen(port, 'localhost', () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue