@@ -113,7 +113,8 @@ 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> | |||
@@ -123,6 +124,8 @@ namespace Discord | |||
/// A task that represents the asynchronous role addition operation. | |||
/// </returns> | |||
Task AddRoleAsync(IRole role, RequestOptions options = null); | |||
//TODO: Add docs | |||
Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null); | |||
/// <summary> | |||
/// Adds the specified <paramref name="roles"/> to this user in the guild. | |||
/// </summary> | |||
@@ -132,6 +135,8 @@ 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="role"/> from this user in the guild. | |||
/// </summary> | |||
@@ -141,6 +146,8 @@ namespace Discord | |||
/// A task that represents the asynchronous role removal operation. | |||
/// </returns> | |||
Task RemoveRoleAsync(IRole role, RequestOptions options = null); | |||
//TODO: Add docs | |||
Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null); | |||
/// <summary> | |||
/// Removes the specified <paramref name="roles"/> from this user in the guild. | |||
/// </summary> | |||
@@ -112,15 +112,27 @@ namespace Discord.Rest | |||
public Task KickAsync(string reason = null, RequestOptions options = null) | |||
=> UserHelper.KickAsync(this, Discord, reason, options); | |||
/// <inheritdoc /> | |||
public Task AddRoleAsync(ulong roleId, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task AddRoleAsync(IRole role, RequestOptions options = null) | |||
=> AddRolesAsync(new[] { role }, options); | |||
/// <inheritdoc /> | |||
public Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
=> UserHelper.AddRolesAsync(this, Discord, roles, options); | |||
/// <inheritdoc /> | |||
public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task RemoveRoleAsync(IRole role, RequestOptions options = null) | |||
=> RemoveRolesAsync(new[] { role }, options); | |||
/// <inheritdoc /> | |||
public Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
=> UserHelper.RemoveRolesAsync(this, Discord, roles, options); | |||
@@ -59,27 +59,35 @@ namespace Discord.Rest | |||
/// <inheritdoc /> | |||
ChannelPermissions IGuildUser.GetPermissions(IGuildChannel channel) => Permissions.ToChannelPerms(channel, GuildPermissions.Webhook.RawValue); | |||
/// <inheritdoc /> | |||
Task IGuildUser.KickAsync(string reason, RequestOptions options) => | |||
Task IGuildUser.KickAsync(string reason, RequestOptions options) => | |||
throw new NotSupportedException("Webhook users cannot be kicked."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.ModifyAsync(Action<GuildUserProperties> func, RequestOptions options) => | |||
Task IGuildUser.ModifyAsync(Action<GuildUserProperties> func, RequestOptions options) => | |||
throw new NotSupportedException("Webhook users cannot be modified."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.AddRoleAsync(IRole role, RequestOptions options) => | |||
Task IGuildUser.AddRoleAsync(ulong role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
Task IGuildUser.AddRoleAsync(IRole role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.RemoveRoleAsync(IRole role, RequestOptions options) => | |||
Task IGuildUser.AddRolesAsync(IEnumerable<ulong> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.RemoveRoleAsync(ulong role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.RemoveRoleAsync(IRole role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<ulong> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
//IVoiceState | |||
@@ -63,7 +63,7 @@ namespace Discord.WebSocket | |||
/// <summary> | |||
/// Returns a collection of roles that the user possesses. | |||
/// </summary> | |||
public IReadOnlyCollection<SocketRole> Roles | |||
public IReadOnlyCollection<SocketRole> Roles | |||
=> _roleIds.Select(id => Guild.GetRole(id)).Where(x => x != null).ToReadOnlyCollection(() => _roleIds.Length); | |||
/// <summary> | |||
/// Returns the voice channel the user is in, or <c>null</c> if none. | |||
@@ -177,9 +177,15 @@ namespace Discord.WebSocket | |||
public Task KickAsync(string reason = null, RequestOptions options = null) | |||
=> UserHelper.KickAsync(this, Discord, reason, options); | |||
/// <inheritdoc /> | |||
public Task AddRoleAsync(ulong roleId, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task AddRoleAsync(IRole role, RequestOptions options = null) | |||
=> AddRolesAsync(new[] { role }, options); | |||
/// <inheritdoc /> | |||
public Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null) | |||
=> throw new NotImplementedException(); | |||
/// <inheritdoc /> | |||
public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null) | |||
=> UserHelper.AddRolesAsync(this, Discord, roles, options); | |||
/// <inheritdoc /> | |||
@@ -31,7 +31,7 @@ namespace Discord.WebSocket | |||
public override bool IsWebhook => true; | |||
/// <inheritdoc /> | |||
internal override SocketPresence Presence { get { return new SocketPresence(UserStatus.Offline, null, null, null); } set { } } | |||
internal override SocketGlobalUser GlobalUser => | |||
internal override SocketGlobalUser GlobalUser => | |||
throw new NotSupportedException(); | |||
internal SocketWebhookUser(SocketGuild guild, ulong id, ulong webhookId) | |||
@@ -73,32 +73,52 @@ namespace Discord.WebSocket | |||
ChannelPermissions IGuildUser.GetPermissions(IGuildChannel channel) => Permissions.ToChannelPerms(channel, GuildPermissions.Webhook.RawValue); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Webhook users cannot be kicked.</exception> | |||
Task IGuildUser.KickAsync(string reason, RequestOptions options) => | |||
Task IGuildUser.KickAsync(string reason, RequestOptions options) => | |||
throw new NotSupportedException("Webhook users cannot be kicked."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Webhook users cannot be modified.</exception> | |||
Task IGuildUser.ModifyAsync(Action<GuildUserProperties> func, RequestOptions options) => | |||
Task IGuildUser.ModifyAsync(Action<GuildUserProperties> func, RequestOptions options) => | |||
throw new NotSupportedException("Webhook users cannot be modified."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.AddRoleAsync(IRole role, RequestOptions options) => | |||
Task IGuildUser.AddRoleAsync(ulong roleId, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
Task IGuildUser.AddRoleAsync(IRole role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRoleAsync(IRole role, RequestOptions options) => | |||
Task IGuildUser.AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
Task IGuildUser.AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRoleAsync(ulong roleId, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRoleAsync(IRole role, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<ulong> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
/// <inheritdoc /> | |||
/// <exception cref="NotSupportedException">Roles are not supported on webhook users.</exception> | |||
Task IGuildUser.RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options) => | |||
throw new NotSupportedException("Roles are not supported on webhook users."); | |||
//IVoiceState | |||