forked from matrix-org/matrix-appservice-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
28 lines (25 loc) · 973 Bytes
/
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
var bridgeLib = require("matrix-appservice-bridge");
var Main = require("./lib/Main");
var Cli = bridgeLib.Cli;
var AppServiceRegistration = bridgeLib.AppServiceRegistration;
var 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) {
console.log("Matrix-side listening on port %s", port);
(new Main(config)).run(port);
},
});
cli.run();