module Calamity.Utils.CDNUrl (
cdnURL,
assetHashFile,
isGIFAsset,
) where
import Data.Text qualified as T
import Network.HTTP.Req qualified as Req
cdnURL :: Req.Url 'Req.Https
cdnURL :: Url 'Https
cdnURL = Text -> Url 'Https
Req.https Text
"cdn.discordapp.com"
isGIFAsset :: T.Text -> Bool
isGIFAsset :: Text -> Bool
isGIFAsset = Text -> Text -> Bool
T.isPrefixOf Text
"a_"
assetHashFile :: T.Text -> T.Text
assetHashFile :: Text -> Text
assetHashFile Text
h = if Text -> Bool
isGIFAsset Text
h then Text
h Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".gif" else Text
h Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".png"