1. Hi there, I'm pretty new to javascript and I'm attemping to make a simple discord bot that tells you somebody's Hypixel level, the issue is I have no idea where to begin learning how to use APIs/the Hypixel API. Could anybody point me towards some useful resources to start figuring this out? I've found tutorials that are along these lines but they're mainly for websites using HTML, whereas I'm making a discord bot using purely javascript and I can't quite work out how to translate one into the other.
  2. #2
    • Like Like x 1
  3. Quick clarification:
    Are you using Node.js, or just Javascript?
  4. Node.js, sorry I didn't know what information to include :p
  5. If you are using Node.js then there are a number of packages available to help you with the Hypixel API, as well as the Discord API. It is a little hard to help since I don't know specifically how much you know, and how comfortable you are with various concepts. Here are some packages:
    The Hypixel package I use: https://www.npmjs.com/package/hypixel
    The Discord.js library: https://www.npmjs.com/package/discord.js
    More Hypixel API wrappers: https://hypixel.net/threads/hypixel-api-wrappers.1387746/
    Check out the documentation of these packages and then come back with any questions.

    You don't need to know how JSON/RESTful APIs work to use these packages, however it might be helpful, and it's good knowledge to have in general. This guide will cover a lot of the basics of JSON. If you've worked at all with objects and arrays in Javascript so far, you might notice it looks awfully familiar (JSON literally stands for JavaScript Object Notation), in which case you should get the hang of the first few pages pretty quickly.

    In terms of REST, here's a quick article on what it means to be a RESTful API (I don't think part 2 of this article is necessary to read for you at this point in time, however feel free). RESTful APIs are currently the most popular type of client-server API, and JSON is the most popular "medium" to transfer the data returned by these APIs (alternatives might be XML or YAML). Both the Discord API and the Hypixel API use RESTful APIs, and send JSON responses, so the packages listed above all use the same core concepts of sending out HTTP requests to the APIs, parsing the JSON, and then transforming it into an object for you to use. They simply make it easier, so you don't have to create the HTTP requests, check for errors, etc. yourself.

    Read those articles, the documentation, etc. and let me know if you have any other questions or are just completely confused.
    • Useful Useful x 2
  6. Thank you so much, I'll read though these properly tomorrow, but at first glance this looks like exactly what I've been looking for.
    • Like Like x 1

Share This Page