Use `type` in `fish` like in Bourne-like shell:

 if type -q figlet
 hostname | figlet
 end

Or to limit to executables in `$PATH` (ignoring functions, builtins):

 if command -s figlet > /dev/null
 hostname | figlet
 end

See also [Why not use “which”? What to use then?](/q/85249)