public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Topic.HasValue) { Topic = model.Topic.Value; } if (model.Nsfw.HasValue) { IsNsfw = model.Nsfw.Value; } if (model.RateLimitPerUser.HasValue) { Slowmode = model.RateLimitPerUser.Value; } _type = model.Type; if (model.LastMessageId.HasValue) { LastMessageId = model.LastMessageId.Value; } if (model.LastPinTimestamp.HasValue) { LastPinTimestamp = model.LastPinTimestamp.Value; } }
protected CachedChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model.Id) { Type = model.Type; Update(model); }
public virtual void Update(ChannelJsonModel model) { if (model.Name.HasValue) { Name = model.Name.Value; } }
public static new TransientGuildChannel Create(IClient client, ChannelJsonModel model) { switch (model.Type) { case ChannelType.Text: case ChannelType.News: return(new TransientTextChannel(client, model)); case ChannelType.Voice: return(new TransientVoiceChannel(client, model)); case ChannelType.Category: return(new TransientCategoryChannel(client, model)); case ChannelType.Store: return(new TransientStoreChannel(client, model)); case ChannelType.NewsThread: case ChannelType.PublicThread: case ChannelType.PrivateThread: return(new TransientThreadChannel(client, model)); case ChannelType.Stage: return(new TransientStageChannel(client, model)); } return(new TransientUnknownGuildChannel(client, model)); }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Member.HasValue) { CurrentMember = new TransientThreadMember(Client, model.Member.Value); } if (model.MessageCount.HasValue) { MessageCount = model.MessageCount.Value; } if (model.MemberCount.HasValue) { MemberCount = model.MemberCount.Value; } if (model.ThreadMetadata.HasValue) { var metadataModel = model.ThreadMetadata.Value; IsArchived = metadataModel.Archived; AutomaticArchiveDuration = TimeSpan.FromMinutes(metadataModel.AutoArchiveDuration); ArchiveStateChangedAt = metadataModel.ArchiveTimestamp; IsLocked = metadataModel.Locked.GetValueOrDefault(); AllowsInvitation = metadataModel.Invitable.GetValueOrDefault(true); } }
public static CachedGuildChannel Create(IGatewayClient client, ChannelJsonModel model) { switch (model.Type) { case ChannelType.Text: case ChannelType.News: return(new CachedTextChannel(client, model)); case ChannelType.Voice: return(new CachedVoiceChannel(client, model)); case ChannelType.Category: return(new CachedCategoryChannel(client, model)); case ChannelType.Store: return(new CachedStoreChannel(client, model)); case ChannelType.NewsThread: case ChannelType.PublicThread: case ChannelType.PrivateThread: return(new CachedThreadChannel(client, model)); case ChannelType.Stage: return(new CachedStageChannel(client, model)); } return(new CachedUnknownGuildChannel(client, model)); }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Nsfw.HasValue) { IsNsfw = model.Nsfw.Value; } }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.ParentId.HasValue) { CategoryId = model.ParentId.Value; } }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.UserLimit.HasValue) { MemberLimit = model.UserLimit.Value; } }
public CachedThreadChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { ChannelId = model.ParentId.Value.Value; CreatorId = model.OwnerId.Value; if (model.ThreadMetadata.HasValue) { CreatedAt = model.ThreadMetadata.Value.CreateTimestamp.GetValueOrDefault(); } }
static ChannelJsonModel MatchMemberToThread(ChannelJsonModel threadModel, ThreadMemberJsonModel[] memberModels) { var memberModel = Array.Find(memberModels, x => x.Id == threadModel.Id); if (memberModel != null) { threadModel.Member = memberModel; } return(threadModel); }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Position.HasValue) { Position = model.Position.Value; } if (model.PermissionOverwrites.HasValue) { Overwrites = model.PermissionOverwrites.Value.ToReadOnlyList(this, (x, @this) => new TransientOverwrite(@this.Client, @this.Id, x)); } }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Bitrate.HasValue) { Bitrate = model.Bitrate.Value; } if (model.RtcRegion.HasValue) { Region = model.RtcRegion.Value; } }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.Topic.HasValue) { Topic = model.Topic.Value; } if (model.Nsfw.HasValue) { IsNsfw = model.Nsfw.Value; } if (model.DefaultAutoArchiveDuration.HasValue) { DefaultAutomaticArchiveDuration = TimeSpan.FromMinutes(model.DefaultAutoArchiveDuration.Value); } }
public override void Update(ChannelJsonModel model) { base.Update(model); if (model.RateLimitPerUser.HasValue) { Slowmode = TimeSpan.FromSeconds(model.RateLimitPerUser.Value); } if (model.LastMessageId.HasValue) { LastMessageId = model.LastMessageId.Value; } if (model.LastPinTimestamp.HasValue) { LastPinTimestamp = model.LastPinTimestamp.Value; } }
public static CachedChannel Create(IGatewayClient client, ChannelJsonModel model) { switch (model.Type) { case ChannelType.Direct: case ChannelType.Group: // TODO: cached private channels? break; case ChannelType.Text: case ChannelType.Voice: case ChannelType.Category: case ChannelType.News: case ChannelType.Store: case ChannelType.Thread: return(CachedGuildChannel.Create(client, model)); } return(null /*TransientUnknownChannel(client, model)*/); }
public CachedNestableChannel(IGatewayClient client, Snowflake guildId, ChannelJsonModel model) : base(client, guildId, model) { }
public CachedCategoryChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { }
public CachedStoreChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { }
protected TransientVocalGuildChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
protected CachedCategorizableGuildChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { }
public TransientDirectChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
public TransientCategoryChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
public TransientThreadChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
protected CachedGuildChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { GuildId = model.GuildId.Value; }
protected TransientMessageGuildChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
protected TransientPrivateChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
protected TransientCategorizableGuildChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
public TransientStoreChannel(IClient client, ChannelJsonModel model) : base(client, model) { }
public CachedThreadChannel(IGatewayClient client, ChannelJsonModel model) : base(client, model) { ChannelId = model.ParentId.Value.Value; CreatorId = model.OwnerId.Value; }