Exemple #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);
            }
        }
Exemple #2
0
        public async Task <IReadOnlyList <RestPrivateChannel> > GetPrivateChannelsAsync(RestRequestOptions options = null)
        {
            var models = await ApiClient.GetUserDmsAsync(options).ConfigureAwait(false);

            return(models.ToReadOnlyList(this, (x, @this) => RestPrivateChannel.Create(@this, x)));
        }