feat: user#bannerURL

This commit is contained in:
MARCROCK22 2024-03-26 15:09:32 -04:00
parent 933bbe7d1b
commit d119262f07
5 changed files with 12 additions and 3 deletions

View File

@ -107,7 +107,7 @@ class BaseCommand {
__filePath?: string; __filePath?: string;
__t?: { name: string | undefined; description: string | undefined }; __t?: { name: string | undefined; description: string | undefined };
__d?: true; __autoload?: true;
__tGroups?: Record< __tGroups?: Record<
string /* name for group*/, string /* name for group*/,
{ {

View File

@ -126,7 +126,7 @@ export function Options(options: (new () => SubCommand)[] | OptionsRecord) {
export function AutoLoad() { export function AutoLoad() {
return <T extends { new (...args: any[]): {} }>(target: T) => return <T extends { new (...args: any[]): {} }>(target: T) =>
class extends target { class extends target {
__d = true; __autoload = true;
}; };
} }

View File

@ -76,7 +76,7 @@ export class CommandHandler extends BaseHandler {
} }
commandInstance.__filePath = command.path; commandInstance.__filePath = command.path;
commandInstance.options ??= [] as NonNullable<Command['options']>; commandInstance.options ??= [] as NonNullable<Command['options']>;
if (commandInstance.__d) { if (commandInstance.__autoload) {
//@AutoLoad //@AutoLoad
const options = await this.getFiles(dirname(command.path)); const options = await this.getFiles(dirname(command.path));
for (const option of options) { for (const option of options) {

View File

@ -188,6 +188,10 @@ export class GuildMember extends BaseGuildMember {
return this.rest.cdn.guildMemberAvatar(this.guildId, this.id, this.avatar, options); return this.rest.cdn.guildMemberAvatar(this.guildId, this.id, this.avatar, options);
} }
bannerURL(options?: ImageOptions) {
return this.user.bannerURL(options);
}
async fetchPermissions() { async fetchPermissions() {
if ('permissions' in this) return this.permissions as PermissionsBitField; if ('permissions' in this) return this.permissions as PermissionsBitField;
return this.roles.permissions(); return this.roles.permissions();

View File

@ -38,6 +38,11 @@ export class User extends DiscordBase<APIUser> {
return this.rest.cdn.avatar(this.id, this.avatar, options); return this.rest.cdn.avatar(this.id, this.avatar, options);
} }
bannerURL(options?: ImageOptions) {
if (!this.banner) return;
return this.rest.cdn.banner(this.id, this.banner, options);
}
presence() { presence() {
return this.cache.presences?.get(this.id); return this.cache.presences?.get(this.id);
} }