osu: Fix cache

This commit is contained in:
Natsu Kagami 2020-09-07 14:12:49 -04:00
parent 2ad04b34c9
commit 26074ae257
Signed by: nki
GPG key ID: 73376E117CD20735

View file

@ -1,17 +1,14 @@
use super::db::OsuLastBeatmap; use super::db::OsuLastBeatmap;
use super::BeatmapWithMode; use super::BeatmapWithMode;
use serenity::{ use serenity::model::id::ChannelId;
framework::standard::{CommandError as Error, CommandResult}, use youmubot_prelude::*;
model::id::ChannelId,
prelude::*,
};
/// Save the beatmap into the server data storage. /// Save the beatmap into the server data storage.
pub(crate) fn save_beatmap( pub(crate) fn save_beatmap(
data: &ShareMap, data: &TypeMap,
channel_id: ChannelId, channel_id: ChannelId,
bm: &BeatmapWithMode, bm: &BeatmapWithMode,
) -> CommandResult { ) -> Result<()> {
let db = OsuLastBeatmap::open(data); let db = OsuLastBeatmap::open(data);
let mut db = db.borrow_mut()?; let mut db = db.borrow_mut()?;
@ -22,9 +19,9 @@ pub(crate) fn save_beatmap(
/// Get the last beatmap requested from this channel. /// Get the last beatmap requested from this channel.
pub(crate) fn get_beatmap( pub(crate) fn get_beatmap(
data: &ShareMap, data: &TypeMap,
channel_id: ChannelId, channel_id: ChannelId,
) -> Result<Option<BeatmapWithMode>, Error> { ) -> Result<Option<BeatmapWithMode>> {
let db = OsuLastBeatmap::open(data); let db = OsuLastBeatmap::open(data);
let db = db.borrow()?; let db = db.borrow()?;