تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ممكن تحويل الكود من سي شارب لي فيجوال بيسك
#1
حاولت كتير احوله من خلال اكتر من موقع لكن يحدث مشاكل بالكود 
كود :
string gruopName = "PornHub";
var client = NewClient();
await client.ConnectAsync();


var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel))
           .Cast<TLChannel>()
           .FirstOrDefault(c => c.Title == (gruopName));
var req = new TLRequestGetFullChannel()
{
   Channel = new TLInputChannel() { AccessHash =(long) main.AccessHash, ChannelId = main.Id }
};

var res = await client.SendRequestAsync<TeleSharp.TL.Messages.TLChatFull>(req);

////we have to do this in slices
var result = new ChannelInfo();
var offset = 0;
while (offset < (res.FullChat as TLChannelFull).ParticipantsCount)
{
   var pReq = new TLRequestGetParticipants()
   {
       Channel = new TLInputChannel() { AccessHash = main.AccessHash.Value, ChannelId = main.Id },
       Filter = new TLChannelParticipantsRecent() { },
       Limit = 200,
       Offset = offset
   };
   var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);

   result.Users.AddRange(pRes.Users.ToList().Cast<TLUser>());
   offset += 200;
   await Task.Delay(500);
}
الرد
تم الشكر بواسطة:
#2
(19-02-21, 11:35 PM)اليوم السابع كتب : حاولت كتير احوله من خلال اكتر من موقع لكن يحدث مشاكل بالكود 
كود :
string gruopName = "PornHub";
var client = NewClient();
await client.ConnectAsync();


var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
var main = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel))
           .Cast<TLChannel>()
           .FirstOrDefault(c => c.Title == (gruopName));
var req = new TLRequestGetFullChannel()
{
   Channel = new TLInputChannel() { AccessHash =(long) main.AccessHash, ChannelId = main.Id }
};

var res = await client.SendRequestAsync<TeleSharp.TL.Messages.TLChatFull>(req);

////we have to do this in slices
var result = new ChannelInfo();
var offset = 0;
while (offset < (res.FullChat as TLChannelFull).ParticipantsCount)
{
   var pReq = new TLRequestGetParticipants()
   {
       Channel = new TLInputChannel() { AccessHash = main.AccessHash.Value, ChannelId = main.Id },
       Filter = new TLChannelParticipantsRecent() { },
       Limit = 200,
       Offset = offset
   };
   var pRes = await client.SendRequestAsync<TLChannelParticipants>(pReq);

   result.Users.AddRange(pRes.Users.ToList().Cast<TLUser>());
   offset += 200;
   await Task.Delay(500);
}

Exclamation
الرد
تم الشكر بواسطة: ابراهيم ايبو
#3
Dim gruopName As String = "PornHub"
Dim client = NewClient()
Await client.ConnectAsync()


Dim dialogs = CType(Await, TLDialogs) client.GetUserDialogsAsync()
Dim main = dialogs.Chats.ToList().Where(Function© c.GetType() Is GetType(TLChannel)).Cast(Of TLChannel)().FirstOrDefault(Function© c.Title = (gruopName))
Dim req = New TLRequestGetFullChannel() With { _
.Channel = New TLInputChannel() With { _
.AccessHash =CLng(Fix(main.AccessHash)), _
.ChannelId = main.Id _
} _
}

Dim res = Await client.SendRequestAsync(Of TeleSharp.TL.Messages.TLChatFull)(req)


Dim result = New ChannelInfo()
Dim offset = 0
Do While offset < (TryCast(res.FullChat, TLChannelFull)).ParticipantsCount
Dim pReq = New TLRequestGetParticipants() With { _
.Channel = New TLInputChannel() With { _
.AccessHash = main.AccessHash.Value, _
.ChannelId = main.Id _
}, _
.Filter = New TLChannelParticipantsRecent (New() { }), _
.Limit = 200, _
.Offset = offset _
}
Dim pRes = Await client.SendRequestAsync(Of TLChannelParticipants)(pReq)

result.Users.AddRange(pRes.Users.ToList().Cast(Of TLUser)())
offset += 200
Await Task.Delay(500)
Loop
الرد
تم الشكر بواسطة: ابراهيم ايبو



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم