Do not allow sending role colors > 0xFFFFFF
This commit is contained in:
parent
0d1f5f55fb
commit
e2e03c3078
1 changed files with 5 additions and 0 deletions
|
@ -716,6 +716,11 @@ func (s *Session) GuildRoleCreate(guildID string) (st *Role, err error) {
|
||||||
// perm : The permissions for the role.
|
// perm : The permissions for the role.
|
||||||
func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int) (st *Role, err error) {
|
func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int) (st *Role, err error) {
|
||||||
|
|
||||||
|
// Prevent sending a color int that is too big.
|
||||||
|
if color > 0xFFFFFF {
|
||||||
|
err = fmt.Errorf("color value cannot be larger than 0xFFFFFF")
|
||||||
|
}
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
Name string `json:"name"` // The color the role should have (as a decimal, not hex)
|
Name string `json:"name"` // The color the role should have (as a decimal, not hex)
|
||||||
Color int `json:"color"` // Whether to display the role's users separately
|
Color int `json:"color"` // Whether to display the role's users separately
|
||||||
|
|
Loading…
Reference in a new issue