public GuildChannel(Guild guild, Model model) : base(model.Id) { Guild = guild; Update(model, UpdateSource.Creation); }
internal override void Update(ClientState state, Model model) { base.Update(state, model); Topic = model.Topic.Value; _nsfw = model.Nsfw.GetValueOrDefault(); }
internal override void Update(Model model) { base.Update(model); Topic = model.Topic.Value; _nsfw = model.Nsfw.GetValueOrDefault(); }
internal new static RestGroupChannel Create(BaseDiscordClient discord, Model model) { var entity = new RestGroupChannel(discord, model.Id); entity.Update(model); return(entity); }
public GroupChannel(DiscordRestClient discord, Model model) : base(model.Id) { Discord = discord; Update(model, UpdateSource.Creation); }
internal new static RestDMChannel Create(BaseDiscordClient discord, Model model) { var entity = new RestDMChannel(discord, model.Id, model.Recipients.Value[0].Id); entity.Update(model); return(entity); }
/// <inheritdoc /> internal override void Update(ClientState state, Model model) { base.Update(state, model); CategoryId = model.CategoryId; Bitrate = model.Bitrate.Value; UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; }
internal override void Update(Model model) { base.Update(model); Bitrate = model.Bitrate.Value; UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; }
/// <inheritdoc /> internal override void Update(ClientState state, Model model) { base.Update(state, model); Bitrate = model.Bitrate.Value; UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; RTCRegion = model.RTCRegion.GetValueOrDefault(null); }
public ISocketGuildChannel AddChannel(ChannelModel model, DataStore dataStore, ConcurrentHashSet <ulong> channels = null) { var channel = ToChannel(model); (channels ?? _channels).TryAdd(model.Id); dataStore.AddChannel(channel); return(channel); }
internal override void Update(ClientState state, Model model) { base.Update(state, model); CategoryId = model.CategoryId; Topic = model.Topic.GetValueOrDefault(); SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet? _nsfw = model.Nsfw.GetValueOrDefault(); }
public DMChannel(DiscordRestClient discord, IUser recipient, Model model) : base(model.Id) { Discord = discord; Recipient = recipient; Update(model, UpdateSource.Creation); }
/// <inheritdoc /> internal override void Update(Model model) { base.Update(model); CategoryId = model.CategoryId; Topic = model.Topic.Value; SlowModeInterval = model.SlowMode.Value; IsNsfw = model.Nsfw.GetValueOrDefault(); }
internal SocketGuildChannel AddChannel(ClientState state, ChannelModel model) { var channel = SocketGuildChannel.Create(this, state, model); _channels.TryAdd(model.Id); state.AddChannel(channel); return(channel); }
public override void Update(Model model, UpdateSource source) { if (source == UpdateSource.Rest && IsAttached) { return; } base.Update(model, source); }
public void Update(Model model, UpdateSource source) { if (/*source == UpdateSource.Rest && */ IsAttached) { return; } (Recipient as User).Update(model.Recipients.Value[0], source); }
public override void Update(Model model, UpdateSource source) { if (source == UpdateSource.Rest && IsAttached) { return; } base.Update(model, source); Bitrate = model.Bitrate.Value; UserLimit = model.UserLimit.Value; }
internal override void Update(Model model) { base.Update(model); IsNsfw = model.Nsfw.GetValueOrDefault(false); Topic = model.Topic.GetValueOrDefault(); DefaultAutoArchiveDuration = model.AutoArchiveDuration.GetValueOrDefault(ThreadArchiveDuration.OneDay); Tags = model.ForumTags.GetValueOrDefault(Array.Empty <API.ForumTags>()).Select( x => new ForumTag(x.Id, x.Name, x.EmojiId.GetValueOrDefault(null), x.EmojiName.GetValueOrDefault()) ).ToImmutableArray(); }
public SocketTextChannel(SocketGuild guild, Model model) : base(guild, model) { if (Discord.MessageCacheSize > 0) { _messages = new MessageCache(Discord, this); } else { _messages = new MessageManager(Discord, this); } }
public SocketDMChannel(DiscordSocketClient discord, SocketDMUser recipient, Model model) : base(discord, recipient, model) { if (Discord.MessageCacheSize > 0) { _messages = new MessageCache(Discord, this); } else { _messages = new MessageManager(Discord, this); } }
public SocketGroupChannel(DiscordSocketClient discord, Model model) : base(discord, model) { if (Discord.MessageCacheSize > 0) { _messages = new MessageCache(Discord, this); } else { _messages = new MessageManager(Discord, this); } _voiceStates = new ConcurrentDictionary <ulong, VoiceState>(1, 5); }
internal override void Update(ClientState state, Model model) { Name = model.Name.Value; Position = model.Position.Value; var overwrites = model.PermissionOverwrites.Value; var newOverwrites = ImmutableArray.CreateBuilder <Overwrite>(overwrites.Length); for (int i = 0; i < overwrites.Length; i++) { newOverwrites.Add(overwrites[i].ToEntity()); } _overwrites = newOverwrites.ToImmutable(); }
new internal ISocketGuildChannel ToChannel(ChannelModel model) { switch (model.Type) { case ChannelType.Text: return(new SocketTextChannel(this, model)); case ChannelType.Voice: return(new SocketVoiceChannel(this, model)); default: throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); } }
/// <exception cref="InvalidOperationException">Unexpected channel type.</exception> internal static IRestPrivateChannel CreatePrivate(BaseDiscordClient discord, Model model) { switch (model.Type) { case ChannelType.DM: return(RestDMChannel.Create(discord, model)); case ChannelType.Group: return(RestGroupChannel.Create(discord, model)); default: throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); } }
internal static RestChannel Create(BaseDiscordClient discord, Model model) { switch (model.Type) { case ChannelType.Text: case ChannelType.Voice: return(RestGuildChannel.Create(discord, new RestGuild(discord, model.GuildId.Value), model)); case ChannelType.DM: case ChannelType.Group: return(CreatePrivate(discord, model) as RestChannel); default: throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); } }
internal override void Update(Model model) { if (model.Name.IsSpecified) { Name = model.Name.Value; } if (model.Icon.IsSpecified) { _iconId = model.Icon.Value; } if (model.Recipients.IsSpecified) { UpdateUsers(model.Recipients.Value); } }
/// <inheritdoc /> internal override void Update(Model model) { base.Update(model); if (model.Bitrate.IsSpecified) { Bitrate = model.Bitrate.Value; } if (model.UserLimit.IsSpecified) { UserLimit = model.UserLimit.Value != 0 ? model.UserLimit.Value : (int?)null; } RTCRegion = model.RTCRegion.GetValueOrDefault(null); }
/// <exception cref="InvalidOperationException">Unexpected channel type.</exception> internal static RestChannel Create(BaseDiscordClient discord, Model model) { return(model.Type switch { ChannelType.News or ChannelType.Text or ChannelType.Voice or ChannelType.Stage or ChannelType.NewsThread or ChannelType.PrivateThread or ChannelType.PublicThread => RestGuildChannel.Create(discord, new RestGuild(discord, model.GuildId.Value), model), ChannelType.DM or ChannelType.Group => CreatePrivate(discord, model) as RestChannel, ChannelType.Category => RestCategoryChannel.Create(discord, new RestGuild(discord, model.GuildId.Value), model), _ => new RestChannel(discord, model.Id), });
internal static RestChannel Create(BaseDiscordClient discord, Model model) { switch (model.Type) { case ChannelType.Text: case ChannelType.Voice: return(RestGuildChannel.Create(discord, new RestGuild(discord, model.GuildId.Value), model)); case ChannelType.DM: case ChannelType.Group: return(CreatePrivate(discord, model) as RestChannel); default: return(new RestChannel(discord, model.Id)); } }
internal override void Update(ClientState state, Model model) { base.Update(state, model); CategoryId = model.CategoryId; Topic = model.Topic.GetValueOrDefault(); SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet? _nsfw = model.Nsfw.GetValueOrDefault(); if (model.AutoArchiveDuration.IsSpecified) { DefaultArchiveDuration = model.AutoArchiveDuration.Value; } else { DefaultArchiveDuration = ThreadArchiveDuration.OneDay; } // basic value at channel creation. Shouldn't be called since guild text channels always have this property }