Skip to content

Commit

Permalink
Add MaxBitrate to the interface (discord-net#1861)
Browse files Browse the repository at this point in the history
Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
  • Loading branch information
SubZero0 and quinchs authored Nov 24, 2021
1 parent 3cb662f commit e0dbe7c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/Discord.Net.Core/Entities/Guilds/IGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ public interface IGuild : IDeletable, ISnowflakeEntity
/// The approximate number of non-offline members in this guild.
/// </returns>
int? ApproximatePresenceCount { get; }
/// <summary>
/// Gets the max bitrate for voice channels in this guild.
/// </summary>
/// <returns>
/// A <see cref="int"/> representing the maximum bitrate value allowed by Discord in this guild.
/// </returns>
int MaxBitrate { get; }

/// <summary>
/// Gets the preferred locale of this guild in IETF BCP 47
Expand Down
14 changes: 14 additions & 0 deletions src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ public class RestGuild : RestEntity<ulong>, IGuild, IUpdateable
public int? ApproximateMemberCount { get; private set; }
/// <inheritdoc />
public int? ApproximatePresenceCount { get; private set; }
/// <inheritdoc/>
public int MaxBitrate
{
get
{
return PremiumTier switch
{
PremiumTier.Tier1 => 128000,
PremiumTier.Tier2 => 256000,
PremiumTier.Tier3 => 384000,
_ => 96000,
};
}
}
/// <inheritdoc />
public NsfwLevel NsfwLevel { get; private set; }
/// <inheritdoc />
Expand Down
10 changes: 2 additions & 8 deletions src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,18 @@ public SocketVoiceChannel AFKChannel
return id.HasValue ? GetVoiceChannel(id.Value) : null;
}
}
/// <summary>
/// Gets the max bitrate for voice channels in this guild.
/// </summary>
/// <returns>
/// A <see cref="int"/> representing the maximum bitrate value allowed by Discord in this guild.
/// </returns>
/// <inheritdoc/>
public int MaxBitrate
{
get
{
var maxBitrate = PremiumTier switch
return PremiumTier switch
{
PremiumTier.Tier1 => 128000,
PremiumTier.Tier2 => 256000,
PremiumTier.Tier3 => 384000,
_ => 96000,
};
return maxBitrate;
}
}
/// <summary>
Expand Down

0 comments on commit e0dbe7c

Please sign in to comment.