ur welcome karx

This commit is contained in:
gallant 2022-08-11 15:55:20 -05:00
parent 37fe9a8687
commit 10dd6a607f
1 changed files with 7 additions and 10 deletions

View File

@ -1,10 +1,8 @@
use crate::bot::{Command, Context};
use async_trait::async_trait;
//use std::collections::HashMap;
use reqwest::Client;
use serde_json::{Map,Value};
use serde::{Deserialize};
use tracing::Level;
#[derive(Default)]
@ -20,14 +18,13 @@ impl Pkg {
}
}
#[derive(Debug, Deserialize)]
struct pkgd{
version: u32,
results: Vec<result>,
#[derive(Debug,Deserialize)]
struct Depkgd{
results: Vec<TheGStuff>,
}
#[derive(Debug, Deserialize)]
struct result {
#[derive(Debug,Deserialize)]
struct TheGStuff {
pkgname: String,
repo: String,
pkgver: String,
@ -45,7 +42,7 @@ impl Command for Pkg {
))
.send()
.await?.text().await?;
let b: pkgd = serde_json::from_str(&body)?;
let b: Depkgd = serde_json::from_str(&body)?;
let c = &b.results[0];
tracing::debug!("{:?}",b);
Ok(format!("{} (v: {}): {}",c.pkgname,c.pkgver,c.pkgdesc))