feat(discord): Moved most strings to Strings

- Added Error::AccountIsSelf variant
- /balance give to self now returns error
This commit is contained in:
Alexey 2025-12-17 14:43:40 +03:00
commit 787118309a
7 changed files with 247 additions and 85 deletions

View file

@ -31,8 +31,14 @@ pub async fn unlock(
let account_path = conf.full_accounts_path();
account.save(account_path)?;
let strings = &ctx.data().strings;
let formatter = strings.formatter()
.user(ctx.author())
.balance(&account, &map)
.value(id);
let reply_string = format!("Unlocked room #{id}. Your balance: {} points", account.balance);
let reply_string = formatter.fmt(&strings.map.room_unlocked);
ctx.reply(reply_string).await?;
Ok(())
@ -59,8 +65,13 @@ pub async fn r#move(
account.location = id;
let account_path = conf.full_accounts_path();
account.save(account_path)?;
let strings = &ctx.data().strings;
let formatter = strings.formatter()
.user(ctx.author())
.value(id);
let reply_string = format!("Moved to room #{id}.");
let reply_string = formatter.fmt(&strings.map.moved_to_room);
ctx.reply(reply_string).await?;
Ok(())