Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.cli = new Cli({
bridgeConfig: {
affectsRegistration: true,
schema: "./config/config.schema.yaml",
},
registrationPath: "purple-registration.yaml",
generateRegistration: this.generateRegistration,
run: this.runBridge.bind(this),
});
this.cfg = new Config();
this.deduplicator = new Deduplicator();
// For testing w/o libpurple.
// this.purple = new MockPurpleInstance();
// setTimeout(() => {
// (this.purple as MockPurpleInstance).emit("received-im-msg", {
// sender: "testacc@localhost/",
// message: "test",
// 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();
const config = require('../config.json');
const { Cli, AppServiceRegistration } = require("matrix-appservice-bridge");
const Puppet = require('./puppet');
const App = require('./app');
const path = require('path');
const puppet = new Puppet(path.join(__dirname, '../config.json' ));
new Cli({
port: config.port,
registrationPath: config.registrationPath,
generateRegistration: function(reg, callback) {
puppet.associate().then(()=>{
reg.setId(AppServiceRegistration.generateToken());
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("groupmebot");
reg.addRegexPattern("users", "@groupme_.*", true);
callback(reg);
}).catch(err=>{
console.error(err.message);
process.exit(-1);
});
},
run: function(port) {
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 = [];
new Cli({
port: config.port,
registrationPath: config.registrationPath,
generateRegistration: function(reg, callback) {
reg.setId(AppServiceRegistration.generateToken());
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("imessagebot");
reg.addRegexPattern("users", "@imessage_.*", true);
callback(reg);
},
run: function(port, _config) {
//console.log(accessDat);
bridge = new Bridge({
homeserverUrl: config.bridge.homeserverUrl,
domain: config.bridge.domain,
registration: config.bridge.registration,
import {
Cli,
} from 'matrix-appservice-bridge'
import {
generateRegistration,
run,
} from './appservice/'
import {
MATRIX_APPSERVICE_REGISTRATION_YAML_FILE,
} from './config'
const cli = new Cli({
generateRegistration,
registrationPath: MATRIX_APPSERVICE_REGISTRATION_YAML_FILE,
run,
})
cli.run()
export function createCli (): Cli {
const port = DEFAULT_PORT
const registrationPath = REGISTRATION_FILE
const schema = SCHEMA_FILE
const bridgeConfig = {
schema,
}
const cli = new Cli({
bridgeConfig,
generateRegistration,
port,
registrationPath,
run,
})
return cli
}
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",
domain: "localhost"
},
instagram: {
clientId: "",
clientSecret: "",
publicUrlBase: "",
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",
domain: "localhost"
},
webhookBot: {
localpart: "_webhook",
appearance: {
displayName: "Webhook Bridge",
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { Logging, Cli, AppServiceRegistration } from "matrix-appservice-bridge";
import { Main } from "./Main";
import { IConfig } from "./IConfig";
const cli = new Cli({
bridgeConfig: {
affectsRegistration: true,
schema: "config/slack-config-schema.yaml",
},
registrationPath: "slack-registration.yaml",
generateRegistration(reg, callback) {
const config = cli.getConfig();
reg.setId(AppServiceRegistration.generateToken());
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("slackbot");
reg.addRegexPattern("users", `@${config.username_prefix}.*`, true);
callback(reg);
},
run(port: number, config: IConfig, registration: any) {
Logging.configure(config.logging || {});
limitations under the License.
*/
import { Cli, Bridge, AppServiceRegistration, ClientFactory, BridgeContext } from "matrix-appservice-bridge";
import * as yaml from "js-yaml";
import * as fs from "fs";
import { DiscordBridgeConfig } from "./config";
import { DiscordBot } from "./bot";
import { DiscordStore } from "./store";
import { Log } from "./log";
import "source-map-support/register";
import { MetricPeg, PrometheusBridgeMetrics } from "./metrics";
const log = new Log("DiscordAS");
const cli = new Cli({
bridgeConfig: {
affectsRegistration: true,
schema: "./config/config.schema.yaml",
},
generateRegistration,
registrationPath: "discord-registration.yaml",
run,
});
try {
cli.run();
} catch (err) {
log.error("Failed to start bridge.");
log.error(err);
}