Added hoist and color editing for roles
This commit is contained in:
@@ -139,6 +139,10 @@ namespace Discord.API
|
||||
public string Name;
|
||||
[JsonProperty("permissions", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public uint? Permissions;
|
||||
[JsonProperty("hoist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? Hoist;
|
||||
[JsonProperty("color", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public uint? Color;
|
||||
}
|
||||
|
||||
//Servers
|
||||
|
||||
@@ -270,12 +270,12 @@ namespace Discord
|
||||
|
||||
return _rest.Delete(Endpoints.ServerRole(serverId, roleId));
|
||||
}
|
||||
public Task EditRole(string serverId, string roleId, string name = null, uint? permissions = null)
|
||||
public Task EditRole(string serverId, string roleId, string name = null, uint? permissions = null, bool? hoist = null, uint? color = null)
|
||||
{
|
||||
if (serverId == null) throw new ArgumentNullException(nameof(serverId));
|
||||
if (roleId == null) throw new ArgumentNullException(nameof(roleId));
|
||||
|
||||
var request = new EditRoleRequest { Name = name, Permissions = permissions };
|
||||
var request = new EditRoleRequest { Name = name, Permissions = permissions, Hoist = hoist, Color = color };
|
||||
return _rest.Patch(Endpoints.ServerRole(serverId, roleId), request);
|
||||
}
|
||||
|
||||
|
||||
@@ -654,13 +654,13 @@ namespace Discord
|
||||
|
||||
public Task EditRole(Role role, string newName)
|
||||
=> EditRole(role?.ServerId, role?.Id, newName);
|
||||
public Task EditRole(string serverId, string roleId, string name = null, PackedServerPermissions permissions = null)
|
||||
public Task EditRole(string serverId, string roleId, string name = null, PackedServerPermissions permissions = null, bool? hoist = null, uint? color = null)
|
||||
{
|
||||
CheckReady();
|
||||
if (serverId == null) throw new NullReferenceException(nameof(serverId));
|
||||
if (roleId == null) throw new NullReferenceException(nameof(roleId));
|
||||
|
||||
return _api.EditRole(serverId, roleId, name: name, permissions: permissions?.RawValue);
|
||||
return _api.EditRole(serverId, roleId, name: name, permissions: permissions?.RawValue, hoist: hoist, color: color);
|
||||
}
|
||||
|
||||
public Task DeleteRole(Role role)
|
||||
|
||||
Reference in New Issue
Block a user