rename req.userid -> req.user_id

This commit is contained in:
Flam3rboy
2021-03-08 18:40:37 +01:00
parent 56c9e43777
commit 6a1e0594dc
15 changed files with 309 additions and 78 deletions
+9 -20
View File
@@ -32,9 +32,9 @@ export const Endpoints = {
Emoji: (emojiID: string, format = "png") => `${root}/emojis/${emojiID}.${format}`,
Asset: (name: string) => `${root}/assets/${name}`,
DefaultAvatar: (discriminator: string) => `${root}/embed/avatars/${discriminator}.png`,
Avatar: (userID: string, hash: string, format = "webp", size: number, dynamic = false) => {
Avatar: (user_id: string, hash: string, format = "webp", size: number, dynamic = false) => {
if (dynamic) format = hash.startsWith("a_") ? "gif" : format;
return makeImageUrl(`${root}/avatars/${userID}/${hash}`, { format, size });
return makeImageUrl(`${root}/avatars/${user_id}/${hash}`, { format, size });
},
Banner: (guildID: string, hash: string, format = "webp", size: number) =>
makeImageUrl(`${root}/banners/${guildID}/${hash}`, { format, size }),
@@ -42,27 +42,18 @@ export const Endpoints = {
if (dynamic) format = hash.startsWith("a_") ? "gif" : format;
return makeImageUrl(`${root}/icons/${guildID}/${hash}`, { format, size });
},
AppIcon: (
clientID: string,
hash: string,
{ format = "webp", size }: { format?: string; size?: number } = {}
) => makeImageUrl(`${root}/app-icons/${clientID}/${hash}`, { size, format }),
AppAsset: (
clientID: string,
hash: string,
{ format = "webp", size }: { format?: string; size?: number } = {}
) => makeImageUrl(`${root}/app-assets/${clientID}/${hash}`, { size, format }),
AppIcon: (clientID: string, hash: string, { format = "webp", size }: { format?: string; size?: number } = {}) =>
makeImageUrl(`${root}/app-icons/${clientID}/${hash}`, { size, format }),
AppAsset: (clientID: string, hash: string, { format = "webp", size }: { format?: string; size?: number } = {}) =>
makeImageUrl(`${root}/app-assets/${clientID}/${hash}`, { size, format }),
GDMIcon: (channelID: string, hash: string, format = "webp", size: number) =>
makeImageUrl(`${root}/channel-icons/${channelID}/${hash}`, { size, format }),
Splash: (guildID: string, hash: string, format = "webp", size: number) =>
makeImageUrl(`${root}/splashes/${guildID}/${hash}`, { size, format }),
DiscoverySplash: (guildID: string, hash: string, format = "webp", size: number) =>
makeImageUrl(`${root}/discovery-splashes/${guildID}/${hash}`, { size, format }),
TeamIcon: (
teamID: string,
hash: string,
{ format = "webp", size }: { format?: string; size?: number } = {}
) => makeImageUrl(`${root}/team-icons/${teamID}/${hash}`, { size, format }),
TeamIcon: (teamID: string, hash: string, { format = "webp", size }: { format?: string; size?: number } = {}) =>
makeImageUrl(`${root}/team-icons/${teamID}/${hash}`, { size, format }),
};
},
invite: (root: string, code: string) => `${root}/${code}`,
@@ -346,9 +337,7 @@ export const MessageTypes = [
* * REPLY
* @typedef {string} SystemMessageType
*/
export const SystemMessageTypes = MessageTypes.filter(
(type: string | null) => type && type !== "DEFAULT" && type !== "REPLY"
);
export const SystemMessageTypes = MessageTypes.filter((type: string | null) => type && type !== "DEFAULT" && type !== "REPLY");
/**
* <info>Bots cannot set a `CUSTOM_STATUS`, it is only for custom statuses received from users</info>
+1 -1
View File
@@ -43,7 +43,7 @@ export async function addMember(user_id: bigint, guild_id: bigint, cache?: { gui
guild_id: guild_id,
nick: undefined,
roles: [guild_id], // @everyone role
joined_at: Date.now(),
joined_at: new Date(),
premium_since: undefined,
deaf: false,
mute: false,
+1 -1
View File
@@ -51,7 +51,7 @@ export class Length {
constructor(public type: any, public min: number, public max: number) {}
check(value: string) {
if (typeof value === "string") return value.length >= this.min && value.length <= this.max;
if (typeof value === "string" || Array.isArray(value)) return value.length >= this.min && value.length <= this.max;
if (typeof value === "number" || typeof value === "bigint") return value >= this.min && value <= this.max;
return false;
}