feat(discord): Added /balance {give,set} commands

- Also, you cannot /answer to unpublished quest
- Also, changed /scoreboard to print name instead of mentioning
- Also, made --config an option, defaulting to "cfg/config.toml"
This commit is contained in:
Alexey 2025-12-15 13:26:37 +03:00
commit 4ba57b925a
6 changed files with 111 additions and 10 deletions

View file

@ -13,6 +13,8 @@ pub enum Error {
BothChannelAndUser,
SerenityError(serenity::Error),
SquadQuestError(squad_quest::error::Error),
AccountNotFound,
InsufficientFunds(u32),
}
impl From<serenity::Error> for Error {
@ -38,6 +40,8 @@ impl Display for Error {
Self::BothChannelAndUser => write!(f, "both channel and user was specified"),
Self::SerenityError(_) => write!(f, "discord interaction error"),
Self::SquadQuestError(_) => write!(f, "internal logic error"),
Self::AccountNotFound => write!(f, "account not found"),
Self::InsufficientFunds(amount) => write!(f, "account does not have {amount} points"),
}
}
}
@ -50,7 +54,9 @@ impl std::error::Error for Error {
Self::QuestIsCompleted(_) |
Self::NoContent |
Self::NoChannelOrUser |
Self::BothChannelAndUser => None,
Self::BothChannelAndUser |
Self::AccountNotFound |
Self::InsufficientFunds(_) => None,
Self::SerenityError(error) => Some(error),
Self::SquadQuestError(error) => Some(error),
}