예제 #1
0
        /// <summary>
        /// Populates this builder with data from another overwrite object.
        /// </summary>
        /// <param name="other">Overwrite from which data will be used.</param>
        /// <returns>This builder.</returns>
        public async Task <DiscordOverwriteBuilder> FromAsync(DiscordOverwrite other)
        {
            this.Allowed = other.Allowed;
            this.Denied  = other.Denied;
            this.Type    = other.Type;
            this.Target  = this.Type == OverwriteType.Member ? await other.GetMemberAsync().ConfigureAwait(false) as SnowflakeObject : await other.GetRoleAsync().ConfigureAwait(false) as SnowflakeObject;

            return(this);
        }
예제 #2
0
 /// <summary>
 /// Updates a channel permission overwrite.
 /// </summary>
 /// <param name="overwrite">Overwrite to update.</param>
 /// <param name="allow">Permissions to allow.</param>
 /// <param name="deny">Permissions to deny.</param>
 /// <param name="reason">Reason for audit logs.</param>
 /// <returns></returns>
 public Task UpdateOverwriteAsync(DiscordOverwrite overwrite, Permissions allow, Permissions deny, string reason = null) =>
 this.Discord.ApiClient.EditChannelPermissionsAsync(this.Id, overwrite.Id, allow, deny, overwrite.Type, reason);
예제 #3
0
 /// <summary>
 /// Deletes a channel permission overwrite
 /// </summary>
 /// <param name="overwrite"></param>
 /// <param name="reason">Reason for audit logs.</param>
 /// <returns></returns>
 public Task DeleteOverwriteAsync(DiscordOverwrite overwrite, string reason = null) =>
 this.Discord.ApiClient.DeleteChannelPermissionAsync(this.Id, overwrite.Id, reason);