mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
formatting
This commit is contained in:
1
mod.ts
1
mod.ts
@@ -17,7 +17,6 @@ Client({
|
||||
if (!message.guild_id) return;
|
||||
const guild = cache.guilds.get(message.guild_id);
|
||||
if (!guild) return logYellow("no guild");
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -60,7 +60,7 @@ export const RequestManager = {
|
||||
},
|
||||
};
|
||||
|
||||
function createRequestBody (body: any, method?: RequestMethod) {
|
||||
function createRequestBody(body: any, method?: RequestMethod) {
|
||||
return {
|
||||
headers: {
|
||||
Authorization: authorization,
|
||||
@@ -72,7 +72,7 @@ function createRequestBody (body: any, method?: RequestMethod) {
|
||||
body: JSON.stringify(body),
|
||||
method: method?.toUpperCase(),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
async function checkRatelimits(url: string) {
|
||||
const ratelimited = ratelimitedPaths.get(url);
|
||||
@@ -109,7 +109,7 @@ async function runMethod(
|
||||
) {
|
||||
if (retryCount > 10) throw new Error(Errors.RATE_LIMIT_RETRY_MAXED);
|
||||
await delay(json.retry_after);
|
||||
return runMethod(method, url, body, retryCount++)
|
||||
return runMethod(method, url, body, retryCount++);
|
||||
}
|
||||
|
||||
return resolve(json);
|
||||
@@ -124,7 +124,7 @@ async function runMethod(
|
||||
processQueue();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function processHeaders(url: string, headers: Headers) {
|
||||
// If a rate limit response is encountered this will become true and returned
|
||||
@@ -160,4 +160,4 @@ function processHeaders(url: string, headers: Headers) {
|
||||
|
||||
// Returns a boolean to check if we need to request again once the rate limit resets
|
||||
return ratelimited;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -252,11 +252,13 @@ export const createGuild = (data: CreateGuildPayload) => {
|
||||
return RequestManager.post(endpoints.GUILD_PRUNE(data.id), { days });
|
||||
},
|
||||
fetchMembers: (options?: FetchMembersOptions) => {
|
||||
if (!(identifyPayload.intents & Intents.GUILD_MEMBERS)) throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS)
|
||||
if (!(identifyPayload.intents & Intents.GUILD_MEMBERS)) {
|
||||
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
requestAllMembers(data.id, resolve, guild.memberCount, options)
|
||||
})
|
||||
requestAllMembers(data.id, resolve, guild.memberCount, options);
|
||||
});
|
||||
},
|
||||
/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */
|
||||
getAuditLogs: (options: GetAuditLogsOptions) => {
|
||||
|
||||
@@ -14,7 +14,7 @@ export function createMessage(data: MessageCreateOptions) {
|
||||
return {
|
||||
...data,
|
||||
raw: data,
|
||||
mentions: data.mentions.map(user => createUser(user)),
|
||||
mentions: data.mentions.map((user) => createUser(user)),
|
||||
author: createUser({ ...data.author, avatar: data.author.avatar || "" }),
|
||||
timestamp: Date.parse(data.timestamp),
|
||||
editedTimestamp: data.edited_timestamp
|
||||
|
||||
@@ -22,5 +22,5 @@ export enum Errors {
|
||||
NICKNAMES_MAX_LENGTH = "NICKNAMES_MAX_LENGTH",
|
||||
PRUNE_MIN_DAYS = "PRUNE_MIN_DAYS",
|
||||
RATE_LIMIT_RETRY_MAXED = "RATE_LIMIT_RETRY_MAXED",
|
||||
MISSING_INTENT_GUILD_MEMBERS = "MISSING_INTENT_GUILD_MEMBERS"
|
||||
MISSING_INTENT_GUILD_MEMBERS = "MISSING_INTENT_GUILD_MEMBERS",
|
||||
}
|
||||
|
||||
@@ -5,7 +5,5 @@ export const formatImageURL = (
|
||||
size: ImageSize = 128,
|
||||
format?: ImageFormats,
|
||||
) => {
|
||||
return `${url}.${
|
||||
format || url.includes("/a_") ? "gif" : "jpg"
|
||||
}?size=${size}`;
|
||||
return `${url}.${format || url.includes("/a_") ? "gif" : "jpg"}?size=${size}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user