fix: 🐛 JSDoc

This commit is contained in:
Elysia
2023-04-22 13:32:37 +07:00
parent 26f48c90e4
commit e5ee2831f0
3 changed files with 28 additions and 4 deletions

View File

@@ -296,10 +296,24 @@ class User extends Base {
if ('badges' in data) {
/**
* User badges (Boost, Slash, AutoMod, etc.)
* @type {?Array<{ id: string, description: string, icon: string, link?: string }>}
* @callback BadgeIcon
* @returns {string}
*/
this.badges = data.badges;
/**
* @typedef {Object} UserBadge
* @property {string} id The id of the badge
* @property {string} description The description of the badge
* @property {string} icon The icon hash of the badge
* @property {?string} link The link of the badge
* @property {BadgeIcon} iconURL The iconURL of the badge
*/
/**
* User badges (Boost, Slash, AutoMod, etc.)
* @type {?Array<UserBadge>}
*/
this.badges = data.badges.map(o => ({ ...o, iconURL: () => this.client.rest.cdn.BadgeIcon(o.icon) }));
}
if ('guild_badges' in data) {

View File

@@ -227,6 +227,8 @@ exports.Endpoints = {
makeImageUrl(`${root}/role-icons/${roleId}/${hash}`, { size, format }),
guildScheduledEventCover: (scheduledEventId, coverHash, format, size) =>
makeImageUrl(`${root}/guild-events/${scheduledEventId}/${coverHash}`, { size, format }),
// Test only
BadgeIcon: hash => makeImageUrl(`${root}/badge-icons/${hash}.png`),
};
},
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),