Пример #1
0
        public async void StickerSendExecute(Sticker sticker, bool?schedule, bool?silent)
        {
            Delegate?.HideStickers();

            var chat = _chat;

            if (chat == null)
            {
                return;
            }

            var restricted = await VerifyRightsAsync(chat, x => x.CanSendOtherMessages, Strings.Resources.GlobalAttachStickersRestricted, Strings.Resources.AttachStickersRestrictedForever, Strings.Resources.AttachStickersRestricted);

            if (restricted)
            {
                return;
            }

            var options = await PickSendMessageOptionsAsync(schedule, silent);

            if (options == null)
            {
                return;
            }

            var reply = GetReply(true);
            var input = new InputMessageSticker(new InputFileId(sticker.StickerValue.Id), sticker.Thumbnail?.ToInput(), sticker.Width, sticker.Height);

            await SendMessageAsync(reply, input, options);
        }
        public async void SendAnimationExecute(Animation animation)
        {
            var chat = _chat;

            if (chat == null)
            {
                return;
            }

            var restricted = await VerifyRightsAsync(chat, x => x.CanSendOtherMessages, Strings.Resources.AttachStickersRestrictedForever, Strings.Resources.AttachStickersRestricted);

            if (restricted)
            {
                return;
            }

            var reply = GetReply(true);
            var input = new InputMessageSticker(new InputFileId(animation.AnimationValue.Id), null, 0, 0);

            await SendMessageAsync(reply, input);
        }
Пример #3
0
        public async void StickerSendExecute(Sticker sticker, bool?schedule, bool?silent, string emoji = null)
        {
            Delegate?.HideStickers();

            var chat = _chat;

            if (chat == null)
            {
                return;
            }

            if (sticker.PremiumAnimation != null && ProtoService.IsPremiumAvailable && !ProtoService.IsPremium)
            {
                await new UniqueStickersPopup(ProtoService, sticker).ShowQueuedAsync();
                return;
            }

            var restricted = await VerifyRightsAsync(chat, x => x.CanSendOtherMessages, Strings.Resources.GlobalAttachStickersRestricted, Strings.Resources.AttachStickersRestrictedForever, Strings.Resources.AttachStickersRestricted);

            if (restricted)
            {
                return;
            }

            var options = await PickMessageSendOptionsAsync(schedule, silent);

            if (options == null)
            {
                return;
            }

            var reply = GetReply(true);
            var input = new InputMessageSticker(new InputFileId(sticker.StickerValue.Id), sticker.Thumbnail?.ToInput(), sticker.Width, sticker.Height, emoji ?? string.Empty);

            await SendMessageAsync(chat, reply, input, options);
        }