How to use the matrix-appservice-bridge.RemoteUser 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 turt2live / matrix-appservice-instagram-media / src / InstagramBridge.js View on Github external
_onUserQuery(matrixUser) {
        // Avatar and name will eventually make it back to us from the profile service.
        var handle = matrixUser.localpart.substring('_instagram_'.length); // no dashes in uuid
        ProfileService.queueProfileCheck(handle);
        return Promise.resolve({
            remote: new RemoteUser(matrixUser.localpart)
        });
    }
}
github matrix-hacks / matrix-puppet-server / src / base.js View on Github external
return this.getThirdPartyUserDataById(thirdPartyUserId).then(thirdPartyUserData => {
          info("got 3p user data:", thirdPartyUserData);
          return new RemoteUser(thirdPartyUserId, {
            senderName: thirdPartyUserData.senderName
          });
        }).then(rUser => {
          return userStore.setRemoteUser(rUser);
github matrix-hacks / matrix-puppet-server / src / base.ts View on Github external
return this.adapter.getUserData(b2a(thirdPartyUserId)).then(thirdPartyUserData => {
          info("got 3p user data:", thirdPartyUserData);
          return new RemoteUser(thirdPartyUserId, thirdPartyUserData);
        }).then(rUser => {
          return userStore.setRemoteUser(rUser);
github Half-Shot / matrix-appservice-twitter / twitter-as.js View on Github external
return util.uploadContentFromUrl(bridge, twitter_user.profile_image_url_https, queriedUser.getId()).then((uri) => {
      return {
        name: twitter_user.name + " (@" + twitter_user.screen_name + ")",
        url: uri,
        remote: new RemoteUser(twitter_user.id_str)
      };
    });
  }).catch((error) => {
github matrix-org / matrix-bifrost / src / Store.ts View on Github external
private async _storeUser(userId: string, protocol: PurpleProtocol,
                             username: string, type: MUSER_TYPES, extraData: any = {})
                            : Promise<{remote: BifrostRemoteUser, matrix: MatrixUser}> {
        const id = Util.createRemoteId(protocol.id, username);
        const mxUser = (await this.userStore.getMatrixUser(userId)) || new MatrixUser(userId);
        const existing = await this.userStore.getRemoteUser(id);
        if (!existing) {
            const remoteUser = new RemoteUser(Util.createRemoteId(protocol.id, username), extraData);
            remoteUser.set("protocol_id", protocol.id);
            remoteUser.set("username", username);
            remoteUser.set("type", type);
            await this.userStore.linkUsers(mxUser, remoteUser);
            log.info(`Linked new ${type} ${userId} -> ${id}`);
            return {remote: new BifrostRemoteUser(
                remoteUser, userId, this.asBot.isRemoteUser(userId),
            ), matrix: mxUser};
        } else {
            const linkedMatrixUsers = await this.userStore.getMatrixLinks(id);
            if (!linkedMatrixUsers.includes(mxUser.getId())) {
                log.warn(`${id} was not correctly linked to ${mxUser.getId()}, resolving`);
                await this.userStore.linkUsers(mxUser, existing);
            }
            for (const lnkUserId of linkedMatrixUsers) {
                if (lnkUserId === mxUser.getId()) {