arikawa/discord/url.go

35 lines
654 B
Go
Raw Permalink Normal View History

2020-01-02 05:39:52 +00:00
package discord
2020-05-15 19:28:35 +00:00
import "strings"
type ImageType string
const (
// AutoImage chooses automatically between a PNG and GIF.
AutoImage ImageType = "auto"
2020-05-15 20:13:15 +00:00
// JPEGImage is the JPEG image type.
2020-05-15 19:28:35 +00:00
JPEGImage ImageType = ".jpeg"
// PNGImage is the PNG image type.
PNGImage ImageType = ".png"
// WebPImage is the WebP image type.
WebPImage ImageType = ".webp"
// GIFImage is the GIF image type.
GIFImage ImageType = ".gif"
)
func (t ImageType) format(name string) string {
if t == AutoImage {
if strings.HasPrefix(name, "a_") {
return name + ".gif"
}
return name + ".png"
}
return name + string(t)
}
2020-01-02 05:39:52 +00:00
type URL = string
type Hash = string