From fb8d1c2d0701d78c3c01866e1eda6bce4f68fa48 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Mon, 9 Oct 2023 15:19:03 +0200
Subject: [PATCH] Some more implicit Input conversions
---
.github/dev.yml | 2 +-
src/Client.Helpers.cs | 1 +
src/TL.Helpers.cs | 9 +++++++++
src/TL.Schema.cs | 42 ++++++++++++++++++++++++++++++-----------
src/TL.SchemaFuncs.cs | 44 ++++++++++++++++++++++++++++++-------------
5 files changed, 73 insertions(+), 25 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 3a41fac..e20f7e3 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -1,7 +1,7 @@
pr: none
trigger: [ master ]
-name: 3.5.7-dev.$(Rev:r)
+name: 3.5.8-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index 55ea982..8047a3b 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -668,6 +668,7 @@ namespace WTelegram
}
/// If you want to get all messages from a chat, use method Messages_GetHistory
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822")]
public Task GetMessages(InputPeer peer)
=> throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory");
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index 4ff1deb..25101be 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -381,6 +381,13 @@ namespace TL
public static implicit operator InputGeoPoint(GeoPoint geo) => new() { lat = geo.lat, lon = geo.lon, accuracy_radius = geo.accuracy_radius, flags = (InputGeoPoint.Flags)geo.flags };
}
+ partial class InputNotifyPeerBase
+ {
+ public static implicit operator InputNotifyPeerBase(InputPeer peer) => new InputNotifyPeer { peer = peer };
+ public static implicit operator InputNotifyPeerBase(ChatBase chat) => new InputNotifyPeer { peer = chat };
+ public static implicit operator InputNotifyPeerBase(UserBase user) => new InputNotifyPeer { peer = user };
+ }
+
partial class WallPaperBase { public static implicit operator InputWallPaperBase(WallPaperBase wp) => wp.ToInputWallPaper();
protected abstract InputWallPaperBase ToInputWallPaper(); }
partial class WallPaper { protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaper { id = id, access_hash = access_hash }; }
@@ -620,6 +627,8 @@ namespace TL
partial class InputDialogPeerBase
{
public static implicit operator InputDialogPeerBase(InputPeer peer) => new InputDialogPeer { peer = peer };
+ public static implicit operator InputDialogPeerBase(ChatBase chat) => new InputDialogPeer { peer = chat };
+ public static implicit operator InputDialogPeerBase(UserBase user) => new InputDialogPeer { peer = user };
}
partial class SecureFile
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 1a545be..3b3a121 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -2677,7 +2677,7 @@ namespace TL
}
/// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , ,
- public abstract class InputNotifyPeerBase : IObject { }
+ public abstract partial class InputNotifyPeerBase : IObject { }
/// Notifications generated by a certain user or group. See
[TLDef(0xB8BC5B0C)]
public class InputNotifyPeer : InputNotifyPeerBase
@@ -4687,10 +4687,11 @@ namespace TL
public int id;
public long random_id;
}
- /// See
+ /// Indicates that stories stealth mode was activated. See
[TLDef(0x2C084DC1)]
public class UpdateStoriesStealthMode : Update
{
+ /// Information about the current stealth mode session.
public StoriesStealthMode stealth_mode;
}
/// See
@@ -11713,8 +11714,11 @@ namespace TL
other = 0x1000,
/// If set, allows the admin to create, delete or modify forum topics ».
manage_topics = 0x2000,
+ /// If set, allows the admin to post stories as the channel.
post_stories = 0x4000,
+ /// If set, allows the admin to edit stories posted by the other admins of the channel.
edit_stories = 0x8000,
+ /// If set, allows the admin to delete stories posted by the other admins of the channel.
delete_stories = 0x10000,
}
}
@@ -12190,7 +12194,7 @@ namespace TL
[TLDef(0x629F1980)]
public class Auth_LoginToken : Auth_LoginTokenBase
{
- /// Expiry date of QR code
+ /// Expiration date of QR code
public DateTime expires;
/// Token to render in QR code
public byte[] token;
@@ -14572,7 +14576,7 @@ namespace TL
{
/// The temporary profile link.
public string url;
- /// Its expiry date
+ /// Its expiration date
public DateTime expires;
}
@@ -15293,13 +15297,15 @@ namespace TL
public string link;
}
- /// See
+ /// Information about the current stealth mode session. See
[TLDef(0x712E27FD)]
public class StoriesStealthMode : IObject
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
public Flags flags;
+ /// The date up to which stealth mode will be active.
[IfFlag(0)] public DateTime active_until_date;
+ /// The date starting from which the user will be allowed to re-enable stealth mode again.
[IfFlag(1)] public DateTime cooldown_until_date;
[Flags] public enum Flags : uint
@@ -15395,16 +15401,21 @@ namespace TL
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
- /// See
+ /// The current boost status » of a channel. See
[TLDef(0xE5C1AA5C)]
public class Stories_BoostsStatus : IObject
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
public Flags flags;
+ /// The current boost level of the channel.
public int level;
+ /// The number of boosts acquired so far in the current level.
public int current_level_boosts;
+ /// Total number of boosts acquired so far.
public int boosts;
+ /// Total number of boosts needed to reach the next level; if absent, the next level isn't available.
[IfFlag(0)] public int next_level_boosts;
+ /// Only returned to channel admins: contains the approximated number of Premium users subscribed to the channel, related to the total number of subscribers.
[IfFlag(1)] public StatsPercentValue premium_audience;
public string boost_url;
@@ -15414,40 +15425,49 @@ namespace TL
has_next_level_boosts = 0x1,
/// Field has a value
has_premium_audience = 0x2,
+ /// Whether we're currently boosting this channel.
my_boost = 0x4,
}
}
- /// See Derived classes: ,
+ /// Whether the specified channel can be boosted, see here for more info ». See Derived classes: ,
public abstract class Stories_CanApplyBoostResult : IObject { }
- /// See
+ /// We're not boosting any channel, and we can freely boost the specified channel. See
[TLDef(0xC3173587)]
public class Stories_CanApplyBoostOk : Stories_CanApplyBoostResult { }
- /// See
+ /// We're boosting another channel, but we can freely boost the specified channel. See
[TLDef(0x712C4655)]
public class Stories_CanApplyBoostReplace : Stories_CanApplyBoostResult
{
+ /// The channel we're currently boosting.
public Peer current_boost;
+ /// Channel information.
public Dictionary chats;
}
- /// See
+ /// Info about a boost made by a specific user. See
[TLDef(0x0E9E6380)]
public class Booster : IObject
{
+ /// ID of the user that made the boost.
public long user_id;
+ /// Default expiration date of the boost.
public DateTime expires;
}
- /// See
+ /// Info about the users currently boosting the channel. See
[TLDef(0xF3DD3D1D)]
public class Stories_BoostersList : IObject
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
public Flags flags;
+ /// Total number of boosters.
public int count;
+ /// Info about the automatic expiration date of every user's boost.
public Booster[] boosters;
+ /// Next offset for pagination.
[IfFlag(0)] public string next_offset;
+ /// Info about the users mentioned in the boosters field.
public Dictionary users;
[Flags] public enum Flags : uint
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 8074643..0b6743d 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -2000,7 +2000,7 @@ namespace TL
is_admin = is_admin,
});
- /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
+ /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Turn a basic group into a supergroup See Possible codes: 400,403 (details)
/// Basic group to migrate
public static Task Messages_MigrateChat(this Client client, long chat_id)
=> client.Invoke(new Messages_MigrateChat
@@ -2459,7 +2459,7 @@ namespace TL
error = error,
});
- /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403,500 (details)
+ /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details)
/// The chat, can be for bots and for users.
/// File uploaded in chunks as described in files »
/// a null value means messageMediaEmpty
@@ -3207,7 +3207,7 @@ namespace TL
/// React to message. See Possible codes: 400,403 (details)
/// Whether a bigger and longer reaction should be shown
- /// Add this reaction to the recent reactions list ».
+ /// Whether to add this reaction to the recent reactions list ».
/// Peer
/// Message ID to react to
/// A list of reactions
@@ -3701,7 +3701,7 @@ namespace TL
limit = limit,
});
- /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400,500 (details)
+ /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400 (details)
/// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings.
/// Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user.
/// Input photo
@@ -4135,7 +4135,7 @@ namespace TL
channel = channel,
});
- /// Create a supergroup/channel. See Possible codes: 400,406,500 (details)
+ /// Create a supergroup/channel. See Possible codes: 400,406 (details)
/// Whether to create a channel
/// Whether to create a supergroup
/// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport
@@ -5634,7 +5634,8 @@ namespace TL
peers = peers,
});
- /// See Possible codes: 400 (details)
+ /// Check whether we can post stories as the specified peer. See Possible codes: 400 (details)
+ /// The peer from which we wish to post stories.
public static Task Stories_CanSendStory(this Client client, InputPeer peer)
=> client.Invoke(new Stories_CanSendStory
{
@@ -5643,6 +5644,7 @@ namespace TL
/// Uploads a Telegram Story. See Possible codes: 400 (details)
/// If set, disables forwards and story download functionality.
+ /// The peer to send the story as.
/// The media file.
/// Story caption.
/// Message entities for styled text
@@ -5662,7 +5664,12 @@ namespace TL
});
/// See Possible codes: 400 (details)
- /// Message entities for styled text
+ /// Peer where the story was posted.
+ /// ID of story to edit.
+ /// If specified, replaces the story media.
+ /// If specified, replaces the story caption.
+ /// Message entities for styled text in the caption
+ /// If specified, alters the privacy settings of the story.
public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null)
=> client.Invoke(new Stories_EditStory
{
@@ -5802,14 +5809,20 @@ namespace TL
message = message,
});
- /// See
+ /// Activates stories stealth mode, see here » for more info. See
+ /// Whether to erase views from any stories opened in the past stories_stealth_past_period seconds », as specified by the client configuration.
+ /// Whether to hide future story views for the next stories_stealth_future_period seconds », as specified by the client configuration.
public static Task Stories_ActivateStealthMode(this Client client, bool past = false, bool future = false)
=> client.Invoke(new Stories_ActivateStealthMode
{
flags = (Stories_ActivateStealthMode.Flags)((past ? 0x1 : 0) | (future ? 0x2 : 0)),
});
- /// See Possible codes: 400 (details)
+ /// React to a story. See Possible codes: 400 (details)
+ /// Whether to add this reaction to the recent reactions list ».
+ /// The peer that sent the story
+ /// ID of the story to react to
+ /// Reaction
public static Task Stories_SendReaction(this Client client, InputPeer peer, int story_id, Reaction reaction, bool add_to_recent = false)
=> client.Invoke(new Stories_SendReaction
{
@@ -5853,14 +5866,17 @@ namespace TL
hidden = hidden,
});
- /// See Possible codes: 400 (details)
+ /// Get the current boost status of a channel, see here » for more info on boosts. See Possible codes: 400 (details)
+ /// The channel
public static Task Stories_GetBoostsStatus(this Client client, InputPeer peer)
=> client.Invoke(new Stories_GetBoostsStatus
{
peer = peer,
});
- /// See Possible codes: 400 (details)
+ /// Obtain info about the users currently boosting a channel, see here » for more info about boosts. See Possible codes: 400 (details)
+ /// The channel.
+ /// Next offset for pagination, obtained from the next_offset field of .
/// Maximum number of results to return, see pagination
public static Task Stories_GetBoostersList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue)
=> client.Invoke(new Stories_GetBoostersList
@@ -5870,14 +5886,16 @@ namespace TL
limit = limit,
});
- /// See Possible codes: 400 (details)
+ /// Check whether a channel can be boosted, see here for more info ». See Possible codes: 400 (details)
+ /// The channel to boost.
public static Task Stories_CanApplyBoost(this Client client, InputPeer peer)
=> client.Invoke(new Stories_CanApplyBoost
{
peer = peer,
});
- /// See Possible codes: 400 (details)
+ /// Boost » a channel, leveling it up and granting it permission to post stories ». See Possible codes: 400 (details)
+ /// The channel to boost.
public static Task Stories_ApplyBoost(this Client client, InputPeer peer)
=> client.Invoke(new Stories_ApplyBoost
{