WTelegramClientHelperGetChannelsByTitleAsync Method
Asynchronously retrieves a collection of Channel
objects that match the provided channel title.
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>> GetChannelsByTitleAsync(
Client client,
string channelTitle,
StringComparison stringComparison = StringComparison.Ordinal
)
Public Shared Function GetChannelsByTitleAsync (
client As Client,
channelTitle As String,
Optional stringComparison As StringComparison = StringComparison.Ordinal
) As Task(Of ReadOnlyCollection(Of Channel))
Dim client As Client
Dim channelTitle As String
Dim stringComparison As StringComparison
Dim returnValue As Task(Of ReadOnlyCollection(Of Channel))
returnValue = WTelegramClientHelper.GetChannelsByTitleAsync(client,
channelTitle, stringComparison)
public:
static Task<ReadOnlyCollection<Channel^>^>^ GetChannelsByTitleAsync(
Client^ client,
String^ channelTitle,
StringComparison stringComparison = StringComparison::Ordinal
)
static member GetChannelsByTitleAsync :
client : Client *
channelTitle : string *
?stringComparison : StringComparison
(* Defaults:
let _stringComparison = defaultArg stringComparison StringComparison.Ordinal
*)
-> Task<ReadOnlyCollection<Channel>>
No code example is currently available or this language may not be supported.
- client Client
-
The source Client object.
- channelTitle String
-
The title of the channel or group to search for.
- stringComparison StringComparison (Optional)
-
Optional. The type of string comparison to be used for channelTitle.
Default value is: Ordinal
TaskReadOnlyCollectionChannel
An asynchronous operation that yields a
ReadOnlyCollectionT
containing the matching channels.
This is a code example to get all channels matching the specified title.
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, Tl.UserBase).ID
Debug.WriteLine($"We are logged-in as user: {myUser.MainUsername}, id: {myUserId}")
Dim channelTitle As String = "Channel title"
Dim channels As ReadOnlyCollection(Of TL.Channel) =
Await GetChannelsByTitleAsync(client, channelTitle, StringComparison.OrdinalIgnoreCase)
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.