Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
iconUrlFormat(format?: null | string, query?: UrlQuery): null | string {
if (!this.icon) {
return null;
}
const hash = this.icon;
format = getFormatFromHash(
hash,
format,
this.client.imageFormat,
);
return addQuery(
Endpoints.CDN.URL + Endpoints.CDN.APP_ICON(this.id, hash, format),
query,
);
}
get defaultAvatarUrl(): string {
return Endpoints.CDN.URL + Endpoints.CDN.AVATAR_DEFAULT(this.discriminator);
}
splashUrlFormat(format?: null | string, query?: UrlQuery): null | string {
if (!this.splash) {
return null;
}
const hash = this.splash;
format = getFormatFromHash(
hash,
format,
this.client.imageFormat,
);
return addQuery(
Endpoints.CDN.URL + Endpoints.CDN.APP_ICON(this.id, hash, format),
query,
);
}
}
avatarUrlFormat(format?: null | string, query?: UrlQuery): string {
if (!this.avatar) {
return addQuery(this.defaultAvatarUrl, query);
}
const hash = this.avatar;
format = getFormatFromHash(hash, format, this.client.imageFormat);
return addQuery(Endpoints.CDN.URL + Endpoints.CDN.AVATAR(this.id, hash, format), query);
}