How to use the matrix-appservice-bridge.RoomBridgeStore 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 matrix-org / matrix-bifrost / test / mocks / store.ts View on Github external
export function mockStore(remoteUserRegex = DEF_REGEX): Store {
    const userStore = new UserBridgeStore(new Datastore());
    const roomStore = new RoomBridgeStore(new Datastore());
    return new Store({
        getRoomStore: () => roomStore,
        getUserStore: () => userStore,
        getBot: () => ({
            isRemoteUser: (u) => remoteUserRegex.exec(u) !== null,
        }),
    });
}
github matrix-org / matrix-appservice-slack / src / scripts / migrateToPostgres.ts View on Github external
const eventStore = new NeDB({ filename: path.join(NEDB_DIRECTORY, "event-store.db"), ...config});

    try {
        await promisify(teamStore.loadDatabase).bind(teamStore)();
        await promisify(roomStore.loadDatabase).bind(roomStore)();
        await promisify(userStore.loadDatabase).bind(userStore)();
        await promisify(eventStore.loadDatabase).bind(eventStore)();
    } catch (ex) {
        log.error("Couldn't load datastores");
        log.error("Ensure you have given the correct path to the database.");
        throw ex;
    }

    const nedb = new NedbDatastore(
        new UserBridgeStore(userStore),
        new RoomBridgeStore(roomStore),
        new EventBridgeStore(eventStore),
        teamStore,
    );
    try {
        const startedAt = Date.now();
        await migrateFromNedb(nedb, pgres);
        log.info(`Completed migration in ${Math.round(Date.now() - startedAt)}ms`);
    } catch (ex) {
        log.error("An error occured while migrating databases:");
        log.error(ex);
        log.error("Your existing databases have not been modified, but you may need to drop the postgres table and start over");
    }
}
github huan / matrix-appservice-wechaty / src / appservice-manager.spec.ts View on Github external
    getRoomStore: () => new RoomBridgeStore(new Nedb()),
    getUserStore: () => new UserBridgeStore(new Nedb()),