Set channel and role edit perms to int64 (#867)
* set channel and role edit perms to int64 * add string serialization
This commit is contained in:
parent
e6a8d51c9b
commit
5f6bb2d120
1 changed files with 9 additions and 9 deletions
10
restapi.go
10
restapi.go
|
@ -1048,7 +1048,7 @@ func (s *Session) GuildRoleCreate(guildID string) (st *Role, err error) {
|
||||||
// hoist : Whether to display the role's users separately.
|
// hoist : Whether to display the role's users separately.
|
||||||
// perm : The permissions for the role.
|
// perm : The permissions for the role.
|
||||||
// mention : Whether this role is mentionable
|
// mention : Whether this role is mentionable
|
||||||
func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int, mention bool) (st *Role, err error) {
|
func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int64, mention bool) (st *Role, err error) {
|
||||||
|
|
||||||
// Prevent sending a color int that is too big.
|
// Prevent sending a color int that is too big.
|
||||||
if color > 0xFFFFFF {
|
if color > 0xFFFFFF {
|
||||||
|
@ -1060,7 +1060,7 @@ func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist b
|
||||||
Name string `json:"name"` // The role's name (overwrites existing)
|
Name string `json:"name"` // The role's name (overwrites existing)
|
||||||
Color int `json:"color"` // The color the role should have (as a decimal, not hex)
|
Color int `json:"color"` // The color the role should have (as a decimal, not hex)
|
||||||
Hoist bool `json:"hoist"` // Whether to display the role's users separately
|
Hoist bool `json:"hoist"` // Whether to display the role's users separately
|
||||||
Permissions int `json:"permissions"` // The overall permissions number of the role (overwrites existing)
|
Permissions int64 `json:"permissions,string"` // The overall permissions number of the role (overwrites existing)
|
||||||
Mentionable bool `json:"mentionable"` // Whether this role is mentionable
|
Mentionable bool `json:"mentionable"` // Whether this role is mentionable
|
||||||
}{name, color, hoist, perm, mention}
|
}{name, color, hoist, perm, mention}
|
||||||
|
|
||||||
|
@ -1807,13 +1807,13 @@ func (s *Session) ChannelInviteCreate(channelID string, i Invite) (st *Invite, e
|
||||||
// ChannelPermissionSet creates a Permission Override for the given channel.
|
// ChannelPermissionSet creates a Permission Override for the given channel.
|
||||||
// NOTE: This func name may changed. Using Set instead of Create because
|
// NOTE: This func name may changed. Using Set instead of Create because
|
||||||
// you can both create a new override or update an override with this function.
|
// you can both create a new override or update an override with this function.
|
||||||
func (s *Session) ChannelPermissionSet(channelID, targetID string, targetType PermissionOverwriteType, allow, deny int) (err error) {
|
func (s *Session) ChannelPermissionSet(channelID, targetID string, targetType PermissionOverwriteType, allow, deny int64) (err error) {
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type PermissionOverwriteType `json:"type"`
|
Type PermissionOverwriteType `json:"type"`
|
||||||
Allow int `json:"allow"`
|
Allow int64 `json:"allow,string"`
|
||||||
Deny int `json:"deny"`
|
Deny int64 `json:"deny,string"`
|
||||||
}{targetID, targetType, allow, deny}
|
}{targetID, targetType, allow, deny}
|
||||||
|
|
||||||
_, err = s.RequestWithBucketID("PUT", EndpointChannelPermission(channelID, targetID), data, EndpointChannelPermission(channelID, ""))
|
_, err = s.RequestWithBucketID("PUT", EndpointChannelPermission(channelID, targetID), data, EndpointChannelPermission(channelID, ""))
|
||||||
|
|
Loading…
Reference in a new issue