This commit is contained in:
Travis CI 2016-12-13 03:35:10 +00:00
parent 131b312824
commit 88da356778
2 changed files with 45 additions and 6 deletions

View file

@ -141,7 +141,8 @@ exports.Errors = {
};
const PROTOCOL_VERSION = exports.PROTOCOL_VERSION = 6;
const API = exports.API = `https://discordapp.com/api/v${PROTOCOL_VERSION}`;
const HOST = exports.HOST = `https://discordapp.com`;
const API = exports.API = `${HOST}/api/v${PROTOCOL_VERSION}`;
const Endpoints = exports.Endpoints = {
// general
login: `${API}/auth/login`,
@ -150,6 +151,7 @@ const Endpoints = exports.Endpoints = {
botGateway: `${API}/gateway/bot`,
invite: (id) => `${API}/invite/${id}`,
inviteLink: (id) => `https://discord.gg/${id}`,
assets: (asset) => `${HOST}/assets/${asset}`,
CDN: 'https://cdn.discordapp.com',
// users
@ -381,6 +383,14 @@ exports.MessageTypes = {
6: 'PINS_ADD',
};
exports.DefaultAvatars = {
BLURPLE: '6debd47ed13483642cf09e832ed0bc1b',
GREY: '322c936a8c8be1b803cd94861bdfa868',
GREEN: 'dd4dbc0016779df1378e7812eabaa04d',
ORANGE: '0e291f67c9274a1abdddeb3fd919cbaa',
RED: '1cbd08c76f8af6dddce02c5138971129',
};
const PermissionFlags = exports.PermissionFlags = {
CREATE_INSTANT_INVITE: 1 << 0,
KICK_MEMBERS: 1 << 1,
@ -1053,6 +1063,26 @@ class User {
return Constants.Endpoints.avatar(this.id, this.avatar);
}
/**
* A link to the user's default avatar
* @type {string}
* @readonly
*/
get defaultAvatarURL() {
let defaultAvatars = Object.values(Constants.DefaultAvatars);
let defaultAvatar = this.discriminator % defaultAvatars.length;
return Constants.endpoints.assets(`${defaultAvatars[defaultAvatar]}.png`);
}
/**
* A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned
* @type {string}
* @readonly
*/
get displayAvatarURL() {
return this.avatarURL || this.defaultAvatarURL;
}
/**
* The note that is set for the user
* <warn>This is only available when using a user account.</warn>
@ -2712,6 +2742,15 @@ class GuildMember {
return this.user.id;
}
/**
* The nickname of the member, or their username if they don't have one
* @type {string}
* @readonly
*/
get displayName() {
return this.nickname || this.user.username;
}
/**
* The overall set of permissions for the guild member, taking only roles into account
* @type {EvaluatedPermissions}

10
discord.indev.min.js vendored

File diff suppressed because one or more lines are too long