Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the role to which this overwrite applies.
 /// </summary>
 /// <param name="role">Role to which apply this overwrite's permissions.</param>
 /// <returns>This builder.</returns>
 public DiscordOverwriteBuilder For(DiscordRole role)
 {
     this.Target = role;
     this.Type   = OverwriteType.Role;
     return(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new Discord permission overwrite builder for a role. This class can be used to construct permission overwrites for guild channels, used when creating channels.
 /// </summary>
 public DiscordOverwriteBuilder(DiscordRole role)
 {
     this.Target = role;
     this.Type   = OverwriteType.Role;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the member to which this overwrite applies.
 /// </summary>
 /// <param name="member">Member to which apply this overwrite's permissions.</param>
 /// <returns>This builder.</returns>
 public DiscordOverwriteBuilder For(DiscordMember member)
 {
     this.Target = member;
     this.Type   = OverwriteType.Member;
     return(this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new Discord permission overwrite builder for a member. This class can be used to construct permission overwrites for guild channels, used when creating channels.
 /// </summary>
 public DiscordOverwriteBuilder(DiscordMember member)
 {
     this.Target = member;
     this.Type   = OverwriteType.Member;
 }