GuildUserExtensions removed in favour of atomic role add/remove endpoints (#540)
* Removed GuildUserExtensions and moved the methods to IGuildUser and implementations * Made changes per fox's suggestion: Change->Modify. New Modify overload. * Oops * Per Volt: reimplemented new endpoints * Fixing broken docstrings * I forgot that docstrings are XML * Implemented atomic add/remove role endpoints * Removed so people aren't irked * Added single-item role add/remove methods
This commit is contained in:
committed by
RogueException
parent
11ba30c6fa
commit
efbd3cb681
@@ -388,6 +388,26 @@ namespace Discord.API
|
||||
break;
|
||||
}
|
||||
}
|
||||
public async Task AddRoleAsync(ulong guildId, ulong userId, ulong roleId, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(userId, 0, nameof(userId));
|
||||
Preconditions.NotEqual(roleId, 0, nameof(roleId));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
await SendAsync("PUT", () => $"guilds/{guildId}/members/{userId}/roles/{roleId}", ids, options: options);
|
||||
}
|
||||
public async Task RemoveRoleAsync(ulong guildId, ulong userId, ulong roleId, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(userId, 0, nameof(userId));
|
||||
Preconditions.NotEqual(roleId, 0, nameof(roleId));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}/roles/{roleId}", ids, options: options);
|
||||
}
|
||||
|
||||
//Channel Messages
|
||||
public async Task<Message> GetChannelMessageAsync(ulong channelId, ulong messageId, RequestOptions options = null)
|
||||
|
||||
Reference in New Issue
Block a user