Guild Channels
This commit is contained in:
parent
e925e541fd
commit
da80a3133d
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
28
Discord.Model/Types/GuildVoiceChannel.cs
Normal file
28
Discord.Model/Types/GuildVoiceChannel.cs
Normal file
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user