Skip to content

Commit

Permalink
feat(Session.UserUpdate)!: add banner support (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 authored Jun 21, 2024
1 parent d26ad10 commit e189ee5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/avatar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func main() {
// Now lets format our base64 image into the proper format Discord wants
// and then call UserUpdate to set it as our user's Avatar.
avatar := fmt.Sprintf("data:%s;base64,%s", contentType, base64img)
_, err = dg.UserUpdate("", avatar)
_, err = dg.UserUpdate("", avatar, "")
if err != nil {
fmt.Println(err)
}
Expand Down
5 changes: 3 additions & 2 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (s *Session) UserAvatarDecode(u *User, options ...RequestOption) (img image
}

// 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
// data:image/png;base64,BASE64_STRING_OF_NEW_AVATAR_PNG
Expand All @@ -368,7 +368,8 @@ func (s *Session) UserUpdate(username, avatar string, options ...RequestOption)
data := struct {
Username string `json:"username,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...)
if err != nil {
Expand Down

0 comments on commit e189ee5

Please sign in to comment.