Overview
Faculty Bot provides moderation tools through Discord’s context menu system, allowing moderators to quickly manage messages and users without typing commands. All moderation actions are restricted to users with appropriate permissions.Permission System
The bot implements a dual permission system:src/commands/moderation.rs:5-27
Permission Levels
Semestermods
Custom role stored in database for student moderatorsCan use pin, delete, and basic moderation tools.
Discord Permissions
Standard Discord permissions like MANAGE_MESSAGESAllows staff to use moderation without database entry.
Message Management
Pin/Unpin Messages
Context menu command that toggles message pin state:src/commands/moderation.rs:29-54
Delete Messages
Permanently remove messages using the context menu:src/commands/moderation.rs:56-73
Note: This action is irreversible. The message is permanently deleted from Discord.
User Role Management
Promote to Semestermod
Grant semestermod privileges to a user:src/commands/moderation.rs:75-98
Demote from Semestermod
Revoke semestermod privileges:src/commands/moderation.rs:100-123
Requirements: MANAGE_GUILD permission (typically Administrator role)
Context Menu Commands
Toggle Pin State
Permission: Semestermod or MANAGE_MESSAGESRight-click any message to pin or unpin it
Delete Message
Permission: Semestermod or MANAGE_MESSAGESRight-click any message to delete it permanently
Promote to Semestermod
Permission: MANAGE_GUILDRight-click a user to grant moderation privileges
Demote from Semestermod
Permission: MANAGE_GUILDRight-click a user to revoke moderation privileges
Database Schema
Semestermods are tracked in a dedicated table:src/structs.rs:49-51
This allows the bot to persist moderator status across restarts and query it efficiently.
Implementation Notes
Ephemeral Responses
All moderation commands use ephemeral responses, meaning:- Only the moderator sees the success/failure message
- No clutter in the channel
- Discreet moderation actions
ephemeral attribute ensures responses are private.
Reference: src/commands/moderation.rs:32
Guild-Only Restriction
All moderation commands are restricted to guild (server) contexts:Best Practices
Use Context Menus
Faster than typing commands for message actions
Grant Semestermod Carefully
Only promote trusted community members
Ephemeral by Default
Keeps moderation discreet and professional
Database Persistence
Semestermod status survives bot restarts
Security Features
- Dual Permission Check: Must pass either database check or Discord permission check
- Guild-Only Commands: Cannot be used in DMs or group chats
- MANAGE_GUILD Requirement: Only administrators can promote/demote semestermods
- Ephemeral Responses: Moderation actions are private to the moderator