mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
whoops (#1325)
This commit is contained in:
@@ -245,7 +245,7 @@ class Guild {
|
|||||||
*/
|
*/
|
||||||
get iconURL() {
|
get iconURL() {
|
||||||
if (!this.icon) return null;
|
if (!this.icon) return null;
|
||||||
return Constants.Endpoints.guildIcon(this.id, this.icon);
|
return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,7 +255,7 @@ class Guild {
|
|||||||
*/
|
*/
|
||||||
get splashURL() {
|
get splashURL() {
|
||||||
if (!this.splash) return null;
|
if (!this.splash) return null;
|
||||||
return Constants.Endpoints.guildSplash(this.id, this.splash);
|
return Constants.Endpoints.Guild(this).Splash(this.client.options.http.cdn, this.splash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class User {
|
|||||||
*/
|
*/
|
||||||
get avatarURL() {
|
get avatarURL() {
|
||||||
if (!this.avatar) return null;
|
if (!this.avatar) return null;
|
||||||
return Constants.Endpoints.avatar(this.id, this.avatar);
|
return Constants.Endpoints.User(this).Avatar(this.client.options.http.cdn, this.avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ exports.DefaultOptions = {
|
|||||||
http: {
|
http: {
|
||||||
version: 6,
|
version: 6,
|
||||||
host: 'https://discordapp.com',
|
host: 'https://discordapp.com',
|
||||||
|
cdn: 'https://cdn.discordapp.com',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ exports.Errors = {
|
|||||||
INVALID_TOKEN: 'An invalid token was provided.',
|
INVALID_TOKEN: 'An invalid token was provided.',
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Endpoints = {
|
const Endpoints = exports.Endpoints = {
|
||||||
User: userID => {
|
User: userID => {
|
||||||
if (userID.id) userID = userID.id;
|
if (userID.id) userID = userID.id;
|
||||||
const base = `/users/${userID}`;
|
const base = `/users/${userID}`;
|
||||||
@@ -97,9 +98,9 @@ exports.Endpoints = {
|
|||||||
Note: id => `${base}/notes/${id}`,
|
Note: id => `${base}/notes/${id}`,
|
||||||
Mentions: (limit, roles, everyone, guildID) =>
|
Mentions: (limit, roles, everyone, guildID) =>
|
||||||
`${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,
|
`${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,
|
||||||
Avatar: hash => {
|
Avatar: (root, hash) => {
|
||||||
if (userID === '1') return hash;
|
if (userID === '1') return hash;
|
||||||
return hash;
|
return Endpoints.CDN(root).Avatar(userID, hash);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -124,8 +125,8 @@ exports.Endpoints = {
|
|||||||
ack: `${base}/ack`,
|
ack: `${base}/ack`,
|
||||||
settings: `${base}/settings`,
|
settings: `${base}/settings`,
|
||||||
Emoji: emojiID => `${base}/emojis/${emojiID}`,
|
Emoji: emojiID => `${base}/emojis/${emojiID}`,
|
||||||
Icon: hash => `cdn/${hash}`,
|
Icon: (root, hash) => Endpoints.CDN(root).Icon(guildID, hash),
|
||||||
Splash: hash => `cdn/${hash}`,
|
Splash: (root, hash) => Endpoints.CDN(root).Splash(guildID, hash),
|
||||||
Role: roleID => `${base}/roles/${roleID}`,
|
Role: roleID => `${base}/roles/${roleID}`,
|
||||||
Member: memberID => {
|
Member: memberID => {
|
||||||
const mbase = `${base}/members/${memberID}`;
|
const mbase = `${base}/members/${memberID}`;
|
||||||
@@ -176,9 +177,14 @@ exports.Endpoints = {
|
|||||||
},
|
},
|
||||||
Message: m => exports.Endpoints.Channel(m.channel).Message(m),
|
Message: m => exports.Endpoints.Channel(m.channel).Message(m),
|
||||||
Member: m => exports.Endpoints.Guild(m.guild).Member(m),
|
Member: m => exports.Endpoints.Guild(m.guild).Member(m),
|
||||||
CDN: {
|
CDN(root) {
|
||||||
Emoji: emojiID => `/emojis/$${emojiID}.png`,
|
return {
|
||||||
Asset: name => `/assets/${name}`,
|
Emoji: emojiID => `${root}/emojis/$${emojiID}.png`,
|
||||||
|
Asset: name => `${root}/assets/${name}`,
|
||||||
|
Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png'}?size=2048`,
|
||||||
|
Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`,
|
||||||
|
Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
OAUTH2: {
|
OAUTH2: {
|
||||||
Application: appID => {
|
Application: appID => {
|
||||||
|
|||||||
Reference in New Issue
Block a user