github.com/diamondburned/arikawa/v2@v2.1.0/discord/url.go (about)

     1  package discord
     2  
     3  import "strings"
     4  
     5  type ImageType string
     6  
     7  const (
     8  	// AutoImage chooses automatically between a PNG and GIF.
     9  	AutoImage ImageType = "auto"
    10  
    11  	// JPEGImage is the JPEG image type.
    12  	JPEGImage ImageType = ".jpeg"
    13  	// PNGImage is the PNG image type.
    14  	PNGImage ImageType = ".png"
    15  	// WebPImage is the WebP image type.
    16  	WebPImage ImageType = ".webp"
    17  	// GIFImage is the GIF image type.
    18  	GIFImage ImageType = ".gif"
    19  )
    20  
    21  func (t ImageType) format(name string) string {
    22  	if t == AutoImage {
    23  		if strings.HasPrefix(name, "a_") {
    24  			return name + ".gif"
    25  		}
    26  
    27  		return name + ".png"
    28  	}
    29  
    30  	return name + string(t)
    31  }
    32  
    33  type URL = string
    34  type Hash = string