mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
switch to cdn endpoints, add guild splash url (#932)
This commit is contained in:
parent
6043a1f83a
commit
edfb27f428
3 changed files with 16 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ class Emoji {
|
|||
* @readonly
|
||||
*/
|
||||
get url() {
|
||||
return `${Constants.Endpoints.CDN}/emojis/${this.id}.png`;
|
||||
return Constants.Endpoints.emoji(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -241,6 +241,16 @@ class Guild {
|
|||
return Constants.Endpoints.guildIcon(this.id, this.icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL to this guild's splash (if it has one, otherwise it returns null)
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
get splashURL() {
|
||||
if (!this.splash) return null;
|
||||
return Constants.Endpoints.guildSplash(this.id, this.splash);
|
||||
}
|
||||
|
||||
/**
|
||||
* The owner of the guild
|
||||
* @type {GuildMember}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ const Endpoints = exports.Endpoints = {
|
|||
// guilds
|
||||
guilds: `${API}/guilds`,
|
||||
guild: (guildID) => `${Endpoints.guilds}/${guildID}`,
|
||||
guildIcon: (guildID, hash) => `${Endpoints.guild(guildID)}/icons/${hash}.jpg`,
|
||||
guildIcon: (guildID, hash) => `${Endpoints.CDN}/icons/${guildID}/${hash}.jpg`,
|
||||
guildSplash: (guildID, hash) => `${Endpoints.CDN}/splashes/${guildID}/${hash}.jpg`,
|
||||
guildPrune: (guildID) => `${Endpoints.guild(guildID)}/prune`,
|
||||
guildEmbed: (guildID) => `${Endpoints.guild(guildID)}/embed`,
|
||||
guildInvites: (guildID) => `${Endpoints.guild(guildID)}/invites`,
|
||||
|
|
@ -136,6 +137,9 @@ const Endpoints = exports.Endpoints = {
|
|||
// oauth
|
||||
myApplication: `${API}/oauth2/applications/@me`,
|
||||
getApp: (id) => `${API}/oauth2/authorize?client_id=${id}`,
|
||||
|
||||
// emoji
|
||||
emoji: (emojiID) => `${Endpoints.CDN}/emojis/${emojiID}.png`,
|
||||
};
|
||||
|
||||
exports.Status = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue