multiuser messaging
This commit is contained in:
parent
5980709885
commit
0367fe45d1
@ -14,7 +14,7 @@ function runCommand(input) {
|
|||||||
// Handle different chat modes
|
// Handle different chat modes
|
||||||
switch (modeSplit[0]) {
|
switch (modeSplit[0]) {
|
||||||
case "msg":
|
case "msg":
|
||||||
directMessage(modeSplit[1], input);
|
directMessage(modeSplit[1].split(','), input);
|
||||||
renameToSelf();
|
renameToSelf();
|
||||||
return "";
|
return "";
|
||||||
// case "chat":
|
// case "chat":
|
||||||
|
@ -151,6 +151,7 @@ function getChatMessages() {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
from: chatMode.split(' ')[1].split(','),
|
||||||
name: window.localStorage.getItem("name"),
|
name: window.localStorage.getItem("name"),
|
||||||
id: window.localStorage.getItem("id")
|
id: window.localStorage.getItem("id")
|
||||||
})
|
})
|
||||||
@ -177,16 +178,16 @@ function getChatMessages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send a direct message, do not look at response
|
// Send a direct message, do not look at response
|
||||||
function directMessage(name, message) {
|
function directMessage(names, message) {
|
||||||
fetch('/message', {
|
fetch('/message', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
recipient: name,
|
|
||||||
name: window.localStorage.getItem("name"),
|
name: window.localStorage.getItem("name"),
|
||||||
id: window.localStorage.getItem("id"),
|
id: window.localStorage.getItem("id"),
|
||||||
|
to: names,
|
||||||
message
|
message
|
||||||
})
|
})
|
||||||
}).then(res => {});
|
}).then(res => {});
|
||||||
|
Loading…
Reference in New Issue
Block a user