Distance between any two points in a compact metric space

I am given the following problem:

Show that if a metric space (X,d) is compact (meaning X is compact with respect to the metric d), then there exist points a,b ∈ X such that d(a,b) = sup{d(x,y) : x,y in X}. (Hint: You’ll need to use the fact that (X,d) is compact twice. In particular, this means that every compact metric space has an upper bound on how far away two points can be)

However, I am not sure if the problem has left out $X \subseteq \mathbb{R}$. Does the statement hold in a general metric space?

Secondly, how might one go about proving this?

Here is a way to use compactness once. Consider the given distance function $d:X\times X\to \mathbb R$. If $X$ is compact, then so is $X\times X$ (this is the easy part of Tychonoff that can actually be proved easily without recourse to anything complicated). Now, a continuous real-valued function on a compact set attains a maximum. The distance function is always (uniformly) continuous.
In case you are looking for a proof that avoids any topology: A metric space is compact if every sequence in it admits a convergent subsequence. Prove that if $X$ is compact, then so is $X\times X$. Then, suppose the distances were unbounded. Construct a sequence of pairs of points $(x_i,y_i)$ with unbounded distances. Extract a subsequence, use continuity of the distance function and get a contradiction. Thus the distances are bounded. Let $s$ be the supremum of all distances. Now construct a sequences of pairs as above that converges to the supremum. Extract a convergent subsequence, apply continuity of the distance function, and show the supermum is attained at the limit of the extracted subsequence.