aboutsummaryrefslogtreecommitdiff
path: root/src/hypixelApi.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/hypixelApi.ts')
-rw-r--r--src/hypixelApi.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts
index 42d4f74..40a972a 100644
--- a/src/hypixelApi.ts
+++ b/src/hypixelApi.ts
@@ -13,6 +13,10 @@ if (!process.env.hypixel_keys)
/** This array should only ever contain one item because using multiple hypixel api keys isn't allowed :) */
const apiKeys = process.env?.hypixel_keys?.split(' ') ?? []
+if (apiKeys.length === 0) {
+ console.warn('Warning: hypixel_keys was not found in .env. This will prevent the program from using the Hypixel API.')
+}
+
interface KeyUsage {
remaining: number
limit: number
@@ -100,6 +104,7 @@ export interface HypixelPlayerSocialMedia {
/** Send an HTTP request to the Hypixel API */
export let sendApiRequest = async<P extends keyof typedHypixelApi.Requests>(path: P, options: typedHypixelApi.Requests[P]['options']): Promise<typedHypixelApi.Requests[P]['response']['data']> => {
// Send a raw http request to api.hypixel.net, and return the parsed json
+ console.log('requesting', path, options)
let response: typedHypixelApi.Requests[P]['response']
try {
response = await typedHypixelApi.request(