示例#1
0
        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)));
        }
示例#3
0
        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());
        }