Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 7cb79dc

Browse files
author
jonas747
committed
added GuildRoleCreateComplex
1 parent bd0ead5 commit 7cb79dc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

restapi.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,20 @@ func (s *Session) GuildRoleCreate(guildID int64) (st *Role, err error) {
11191119
return
11201120
}
11211121

1122+
// GuildRoleCreateComplex returns a new Guild Role.
1123+
// guildID: The ID of a Guild.
1124+
func (s *Session) GuildRoleCreateComplex(guildID int64, roleCreate RoleCreate) (st *Role, err error) {
1125+
1126+
body, err := s.RequestWithBucketID("POST", EndpointGuildRoles(guildID), roleCreate, EndpointGuildRoles(guildID))
1127+
if err != nil {
1128+
return
1129+
}
1130+
1131+
err = unmarshal(body, &st)
1132+
1133+
return
1134+
}
1135+
11221136
// GuildRoleEdit updates an existing Guild Role with new values
11231137
// guildID : The ID of a Guild.
11241138
// roleID : The ID of a Role.

structs.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,14 @@ type ChannelEdit struct {
247247
RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"`
248248
}
249249

250+
type RoleCreate struct {
251+
Name string `json:"name,omitempty"`
252+
Permissions string `json:"permissions,omitempty"`
253+
Color int32 `json:"color,omitempty"`
254+
Hoist bool `json:"hoist"`
255+
Mentionable bool `json:"mentionable"`
256+
}
257+
250258
// A PermissionOverwrite holds permission overwrite data for a Channel
251259
type PermissionOverwrite struct {
252260
ID int64 `json:"id,string"`

0 commit comments

Comments
 (0)