From b1c8d225f2d1a5966430b78b852c399d0817247b Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 17 Jun 2022 15:12:50 +0200
Subject: [PATCH] implicit InputStickerSet from string shortName
---
EXAMPLES.md | 6 +++---
src/TL.Helpers.cs | 5 +++++
src/TL.Schema.cs | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 547dc5f..517c79f 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -73,13 +73,13 @@ foreach (var stickerSet in allStickers.sets)
// • Send a random sticker from the user's favorites stickers
var favedStickers = await client.Messages_GetFavedStickers();
var stickerDoc = favedStickers.stickers[new Random().Next(favedStickers.stickers.Length)];
-await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc });
+await client.SendMessageAsync(InputPeer.Self, null, stickerDoc);
// • Send a specific sticker given the stickerset shortname and emoticon
-var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" });
+var friendlyPanda = await client.Messages_GetStickerSet("Friendly_Panda");
var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0];
var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId);
-await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc });
+await client.SendMessageAsync(InputPeer.Self, null, laughDoc);
// • Send a GIF from an internet URL
await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocumentExternal
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index d21f5a4..62b2c53 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -416,6 +416,11 @@ namespace TL
partial class SendMessageEmojiInteraction { public override string ToString() => "clicking on emoji"; }
partial class SendMessageEmojiInteractionSeen { public override string ToString() => "watching emoji reaction"; }
+ partial class InputStickerSet
+ {
+ public static implicit operator InputStickerSet(string shortName) => new InputStickerSetShortName { short_name = shortName };
+ }
+
partial class StickerSet
{
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 4237153..924911e 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -5954,7 +5954,7 @@ namespace TL
/// Represents a stickerset Derived classes: , , , , See
/// a null value means inputStickerSetEmpty
- public abstract class InputStickerSet : IObject { }
+ public abstract partial class InputStickerSet : IObject { }
/// Stickerset by ID See
[TLDef(0x9DE7A269)]
public class InputStickerSetID : InputStickerSet