Added hoist and color editing for roles

This commit is contained in:
RogueException
2015-10-13 04:07:02 -03:00
parent 765647732c
commit 5382b52037
3 changed files with 8 additions and 4 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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)