rewuite to use async
This commit is contained in:
parent
fefda571d6
commit
242d32639a
8
.babelrc
8
.babelrc
@ -1,8 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
"@babel/preset-env"
|
||||
],
|
||||
"plugins": [
|
||||
"dynamic-import-node"
|
||||
]
|
||||
}
|
51
package.json
51
package.json
@ -21,9 +21,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.4",
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/node": "^7.8.4",
|
||||
"@babel/preset-env": "^7.8.4",
|
||||
"@babel/core": "7.7.7",
|
||||
"@babel/node": "^7.8.7",
|
||||
"@babel/plugin-proposal-class-properties": "7.7.4",
|
||||
"@babel/plugin-proposal-decorators": "7.7.4",
|
||||
"@babel/plugin-proposal-export-namespace-from": "7.7.4",
|
||||
"@babel/plugin-proposal-function-sent": "7.7.4",
|
||||
"@babel/plugin-proposal-json-strings": "7.7.4",
|
||||
"@babel/plugin-proposal-numeric-separator": "7.7.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
|
||||
"@babel/plugin-proposal-throw-expressions": "7.7.4",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.7.4",
|
||||
"@babel/plugin-syntax-import-meta": "7.7.4",
|
||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||
"@babel/preset-env": "^7.9.0",
|
||||
"babel-jest": "^25.1.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.0",
|
||||
"jest": "^25.1.0",
|
||||
@ -32,6 +43,38 @@
|
||||
"wait-for-expect": "^3.0.2"
|
||||
},
|
||||
"jest": {
|
||||
"testPathIgnorePatterns": ["dist"]
|
||||
"testPathIgnorePatterns": [
|
||||
"dist"
|
||||
]
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "12"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-json-strings",
|
||||
[
|
||||
"@babel/plugin-proposal-decorators",
|
||||
{
|
||||
"legacy": true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-transform-runtime"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
435
src/bot.js
435
src/bot.js
File diff suppressed because it is too large
Load Diff
35
src/index.js
35
src/index.js
@ -1,6 +1,39 @@
|
||||
require('dotenv').config()
|
||||
|
||||
const ENCRYPTION_CONFIG = { algorithm: "m.megolm.v1.aes-sha2" };
|
||||
const KICK_REASON = "A facilitator has already joined this chat.";
|
||||
const BOT_ERROR_MESSAGE =
|
||||
"Something went wrong on our end, please restart the chat and try again.";
|
||||
const MAX_RETRIES = 3;
|
||||
const {
|
||||
MATRIX_SERVER_URL,
|
||||
BOT_USERNAME,
|
||||
BOT_USERID,
|
||||
BOT_PASSWORD,
|
||||
BOT_DISPLAY_NAME,
|
||||
FACILITATOR_GROUP_ID,
|
||||
FACILITATOR_ROOM_ID,
|
||||
CHAT_OFFLINE_MESSAGE,
|
||||
CAPTURE_TRANSCRIPTS
|
||||
} = process.env;
|
||||
|
||||
const botConfig = {
|
||||
ENCRYPTION_CONFIG,
|
||||
KICK_REASON,
|
||||
BOT_ERROR_MESSAGE,
|
||||
MAX_RETRIES,
|
||||
MATRIX_SERVER_URL,
|
||||
BOT_USERNAME,
|
||||
BOT_USERID,
|
||||
BOT_PASSWORD,
|
||||
BOT_DISPLAY_NAME,
|
||||
FACILITATOR_GROUP_ID,
|
||||
FACILITATOR_ROOM_ID,
|
||||
CHAT_OFFLINE_MESSAGE,
|
||||
CAPTURE_TRANSCRIPTS
|
||||
}
|
||||
|
||||
import OcrccBot from './bot'
|
||||
|
||||
const bot = new OcrccBot();
|
||||
const bot = new OcrccBot(botConfig);
|
||||
bot.start();
|
||||
|
@ -1,5 +0,0 @@
|
||||
@help-bot:rhok.space [17:39:36]: Facilitator Demo Account has joined the chat.
|
||||
@ocrcc-facilitator-demo:rhok.space [17:39:48]: heyooo
|
||||
@help-bot:rhok.space [17:41:13]: Bleep bloop
|
||||
@help-bot:rhok.space [17:41:21]: 20 Mar 2020 - 17:39:35 - !HyOQxerRxiwlUBolJA:rhok.space.txt
|
||||
@95326bf0-cd5e-45d7-be64-cb413d37d929:rhok.space [17:42:01]: hi
|
Loading…
Reference in New Issue
Block a user