feat: Implemented daily timer

- Bump version to 0.10.0
- Added /timer command
This commit is contained in:
Alexey 2025-12-18 15:58:18 +03:00
commit cc916c06ce
11 changed files with 187 additions and 32 deletions

View file

@ -310,6 +310,27 @@ pub async fn update(
Ok(())
}
pub async fn publish_inner(ctx: Context<'_>, quest: &mut Quest) -> Result<(), Error> {
quest.public = true;
let quests_path = ctx.data().config.full_quests_path();
quest.save(quests_path)?;
let content = make_quest_message_content(ctx, &quest);
let builder = CreateMessage::new()
.content(content);
let dc = ctx.data().discord.clone();
let channel = {
let guard = dc.lock().expect("shouldn't be locked");
guard.quests_channel
};
channel.send_message(ctx, builder).await?;
Ok(())
}
/// Mark quest as public and send its message in quests channel
#[poise::command(
prefix_command,
@ -335,24 +356,8 @@ pub async fn publish(
if quest.public {
return Err(Error::QuestIsPublic(id));
}
quest.public = true;
let content = make_quest_message_content(ctx, &quest);
let builder = CreateMessage::new()
.content(content);
let dc = ctx.data().discord.clone();
let channel = {
let guard = dc.lock().expect("shouldn't be locked");
guard.quests_channel
};
channel.send_message(ctx, builder).await?;
let quests_path = ctx.data().config.full_quests_path();
quest.save(quests_path)?;
publish_inner(ctx, quest).await?;
let strings = &ctx.data().strings;
let formatter = strings.formatter().quest(&quest);