| @@ -113,8 +113,15 @@ namespace Discord | |||
| /// A task that represents the asynchronous modification operation. | |||
| /// </returns> | |||
| Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null); | |||
| //TODO add docs | |||
| Task AddRoleAsync(ulong id, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Adds the specified role to this user in the guild. | |||
| /// </summary> | |||
| /// <param name="roleId">The role to be added to the user.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous role addition operation. | |||
| /// </returns> | |||
| Task AddRoleAsync(ulong roleId, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Adds the specified role to this user in the guild. | |||
| /// </summary> | |||
| @@ -124,7 +131,14 @@ namespace Discord | |||
| /// A task that represents the asynchronous role addition operation. | |||
| /// </returns> | |||
| Task AddRoleAsync(IRole role, RequestOptions options = null); | |||
| //TODO: Add docs | |||
| /// <summary> | |||
| /// Adds the specified <paramref name="roleIds"/> to this user in the guild. | |||
| /// </summary> | |||
| /// <param name="roleIds">The roles to be added to the user.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous role addition operation. | |||
| /// </returns> | |||
| Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Adds the specified <paramref name="roles"/> to this user in the guild. | |||
| @@ -135,8 +149,15 @@ namespace Discord | |||
| /// A task that represents the asynchronous role addition operation. | |||
| /// </returns> | |||
| Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null); | |||
| //TODO add docs | |||
| Task RemoveRoleAsync(ulong id, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Removes the specified <paramref name="roleId"/> from this user in the guild. | |||
| /// </summary> | |||
| /// <param name="roleId">The role to be removed from the user.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous role removal operation. | |||
| /// </returns> | |||
| Task RemoveRoleAsync(ulong roleId, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Removes the specified <paramref name="role"/> from this user in the guild. | |||
| /// </summary> | |||
| @@ -146,7 +167,14 @@ namespace Discord | |||
| /// A task that represents the asynchronous role removal operation. | |||
| /// </returns> | |||
| Task RemoveRoleAsync(IRole role, RequestOptions options = null); | |||
| //TODO: Add docs | |||
| /// <summary> | |||
| /// Removes the specified <paramref name="roleIds"/> from this user in the guild. | |||
| /// </summary> | |||
| /// <param name="roleIds">The roles to be removed from the user.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous role removal operation. | |||
| /// </returns> | |||
| Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null); | |||
| /// <summary> | |||
| /// Removes the specified <paramref name="roles"/> from this user in the guild. | |||
| @@ -113,28 +113,28 @@ namespace Discord.Rest | |||
| => UserHelper.KickAsync(this, Discord, reason, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRoleAsync(ulong roleId, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => AddRolesAsync(new[] { roleId }, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRoleAsync(IRole role, RequestOptions options = null) | |||
| => AddRolesAsync(new[] { role }, options); | |||
| => AddRoleAsync(role.Id, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => UserHelper.AddRolesAsync(this, Discord, roleIds, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
| => UserHelper.AddRolesAsync(this, Discord, roles, options); | |||
| => AddRolesAsync(roles.Select(x => x.Id), options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => RemoveRolesAsync(new[] { roleId }, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRoleAsync(IRole role, RequestOptions options = null) | |||
| => RemoveRolesAsync(new[] { role }, options); | |||
| => RemoveRoleAsync(role.Id, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => UserHelper.RemoveRolesAsync(this, Discord, roleIds, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
| => UserHelper.RemoveRolesAsync(this, Discord, roles, options); | |||
| => RemoveRolesAsync(roles.Select(x => x.Id)); | |||
| /// <inheritdoc /> | |||
| /// <exception cref="InvalidOperationException">Resolving permissions requires the parent guild to be downloaded.</exception> | |||
| @@ -73,16 +73,16 @@ namespace Discord.Rest | |||
| return RestDMChannel.Create(client, await client.ApiClient.CreateDMChannelAsync(args, options).ConfigureAwait(false)); | |||
| } | |||
| public static async Task AddRolesAsync(IGuildUser user, BaseDiscordClient client, IEnumerable<IRole> roles, RequestOptions options) | |||
| public static async Task AddRolesAsync(IGuildUser user, BaseDiscordClient client, IEnumerable<ulong> roleIds, RequestOptions options) | |||
| { | |||
| foreach (var role in roles) | |||
| await client.ApiClient.AddRoleAsync(user.Guild.Id, user.Id, role.Id, options).ConfigureAwait(false); | |||
| foreach (var roleId in roleIds) | |||
| await client.ApiClient.AddRoleAsync(user.Guild.Id, user.Id, roleId, options).ConfigureAwait(false); | |||
| } | |||
| public static async Task RemoveRolesAsync(IGuildUser user, BaseDiscordClient client, IEnumerable<IRole> roles, RequestOptions options) | |||
| public static async Task RemoveRolesAsync(IGuildUser user, BaseDiscordClient client, IEnumerable<ulong> roleIds, RequestOptions options) | |||
| { | |||
| foreach (var role in roles) | |||
| await client.ApiClient.RemoveRoleAsync(user.Guild.Id, user.Id, role.Id, options).ConfigureAwait(false); | |||
| foreach (var roleId in roleIds) | |||
| await client.ApiClient.RemoveRoleAsync(user.Guild.Id, user.Id, roleId, options).ConfigureAwait(false); | |||
| } | |||
| } | |||
| } | |||
| @@ -178,28 +178,28 @@ namespace Discord.WebSocket | |||
| => UserHelper.KickAsync(this, Discord, reason, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRoleAsync(ulong roleId, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => AddRolesAsync(new[] { roleId }, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRoleAsync(IRole role, RequestOptions options = null) | |||
| => AddRolesAsync(new[] { role }, options); | |||
| => AddRoleAsync(role.Id, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => UserHelper.AddRolesAsync(this, Discord, roleIds, options); | |||
| /// <inheritdoc /> | |||
| public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
| => UserHelper.AddRolesAsync(this, Discord, roles, options); | |||
| => AddRolesAsync(roles.Select(x => x.Id), options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => RemoveRolesAsync(new[] { roleId }, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRoleAsync(IRole role, RequestOptions options = null) | |||
| => RemoveRolesAsync(new[] { role }, options); | |||
| => RemoveRoleAsync(role.Id, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
| => throw new NotImplementedException(); | |||
| => UserHelper.RemoveRolesAsync(this, Discord, roleIds, options); | |||
| /// <inheritdoc /> | |||
| public Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
| => UserHelper.RemoveRolesAsync(this, Discord, roles, options); | |||
| => RemoveRolesAsync(roles.Select(x => x.Id)); | |||
| /// <inheritdoc /> | |||
| public ChannelPermissions GetPermissions(IGuildChannel channel) | |||