async validateDiscordSubjectsArg(context, orgId) {
    const guild = context.discordClient.guilds.cache.get(orgId);
    if (guild === undefined) {
      return true;
    }

    let areMembersNotOk = false;
    if (this.subjectIds.length > 0) {
      const collection = await guild.members.fetch();

      const filteredEntities = collection.filter(entity => this.subjectIds.includes(entity.id));

      areMembersNotOk = filteredEntities.size !== this.subjectIds.length;
    }

    let areRolesNotOk = false;
    if (this.subjectRoles.length > 0) {
      const fetchedManager = await guild.roles.fetch();
      const collection = fetchedManager.cache;

      const filteredEntities = collection.filter(entity => this.subjectRoles.includes(entity.id));

      areRolesNotOk = filteredEntities.size !== this.subjectRoles.length;
    }

    return areMembersNotOk || areRolesNotOk;
  }
/**
   * Validates that all given subjects (members and roles) are existing for the organization.
   * @param  {Context}  context the Bot's context
   * @param  {string}   orgId   the organization identifier
   * @return {Promise}          true if the validation passed
   */
Validates that all given subjects (members and roles) are existing for the organization.
@param  {Context}  context the Bot's context
@param  {string}   orgId   the organization identifier
@return {Promise}          true if the validation passed
Validates that all given subjects ( members and roles ) are existing for the organization . @param { Context } context the Bot ' s context @param { string } orgId the organization identifier @return { Promise } true if the validation passed
async validateDiscordSubjectsArg(context, orgId) {
    const guild = context.discordClient.guilds.cache.get(orgId);
    if (guild === undefined) {
      return true;
    }
    let areMembersNotOk = false;
    if (this.subjectIds.length > 0) {
      const collection = await guild.members.fetch();
      const filteredEntities = collection.filter(entity => this.subjectIds.includes(entity.id));
      areMembersNotOk = filteredEntities.size !== this.subjectIds.length;
    }
    let areRolesNotOk = false;
    if (this.subjectRoles.length > 0) {
      const fetchedManager = await guild.roles.fetch();
      const collection = fetchedManager.cache;
      const filteredEntities = collection.filter(entity => this.subjectRoles.includes(entity.id));
      areRolesNotOk = filteredEntities.size !== this.subjectRoles.length;
    }
    return areMembersNotOk || areRolesNotOk;
  }
async validateDiscordSubjectsArg ( context , orgId ) { const guild = context . discordClient . guilds . cache . get ( orgId ) ; if ( guild === undefined ) { return true ; } let areMembersNotOk = false ; if ( this . subjectIds . length > 0 ) { const collection = await guild . members . fetch ( ) ; const filteredEntities = collection . filter ( entity => this . subjectIds . includes ( entity . id ) ) ; areMembersNotOk = filteredEntities . size !== this . subjectIds . length ; } let areRolesNotOk = false ; if ( this . subjectRoles . length > 0 ) { const fetchedManager = await guild . roles . fetch ( ) ; const collection = fetchedManager . cache ; const filteredEntities = collection . filter ( entity => this . subjectRoles . includes ( entity . id ) ) ; areRolesNotOk = filteredEntities . size !== this . subjectRoles . length ; } return areMembersNotOk || areRolesNotOk ; }
Validates that all given subjects (members and roles) are existing for the organization.
Validates that all given subjects ( members and roles ) are existing for the organization .