Upgrade to layer 149: More Topics stuff

This commit is contained in:
Wizou 2022-11-23 14:18:07 +01:00
parent fd593b429a
commit 11238550d3
6 changed files with 62 additions and 23 deletions

View file

@ -47,7 +47,7 @@ The `lvl` argument correspond to standard [LogLevel values](https://learn.micros
<a name="msg-by-name"></a>
### Send a message to someone by @username
```csharp
var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // username without the @
var resolved = await client.Contacts_ResolveUsername("JsonDumpBot"); // username without the @
await client.SendMessageAsync(resolved, "/start");
```
*Note: This also works if the @username points to a channel/group, but you must already have joined that channel before sending a message to it.

21
FAQ.md
View file

@ -72,13 +72,11 @@ You can then retrieve it with `client.GetAccessHashFor<User/Channel/Photo/Docume
⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be usable for most requests. See [Min constructors](https://core.telegram.org/api/min).*
<a name="dev-versions"></a>
#### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget
#### 5. I need to test a feature that has been recently developed but seems not available in my program
The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit.
The developmental versions of the library are now available as **pre-release** on Nuget (with `-dev` in the version number)
You can access these versions for testing in your program by going to our [private nuget feeds](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient),
click on button "Connect to feed" and follow the steps to setup your dev environment.
After that, you should be able to see/install the pre-release versions in your Nuget package manager and install them in your application. *(make sure you enable the **pre-release** checkbox)*
So make sure you tick the checkbox "Include prerelease" in Nuget manager and/or navigate to the Versions list then select the highest `x.x.x-dev.x` version to install in your program.
<a name="wrong-server"></a>
#### 6. Telegram asks me to signup (firstname, lastname) even for an existing account
@ -307,14 +305,19 @@ So you can either:
- Build your code in RELEASE mode
- Modify your config callback to reply to "server_address" with the IP address of Telegram production servers (as found on your API development tools)
2) Did you call `LoginUserIfNeeded()`?
If you don't authenticate as a user (or bot), you have access to a very limited subset of Telegram APIs
2) Did you call `Login` or `LoginUserIfNeeded` succesfully?
If you don't complete authentication as a user (or bot), you have access to a very limited subset of Telegram APIs.
Make sure your calls succeed and don't throw an exception.
3) Did you use `await` with every Client methods?
This library is completely Task-based. You should learn, understand and use the [asynchronous model of C# programming](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/) before proceeding further.
Using `.Result` or `.Wait()` can lead to deadlocks.
4) Is your program ending immediately instead of waiting for Updates?
Your program must be running/waiting continuously in order for the background Task to receive and process the Updates. So make sure your main program doesn't end immediately. For a console program, this is typical done by waiting for a key or some close event.
Your program must be running/waiting continuously in order for the background Task to receive and process the Updates.
So make sure your main program doesn't end immediately or dispose the client too soon (via `using`?).
For a console program, this is typical done by waiting for a key or some close event.
5) Is every Telegram API call rejected? (typically with an exception message like `AUTH_RESTART`)
The user authentification might have failed at some point (or the user revoked the authorization). It is therefore necessary to go through the authentification again. This can be done by deleting the WTelegram.session file, or at runtime by calling `client.Reset()`
The user authentification might have failed at some point (or the user revoked the authorization).
It is therefore necessary to go through the authentification again. This can be done by deleting the WTelegram.session file, or at runtime by calling `client.Reset()`

View file

@ -1,8 +1,6 @@
[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/)
[![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7)
[![API Layer](https://img.shields.io/badge/API_Layer-148-blueviolet)](https://corefork.telegram.org/methods)
[![dev nuget](https://img.shields.io/nuget/vpre/WTelegramClient?color=ffc040&label=dev%20nuget)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient)
[![Support Chat](https://img.shields.io/badge/Contact_us-on_Telegram-238EC2)](https://t.me/WTelegramClient)
[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods)
[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate)
## _Telegram Client API library written 100% in C# and .NET Standard_
@ -204,7 +202,7 @@ It has been tested in a Console app, [in Windows Forms](https://github.com/wiz0u
Don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos)
as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers.
Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient)
You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide.
If you read all this ReadMe, the [Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md),
the [Examples codes](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient)
If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going.

View file

@ -2974,7 +2974,7 @@ namespace TL
}
}
/// <summary>Channel messages <para>See <a href="https://corefork.telegram.org/constructor/messages.channelMessages"/></para></summary>
[TLDef(0x64479808)]
[TLDef(0xC776BA4E)]
public partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver
{
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a></summary>
@ -2987,6 +2987,7 @@ namespace TL
[IfFlag(2)] public int offset_id_offset;
/// <summary>Found messages</summary>
public MessageBase[] messages;
public ForumTopicBase[] topics;
/// <summary>Chats</summary>
public Dictionary<long, ChatBase> chats;
/// <summary>Users</summary>
@ -4366,16 +4367,29 @@ namespace TL
public MessageExtendedMediaBase extended_media;
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/updateChannelPinnedTopic"/></para></summary>
[TLDef(0xF694B0AE)]
[TLDef(0x192EFBE3)]
public class UpdateChannelPinnedTopic : Update
{
public Flags flags;
public long channel_id;
[IfFlag(0)] public int topic_id;
public int topic_id;
[Flags] public enum Flags : uint
{
has_topic_id = 0x1,
pinned = 0x1,
}
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/updateChannelPinnedTopics"/></para></summary>
[TLDef(0xFE198602)]
public class UpdateChannelPinnedTopics : Update
{
public Flags flags;
public long channel_id;
[IfFlag(0)] public int[] order;
[Flags] public enum Flags : uint
{
has_order = 0x1,
}
}
@ -13857,6 +13871,7 @@ namespace TL
closed = 0x4,
pinned = 0x8,
has_draft = 0x10,
short = 0x20,
}
public override int ID => id;

View file

@ -4296,6 +4296,15 @@ namespace TL
top_msg_id = top_msg_id,
});
/// <summary><para>See <a href="https://corefork.telegram.org/method/channels.reorderPinnedForumTopics"/></para></summary>
public static Task<UpdatesBase> Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false)
=> client.Invoke(new Channels_ReorderPinnedForumTopics
{
flags = (Channels_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0),
channel = channel,
order = order,
});
/// <summary>Sends a custom request; for bots only <para>See <a href="https://corefork.telegram.org/method/bots.sendCustomRequest"/> [bots: ✓]</para> <para>Possible <see cref="RpcException"/> codes: 400,403 (<a href="https://corefork.telegram.org/method/bots.sendCustomRequest#possible-errors">details</a>)</para></summary>
/// <param name="custom_method">The method name</param>
/// <param name="params_">JSON-serialized method parameters</param>
@ -8529,6 +8538,19 @@ namespace TL.Methods
public int top_msg_id;
}
[TLDef(0x2950A18F)]
public class Channels_ReorderPinnedForumTopics : IMethod<UpdatesBase>
{
public Flags flags;
public InputChannelBase channel;
public int[] order;
[Flags] public enum Flags : uint
{
force = 0x1,
}
}
[TLDef(0xAA2769ED)]
public class Bots_SendCustomRequest : IMethod<DataJSON>
{

View file

@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
public const int Version = 148; // fetched 01/11/2022 17:33:23
public const int Version = 149; // fetched 23/11/2022 13:15:45
internal const int SecretChats = 144;
internal const int MTProto2 = 73;
internal const uint VectorCtor = 0x1CB5C415;
@ -233,7 +233,7 @@ namespace TL
[0xF0E3E596] = typeof(Messages_DialogsNotModified),
[0x8C718E87] = typeof(Messages_Messages),
[0x3A54685E] = typeof(Messages_MessagesSlice),
[0x64479808] = typeof(Messages_ChannelMessages),
[0xC776BA4E] = typeof(Messages_ChannelMessages),
[0x74535F21] = typeof(Messages_MessagesNotModified),
[0x64FF9FD5] = typeof(Messages_Chats),
[0x9CD81144] = typeof(Messages_ChatsSlice),
@ -363,7 +363,8 @@ namespace TL
[0x6F7863F4] = typeof(UpdateRecentReactions),
[0x86FCCF85] = typeof(UpdateMoveStickerSetToTop),
[0x5A73A98C] = typeof(UpdateMessageExtendedMedia),
[0xF694B0AE] = typeof(UpdateChannelPinnedTopic),
[0x192EFBE3] = typeof(UpdateChannelPinnedTopic),
[0xFE198602] = typeof(UpdateChannelPinnedTopics),
[0xA56C2A3E] = typeof(Updates_State),
[0x5D75A138] = typeof(Updates_DifferenceEmpty),
[0x00F49CA0] = typeof(Updates_Difference),