.webp => .png
This commit is contained in:
		
							parent
							
								
									e553888c1c
								
							
						
					
					
						commit
						84c106655c
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -3,11 +3,11 @@ import { ImageFormats, ImageSize } from '../types/cdn.ts' | ||||||
| /** Function to get Image URL from a resource on Discord CDN */ | /** Function to get Image URL from a resource on Discord CDN */ | ||||||
| export const ImageURL = ( | export const ImageURL = ( | ||||||
|   url: string, |   url: string, | ||||||
|   format: ImageFormats | undefined = 'webp', |   format: ImageFormats | undefined = 'png', | ||||||
|   size: ImageSize | undefined = 128 |   size: ImageSize | undefined = 128 | ||||||
| ): string => { | ): string => { | ||||||
|   size = size === undefined ? 128 : size |   size = size === undefined ? 128 : size | ||||||
|   if (url.includes('a_')) { |   if (url.includes('a_')) { | ||||||
|     return `${url}.${format === undefined ? 'gif' : format}?size=${size}` |     return `${url}.${format === undefined ? 'gif' : format}?size=${size}` | ||||||
|   } else return `${url}.${format === 'gif' ? 'webp' : format}?size=${size}` |   } else return `${url}.${format === 'gif' ? 'png' : format}?size=${size}` | ||||||
| } | } | ||||||
|  | @ -40,7 +40,7 @@ export class User extends Base { | ||||||
|     return `<@${this.id}>` |     return `<@${this.id}>` | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   avatarURL(format: ImageFormats = 'webp', size: ImageSize = 512): string { |   avatarURL(format: ImageFormats = 'png', size: ImageSize = 512): string { | ||||||
|     return this.avatar != null |     return this.avatar != null | ||||||
|       ? `${ImageURL(USER_AVATAR(this.id, this.avatar), format, size)}` |       ? `${ImageURL(USER_AVATAR(this.id, this.avatar), format, size)}` | ||||||
|       : `${DEFAULT_USER_AVATAR(String(Number(this.discriminator) % 5))}.png` |       : `${DEFAULT_USER_AVATAR(String(Number(this.discriminator) % 5))}.png` | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue