mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-05 06:26:08 +00:00
feat: remove dynamicAvatarURL, option exclude
added in GuildMember#avatarURL
This commit is contained in:
parent
9c2b37316a
commit
0fd02117ce
@ -46,7 +46,7 @@ export const CDNRouter = {
|
||||
return (value: string | CDNUrlOptions | undefined, options?: CDNUrlOptions) => {
|
||||
const lastRoute = `${CDN_URL}/${route.join('/')}`;
|
||||
let routeResult = lastRoute;
|
||||
if (typeof value === 'string') {
|
||||
if (typeof value === 'string' || typeof value === 'number') {
|
||||
routeResult = `${lastRoute}${value ? `/${value}` : ''}`;
|
||||
return parseCDNURL(routeResult, options);
|
||||
}
|
||||
|
@ -266,6 +266,8 @@ export class CommandHandler extends BaseHandler {
|
||||
this.client.options?.commands?.defaults?.onPermissionsFail;
|
||||
option.botPermissions ??= commandInstance.botPermissions;
|
||||
option.defaultMemberPermissions ??= commandInstance.defaultMemberPermissions;
|
||||
option.contexts ??= commandInstance.contexts;
|
||||
option.integrationTypes ??= commandInstance.integrationTypes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,17 +176,15 @@ export class GuildMember extends BaseGuildMember {
|
||||
return this.user.write(body);
|
||||
}
|
||||
|
||||
avatarURL(options?: ImageOptions) {
|
||||
if (!this.avatar) {
|
||||
return null;
|
||||
defaultAvatarURL() {
|
||||
return this.user.defaultAvatarURL();
|
||||
}
|
||||
|
||||
return this.rest.cdn.guilds(this.guildId).users(this.id).avatars(this.avatar).get(options);
|
||||
}
|
||||
|
||||
dynamicAvatarURL(options?: ImageOptions) {
|
||||
avatarURL(options: ImageOptions & { exclude: true }): string | null;
|
||||
avatarURL(options?: ImageOptions & { exclude?: false }): string;
|
||||
avatarURL(options?: ImageOptions & { exclude?: boolean }): string | null {
|
||||
if (!this.avatar) {
|
||||
return this.user.avatarURL(options);
|
||||
return options?.exclude ? null : this.user.avatarURL();
|
||||
}
|
||||
|
||||
return this.rest.cdn.guilds(this.guildId).users(this.id).avatars(this.avatar).get(options);
|
||||
|
@ -33,9 +33,13 @@ export class User extends DiscordBase<APIUser> {
|
||||
return this.client.users.write(this.id, body);
|
||||
}
|
||||
|
||||
defaultAvatarURL() {
|
||||
return this.rest.cdn.embed.avatars.get(calculateUserDefaultAvatarIndex(this.id, this.discriminator));
|
||||
}
|
||||
|
||||
avatarURL(options?: ImageOptions) {
|
||||
if (!this.avatar) {
|
||||
return this.rest.cdn.embed.avatars.get(calculateUserDefaultAvatarIndex(this.id, this.discriminator));
|
||||
return this.defaultAvatarURL();
|
||||
}
|
||||
|
||||
return this.rest.cdn.avatars(this.id).get(this.avatar, options);
|
||||
|
Loading…
x
Reference in New Issue
Block a user