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]] [[package]]
name = "playerbot" name = "playerbot"
version = "0.5.0" version = "0.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"dotenvy", "dotenvy",

View File

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

View File

@ -4,7 +4,7 @@ mod scpsl;
mod types; mod types;
use dotenvy::{self, dotenv}; use dotenvy::{self, dotenv};
use minecraft::Minecraft; use minecraft::Minecraft;
use scpsl::SCPSL; use scpsl::Scpsl;
use tokio::join; use tokio::join;
use url::{self, Url}; 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(), Url::try_from("https://api.mcstatus.io/v2/status/java/mchprs.shibedrill.site").unwrap(),
std::env::var("TOKEN_BOT_MC_MCHPRS").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(), Url::try_from("https://api.scplist.kr/api/servers/81460").unwrap(),
std::env::var("TOKEN_BOT_SCPSL").unwrap(), std::env::var("TOKEN_BOT_SCPSL").unwrap(),
); );

View File

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

View File

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