示例#1
0
        private List <IChannelParticipant> GetChannelParticipants(ChannelFull channelFull, IChannelParticipantsFilter filter)
        {
            var participantsList = new List <IChannelParticipant>();

            using (var client = new FullClientDisposable(this))
            {
                uint count  = 100;
                uint offset = 0;
                var  result = (ChannelsChannelParticipants)TelegramUtils.RunSynchronously(
                    client.Client.Methods.ChannelsGetParticipantsAsync(new ChannelsGetParticipantsArgs
                {
                    Channel = new InputChannel
                    {
                        ChannelId  = channelFull.Id,
                        AccessHash = TelegramUtils.GetChannelAccessHash(_dialogs.GetChat(channelFull.Id))
                    },
                    Filter = filter,
                    Limit  = 100,
                    Offset = offset
                }));
                participantsList.AddRange(result.Participants);
                _dialogs.AddUsers(result.Users);
            }
            return(participantsList);
        }
示例#2
0
        private List<IChannelParticipant> GetChannelParticipants(ChannelFull channelFull, IChannelParticipantsFilter filter)
        {
            var participantsList = new List<IChannelParticipant>();
            using (var client = new FullClientDisposable(this))
            {
                uint count = 100;
                uint offset = 0;
                while (count > 0)
                {
                    var result = (ChannelsChannelParticipants)TelegramUtils.RunSynchronously(
                        client.Client.Methods.ChannelsGetParticipantsAsync(new ChannelsGetParticipantsArgs
                        {
                            Channel = new InputChannel
                            {
                                ChannelId = channelFull.Id,
                                AccessHash = TelegramUtils.GetChannelAccessHash(_dialogs.GetChat(channelFull.Id))
                            },
                            Filter = filter,
                            Limit = 100,
                            Offset = offset
                        }));
                    DebugPrint("channel result " + ObjectDumper.Dump(result));
                    participantsList.AddRange(result.Participants);
                    count = (uint)result.Participants.Count;
                    offset += count;
                    _dialogs.AddUsers(result.Users);
                }

            }
            return participantsList;
        }