internal new static RpcGroupChannel Create(DiscordRpcClient discord, Model model) { var entity = new RpcGroupChannel(discord, model.Id); entity.Update(model); return(entity); }
internal virtual void Update(Model model) { if (model.Name.IsSpecified) { Name = model.Name.Value; } }
internal new static RpcVoiceChannel Create(DiscordRpcClient discord, Model model) { var entity = new RpcVoiceChannel(discord, model.Id, model.GuildId.Value); entity.Update(model); return(entity); }
internal override void Update(Model model) { base.Update(model); if (model.Position.IsSpecified) { Position = model.Position.Value; } }
internal static RpcChannel Create(DiscordRpcClient discord, Model model) { if (model.GuildId.IsSpecified) { return(RpcGuildChannel.Create(discord, model)); } else { return(CreatePrivate(discord, model)); } }
internal override void Update(Model model) { base.Update(model); if (model.UserLimit.IsSpecified) { UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; } if (model.Bitrate.IsSpecified) { Bitrate = model.Bitrate.Value; } VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); }
internal static RpcChannel CreatePrivate(DiscordRpcClient discord, Model model) { switch (model.Type) { case ChannelType.DM: return(RpcDMChannel.Create(discord, model)); case ChannelType.Group: return(RpcGroupChannel.Create(discord, model)); default: throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); } }
internal new static RpcGuildChannel Create(DiscordRpcClient discord, Model model) { switch (model.Type) { case ChannelType.Text: return(RpcTextChannel.Create(discord, model)); case ChannelType.Voice: return(RpcVoiceChannel.Create(discord, model)); default: throw new InvalidOperationException("Unknown guild channel type"); } }
internal override void Update(Model model) { base.Update(model); CachedMessages = model.Messages.Select(x => RpcMessage.Create(Discord, Id, x)).ToImmutableArray(); VoiceStates = model.VoiceStates.Select(x => RpcVoiceState.Create(Discord, x)).ToImmutableArray(); }