internal static RestChannel Create(RestDiscordClient client, ChannelModel model) { switch (model.Type.Value) { case ChannelType.Text: case ChannelType.Voice: case ChannelType.Category: case ChannelType.News: return(RestGuildChannel.Create(client, model)); case ChannelType.Dm: case ChannelType.Group: return(RestPrivateChannel.Create(client, model)); default: return(null); } }
public async Task <IReadOnlyList <RestGuildChannel> > GetChannelsAsync(Snowflake guildId, RestRequestOptions options = null) { var models = await ApiClient.GetGuildChannelsAsync(guildId, options).ConfigureAwait(false); return(models.ToReadOnlyList(this, (x, @this) => RestGuildChannel.Create(@this, x))); }
public async Task <IReadOnlyList <RestGuildChannel> > GetChannelsAsync(Snowflake guildId, RestRequestOptions options = null) { var models = await ApiClient.GetGuildChannelsAsync(guildId, options).ConfigureAwait(false); return(models.Select(x => RestGuildChannel.Create(this, x)).ToImmutableArray()); }