multiuser messaging
This commit is contained in:
parent
5980709885
commit
0367fe45d1
@ -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":
|
||||
|
@ -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 => {});
|
||||
|
Loading…
Reference in New Issue
Block a user