aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/bwmarrin/discordgo/util.go
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2023-08-18 00:08:21 -0700
committerJordan <me@jordan.im>2023-08-18 00:08:21 -0700
commit61553158764c6801578076c72d8bffb423e343cc (patch)
tree5d45cf4b6699eebf01e9f2b6ac9ff0000819ebd2 /vendor/github.com/bwmarrin/discordgo/util.go
parent001a042ccba1c3faf340d8217ee8d15efa60dc05 (diff)
downloadkeep-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.go18
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
+}