ur welcome karx

master
gallant 4 months ago
parent 37fe9a8687
commit 10dd6a607f
  1. 17
      src/commands/pkg.rs

@ -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))

Loading…
Cancel
Save