Commit 10b83294 authored by Anastasios Kalogeropoulos's avatar Anastasios Kalogeropoulos
Browse files

timezone added

parent b810d651
const Helper = require('./helper');
class Client {
constructor(ws, uuid) {
......@@ -5,10 +7,10 @@ class Client {
this.uuid = uuid;
this.conversation_history = [];
}
saveMessageInHistory(text, direction) {
let historyMessage = {
"timestamp": Date.now(),
"timestamp": Helper.calculateTimestamp(2),
"text": text,
"quick_replies": "",
"direction": direction
......
module.exports = {
calculateTimestamp: function(timezone) { //timezone = 1 for GMT+1, timezone = 2 for GMT+2 ...
let current = Date.now();
return current - (timezone*(-60)*60*1000);
}
}
\ No newline at end of file
......@@ -4,12 +4,11 @@ const WebSocket = require('ws');
const http = require('http');
const uuidv4 = require('uuid/v4');
const {port, botOathToken, channel} = require('./config');
const app = express();
const Client = require('./client.js');
const APIService = require('./api-service.js')
const Helper = require('./helper');
//initialize a simple http server
const server = http.createServer(app);
......@@ -124,7 +123,7 @@ function createOutgoingMessage(text, uuid) {
"text": text,
"quick_replies": []
},
"timestamp": Date.now
"timestamp": Helper.calculateTimestamp(2)
}
}
return outgoingMessage;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment