Fix GIF stickers
This commit is contained in:
		
							parent
							
								
									ec1550bc97
								
							
						
					
					
						commit
						0c1a015222
					
				
					 1 changed files with 5 additions and 6 deletions
				
			
		|  | @ -109,18 +109,17 @@ function emoji(emojiID, animated) { | |||
| } | ||||
| 
 | ||||
| const stickerFormat = new Map([ | ||||
| 	[1, {label: "PNG", ext: "png", mime: "image/png"}], | ||||
| 	[2, {label: "APNG", ext: "png", mime: "image/apng"}], | ||||
| 	[3, {label: "LOTTIE", ext: "json", mime: "lottie"}], | ||||
| 	[4, {label: "GIF", ext: "gif", mime: "image/gif"}] | ||||
| 	[1, {label: "PNG", ext: "png", mime: "image/png", endpoint: "/stickers/"}], | ||||
| 	[2, {label: "APNG", ext: "png", mime: "image/apng", endpoint: "/stickers/"}], | ||||
| 	[3, {label: "LOTTIE", ext: "json", mime: "lottie", endpoint: "/stickers/"}], | ||||
| 	[4, {label: "GIF", ext: "gif", mime: "image/gif", endpoint: "https://media.discordapp.net/stickers/"}] | ||||
| ]) | ||||
| 
 | ||||
| /** @param {{id: string, format_type: number}} sticker */ | ||||
| function sticker(sticker) { | ||||
| 	const format = stickerFormat.get(sticker.format_type) | ||||
| 	if (!format) throw new Error(`No such format ${sticker.format_type} for sticker ${JSON.stringify(sticker)}`) | ||||
| 	const ext = format.ext | ||||
| 	return `/stickers/${sticker.id}.${ext}` | ||||
| 	return `${format.endpoint}${sticker.id}.${format.ext}` | ||||
| } | ||||
| 
 | ||||
| module.exports.DISCORD_IMAGES_BASE = DISCORD_IMAGES_BASE | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue