this is a LOT

This commit is contained in:
August 2024-10-21 23:00:35 -04:00
parent b04157e4ae
commit cb17b18ad3
Signed by: shibedrill
GPG Key ID: 5FE0CB25945EFAA2
5 changed files with 10 additions and 10 deletions

2
Cargo.lock generated
View File

@ -1126,7 +1126,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "playerbot"
version = "0.5.0"
version = "0.6.0"
dependencies = [
"anyhow",
"dotenvy",

View File

@ -1,6 +1,6 @@
[package]
name = "playerbot"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
[dependencies]

View File

@ -4,7 +4,7 @@ mod scpsl;
mod types;
use dotenvy::{self, dotenv};
use minecraft::Minecraft;
use scpsl::SCPSL;
use scpsl::Scpsl;
use tokio::join;
use url::{self, Url};
@ -23,7 +23,7 @@ async fn main() {
Url::try_from("https://api.mcstatus.io/v2/status/java/mchprs.shibedrill.site").unwrap(),
std::env::var("TOKEN_BOT_MC_MCHPRS").unwrap(),
);
let scpsl = SCPSL::new(
let scpsl = Scpsl::new(
Url::try_from("https://api.scplist.kr/api/servers/81460").unwrap(),
std::env::var("TOKEN_BOT_SCPSL").unwrap(),
);

View File

@ -98,7 +98,7 @@ pub async fn event_handler(
.unwrap();
info!("Got status: {}", status.to_string());
funcs::set_presence(&ctx, status);
funcs::set_presence(ctx, status);
tokio::time::sleep(std::time::Duration::from_secs(30)).await;
},
_ => Ok(()),

View File

@ -12,16 +12,16 @@ struct ServerSummary {
}
pub struct Data {
controller: SCPSL,
controller: Scpsl,
}
#[derive(Clone)]
pub struct SCPSL {
pub struct Scpsl {
url: Url,
token: String,
}
impl SCPSL {
impl Scpsl {
pub fn new(url: Url, token: String) -> Self {
Self { url, token }
}
@ -38,8 +38,8 @@ impl SCPSL {
Ok(ServerResponse::new(
data.online,
playercount_unwrapped.get(0).map(|u| u.clone()),
playercount_unwrapped.get(1).map(|u| u.clone()),
playercount_unwrapped.first().copied(),
playercount_unwrapped.get(1).copied(),
))
}