Releasing 3.1.1

This commit is contained in:
Wizou 2022-11-12 19:40:34 +01:00
parent 6b3fcdb967
commit ba523f7d21
2 changed files with 13 additions and 13 deletions

View file

@ -96,15 +96,15 @@ await DoLogin("+12025550156"); // user's phone_number
async Task DoLogin(string loginInfo) // (add this method to your code) async Task DoLogin(string loginInfo) // (add this method to your code)
{ {
while (client.User == null) while (client.User == null)
switch (await client.Login(loginInfo)) // returns which config info is needed to continue login switch (await client.Login(loginInfo)) // returns which config is needed to continue login
{ {
case "verification_code": Console.Write("Code: "); loginInfo = Console.ReadLine(); break; case "verification_code": Console.Write("Code: "); loginInfo = Console.ReadLine(); break;
case "name": loginInfo = "John Doe"; break; // if sign-up is required (first_name last_name) case "name": loginInfo = "John Doe"; break; // if sign-up is required (first/last_name)
case "password": loginInfo = "secret!"; break; // if user has enabled 2FA case "password": loginInfo = "secret!"; break; // if user has enabled 2FA
default: loginInfo = null; break; default: loginInfo = null; break;
} }
Console.WriteLine($"We are logged-in as {client.User} (id {client.User.id})"); Console.WriteLine($"We are logged-in as {client.User} (id {client.User.id})");
} }
``` ```
@ -134,7 +134,7 @@ foreach (var (id, chat) in chats.chats)
switch (chat) // example of downcasting to their real classes: switch (chat) // example of downcasting to their real classes:
{ {
case Chat basicChat when basicChat.IsActive: case Chat basicChat when basicChat.IsActive:
Console.WriteLine($"{id}: Basic chat: {basicChat.title} with {basicChat.participants_count} members"); Console.WriteLine($"{id}: Basic chat: {basicChat.title}");
break; break;
case Channel group when group.IsGroup: case Channel group when group.IsGroup:
Console.WriteLine($"{id}: Group {group.username}: {group.title}"); Console.WriteLine($"{id}: Group {group.username}: {group.title}");

View file

@ -23,7 +23,7 @@
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<PackageTags>Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl</PackageTags> <PackageTags>Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>$(ReleaseNotes.Replace('|',$([System.Environment]::NewLine)))</PackageReleaseNotes> <PackageReleaseNotes>$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))</PackageReleaseNotes>
<NoWarn>IDE0079;0419;1573;1591;NETSDK1138</NoWarn> <NoWarn>IDE0079;0419;1573;1591;NETSDK1138</NoWarn>
<DefineConstants>TRACE;OBFUSCATION</DefineConstants> <DefineConstants>TRACE;OBFUSCATION</DefineConstants>
</PropertyGroup> </PropertyGroup>
@ -42,9 +42,9 @@
<None Include="..\logo.png" Link="Data\logo.png" Pack="true" PackagePath="\" /> <None Include="..\logo.png" Link="Data\logo.png" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <!--<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>-->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="IndexRange" Version="1.0.2" /> <PackageReference Include="IndexRange" Version="1.0.2" />