예제 #1
0
        public async Task GetRandomGifAsyncTest()
        {
            if (this.giphy.IsDisabled())
            {
                Assert.Inconclusive("Service has not been properly initialized.");
            }

            RandomImageData data = await this.giphy.GetRandomGifAsync();

            Assert.IsNotNull(data?.Url);
        }
예제 #2
0
        public async Task RandomAsync(CommandContext ctx)
        {
            if (this.Service.IsDisabled())
            {
                throw new ServiceDisabledException();
            }

            GiphyDotNet.Model.GiphyRandomImage.Data res = await this.Service.GetRandomGifAsync();

            await ctx.RespondAsync(embed : new DiscordEmbedBuilder {
                Title    = "Random gif:",
                ImageUrl = res.Url,
                Color    = this.ModuleColor
            }.Build());
        }