From f8fab6c3e9ac5ae349a393b648a54b0975506a72 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:34:50 +0200 Subject: [PATCH] some TL generic helpers --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/TL.Xtended.cs | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b80f31d..611e374 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.0.0-dev.$(Rev:r) +name: 4.0.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 47e6a28..4c8040d 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 4.0.0 +name: 4.0.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 6726515..28d04ed 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -327,6 +327,7 @@ namespace TL protected override InputPhoto ToInputPhoto() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputPhotoFileLocation ToFileLocation() => ToFileLocation(LargestPhotoSize); public InputPhotoFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type }; + public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestPhotoSize => sizes.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); } @@ -507,6 +508,7 @@ namespace TL public string Filename => GetAttribute()?.file_name; protected override InputDocument ToInputDocument() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type }; + public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestThumbSize => thumbs?.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); public T GetAttribute() where T : DocumentAttribute => attributes.OfType().FirstOrDefault(); } @@ -733,4 +735,10 @@ namespace TL partial class Theme { public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; } partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + + partial class RequestedPeer { public abstract long ID { get; } } + partial class RequestedPeerUser { public override long ID => user_id; } + partial class RequestedPeerChat { public override long ID => chat_id; } + partial class RequestedPeerChannel { public override long ID => channel_id; } + }