feat: Added message context to strings.quest.publish
This commit is contained in:
parent
0ab777d898
commit
81a9ec0c50
2 changed files with 10 additions and 6 deletions
|
|
@ -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<Message, Error> {
|
||||
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?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue