feat: Completed commands list
- Added MapError::CannotReach variant - Updated Map::unlock_room_for_account to check reachableness - Added /info command - Added /unlock command - Added /move command - Added /reset command
This commit is contained in:
parent
4ba57b925a
commit
b6ea2d8958
11 changed files with 170 additions and 12 deletions
|
|
@ -40,6 +40,34 @@ fn account_user_id(account: &Account) -> UserId {
|
|||
UserId::new(account.id.clone().parse::<u64>().expect("automatically inserted"))
|
||||
}
|
||||
|
||||
#[poise::command(
|
||||
prefix_command,
|
||||
slash_command,
|
||||
guild_only,
|
||||
required_permissions = "ADMINISTRATOR",
|
||||
)]
|
||||
pub async fn reset(
|
||||
ctx: Context<'_>,
|
||||
who: UserId,
|
||||
) -> Result<(), Error> {
|
||||
let accounts = ctx.data().config.load_accounts();
|
||||
|
||||
let acc_id = format!("{}", who.get());
|
||||
|
||||
if let None = accounts.iter().find(|a| a.id == acc_id) {
|
||||
return Err(Error::AccountNotFound);
|
||||
}
|
||||
|
||||
let mut path = ctx.data().config.full_accounts_path();
|
||||
path.push(format!("{acc_id}.toml"));
|
||||
Account::delete(path)?;
|
||||
|
||||
let reply_string = "User was successfully reset.".to_string();
|
||||
ctx.reply(reply_string).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[poise::command(
|
||||
prefix_command,
|
||||
slash_command,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue