mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-25 03:19:20 +00:00
Discord: add ImageType
This commit is contained in:
parent
aa99f50b9c
commit
ceb6986749
|
@ -1,4 +1,34 @@
|
||||||
package discord
|
package discord
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
type ImageType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// AutoImage chooses automatically between a PNG and GIF.
|
||||||
|
AutoImage ImageType = "auto"
|
||||||
|
|
||||||
|
// JPEGImage is a JPEG image type.
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
type URL = string
|
type URL = string
|
||||||
type Hash = string
|
type Hash = string
|
||||||
|
|
Loading…
Reference in a new issue