discordgo icon indicating copy to clipboard operation
discordgo copied to clipboard

the function ChannelEditComplex does not respect omitting Position

Open VMpc opened this issue 3 years ago • 1 comments

The struct (ChannelEdit) in structs.go does not have an "omitempty" tag after Position resulting in it changing the channel position if you do not specify.

type ChannelEdit struct {
	Name                 string                 `json:"name,omitempty"`
	Topic                string                 `json:"topic,omitempty"`
	NSFW                 bool                   `json:"nsfw,omitempty"`
	Position             int                    `json:"position"` // here (Should be `json:"position,omitempty"`)
	Bitrate              int                    `json:"bitrate,omitempty"`
	UserLimit            int                    `json:"user_limit,omitempty"`
	PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"`
	ParentID             string                 `json:"parent_id,omitempty"`
	RateLimitPerUser     int                    `json:"rate_limit_per_user,omitempty"`
}

VMpc avatar May 03 '21 04:05 VMpc

Unfortunately adding omitempty will prevent moving a channel to the top (position 0). Related #808.

njhanley avatar Apr 09 '22 22:04 njhanley