diff options
author | Jordan <me@jordan.im> | 2023-08-18 00:08:21 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2023-08-18 00:08:21 -0700 |
commit | 61553158764c6801578076c72d8bffb423e343cc (patch) | |
tree | 5d45cf4b6699eebf01e9f2b6ac9ff0000819ebd2 /vendor/github.com/bwmarrin/discordgo/util.go | |
parent | 001a042ccba1c3faf340d8217ee8d15efa60dc05 (diff) | |
download | keep-61553158764c6801578076c72d8bffb423e343cc.tar.gz keep-61553158764c6801578076c72d8bffb423e343cc.zip |
misc: go get -u; go mod tidy; go mod vendor
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/util.go')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/util.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/util.go b/vendor/github.com/bwmarrin/discordgo/util.go index 86f43b5..957f301 100644 --- a/vendor/github.com/bwmarrin/discordgo/util.go +++ b/vendor/github.com/bwmarrin/discordgo/util.go @@ -51,7 +51,7 @@ func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType for i, file := range files { h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file%d"; filename="%s"`, i, quoteEscaper.Replace(file.Name))) + h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="files[%d]"; filename="%s"`, i, quoteEscaper.Replace(file.Name))) contentType := file.ContentType if contentType == "" { contentType = "application/octet-stream" @@ -107,3 +107,19 @@ func bannerURL(bannerHash, staticBannerURL, animatedBannerURL, size string) stri } return URL } + +func iconURL(iconHash, staticIconURL, animatedIconURL, size string) string { + var URL string + if iconHash == "" { + return "" + } else if strings.HasPrefix(iconHash, "a_") { + URL = animatedIconURL + } else { + URL = staticIconURL + } + + if size != "" { + return URL + "?size=" + size + } + return URL +} |