forked from pothtonswer/discordmuffin
feat(Session.UserUpdate)!: add banner support (#1509)
This commit is contained in:
parent
d26ad10ba6
commit
e189ee5de8
2 changed files with 4 additions and 3 deletions
|
@ -82,7 +82,7 @@ func main() {
|
||||||
// Now lets format our base64 image into the proper format Discord wants
|
// Now lets format our base64 image into the proper format Discord wants
|
||||||
// and then call UserUpdate to set it as our user's Avatar.
|
// and then call UserUpdate to set it as our user's Avatar.
|
||||||
avatar := fmt.Sprintf("data:%s;base64,%s", contentType, base64img)
|
avatar := fmt.Sprintf("data:%s;base64,%s", contentType, base64img)
|
||||||
_, err = dg.UserUpdate("", avatar)
|
_, err = dg.UserUpdate("", avatar, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ func (s *Session) UserAvatarDecode(u *User, options ...RequestOption) (img image
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserUpdate updates current user settings.
|
// UserUpdate updates current user settings.
|
||||||
func (s *Session) UserUpdate(username, avatar string, options ...RequestOption) (st *User, err error) {
|
func (s *Session) UserUpdate(username, avatar, banner string, options ...RequestOption) (st *User, err error) {
|
||||||
|
|
||||||
// NOTE: Avatar must be either the hash/id of existing Avatar or
|
// NOTE: Avatar must be either the hash/id of existing Avatar or
|
||||||
// data:image/png;base64,BASE64_STRING_OF_NEW_AVATAR_PNG
|
// data:image/png;base64,BASE64_STRING_OF_NEW_AVATAR_PNG
|
||||||
|
@ -368,7 +368,8 @@ func (s *Session) UserUpdate(username, avatar string, options ...RequestOption)
|
||||||
data := struct {
|
data := struct {
|
||||||
Username string `json:"username,omitempty"`
|
Username string `json:"username,omitempty"`
|
||||||
Avatar string `json:"avatar,omitempty"`
|
Avatar string `json:"avatar,omitempty"`
|
||||||
}{username, avatar}
|
Banner string `json:"banner,omitempty"`
|
||||||
|
}{username, avatar, banner}
|
||||||
|
|
||||||
body, err := s.RequestWithBucketID("PATCH", EndpointUser("@me"), data, EndpointUsers, options...)
|
body, err := s.RequestWithBucketID("PATCH", EndpointUser("@me"), data, EndpointUsers, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue