diff --git a/Discord.Model/Types/GuildTextChannel.cs b/Discord.Model/Types/GuildTextChannel.cs index 1adcb29..bf0ca8a 100644 --- a/Discord.Model/Types/GuildTextChannel.cs +++ b/Discord.Model/Types/GuildTextChannel.cs @@ -1,4 +1,5 @@ using Discord.API; +using Serilog; namespace Discord.Model; @@ -6,7 +7,23 @@ public class GuildTextChannel : GuildChannel { internal GuildTextChannel(GuildChannelData data) : base(data){ - + Update(data, false); + } + + protected new void Update(GuildChannelData data, bool call_base_update){ + if((ChannelType)data.Type is not ChannelType.GuildText or ChannelType.GuildAnnouncement){ + Log.Warning("Channel type is not compatible with GuildTextChannel: {type}", (ChannelType)data.Type); + } + if(call_base_update) base.Update(data, call_base_update); + } + + public override void Update(ChannelData data) + { + if(data is GuildChannelData guild_data){ + Update(guild_data, true); + }else{ + throw new ArgumentException("data must be GuildChannelData", nameof(data)); + } } } diff --git a/Discord.Model/Types/GuildVoiceChannel.cs b/Discord.Model/Types/GuildVoiceChannel.cs new file mode 100644 index 0000000..35fbd6d --- /dev/null +++ b/Discord.Model/Types/GuildVoiceChannel.cs @@ -0,0 +1,28 @@ +using System.Data; +using Discord.API; + +namespace Discord.Model; + +public class GuildVoiceChannel : GuildChannel +{ + public int Bitrate {get; protected set;} + + internal GuildVoiceChannel(GuildChannelData data) : base(data) + { + Update(data, false); + } + + protected new void Update(GuildChannelData data, bool call_base_update){ + Bitrate = data.Bitrate!.Value; + if(call_base_update) base.Update(data, call_base_update); + } + + public override void Update(ChannelData data) + { + if(data is GuildChannelData guild_data){ + Update(guild_data, true); + }else{ + throw new ArgumentException("data must be GuildChannelData", nameof(data)); + } + } +}