How to use the @slack/client.CLIENT_EVENTS.WEB function in @slack/client

To help you get started, we’ve selected a few @slack/client 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 broidHQ / integrations / broid-slack / src / core / adapter.ts View on Github external
.map(() =>
        Promise.resolve({ type: "connected", serviceID: this.serviceId() }));
    const authenticated = Observable
      .fromEvent(this.session, CLIENT_EVENTS.RTM.AUTHENTICATED)
      .map((e: any) => {
        R.forEach((user) => this.storeUsers.set(user.id, user), e.users || []);
        R.forEach((channel) => this.storeChannels.set(channel.id, channel),
          e.channels || []);
        return Promise.resolve({ type: "authenticated", serviceID: this.serviceId() });
      });
    const disconnected = Observable
      .fromEvent(this.session, CLIENT_EVENTS.RTM.DISCONNECT)
      .map(() =>
        Promise.resolve({ type: "connected", serviceID: this.serviceId() }));
    const rateLimited = Observable
      .fromEvent(this.session, CLIENT_EVENTS.WEB.RATE_LIMITED)
      .map(() =>
        Promise.resolve({ type: "rate_limited", serviceID: this.serviceId() }));

    return Observable.merge(connected, authenticated, disconnected, rateLimited)
      .mergeAll();
  }
github broidHQ / integrations / broid-slack / src / core / Adapter.ts View on Github external
.map(() =>
        Promise.resolve({ type: 'connected', serviceID: this.serviceId() }));
    const authenticated = Observable
      .fromEvent(this.session, CLIENT_EVENTS.RTM.AUTHENTICATED)
      .map((e: any) => {
        R.forEach((user: any) => this.storeUsers.set(user.id, user), e.users || []);
        R.forEach(
          (channel: any) => this.storeChannels.set(channel.id, channel),
          e.channels || []);
        return Promise.resolve({ type: 'authenticated', serviceID: this.serviceId() });
      });
    const disconnected = Observable
      .fromEvent(this.session, CLIENT_EVENTS.RTM.DISCONNECT)
      .map(() => Promise.resolve({ type: 'disconnected', serviceID: this.serviceId() }));
    const rateLimited = Observable
      .fromEvent(this.session, CLIENT_EVENTS.WEB.RATE_LIMITED)
      .map(() => Promise.resolve({ type: 'rate_limited', serviceID: this.serviceId() }));

    this.connected = true;
    return Observable.merge(connected, authenticated, disconnected, rateLimited)
      .mergeAll();
  }