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