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

@ -15,6 +15,7 @@ pub enum Error {
SerenityError(serenity::Error),
SquadQuestError(squad_quest::error::Error),
AccountNotFound,
AccountIsSelf,
InsufficientFunds(u32),
RoomNotFound(u16),
RoomAlreadyUnlocked(u16),
@ -57,6 +58,7 @@ impl Display for Error {
Self::SerenityError(_) => write!(f, "discord interaction error"),
Self::SquadQuestError(_) => write!(f, "internal logic error"),
Self::AccountNotFound => write!(f, "account not found"),
Self::AccountIsSelf => write!(f, "given account is the same as command user"),
Self::InsufficientFunds(amount) => write!(f, "user does not have {amount} points"),
Self::RoomNotFound(id) => write!(f, "room #{id} not found"),
Self::RoomAlreadyUnlocked(id) => write!(f, "room #{id} is already unlocked for this user"),
@ -75,6 +77,7 @@ impl std::error::Error for Error {
Self::NoChannelOrUser |
Self::BothChannelAndUser |
Self::AccountNotFound |
Self::AccountIsSelf |
Self::InsufficientFunds(_) |
Self::RoomNotFound(_) |
Self::RoomAlreadyUnlocked(_) |