mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Revert "+ overload for method InviteToChannel"
This reverts commit 45be5f51d3.
This commit is contained in:
parent
45be5f51d3
commit
9623f9d5ac
|
|
@ -73,7 +73,7 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Network\Requests\AckRequest.cs" />
|
||||
<Compile Include="Network\Requests\PingRequest.cs" />
|
||||
<Compile Include="Types\ParticipantFilterTypes.cs" />
|
||||
<Compile Include="Types\ParticipantTypes.cs" />
|
||||
<Compile Include="Utils\UploadHelper.cs" />
|
||||
<Compile Include="Session.cs" />
|
||||
<Compile Include="TelegramClient.cs" />
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace TLSharp.Core
|
|||
this.handler = handler;
|
||||
|
||||
session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
||||
transport = new TcpTransport(session.DataCenter.Address, session.DataCenter.Port, this.handler);
|
||||
transport = new TcpTransport (session.DataCenter.Address, session.DataCenter.Port, this.handler);
|
||||
}
|
||||
|
||||
public async Task ConnectAsync(bool reconnect = false, CancellationToken token = default(CancellationToken))
|
||||
|
|
@ -110,7 +110,7 @@ namespace TLSharp.Core
|
|||
}
|
||||
|
||||
var dc = dcOptions.First(d => d.Id == dcId);
|
||||
var dataCenter = new DataCenter(dcId, dc.IpAddress, dc.Port);
|
||||
var dataCenter = new DataCenter (dcId, dc.IpAddress, dc.Port);
|
||||
|
||||
transport = new TcpTransport(dc.IpAddress, dc.Port, handler);
|
||||
session.DataCenter = dataCenter;
|
||||
|
|
@ -131,7 +131,7 @@ namespace TLSharp.Core
|
|||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var completed = false;
|
||||
while (!completed)
|
||||
while(!completed)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -139,7 +139,7 @@ namespace TLSharp.Core
|
|||
await sender.Receive(request, token).ConfigureAwait(false);
|
||||
completed = true;
|
||||
}
|
||||
catch (DataCenterMigrationException e)
|
||||
catch(DataCenterMigrationException e)
|
||||
{
|
||||
if (session.DataCenter.DataCenterId.HasValue &&
|
||||
session.DataCenter.DataCenterId.Value == e.DC)
|
||||
|
|
@ -251,7 +251,7 @@ namespace TLSharp.Core
|
|||
return (T)result;
|
||||
}
|
||||
|
||||
internal async Task<T> SendAuthenticatedRequestAsync<T>(TLMethod methodToExecute, CancellationToken token = default(CancellationToken))
|
||||
internal async Task<T> SendAuthenticatedRequestAsync<T> (TLMethod methodToExecute, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
|
@ -278,7 +278,7 @@ namespace TLSharp.Core
|
|||
|
||||
public async Task<TLImportedContacts> ImportContactsAsync(IReadOnlyList<TLInputPhoneContact> contacts, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
var req = new TLRequestImportContacts { Contacts = new TLVector<TLInputPhoneContact>(contacts) };
|
||||
var req = new TLRequestImportContacts { Contacts = new TLVector<TLInputPhoneContact>(contacts)};
|
||||
|
||||
return await SendAuthenticatedRequestAsync<TLImportedContacts>(req, token)
|
||||
.ConfigureAwait(false);
|
||||
|
|
@ -286,7 +286,7 @@ namespace TLSharp.Core
|
|||
|
||||
public async Task<bool> DeleteContactsAsync(IReadOnlyList<TLAbsInputUser> users, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
var req = new TLRequestDeleteContacts { Id = new TLVector<TLAbsInputUser>(users) };
|
||||
var req = new TLRequestDeleteContacts {Id = new TLVector<TLAbsInputUser>(users)};
|
||||
|
||||
return await SendAuthenticatedRequestAsync<bool>(req, token)
|
||||
.ConfigureAwait(false);
|
||||
|
|
@ -294,7 +294,7 @@ namespace TLSharp.Core
|
|||
|
||||
public async Task<TLLink> DeleteContactAsync(TLAbsInputUser user, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
var req = new TLRequestDeleteContact { Id = user };
|
||||
var req = new TLRequestDeleteContact {Id = user};
|
||||
|
||||
return await SendAuthenticatedRequestAsync<TLLink>(req, token)
|
||||
.ConfigureAwait(false);
|
||||
|
|
@ -524,7 +524,7 @@ namespace TLSharp.Core
|
|||
/// <param name="partType">The type of the participants to get. Choose Recents not to filter</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TLChannelParticipants> GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken))
|
||||
public async Task<TLChannelParticipants> GetParticipants(TLChannel channel, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
if (channel == null) return null;
|
||||
return await GetParticipants(channel.Id, (long)channel.AccessHash, stIdx, pageSize, partType, token).ConfigureAwait(false);
|
||||
|
|
@ -541,31 +541,31 @@ namespace TLSharp.Core
|
|||
/// <param name="partType">The type of the participants to get. Choose Recents not to filter</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TLChannelParticipants> GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantFilterTypes partType = ParticipantFilterTypes.Recents, CancellationToken token = default(CancellationToken))
|
||||
public async Task<TLChannelParticipants> GetParticipants(int channelId, long accessHash, int stIdx = -1, int pageSize = -1, ParticipantTypes partType = ParticipantTypes.Recents, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
TLAbsChannelParticipantsFilter filter;
|
||||
switch (partType)
|
||||
{
|
||||
case ParticipantFilterTypes.Admins:
|
||||
case ParticipantTypes.Admins:
|
||||
filter = new TLChannelParticipantsAdmins();
|
||||
break;
|
||||
|
||||
case ParticipantFilterTypes.Kicked:
|
||||
case ParticipantTypes.Kicked:
|
||||
filter = new TLChannelParticipantsKicked();
|
||||
break;
|
||||
|
||||
case ParticipantFilterTypes.Bots:
|
||||
case ParticipantTypes.Bots:
|
||||
filter = new TLChannelParticipantsBots();
|
||||
break;
|
||||
|
||||
case ParticipantFilterTypes.Recents:
|
||||
case ParticipantTypes.Recents:
|
||||
filter = new TLChannelParticipantsRecent();
|
||||
break;
|
||||
|
||||
case ParticipantFilterTypes.Banned:
|
||||
case ParticipantFilterTypes.Restricted:
|
||||
case ParticipantFilterTypes.Contacts:
|
||||
case ParticipantFilterTypes.Search:
|
||||
case ParticipantTypes.Banned:
|
||||
case ParticipantTypes.Restricted:
|
||||
case ParticipantTypes.Contacts:
|
||||
case ParticipantTypes.Search:
|
||||
default:
|
||||
throw new NotImplementedException($"{partType} not implemented yet");
|
||||
}
|
||||
|
|
@ -588,7 +588,7 @@ namespace TLSharp.Core
|
|||
ChannelId = channelId,
|
||||
AccessHash = accessHash
|
||||
},
|
||||
Filter = filter,
|
||||
Filter = new TLChannelParticipantsRecent(),
|
||||
Offset = found,
|
||||
Limit = pageSize
|
||||
};
|
||||
|
|
@ -607,16 +607,6 @@ namespace TLSharp.Core
|
|||
/// <summary>
|
||||
/// Invites the passed users to the specified channel
|
||||
/// </summary>
|
||||
/// <param name="channel">The descriptor of the channel to invite the users to</param>
|
||||
/// <param name="users"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TLUpdates> InviteToChannel(TLChannel channel, int[] users, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
return await InviteToChannel(channel.Id, (long)channel.AccessHash, users, token);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invites the passed users to the specified channel
|
||||
/// </summary>
|
||||
/// <param name="channelId">The id of the channel to invite the users to</param>
|
||||
/// <param name="accessHash">The access hash of the channel to invite the users to</param>
|
||||
/// <param name="users"></param>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace TLSharp.Core.Types
|
||||
{
|
||||
public enum ParticipantFilterTypes
|
||||
public enum ParticipantTypes
|
||||
{
|
||||
Recents,
|
||||
Restricted,
|
||||
Loading…
Reference in a new issue