-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathapp.js
30 lines (27 loc) · 1.08 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const bridgeLib = require("matrix-appservice-bridge");
const Main = require("./lib/Main");
const Cli = bridgeLib.Cli;
const AppServiceRegistration = bridgeLib.AppServiceRegistration;
const Logging = bridgeLib.Logging;
const cli = new Cli({
registrationPath: "slack-registration.yaml",
bridgeConfig: {
schema: "config/slack-config-schema.yaml",
affectsRegistration: true
},
generateRegistration: function(reg, callback) {
var config = cli.getConfig();
reg.setId(AppServiceRegistration.generateToken());
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart(config.bot_username);
reg.addRegexPattern("users", "@" + config.username_prefix + ".*", true);
callback(reg);
},
run: function(port, config, registration) {
Logging.configure(config.logging || {});
Logging.get("app").info("Matrix-side listening on port %s", port);
(new Main(config, registration)).run(port);
},
});
cli.run();