multiuser messaging

This commit is contained in:
Baipyrus 2023-02-02 10:45:07 +01:00
parent 5980709885
commit 0367fe45d1
2 changed files with 4 additions and 3 deletions

View File

@ -14,7 +14,7 @@ function runCommand(input) {
// Handle different chat modes
switch (modeSplit[0]) {
case "msg":
directMessage(modeSplit[1], input);
directMessage(modeSplit[1].split(','), input);
renameToSelf();
return "";
// case "chat":

View File

@ -151,6 +151,7 @@ function getChatMessages() {
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: chatMode.split(' ')[1].split(','),
name: window.localStorage.getItem("name"),
id: window.localStorage.getItem("id")
})
@ -177,16 +178,16 @@ function getChatMessages() {
}
// Send a direct message, do not look at response
function directMessage(name, message) {
function directMessage(names, message) {
fetch('/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: name,
name: window.localStorage.getItem("name"),
id: window.localStorage.getItem("id"),
to: names,
message
})
}).then(res => {});