fix: local api specs
This commit is contained in:
parent
96fc2d54c5
commit
2213436998
3 changed files with 4 additions and 9 deletions
|
@ -20,7 +20,7 @@ pub(crate) async fn helpstart(ctx: Context<'_>) -> Result<(), Error> {
|
|||
.map(|a| name(&ctx.data().caches, &ctx.data().clients.general, a.uuid))
|
||||
.collect::<Vec<_>>();
|
||||
let mc_accounts = futures::future::try_join_all(mc_accounts).await?;
|
||||
let bots = fetch_all(&ctx.data().clients.local_api_client).await?.bots;
|
||||
let bots = fetch_all(&ctx.data().clients.local_api_client).await?;
|
||||
let usable = bots
|
||||
.iter()
|
||||
.filter_map(|b| {
|
||||
|
|
|
@ -3,11 +3,6 @@ use getset::Getters;
|
|||
use reqwest::Client;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Getters)]
|
||||
pub(crate) struct Response {
|
||||
pub(crate) bots: Vec<Bot>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Getters)]
|
||||
#[getset(get = "pub(crate)")]
|
||||
pub(crate) struct Bot {
|
||||
|
@ -36,9 +31,9 @@ pub(crate) enum ListType {
|
|||
Blacklist,
|
||||
}
|
||||
|
||||
pub(crate) async fn fetch_all(client: &Client) -> Result<Response, Error> {
|
||||
pub(crate) async fn fetch_all(client: &Client) -> Result<Vec<Bot>, Error> {
|
||||
let url = "https://localhost:6969/list";
|
||||
let response: Response = client
|
||||
let response: Vec<Bot> = client
|
||||
.get(url)
|
||||
.send()
|
||||
.await?
|
||||
|
|
|
@ -24,7 +24,7 @@ impl Display for Error {
|
|||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
match self {
|
||||
Error::SqlxError(e) => write!(f, "SQLx Error: {}", e),
|
||||
Error::ApiError(e) => write!(f, "HTTPS Error (Hypixel / Mojang API):\n{}", e),
|
||||
Error::ApiError(e) => write!(f, "HTTPS Error:\n{}", e),
|
||||
Error::SerenityError(e) => write!(f, "Discord Error:\n {}", e),
|
||||
Error::OnCooldown(d) => write!(
|
||||
f,
|
||||
|
|
Loading…
Add table
Reference in a new issue