WTelegramClientHelperGetChannelsAsync Method
Asynchronously retrieves a collection of Channel
objects containing all the channels from the client.
Namespace: DevCase.ThirdParty.WTelegramClientAssembly: DevCase.net48.ThirdParty.WTelegramClient (in DevCase.net48.ThirdParty.WTelegramClient.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static Task<ReadOnlyCollection<Channel>> GetChannelsAsync(
Client client
)
Public Shared Function GetChannelsAsync (
client As Client
) As Task(Of ReadOnlyCollection(Of Channel))
Dim client As Client
Dim returnValue As Task(Of ReadOnlyCollection(Of Channel))
returnValue = WTelegramClientHelper.GetChannelsAsync(client)
public:
static Task<ReadOnlyCollection<Channel^>^>^ GetChannelsAsync(
Client^ client
)
static member GetChannelsAsync :
client : Client -> Task<ReadOnlyCollection<Channel>>
No code example is currently available or this language may not be supported.
- client Client
-
The source Client object.
TaskReadOnlyCollectionChannel
An asynchronous operation that yields a
ReadOnlyCollectionT
containing all the channels from the client.
This is a code example.
No code example is currently available or this language may not be supported.
Private Async Sub Test()
Dim clientConfig As New TelegramClientConfig With {
.ApiId = "###",
.ApiHash = "###",
.FirstName = "###",
.LastName = "###",
.Password = "###",
.PhoneNumber = "+34###",
.VerificationCode = "###"
}
Dim client As WTelegram.Client = CreateClient(clientConfig)
Dim myUser As TL.User = Await client.LoginUserIfNeeded()
Dim myUserId As Long = DirectCast(myUser, UserBase).ID
Debug.WriteLine($"We are logged-in as user: {myUser.MainUsername}, id: {myUserId}")
Dim channels As ReadOnlyCollection(Of TL.Channel) = Await GetChannelsAsync(client)
For Each c As TL.Channel In channels
Dim flags As TL.Channel.Flags = ChannelExtensions.GetFlags(c)
Dim isPublic As Boolean = flags.HasFlag(flags.has_username)
Dim sb As New StringBuilder()
sb.AppendLine($"Channel Title: {DirectCast(c, TL.ChatBase).Title}")
sb.AppendLine($"Channel Id...: {DirectCast(c, TL.ChatBase).ID}")
sb.AppendLine($"Channel Type.: {If(c.IsGroup, "Group", "Channel")}")
sb.AppendLine($"Is Public?...: {isPublic}")
sb.AppendLine($"Public Name..: {If(isPublic, c.MainUsername, "null")}")
sb.AppendLine($"Access Hash..: {c.access_hash}")
Debug.WriteLine(sb.ToString())
Next
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.