func (m *Members) Filter(blacklists []string) (*Members, error) {
	newMembers := &Members{}
	if len(blacklists) == 0 {
		newMembers.Members = m.Members
		return newMembers, nil
	}

	for _, member := range m.Members {
		for _, blacklist := range blacklists {
			s := strings.Split(blacklist, ":")
			if len(s) != 2 {
				return nil, fmt.Errorf("exclude is specified in wrong format: %s", blacklist)
			}

			kind := s[0]
			val := s[1]

			switch kind {
			case "id":
				if member.ID != val {
					newMembers.Members = append(newMembers.Members, member)
				}
			case "email":
				if member.Email != val {
					newMembers.Members = append(newMembers.Members, member)
				}
			default:
				return nil, fmt.Errorf("blacklist format should be id or email blacklist: %s", blacklist)
			}
		}
	}

	return newMembers, nil
}
// Filter removes the excluded Slack users by ID or Email.
Filter removes the excluded Slack users by ID or Email.
// Filter removes the excluded Slack users by ID or Email .
func (m *Members) Filter(blacklists []string) (*Members, error) {
	newMembers := &Members{}
	if len(blacklists) == 0 {
		newMembers.Members = m.Members
		return newMembers, nil
	}
	for _, member := range m.Members {
		for _, blacklist := range blacklists {
			s := strings.Split(blacklist, ":")
			if len(s) != 2 {
				return nil, fmt.Errorf("exclude is specified in wrong format: %s", blacklist)
			}
			kind := s[0]
			val := s[1]
			switch kind {
			case "id":
				if member.ID != val {
					newMembers.Members = append(newMembers.Members, member)
				}
			case "email":
				if member.Email != val {
					newMembers.Members = append(newMembers.Members, member)
				}
			default:
				return nil, fmt.Errorf("blacklist format should be id or email blacklist: %s", blacklist)
			}
		}
	}
	return newMembers, nil
}
func ( m * Members ) Filter ( blacklists [ ] string ) ( * Members , error ) { newMembers := & Members { } if len ( blacklists ) == 0 { newMembers . Members = m . Members return newMembers , nil } for _ , member := range m . Members { for _ , blacklist := range blacklists { s := strings . Split ( blacklist , " " ) if len ( s ) != 2 { return nil , fmt . Errorf ( " " , blacklist ) } kind := s [ 0 ] val := s [ 1 ] switch kind { case " " : if member . ID != val { newMembers . Members = append ( newMembers . Members , member ) } case " " : if member . Email != val { newMembers . Members = append ( newMembers . Members , member ) } default : return nil , fmt . Errorf ( " " , blacklist ) } } } return newMembers , nil }
Filter removes the excluded Slack users by ID or Email.
Filter removes the excluded Slack users by ID or Email .