Update rosu-v2

This commit is contained in:
Natsu Kagami 2024-04-26 12:04:02 -04:00
parent e0664760fb
commit ea1c8d2cac
Signed by: nki
GPG key ID: 55A032EB38B49ADB
5 changed files with 9 additions and 10 deletions

2
Cargo.lock generated
View file

@ -1803,7 +1803,7 @@ checksum = "be9e281b71d3797817a1e6615dd8fb081dd61359b4c41d08792cc7c3c1c13b4e"
[[package]] [[package]]
name = "rosu-v2" name = "rosu-v2"
version = "0.8.0" version = "0.8.0"
source = "git+https://github.com/natsukagami/rosu-v2?rev=6f6731cb2f0d235b006ab375dd94b446dde894ac#6f6731cb2f0d235b006ab375dd94b446dde894ac" source = "git+https://github.com/MaxOhn/rosu-v2?rev=bab40491023b4c08f64cb1660e8d0e11db4e3c90#bab40491023b4c08f64cb1660e8d0e11db4e3c90"
dependencies = [ dependencies = [
"bytes", "bytes",
"dashmap", "dashmap",

View file

@ -16,7 +16,7 @@ osuparse = { git = "https://github.com/eltrufas/osuparse", rev = "ad8f6e5e7771e7
regex = "1.5.6" regex = "1.5.6"
reqwest = "0.11.10" reqwest = "0.11.10"
rosu-pp = "0.9.1" rosu-pp = "0.9.1"
rosu-v2 = { git = "https://github.com/natsukagami/rosu-v2", rev = "6f6731cb2f0d235b006ab375dd94b446dde894ac" } rosu-v2 = { git = "https://github.com/MaxOhn/rosu-v2", rev = "bab40491023b4c08f64cb1660e8d0e11db4e3c90" }
time = "0.3" time = "0.3"
serde = { version = "1.0.137", features = ["derive"] } serde = { version = "1.0.137", features = ["derive"] }
serenity = "0.12" serenity = "0.12"

View file

@ -430,7 +430,7 @@ impl Beatmap {
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct UserEvent(pub rosu_v2::model::recent_event::RecentEvent); pub struct UserEvent(pub rosu_v2::model::event::Event);
/// Represents a "achieved rank #x on beatmap" event. /// Represents a "achieved rank #x on beatmap" event.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
@ -445,7 +445,7 @@ impl UserEvent {
/// Try to parse the event into a "rank" event. /// Try to parse the event into a "rank" event.
pub fn to_event_rank(&self) -> Option<UserEventRank> { pub fn to_event_rank(&self) -> Option<UserEventRank> {
match &self.0.event_type { match &self.0.event_type {
rosu_v2::model::recent_event::EventType::Rank { rosu_v2::model::event::EventType::Rank {
grade: _, grade: _,
rank, rank,
mode, mode,

View file

@ -76,7 +76,7 @@ impl User {
pub(crate) fn from_rosu( pub(crate) fn from_rosu(
user: rosu::user::UserExtended, user: rosu::user::UserExtended,
stats: rosu::user::UserStatistics, stats: rosu::user::UserStatistics,
events: Vec<rosu::recent_event::RecentEvent>, events: Vec<rosu::event::Event>,
) -> Self { ) -> Self {
Self { Self {
id: user.user_id as u64, id: user.user_id as u64,
@ -105,8 +105,8 @@ impl User {
} }
} }
impl From<rosu::recent_event::RecentEvent> for UserEvent { impl From<rosu::event::Event> for UserEvent {
fn from(value: rosu::recent_event::RecentEvent) -> Self { fn from(value: rosu::event::Event) -> Self {
Self(value) Self(value)
} }
} }

View file

@ -207,8 +207,7 @@ pub mod builders {
}; };
let now = time::OffsetDateTime::now_utc() let now = time::OffsetDateTime::now_utc()
- time::Duration::DAY * self.event_days.unwrap_or(31); - time::Duration::DAY * self.event_days.unwrap_or(31);
let mut events = let mut events = handle_not_found(client.rosu.recent_activity(user.user_id).await)?
handle_not_found(client.rosu.recent_events(user.user_id).limit(50).await)?
.unwrap_or(vec![]); .unwrap_or(vec![]);
events.retain(|e| (now <= e.created_at)); events.retain(|e| (now <= e.created_at));
let stats = user.statistics.take().unwrap(); let stats = user.statistics.take().unwrap();