From 1bec28bd8105aa09f43492491be9dd9cc7f7d701 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Thu, 13 Jun 2019 14:14:47 +0200 Subject: [PATCH] feat(Guild): default iconURL to gif if animated (#3338) * feat(Guild): default iconURL to gif if animated * Icon, not Banner * fix url --- src/util/Constants.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/Constants.js b/src/util/Constants.js index dc5ddb4572d9..993563c073f6 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -133,8 +133,10 @@ exports.Endpoints = { }, Banner: (guildID, hash, format = 'webp', size) => makeImageUrl(`${root}/banners/${guildID}/${hash}`, { format, size }), - Icon: (guildID, hash, format = 'webp', size) => - makeImageUrl(`${root}/icons/${guildID}/${hash}`, { format, size }), + Icon: (guildID, hash, format = 'default', size) => { + if (format === 'default') format = hash.startsWith('a_') ? 'gif' : 'webp'; + return makeImageUrl(`${root}/icons/${guildID}/${hash}`, { format, size }); + }, AppIcon: (clientID, hash, { format = 'webp', size } = {}) => makeImageUrl(`${root}/app-icons/${clientID}/${hash}`, { size, format }), AppAsset: (clientID, hash, { format = 'webp', size } = {}) =>