コード例 #1
0
        public static async Task <IReadOnlyCollection <RestGroupChannel> > GetGroupChannelsAsync(BaseDiscordClient client, RequestOptions options)
        {
            var models = await client.ApiClient.GetMyPrivateChannelsAsync(options).ConfigureAwait(false);

            return(models
                   .Where(x => x.Type == ChannelType.Group)
                   .Select(x => RestGroupChannel.Create(client, x)).ToImmutableArray());
        }
コード例 #2
0
ファイル: RestChannel.cs プロジェクト: COsborn2/GhandiBot
        /// <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}");
            }
        }