add forget admin command
This commit is contained in:
@@ -58,6 +58,24 @@ pub async fn remove(ctx: Context<'_>, user: User) -> Result<(), Error> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Remove a selfrole from the database without deleting it or attempting to take it from the user
|
||||||
|
#[poise::command(slash_command, prefix_command, required_permissions = "MANAGE_ROLES")]
|
||||||
|
pub async fn forget(ctx: Context<'_>, user: User) -> Result<(), Error> {
|
||||||
|
let guild = ctx.guild_id().ok_or(BigBirbError::GuildOnly)?;
|
||||||
|
let mut tx = ctx.data().database.begin().await?;
|
||||||
|
|
||||||
|
if let Some(role) = super::get_user_role(user.id, guild, &mut *tx).await? {
|
||||||
|
super::remove_role(role, guild, &mut *tx).await?;
|
||||||
|
common::no_ping_reply(&ctx, format!("{user}'s selfrole has been forgotten.")).await?;
|
||||||
|
} else {
|
||||||
|
common::no_ping_reply(&ctx, format!("{user} has no selfrole set.")).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
tx.commit().await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Give a user an existing role as their self role
|
/// Give a user an existing role as their self role
|
||||||
#[poise::command(slash_command, prefix_command, required_permissions = "MANAGE_ROLES")]
|
#[poise::command(slash_command, prefix_command, required_permissions = "MANAGE_ROLES")]
|
||||||
pub async fn give(ctx: Context<'_>, user: User, role: Role, force: Option<bool>) -> Result<(), Error> {
|
pub async fn give(ctx: Context<'_>, user: User, role: Role, force: Option<bool>) -> Result<(), Error> {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ pub async fn role(_ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
"admin::name",
|
"admin::name",
|
||||||
"admin::color",
|
"admin::color",
|
||||||
"admin::remove",
|
"admin::remove",
|
||||||
|
"admin::forget",
|
||||||
"admin::set",
|
"admin::set",
|
||||||
"admin::give",
|
"admin::give",
|
||||||
"whois::whois",
|
"whois::whois",
|
||||||
|
|||||||
Reference in New Issue
Block a user