Added time to messages

This commit is contained in:
jsrobson10 2019-04-17 16:33:59 +10:00
parent 65c31c6050
commit 959298524c
1 changed files with 8 additions and 4 deletions

12
main.js
View File

@ -103,7 +103,8 @@ getrows_sqlite3("messages", function(data)
// Push all the messages to the chats
chats[data.channel].messages.push({
message: data.message,
from: data.from
from: data.from,
date: data.date
});
});
@ -561,13 +562,15 @@ var server = net.createServer(function(socket)
sqlite3_insertData("messages", {
channel: data.channel,
message: data.message,
from: sock.username
from: sock.username,
date: data.date
});
// Add it to the channel
chats[data.channel].messages.push({
message: data.message,
from: sock.username
from: sock.username,
date: data.date
});
// Send it to all the connected clients
@ -581,7 +584,8 @@ var server = net.createServer(function(socket)
mode: "new_message",
message: data.message,
channel: data.channel,
from: sock.username
from: sock.username,
date: data.date
});
}
}