|
@@ -15,7 +15,7 @@ namespace Discord.Rest |
|
|
private ImmutableArray<Overwrite> _overwrites; |
|
|
private ImmutableArray<Overwrite> _overwrites; |
|
|
|
|
|
|
|
|
/// <inheritdoc /> |
|
|
/// <inheritdoc /> |
|
|
public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; |
|
|
|
|
|
|
|
|
public virtual IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; |
|
|
|
|
|
|
|
|
internal IGuild Guild { get; } |
|
|
internal IGuild Guild { get; } |
|
|
/// <inheritdoc /> |
|
|
/// <inheritdoc /> |
|
@@ -81,7 +81,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// An overwrite object for the targeted user; <c>null</c> if none is set. |
|
|
/// An overwrite object for the targeted user; <c>null</c> if none is set. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public OverwritePermissions? GetPermissionOverwrite(IUser user) |
|
|
|
|
|
|
|
|
public virtual OverwritePermissions? GetPermissionOverwrite(IUser user) |
|
|
{ |
|
|
{ |
|
|
for (int i = 0; i < _overwrites.Length; i++) |
|
|
for (int i = 0; i < _overwrites.Length; i++) |
|
|
{ |
|
|
{ |
|
@@ -98,7 +98,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// An overwrite object for the targeted role; <c>null</c> if none is set. |
|
|
/// An overwrite object for the targeted role; <c>null</c> if none is set. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public OverwritePermissions? GetPermissionOverwrite(IRole role) |
|
|
|
|
|
|
|
|
public virtual OverwritePermissions? GetPermissionOverwrite(IRole role) |
|
|
{ |
|
|
{ |
|
|
for (int i = 0; i < _overwrites.Length; i++) |
|
|
for (int i = 0; i < _overwrites.Length; i++) |
|
|
{ |
|
|
{ |
|
@@ -117,7 +117,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
|
|
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) |
|
|
|
|
|
|
|
|
public virtual async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) |
|
|
{ |
|
|
{ |
|
|
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false); |
|
|
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false); |
|
|
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); |
|
|
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); |
|
@@ -131,7 +131,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
|
|
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) |
|
|
|
|
|
|
|
|
public virtual async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) |
|
|
{ |
|
|
{ |
|
|
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false); |
|
|
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false); |
|
|
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); |
|
|
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); |
|
@@ -145,7 +145,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// A task representing the asynchronous operation for removing the specified permissions from the channel. |
|
|
/// A task representing the asynchronous operation for removing the specified permissions from the channel. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) |
|
|
|
|
|
|
|
|
public virtual async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) |
|
|
{ |
|
|
{ |
|
|
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); |
|
|
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); |
|
|
|
|
|
|
|
@@ -166,7 +166,7 @@ namespace Discord.Rest |
|
|
/// <returns> |
|
|
/// <returns> |
|
|
/// A task representing the asynchronous operation for removing the specified permissions from the channel. |
|
|
/// A task representing the asynchronous operation for removing the specified permissions from the channel. |
|
|
/// </returns> |
|
|
/// </returns> |
|
|
public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) |
|
|
|
|
|
|
|
|
public virtual async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) |
|
|
{ |
|
|
{ |
|
|
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); |
|
|
await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); |
|
|
|
|
|
|
|
|