How to use the matrix-appservice-bridge.AppServiceRegistration function in matrix-appservice-bridge

To help you get started, we’ve selected a few matrix-appservice-bridge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RocketChat / hubot-freddie / src / matrix / genASRegFile.js View on Github external
// Usage:
//
// set the HOMESERVER_SENDER_LOCAL and ROCKETCHAT_USER_PREFIX environment variables
//
// node genASRegFile.js -r -u   # remember to add the registration to the HomeServer!


var Cli = require("matrix-appservice-bridge").Cli;
var Bridge = require("matrix-appservice-bridge").Bridge;
var AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;

HomeServerSenderLocal = process.env['HOMESERVER_SENDER_LOCAL'] || 'rcbot'
RocketChatUserPrefix = process.env['ROCKETCHAT_USER_PREFIX'] || '@rocketchat_'  // user name prefix for Rocket.Chat users

new Cli({
    registrationPath: "rocketchat-registration.yaml",
    generateRegistration: function(reg, callback) {
        reg.setHomeserverToken(AppServiceRegistration.generateToken());
        reg.setAppServiceToken(AppServiceRegistration.generateToken());
        reg.setSenderLocalpart(HomeServerSenderLocal);
        reg.addRegexPattern("users", RocketChatUserPrefix + ".*", true);
        callback(reg);
    },
    run: function(port, config) {
    }
}).run();
github RocketChat / hubot-freddie / src / matrix / matrixbridge.js View on Github external
var Bridge = require("matrix-appservice-bridge").Bridge;
var Cli = require("matrix-appservice-bridge").Cli;
var AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;

var localbridge;

var bridge = {
  run: function (port, config, eventHandler, mapRoom ) {
      localbridge = new Bridge({
        homeserverUrl: config.hsurl,
        domain: config.domain,
        registration: config.registration,
        controller: {
            onUserQuery: function(queriedUser) {
                return {}; // auto-provision users with no additonal data
            },
            onEvent: (request, context) => {
              const event = request.getData();
              if (event.type !== "m.room.message" || !event.content) {
github matrix-org / matrix-appservice-rocketchat / app.js View on Github external
response.writeHead(200, {"Content-Type": "application/json"});
            response.write(JSON.stringify({}));
            response.end();
        });
    }).listen(config.rocket_chat_webhook_port, function() {
        var protocol = config.tls ? "https" : "http";
        console.log("Rocket Chat-side listening on port " +
            config.rocket_chat_webhook_port + " over " + protocol);
        callback();
    });
}


var Cli = bridgeLib.Cli;
var Bridge = bridgeLib.Bridge;
var AppServiceRegistration = bridgeLib.AppServiceRegistration;

var cli = new Cli({
    registrationPath: "rocket-chat-registration.yaml",
    bridgeConfig: {
        schema: "config/rocket-chat-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);
    },
github turt2live / matrix-appservice-instagram-media / app.js View on Github external
var Cli = require("matrix-appservice-bridge").Cli;
var AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;
var log = require("./src/util/LogService");
var path = require("path");
var InstagramBridge = require("./src/InstagramBridge");
var InstagramStore = require("./src/storage/InstagramStore");

new Cli({
    registrationPath: "appservice-registration-instagram.yaml",
    enableRegistration: true,
    enableLocalpart: true,
    bridgeConfig: {
        affectsRegistration: true,
        schema: path.join(__dirname, "config/schema.yml"),
        defaults: {
            homeserver: {
                url: "http://localhost:8008",
                mediaUrl: "http://localhost:8008",
github turt2live / matrix-appservice-webhooks / index.js View on Github external
const LogService = require("matrix-js-snippets").LogService;
const Cli = require("matrix-appservice-bridge").Cli;
const AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;
const path = require("path");
const WebhookStore = require("./src/storage/WebhookStore");
const WebhookBridge = require("./src/WebhookBridge");
const WebService = require("./src/WebService");

const cli = new Cli({
    registrationPath: "appservice-registration-webhooks.yaml",
    enableRegistration: true,
    enableLocalpart: true,
    bridgeConfig: {
        affectsRegistration: true,
        schema: path.join(__dirname, "config/schema.yml"),
        defaults: {
            homeserver: {
                url: "http://localhost:8008",
                mediaUrl: "http://localhost:8008",
github Half-Shot / matrix-appservice-twitter / twitter-as.js View on Github external
var log     = require('npmlog');
var yaml    = require("js-yaml");
var fs      = require("fs");

var Cli                    = require("matrix-appservice-bridge").Cli;
var Bridge                 = require("matrix-appservice-bridge").Bridge;
var RemoteUser             = require("matrix-appservice-bridge").RemoteUser;
var AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;
var ClientFactory          = require("matrix-appservice-bridge").ClientFactory;

var MatrixTwitter        = require("./src/MatrixTwitter.js").MatrixTwitter;
var TwitterRoomHandler   = require("./src/TwitterRoomHandler.js").TwitterRoomHandler;
var AccountServices      = require("./src/AccountServices.js").AccountServices;
var TimelineHandler      = require("./src/TimelineHandler.js").TimelineHandler;
var HashtagHandler       = require("./src/HashtagHandler.js").HashtagHandler;
var DirectMessageHandler = require("./src/DirectMessageHandler.js").DirectMessageHandler;
var TwitterDB            = require("./src/TwitterDB.js").TwitterDB;
var util                 = require('./src/util.js');

var twitter;
var bridge;

new Cli({
  registrationPath: "twitter-registration.yaml",
github matrix-hacks / matrix-puppet-imessage / bridge.js View on Github external
let bridge;
let matrixClient;
const config = require('./config.json')
const Cli = require("matrix-appservice-bridge").Cli;
const Bridge = require("matrix-appservice-bridge").Bridge;
const AppServiceRegistration = require("matrix-appservice-bridge").AppServiceRegistration;
const iMessageSend = require('./send-message');
const nodePersist = require('node-persist');
const storage = nodePersist.create({
  dir:'persist/rooms',
  stringify: JSON.stringify,
  parse: JSON.parse,
  encoding: 'utf8',
  logging: false,
  continuous: true,
  interval: false,
  ttl: false
})
const matrixSdk = require("matrix-js-sdk");
const Promise = require('bluebird');

let lastMsgsFromMyself = [];