diff --git a/module/request_manager.ts b/module/request_manager.ts index d5dc2abdc..f703f2e45 100644 --- a/module/request_manager.ts +++ b/module/request_manager.ts @@ -82,8 +82,8 @@ const process_headers = (url: string, headers: Headers) => { // Get all useful headers const remaining = headers.get("x-ratelimit-remaining") const reset_timestamp = headers.get("x-ratelimit-reset") - const retry_after = headers.get('retry-after') - const global = headers.get('x-ratelimit-global') + const retry_after = headers.get("retry-after") + const global = headers.get("x-ratelimit-global") // If there is no remaining rate limit for this endpoint, we save it in cache if (remaining && remaining === "0") { @@ -99,8 +99,8 @@ const process_headers = (url: string, headers: Headers) => { if (global) { ratelimited = true - ratelimited_paths.set('global', { - url: 'global', + ratelimited_paths.set("global", { + url: "global", reset_timestamp: Date.now() + Number(retry_after) }) } diff --git a/structures/channel.ts b/structures/channel.ts index 3e4a5440f..a6f8c5dcc 100644 --- a/structures/channel.ts +++ b/structures/channel.ts @@ -72,6 +72,7 @@ export const create_channel = (data: Channel_Create_Payload, client: Client) => }, /** Send a message to the channel. Requires SEND_MESSAGES permission. */ send_message: async (content: string | MessageContent) => { + console.log('SENDING_MESSAGE:', content) if (typeof content === "string") content = { content } if (data.guild_id) { @@ -83,7 +84,9 @@ export const create_channel = (data: Channel_Create_Payload, client: Client) => if (content.content && content.content.length > 2000) throw new Error(Errors.MESSAGE_MAX_LENGTH) + console.log(endpoints.CHANNEL_MESSAGES(data.id)) const result = await Request_Manager.post(endpoints.CHANNEL_MESSAGES(data.id), content) + console.log(result) return create_message(result, client) }, /** The position of the channel in the server. If this channel does not have a position for example DM channels, it will be -1 */