add debug logs

This commit is contained in:
Skillz
2020-03-14 14:13:22 -04:00
parent f27c7780f7
commit 99e6ea5efd
2 changed files with 7 additions and 4 deletions

View File

@@ -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)
})
}

View File

@@ -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 */