Skip to main content

Overview

The Demote User command allows server administrators to revoke semester moderator privileges from users. This removes their access to moderation commands.
This command requires the MANAGE_GUILD permission and can only be used by server administrators.

Permissions Required

To use this command, you must have:
  • MANAGE_GUILD Discord permission (typically Server Administrator)

Usage

  1. Right-click on a user’s profile or message
  2. Select “Apps” → “Demote from Semestermod”
  3. The bot will remove the user from the semester moderators database

Parameters

user
User
required
The user to demote from semester moderator (selected via context menu)

Examples

Demoting a User

Action: Right-click on a user and select “Demote from Semestermod” Response:
Demoted @Username#1234 from semestermod
The user will no longer have semester moderator privileges and cannot use moderation commands (unless they have Discord permissions).

What Users Lose After Demotion

Demoted users will lose access to:
  • Pin/unpin messages (pin command)
  • Delete messages (delete_message command)
  • Other commands that check for has_mod_or_semestermod permission
Users who have Discord’s MANAGE_MESSAGES or other elevated permissions will still be able to use moderation commands even after demotion.

Implementation Details

From moderation.rs:105-123:
#[poise::command(
    context_menu_command = "Demote from Semestermod",
    required_permissions = "MANAGE_GUILD",
    guild_only
)]
pub async fn demote_user(
    ctx: Context<'_>,
    #[description = "The user to demote"] user: serenity::User,
) -> Result<(), Error> {
    let db = &ctx.data().db;
    let uid = user.id.0 as i64;

    sqlx::query("DELETE FROM semestermods WHERE user_id = $1")
        .bind(uid)
        .execute(db)
        .await
        .map_err(Error::Database)?;

    ctx.say(format!("Demoted {} from semestermod", user.tag()))
        .await
        .map_err(Error::Serenity)?;

    Ok(())
}

Database Operation

The command removes the user from the semestermods table:
DELETE FROM semestermods WHERE user_id = $1
This ensures the user will no longer pass the has_mod_or_semestermod permission check.
This command is guild-only and can only be used within server channels, not in DMs.
Demoting a user who is not currently a semester moderator will not cause an error - the database operation will simply affect zero rows.

Build docs developers (and LLMs) love