Skip to main content

Overview

The Promote User command allows server administrators to grant semester moderator privileges to users. Semester moderators gain access to moderation commands like pin and delete message.
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” → “Promote to Semestermod”
  3. The bot will add the user to the semester moderators database

Parameters

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

Examples

Promoting a User

Action: Right-click on a user and select “Promote to Semestermod” Response:
Promoted @Username#1234 to semestermod
The user will now have semester moderator privileges and can use moderation commands.

What Semester Moderators Can Do

Once promoted, users gain access to:
  • Pin/unpin messages (pin command)
  • Delete messages (delete_message command)
  • Other commands that check for has_mod_or_semestermod permission

Implementation Details

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

    sqlx::query("INSERT INTO semestermods (user_id) VALUES ($1)")
        .bind(uid)
        .execute(db)
        .await
        .map_err(Error::Database)?;

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

    Ok(())
}

Database Structure

The command inserts the user into the semestermods table:
INSERT INTO semestermods (user_id) VALUES ($1)
This table is checked by the has_mod_or_semestermod permission function to grant moderation access.
This command is guild-only and can only be used within server channels, not in DMs.
If the user is already a semester moderator, attempting to promote them again may result in a database error due to duplicate key constraints.

Build docs developers (and LLMs) love