public async void RandomTest()
 {
     var result = await _giphy.RandomSticker(new RandomParameter()
     {
         Tag = "american psycho"
     });
 }
Ejemplo n.º 2
0
        public async void RandomStickerSearch()
        {
            var gifResult = await giphy.RandomSticker(new RandomParameter()
            {
                Tag = "american psycho"
            });

            Assert.True(gifResult != null);
        }
        public async Task <string> GetRandomSticker(string searchParameter)
        {
            var giphy = new Giphy(Configuration["RemotePuzzle:GiphyApiKey"]);

            var randomGif = await giphy.RandomSticker(new GiphyDotNet.Model.Parameters.RandomParameter {
                Tag = searchParameter
            });

            return(randomGif.Data.ImageMp4Url);
        }
Ejemplo n.º 4
0
        public async Task ResumeAfterTagClarification(IDialogContext context, IAwaitable <string> result)
        {
            var tag   = await result;
            var giphy = new Giphy("fdUMs7mLyMOCTmDNSnPJpBuQyPuxgUz7");

            var stickerresult = await giphy.RandomSticker(new RandomParameter()
            {
                Tag = tag
            });

            // setup a message that can hold the generated image
            var replyMessage = context.MakeMessage();

            var animationCard = new AnimationCard
            {
                Image = new ThumbnailUrl
                {
                    Url = "https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png"
                },
                Media = new List <MediaUrl>
                {
                    new MediaUrl()
                    {
                        Url = stickerresult.Data.FixedHeightSmallUrl
                    }
                }
            };

            replyMessage.Attachments = new List <Attachment> {
                animationCard.ToAttachment()
            };

            // return our reply to the user
            await context.PostAsync(replyMessage);

            context.Wait(MessageReceivedAsync);
        }