diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index fca0a89..f6efc6d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://www.paypal.me/wizou"] +custom: ["http://wizou.fr/donate.html"] diff --git a/EXAMPLES.md b/EXAMPLES.md index 2e8c877..8bee3d7 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -130,9 +130,7 @@ for (int offset = 0; ;) if (messagesBase is not Messages_ChannelMessages channelMessages) break; foreach (var msgBase in channelMessages.messages) if (msgBase is Message msg) - { - // process the message - } + Console.WriteLine(msg.message); offset += channelMessages.messages.Length; if (offset >= channelMessages.count) break; } @@ -150,7 +148,7 @@ See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/ You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. -### Download media files you save/forward to yourself +### Download media files you forward to yourself (Saved Messages) See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs). @@ -162,7 +160,7 @@ This is done by activating the experimental `client.CollectAccessHash` system. See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.cs) for how to enable it, and save/restore them for later use. ### Use a proxy to connect to Telegram -This can be done using the client.TcpHandler delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): +This can be done using the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.TcpHandler = async (address, port) => diff --git a/README.md b/README.md index ba2d58d..ac67b9f 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,17 @@ To do this, you need to write a method that will provide the answers, and pass i ```csharp static string Config(string what) { - if (what == "api_id") return "YOUR_API_ID"; - if (what == "api_hash") return "YOUR_API_HASH"; - if (what == "phone_number") return "+12025550156"; - if (what == "verification_code") return null; // let WTelegramClient ask the user with a console prompt - if (what == "first_name") return "John"; // if sign-up is required - if (what == "last_name") return "Doe"; // if sign-up is required - if (what == "password") return "secret!"; // if user has enabled 2FA - return null; + switch (what) + { + case "api_id": return "YOUR_API_ID"; + case "api_hash": return "YOUR_API_HASH"; + case "phone_number": return "+12025550156"; + case "verification_code": return null; // let WTelegramClient ask the user with a console prompt + case "first_name": return "John"; // if sign-up is required + case "last_name": return "Doe"; // if sign-up is required + case "password": return "secret!"; // if user has enabled 2FA + default: return null; // let WTelegramClient decide the default config + } } ... using var client = new WTelegram.Client(Config); @@ -161,3 +164,5 @@ This library can be used for any Telegram scenarios including: Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. Developers feedbacks are welcome in the Telegram channel [@WTelegramClient](https://t.me/WTelegramClient) + +If you like this library, please [consider a donation](http://wizou.fr/donate.html). ❤ This will help the project keep going. diff --git a/src/Generator.cs b/src/Generator.cs index 869108b..2c7bde8 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -92,7 +92,7 @@ namespace WTelegram FromSchema(schema, outputCs); } - public void FromSchema(SchemaJson schema, string outputCs) + internal void FromSchema(SchemaJson schema, string outputCs) { currentJson = Path.GetFileNameWithoutExtension(outputCs); using var sw = new StreamWriter(outputCs, false, Encoding.UTF8); @@ -789,13 +789,13 @@ namespace WTelegram } #pragma warning disable IDE1006 // Naming Styles - public class SchemaJson + internal class SchemaJson { public List constructors { get; set; } public List methods { get; set; } } - public class Constructor + internal class Constructor { public string id { get; set; } public string predicate { get; set; } @@ -806,7 +806,7 @@ namespace WTelegram public int ID => string.IsNullOrEmpty(id) ? 0 : int.Parse(id); } - public class Param + internal class Param { public string name { get; set; } public string type { get; set; } @@ -814,7 +814,7 @@ namespace WTelegram public override int GetHashCode() => HashCode.Combine(name, type); } - public class Method + internal class Method { public string id { get; set; } public string method { get; set; }