mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Add iconURL/avatarURL and fix object.values reference
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,8 +1,3 @@
|
|||||||
const values = require('object.values');
|
|
||||||
const Client = require('./client/Client');
|
const Client = require('./client/Client');
|
||||||
|
|
||||||
if (!Object.values) {
|
|
||||||
values.shim();
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.Client = Client;
|
exports.Client = Client;
|
||||||
|
|||||||
@@ -522,6 +522,18 @@ class Guild {
|
|||||||
setSplash(splash) {
|
setSplash(splash) {
|
||||||
return this.edit({ splash });
|
return this.edit({ splash });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL to this guild's icon (if it has one, otherwise it returns null)
|
||||||
|
* @type {?String}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get iconURL() {
|
||||||
|
if (!this.icon) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Constants.Endpoints.guildIcon(this.id, this.icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Guild;
|
module.exports = Guild;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const TextBasedChannel = require('./interface/TextBasedChannel');
|
const TextBasedChannel = require('./interface/TextBasedChannel');
|
||||||
|
const Constants = require('../util/Constants');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a User on Discord.
|
* Represents a User on Discord.
|
||||||
@@ -65,6 +66,18 @@ class User {
|
|||||||
return `<@${this.id}>`;
|
return `<@${this.id}>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to the user's avatar (if they have one, otherwise null)
|
||||||
|
* @type {?String}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get avatarURL() {
|
||||||
|
if (!this.avatar) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Constants.Endpoints.avatar(this.id, this.avatar);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a DM Channel (if one exists) between the Client and the User. Resolves with the Channel if successful.
|
* Deletes a DM Channel (if one exists) between the Client and the User. Resolves with the Channel if successful.
|
||||||
* @return {Promise<DMChannel>}
|
* @return {Promise<DMChannel>}
|
||||||
|
|||||||
Reference in New Issue
Block a user