From 81a9ec0c50468cd6cdd4192323b6303bf7dd32d6 Mon Sep 17 00:00:00 2001 From: 2ndbeam <2ndbeam@disroot.org> Date: Sun, 21 Dec 2025 11:08:08 +0300 Subject: [PATCH] feat: Added message context to strings.quest.publish --- discord/src/commands/quest.rs | 14 +++++++++----- discord/src/strings.rs | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/discord/src/commands/quest.rs b/discord/src/commands/quest.rs index ee6089d..1d73544 100644 --- a/discord/src/commands/quest.rs +++ b/discord/src/commands/quest.rs @@ -310,7 +310,7 @@ pub async fn update( Ok(()) } -pub async fn publish_inner(ctx: Context<'_>, quest: &mut Quest) -> Result<(), Error> { +pub async fn publish_inner(ctx: Context<'_>, quest: &mut Quest) -> Result { quest.public = true; let quests_path = ctx.data().config.full_quests_path(); @@ -327,8 +327,10 @@ pub async fn publish_inner(ctx: Context<'_>, quest: &mut Quest) -> Result<(), Er guard.quests_channel }; - channel.send_message(ctx, builder).await?; - Ok(()) + match channel.send_message(ctx, builder).await { + Ok(m) => Ok(m), + Err(error) => Err(Error::SerenityError(error)), + } } /// Mark quest as public and send its message in quests channel @@ -357,10 +359,12 @@ pub async fn publish( return Err(Error::QuestIsPublic(id)); } - publish_inner(ctx, quest).await?; + let message = publish_inner(ctx, quest).await?; let strings = &ctx.data().strings; - let formatter = strings.formatter().quest(&quest); + let formatter = strings.formatter() + .quest(&quest) + .message(&message); let reply_string = formatter.fmt(&strings.quest.publish); ctx.reply(reply_string).await?; diff --git a/discord/src/strings.rs b/discord/src/strings.rs index a3d485f..afa2ac8 100644 --- a/discord/src/strings.rs +++ b/discord/src/strings.rs @@ -328,7 +328,7 @@ impl Default for QuestStrings { list_item: "{n}{q.id}: {q.name}{n} Description: {q.description}".to_string(), create: "Created quest {q.id}".to_string(), update: "Updated quest {q.id}".to_string(), - publish: "Published quest {q.id}: {text}".to_string(), + publish: "Published quest {q.id}: {m.link}".to_string(), delete: "Deleted quest {q.id}".to_string(), message_format: "### `{q.id}` {q.name} (+{q.reward}){n}\ Difficulty: *{q.difficulty}*{n}\