First of all, I'm guessing you intended to write $\displaystyle f:\mathbb{Z}\rightarrow \mathbb{Z}=$ a function from the integers to the integers.
Second, if $\displaystyle \forall x\in\mathbb{Z}\,,\,\,f(x)=k=$ a constant, then from the given functional relation $\displaystyle f(x+y)+f(xy-1)=f(x)f(y)-2$ it
follows that $\displaystyle 2k=k^2-2\Longrightarrow k^2-2k-2=0$ , and this quadratic has two real non-integer solutions, contradiction.
Next, inputting
(a) $\displaystyle x=y=0$ in the func. relation we get $\displaystyle f(0)+f(-1)=f(0)^2-2$ ;
(b) inputting $\displaystyle x=y=-1$ we get $\displaystyle f(-2)+f(0)=f(-1)^2-2$ , and;
(c) inputting $\displaystyle x=-1\,,\,y=0$ we get $\displaystyle 2f(-1)=f(-1)f(0)-2$
Now you can find $\displaystyle f(-1)$ as a function of $\displaystyle f(0)$ and substitute then in (a) to get $\displaystyle f(0)$ and etc. (Do you know/remember how to search for rational/integer roots of integral polynomials? This can come handy in this case)
Hmmm... the problem is that the only two possible values for $\displaystyle f(0)$ yield non-integer values for $\displaystyle f(-1)$...
.Check this.
I miscalculated: there's only one possible value for $\displaystyle f(0)$ which then gives one integer value for $\displaystyle f(-1)$ and then one unique integer value for $\displaystyle f(-2)$...fine!
Tonio