mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-05 14:36:09 +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) => {
|
return (value: string | CDNUrlOptions | undefined, options?: CDNUrlOptions) => {
|
||||||
const lastRoute = `${CDN_URL}/${route.join('/')}`;
|
const lastRoute = `${CDN_URL}/${route.join('/')}`;
|
||||||
let routeResult = lastRoute;
|
let routeResult = lastRoute;
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string' || typeof value === 'number') {
|
||||||
routeResult = `${lastRoute}${value ? `/${value}` : ''}`;
|
routeResult = `${lastRoute}${value ? `/${value}` : ''}`;
|
||||||
return parseCDNURL(routeResult, options);
|
return parseCDNURL(routeResult, options);
|
||||||
}
|
}
|
||||||
|
@ -266,6 +266,8 @@ export class CommandHandler extends BaseHandler {
|
|||||||
this.client.options?.commands?.defaults?.onPermissionsFail;
|
this.client.options?.commands?.defaults?.onPermissionsFail;
|
||||||
option.botPermissions ??= commandInstance.botPermissions;
|
option.botPermissions ??= commandInstance.botPermissions;
|
||||||
option.defaultMemberPermissions ??= commandInstance.defaultMemberPermissions;
|
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);
|
return this.user.write(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarURL(options?: ImageOptions) {
|
defaultAvatarURL() {
|
||||||
if (!this.avatar) {
|
return this.user.defaultAvatarURL();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.rest.cdn.guilds(this.guildId).users(this.id).avatars(this.avatar).get(options);
|
avatarURL(options: ImageOptions & { exclude: true }): string | null;
|
||||||
}
|
avatarURL(options?: ImageOptions & { exclude?: false }): string;
|
||||||
|
avatarURL(options?: ImageOptions & { exclude?: boolean }): string | null {
|
||||||
dynamicAvatarURL(options?: ImageOptions) {
|
|
||||||
if (!this.avatar) {
|
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);
|
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);
|
return this.client.users.write(this.id, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultAvatarURL() {
|
||||||
|
return this.rest.cdn.embed.avatars.get(calculateUserDefaultAvatarIndex(this.id, this.discriminator));
|
||||||
|
}
|
||||||
|
|
||||||
avatarURL(options?: ImageOptions) {
|
avatarURL(options?: ImageOptions) {
|
||||||
if (!this.avatar) {
|
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);
|
return this.rest.cdn.avatars(this.id).get(this.avatar, options);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user