Implement BeatmapCache and Oppai interface

This commit is contained in:
Natsu Kagami 2020-06-12 01:03:56 -04:00
parent d68ce9cec8
commit 9aab6e11ec
Signed by: nki
GPG key ID: 73376E117CD20735
4 changed files with 148 additions and 1 deletions

View file

@ -20,6 +20,7 @@ mod cache;
mod db;
pub(crate) mod embeds;
mod hook;
mod oppai_cache;
mod server_rank;
use db::OsuUser;
@ -58,9 +59,10 @@ pub fn setup(
// API client
let http_client = data.get_cloned::<HTTPClient>();
data.insert::<OsuClient>(OsuHttpClient::new(
http_client,
http_client.clone(),
std::env::var("OSU_API_KEY").expect("Please set OSU_API_KEY as osu! api key."),
));
data.insert::<oppai_cache::BeatmapCache>(oppai_cache::BeatmapCache::new(http_client));
// Announcer
announcers.add(announcer::ANNOUNCER_KEY, announcer::updates);