コード例 #1
0
        public async Task <ChannelResult> BuildChannelContainers(List <UrlHistoryContainer> insertedContainers)
        {
            _Log.LogInformation($"Getting {insertedContainers.Count} channels.");
            var channelContainers = new List <ChannelContainer>();
            var errors            = new List <UrlHistoryContainer>();
            var channelsToDelete  = new List <decimal>();

            foreach (var insertedContainer in insertedContainers)
            {
                try
                {
                    var channel = await _DiscordWrapper.GetChannelAsync(insertedContainer.ChannelId);

                    if (channel != null)
                    {
                        channelContainers.Add(new ChannelContainer(channel, insertedContainer));
                    }
                    else
                    {
                        channelsToDelete.Add(insertedContainer.ChannelId);
                    }
                }
                catch (HttpException httpException) when(_WarningResponses.Any(httpException.Message.Contains))
                {
                    _Log.LogError(httpException, $"Error getting channel '{insertedContainer.ChannelId}'. Channel will be deleted.");
                    channelsToDelete.Add(insertedContainer.ChannelId);
                }
            }
コード例 #2
0
        public async Task <List <ChannelContainer> > BuildChannelContainers(List <UnseenChannelClipsContainer> clipContainers)
        {
            var channelContainers = new List <ChannelContainer>();

            foreach (var clipContainer in clipContainers)
            {
                var channel = await _DiscordWrapper.GetChannelAsync(clipContainer.PendingChannelConfigContainer.ChannelId);

                var channelContainer = new ChannelContainer(clipContainer, channel);
                channelContainers.Add(channelContainer);
            }
            return(channelContainers);
        }