Esempio n. 1
0
        internal new static RpcGroupChannel Create(DiscordRpcClient discord, Model model)
        {
            var entity = new RpcGroupChannel(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
Esempio n. 2
0
 internal virtual void Update(Model model)
 {
     if (model.Name.IsSpecified)
     {
         Name = model.Name.Value;
     }
 }
Esempio n. 3
0
        internal new static RpcVoiceChannel Create(DiscordRpcClient discord, Model model)
        {
            var entity = new RpcVoiceChannel(discord, model.Id, model.GuildId.Value);

            entity.Update(model);
            return(entity);
        }
Esempio n. 4
0
 internal override void Update(Model model)
 {
     base.Update(model);
     if (model.Position.IsSpecified)
     {
         Position = model.Position.Value;
     }
 }
Esempio n. 5
0
 internal static RpcChannel Create(DiscordRpcClient discord, Model model)
 {
     if (model.GuildId.IsSpecified)
     {
         return(RpcGuildChannel.Create(discord, model));
     }
     else
     {
         return(CreatePrivate(discord, model));
     }
 }
Esempio n. 6
0
 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();
 }
Esempio n. 7
0
        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}");
            }
        }
Esempio n. 8
0
        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");
            }
        }
Esempio n. 9
0
 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();
 }