Discord runs in the browser, same as HN. And the HTTP APIs they use aren't officially documented (except HN's read-only ones via Firebase and Algolia) (though both are easily reverse engineered and OSS frontends exist). There's not much difference.
Also AFAIK you cannot be banned from HN for using the API, whereas Discord will ban you for any “misuse”. You also don't need to be logged-in to access HN, which is also indexable by search engines, whereas Discord isn't.
There's a huge difference.