You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

PictureService.cs 485 B

1234567891011121314151617181920
  1. using System.IO;
  2. using System.Net.Http;
  3. using System.Threading.Tasks;
  4. namespace TextCommandFramework.Services
  5. {
  6. public class PictureService
  7. {
  8. private readonly HttpClient _http;
  9. public PictureService(HttpClient http)
  10. => _http = http;
  11. public async Task<Stream> GetCatPictureAsync()
  12. {
  13. var resp = await _http.GetAsync("https://cataas.com/cat");
  14. return await resp.Content.ReadAsStreamAsync();
  15. }
  16. }
  17. }