Webpack build for branch master: 305a7d14af

This commit is contained in:
Travis CI 2017-03-31 21:17:06 +00:00
parent 53dc7b9b78
commit aba306582b
2 changed files with 19 additions and 13 deletions

View file

@ -138,6 +138,7 @@ exports.DefaultOptions = {
http: {
version: 6,
host: 'https://discordapp.com',
cdn: 'https://cdn.discordapp.com',
},
};
@ -155,7 +156,7 @@ exports.Errors = {
INVALID_TOKEN: 'An invalid token was provided.',
};
exports.Endpoints = {
const Endpoints = exports.Endpoints = {
User: userID => {
if (userID.id) userID = userID.id;
const base = `/users/${userID}`;
@ -169,9 +170,9 @@ exports.Endpoints = {
Note: id => `${base}/notes/${id}`,
Mentions: (limit, roles, everyone, guildID) =>
`${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,
Avatar: hash => {
Avatar: (root, hash) => {
if (userID === '1') return hash;
return hash;
return Endpoints.CDN(root).Avatar(userID, hash);
},
};
},
@ -196,8 +197,8 @@ exports.Endpoints = {
ack: `${base}/ack`,
settings: `${base}/settings`,
Emoji: emojiID => `${base}/emojis/${emojiID}`,
Icon: hash => `cdn/${hash}`,
Splash: hash => `cdn/${hash}`,
Icon: (root, hash) => Endpoints.CDN(root).Icon(guildID, hash),
Splash: (root, hash) => Endpoints.CDN(root).Splash(guildID, hash),
Role: roleID => `${base}/roles/${roleID}`,
Member: memberID => {
const mbase = `${base}/members/${memberID}`;
@ -248,9 +249,14 @@ exports.Endpoints = {
},
Message: m => exports.Endpoints.Channel(m.channel).Message(m),
Member: m => exports.Endpoints.Guild(m.guild).Member(m),
CDN: {
Emoji: emojiID => `/emojis/$${emojiID}.png`,
Asset: name => `/assets/${name}`,
CDN(root) {
return {
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: {
Application: appID => {
@ -2136,7 +2142,7 @@ class User {
*/
get avatarURL() {
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);
}
/**
@ -4398,7 +4404,7 @@ class Guild {
*/
get iconURL() {
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);
}
/**
@ -4408,7 +4414,7 @@ class Guild {
*/
get splashURL() {
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);
}
/**

File diff suppressed because one or more lines are too long