Merge branch 'master' of github.com:nomadic-labs/ocrcc-bot
This commit is contained in:
commit
b7da515969
@ -1,6 +1,9 @@
|
|||||||
FROM node:10-alpine
|
FROM node:10-alpine
|
||||||
|
|
||||||
RUN apk add g++ make python
|
RUN apk add g++ make python
|
||||||
|
RUN apk add tzdata
|
||||||
|
|
||||||
|
ENV TZ America/Montreal
|
||||||
|
|
||||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||||
|
|
||||||
|
14
dist/bot.js
vendored
14
dist/bot.js
vendored
@ -27,6 +27,7 @@ var _encryptAttachment = _interopRequireDefault(require("./encrypt-attachment"))
|
|||||||
|
|
||||||
global.Olm = require("olm");
|
global.Olm = require("olm");
|
||||||
const BOT_SIGNAL_END_CHAT = 'END_CHAT';
|
const BOT_SIGNAL_END_CHAT = 'END_CHAT';
|
||||||
|
const BOT_SIGNAL_CHAT_OFFLINE = 'CHAT_OFFLINE';
|
||||||
|
|
||||||
class OcrccBot {
|
class OcrccBot {
|
||||||
constructor(botConfig) {
|
constructor(botConfig) {
|
||||||
@ -149,7 +150,7 @@ class OcrccBot {
|
|||||||
} else {
|
} else {
|
||||||
_logger.default.log('info', "NO FACILITATORS ONLINE");
|
_logger.default.log('info', "NO FACILITATORS ONLINE");
|
||||||
|
|
||||||
this.sendNotice(roomId, "CHAT_OFFLINE");
|
this.sendBotSignal(roomId, BOT_SIGNAL_CHAT_OFFLINE);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.handleBotCrash(roomId, err);
|
this.handleBotCrash(roomId, err);
|
||||||
@ -574,10 +575,13 @@ class OcrccBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeoutforFacilitator(roomId) {
|
setTimeoutforFacilitator(roomId) {
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
const stillWaiting = this.localStorage.getItem(`${roomId}-waiting`);
|
const stillWaiting = this.localStorage.getItem(`${roomId}-waiting`);
|
||||||
|
|
||||||
if (stillWaiting) {
|
if (stillWaiting) {
|
||||||
|
_logger.default.log("info", `FACILITATOR DID NOT JOIN CHAT WITHIN TIME LIMIT, SENDING SIGNAL TO END CHAT`);
|
||||||
|
|
||||||
|
await this.sendTextMessage(roomId, this.config.CHAT_NOT_AVAILABLE_MESSAGE);
|
||||||
this.sendBotSignal(roomId, BOT_SIGNAL_END_CHAT);
|
this.sendBotSignal(roomId, BOT_SIGNAL_END_CHAT);
|
||||||
}
|
}
|
||||||
}, this.config.MAX_WAIT_TIME);
|
}, this.config.MAX_WAIT_TIME);
|
||||||
@ -590,8 +594,10 @@ class OcrccBot {
|
|||||||
clearTimeout(oldTimeout);
|
clearTimeout(oldTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newTimeout = setTimeout(() => {
|
const newTimeout = setTimeout(async () => {
|
||||||
this.sendTextMessage(roomId, `This chat has been closed due to inactivity.`);
|
_logger.default.log("info", `CHAT IS INACTIVE, SENDING SIGNAL TO END CHAT`);
|
||||||
|
|
||||||
|
await this.sendTextMessage(roomId, `This chat has been closed due to inactivity.`);
|
||||||
this.sendBotSignal(roomId, BOT_SIGNAL_END_CHAT);
|
this.sendBotSignal(roomId, BOT_SIGNAL_END_CHAT);
|
||||||
}, this.config.MAX_INACTIVE);
|
}, this.config.MAX_INACTIVE);
|
||||||
this.inactivityTimers[roomId] = newTimeout;
|
this.inactivityTimers[roomId] = newTimeout;
|
||||||
|
Loading…
Reference in New Issue
Block a user