From c2491f45425c41a70d3539df29899f612abff8e9 Mon Sep 17 00:00:00 2001 From: August Date: Sun, 3 May 2026 14:33:59 -0400 Subject: [PATCH] New server --- src/main.rs | 5 +++++ src/minecraft.rs | 7 +++++-- src/scpsl.rs | 2 +- src/types.rs | 16 +++++++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4e52e94..d8ac63d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,5 +24,10 @@ async fn main() { std::env::var("TOKEN_BOT_MC_MCHPRS").unwrap(), "Project MCRV".into(), ); + let dawn = Minecraft::new( + Url::try_from("https://api.mcstatus.io/v2/status/java/mchprs.shibedrill.site").unwrap(), + std::env::var("TOKEN_BOT_MC_DAWN").unwrap(), + "Dawn Group".into(), + ); join!(mchprs.run(), gamerzone.run()); } diff --git a/src/minecraft.rs b/src/minecraft.rs index af21798..0864459 100644 --- a/src/minecraft.rs +++ b/src/minecraft.rs @@ -3,7 +3,10 @@ use reqwest::{Client, Request}; use serenity::*; use url::Url; -use crate::{funcs, types::{self, ServerResponse}}; +use crate::{ + funcs, + types::{self, ServerResponse}, +}; #[derive(serde::Deserialize, Debug)] struct ServerSummary { @@ -58,7 +61,7 @@ impl Minecraft { data.online, Some(players.online as u32), Some(players.max as u32), - Some(data.version.name_raw) + Some(data.version.name_raw), )) } else { Ok(ServerResponse::new(data.online, None, None, None)) diff --git a/src/scpsl.rs b/src/scpsl.rs index 9ce8296..f310d10 100644 --- a/src/scpsl.rs +++ b/src/scpsl.rs @@ -46,7 +46,7 @@ impl Scpsl { data.online, playercount_unwrapped.first().copied(), playercount_unwrapped.get(1).copied(), - None + None, )) } diff --git a/src/types.rs b/src/types.rs index 605dc00..d7f1be6 100644 --- a/src/types.rs +++ b/src/types.rs @@ -4,16 +4,21 @@ pub struct ServerResponse { online: bool, players: Option, max: Option, - version: Option + version: Option, } impl ServerResponse { - pub fn new(online: bool, players: Option, max: Option, version: Option) -> Self { + pub fn new( + online: bool, + players: Option, + max: Option, + version: Option, + ) -> Self { ServerResponse { online, players, max, - version + version, } } @@ -38,7 +43,8 @@ impl ServerResponse { } pub fn to_string(&self) -> String { - format!("{} {} {}", + format!( + "{} {} {}", if let Some(players) = self.players { if let Some(max) = self.max { format!("{}/{}", players, max) @@ -50,7 +56,7 @@ impl ServerResponse { }, self.online, if let Some(version) = &self.version { - version.to_string() + version.to_string() } else { "N/A".into() }