public async Task RandomDogAsync(CommandContext ctx) { string url = await PetImagesService.GetRandomDogImageAsync(); if (url is null) { throw new CommandFailedException("Connection to random.dog failed!"); } await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Description = DiscordEmoji.FromName(ctx.Client, ":dog:"), ImageUrl = url, Color = this.ModuleColor }); }
public async Task RandomCatAsync(CommandContext ctx) { string?url = await PetImagesService.GetRandomCatImageAsync(); if (url is null) { throw new CommandFailedException(ctx, "cmd-err-image"); } await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Description = DiscordEmoji.FromName(ctx.Client, ":cat:"), ImageUrl = url, Color = this.ModuleColor }); }
public async Task GetRandomDogImageAsync() { Assert.IsNotNull(await PetImagesService.GetRandomDogImageAsync()); }