Set up simple command for osu

This commit is contained in:
Natsu Kagami 2024-12-31 01:18:22 +01:00 committed by Natsu Kagami
parent 125bad04da
commit 2cdff76837
5 changed files with 37 additions and 1 deletions

View file

@ -15,6 +15,7 @@ use serenity::{
utils::MessageBuilder,
};
pub use commands::osu as osu_command;
use db::{OsuLastBeatmap, OsuSavedUsers, OsuUser, OsuUserMode};
use embeds::{beatmap_embed, score_embed, user_embed};
pub use hook::{dot_osu_hook, hook, score_hook};
@ -38,6 +39,7 @@ use crate::{
mod announcer;
pub(crate) mod beatmap_cache;
mod cache;
mod commands;
mod db;
pub(crate) mod display;
pub(crate) mod embeds;
@ -67,6 +69,17 @@ pub struct OsuEnv {
pub(crate) beatmaps: BeatmapMetaCache,
}
/// Gets an [OsuEnv] from the current environment.
pub trait HasOsuEnv: Send + Sync {
fn osu_env(&self) -> &OsuEnv;
}
impl<T: AsRef<OsuEnv> + Send + Sync> HasOsuEnv for T {
fn osu_env(&self) -> &OsuEnv {
self.as_ref()
}
}
impl std::fmt::Debug for OsuEnv {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "<osu::Env>")