diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs
index 86c5f9a..4ac6947 100644
--- a/TLSharp.Core/TelegramClient.cs
+++ b/TLSharp.Core/TelegramClient.cs
@@ -435,7 +435,19 @@ namespace TLSharp.Core
return ((TLUser)request.Response.User);
}
+ ///
+ /// Gets the full information of a specified chat
+ ///
+ /// The ID of the chat we want the info of
+ ///
+ ///
+ public async Task GetFullChat(int chatId, CancellationToken token = default(CancellationToken))
+ {
+ var req = new TLRequestGetFullChat() { ChatId = chatId };
+ var fchat = await SendRequestAsync(req, token).ConfigureAwait(false);
+ return fchat;
+ }
///
/// Gets the list of chats and channels opened by the authenticated user.
/// Throws an exception if the authenticated user is a bot.
@@ -458,7 +470,7 @@ namespace TLSharp.Core
var ichats = new TeleSharp.TL.TLVector(); // we can't pass a null argument to the TLRequestGetChats
if (exceptdIds != null)
Array.ForEach(exceptdIds, x => ichats.Add(x));
- var chats = await SendRequestAsync(new TLRequestGetAllChats() { ExceptIds = ichats }).ConfigureAwait(false);
+ var chats = await SendRequestAsync(new TLRequestGetAllChats() { ExceptIds = ichats }, token).ConfigureAwait(false);
return chats;
}
///
@@ -481,7 +493,7 @@ namespace TLSharp.Core
public async Task GetFullChannel(int channelId, long accessHash, CancellationToken token = default(CancellationToken))
{
var req = new TLRequestGetFullChannel() { Channel = new TLInputChannel() { ChannelId = channelId, AccessHash = accessHash } };
- var fchat = await SendRequestAsync(req).ConfigureAwait(false);
+ var fchat = await SendRequestAsync(req, token).ConfigureAwait(false);
return fchat;
}
@@ -497,7 +509,7 @@ namespace TLSharp.Core
if (channelIds != null)
Array.ForEach(channelIds, x => channels.Add(new TLInputChannel() { ChannelId = x }));
var req = new TLRequestGetChannels() { Id = channels };
- var fchat = await SendRequestAsync(req).ConfigureAwait(false);
+ var fchat = await SendRequestAsync(req, token).ConfigureAwait(false);
return fchat;
}
@@ -507,9 +519,8 @@ namespace TLSharp.Core
///
/// The TLChannel whose participants are requested
/// The index to start fetching from. -1 will automatically fetch all the results
- /// The index to start fetching from. -1 will automatically fetch all the results
- /// How many results are needed. How many results to be fetch on each iteration.
- /// Values smaller than 0 are ignored. If stIdx manually set, a number of results smaller than pageSize might be returned by Telegram.
+ /// How many results to be fetch on each iteration.
+ /// Values smaller than 0 are ignored. If stIdx is set, a number of results smaller than pageSize might be returned by Telegram.
/// The type of the participants to get. Choose Recents not to filter
///
///
@@ -518,7 +529,6 @@ namespace TLSharp.Core
if (channel == null) return null;
return await GetParticipants(channel.Id, (long)channel.AccessHash, stIdx, pageSize, partType, token).ConfigureAwait(false);
}
-
///
/// Gets the participants of the channel having the supplied type.
/// The method will auto-paginate results and return all the participants
@@ -526,8 +536,8 @@ namespace TLSharp.Core
/// The id of the channel whose participants are requested
/// The access hash of the channel whose participants are requested
/// The index to start fetching from. -1 will automatically fetch all the results
- /// How many results are needed. How many results to be fetch on each iteration.
- /// Values smaller than 0 are ignored. If stIdx manually set, a number of results smaller than pageSize might be returned by Telegram.
+ /// How many results to be fetch on each iteration.
+ /// Values smaller than 0 are ignored. If stIdx is set, a number of results smaller than pageSize might be returned by Telegram.
/// The type of the participants to get. Choose Recents not to filter
///
///
@@ -582,7 +592,7 @@ namespace TLSharp.Core
Offset = found,
Limit = pageSize
};
- var fchat = await SendRequestAsync(req).ConfigureAwait(false);
+ var fchat = await SendRequestAsync(req, token).ConfigureAwait(false);
total = fchat.Count;
found += fchat.Participants.Count;
results.Add(fchat);
@@ -594,6 +604,30 @@ namespace TLSharp.Core
ret.Count = ret.Participants.Count;
return ret;
}
+ ///
+ /// Invites the passed users to the specified channel
+ ///
+ /// The id of the channel to invite the users to
+ /// The access hash of the channel to invite the users to
+ ///
+ ///
+ public async Task InviteToChannel(int channelId, long accessHash, int[] users, CancellationToken token = default(CancellationToken))
+ {
+ TLVector absUsers = new TLVector();
+ Array.ForEach(users, u => absUsers.Add(new TLInputUser() { UserId = u }));
+ var req = new TLRequestInviteToChannel()
+ {
+ Channel = new TLInputChannel()
+ {
+ ChannelId = channelId,
+ AccessHash = accessHash
+ },
+ Users = absUsers
+ };
+ var updates = await SendRequestAsync(req, token).ConfigureAwait(false);
+
+ return updates;
+ }
///
/// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found;