mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-01-05 00:00:21 +01:00
implicit InputStickerSet from string shortName
This commit is contained in:
parent
3f84e10f7f
commit
b1c8d225f2
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -5954,7 +5954,7 @@ namespace TL
|
|||
|
||||
/// <summary>Represents a stickerset <para>Derived classes: <see cref="InputStickerSetID"/>, <see cref="InputStickerSetShortName"/>, <see cref="InputStickerSetAnimatedEmoji"/>, <see cref="InputStickerSetDice"/>, <see cref="InputStickerSetAnimatedEmojiAnimations"/></para> <para>See <a href="https://corefork.telegram.org/type/InputStickerSet"/></para></summary>
|
||||
/// <remarks>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/inputStickerSetEmpty">inputStickerSetEmpty</a></remarks>
|
||||
public abstract class InputStickerSet : IObject { }
|
||||
public abstract partial class InputStickerSet : IObject { }
|
||||
/// <summary>Stickerset by ID <para>See <a href="https://corefork.telegram.org/constructor/inputStickerSetID"/></para></summary>
|
||||
[TLDef(0x9DE7A269)]
|
||||
public class InputStickerSetID : InputStickerSet
|
||||
|
|
|
|||
Loading…
Reference in a new issue