Skip to main content

Overview

The /verify command allows students to verify their identity by linking their Discord account with their university email address. This is a two-step process that requires both initiating the verification with an email and entering a verification code.

Subcommands

verify init

Request a verification code by providing your student email address.
email
string
required
Your student email address. Must end with @stud.hs-kempten.de.Localized names:
  • German: email-adresse

Usage

/verify init email:your.name@stud.hs-kempten.de

Validation

The command validates that:
  • The email address ends with @stud.hs-kempten.de
  • The email is not already associated with another Discord account
  • The user is not already verified

Response

On success, you’ll receive an embed message notifying you that the verification email has been sent. Note that the mail server may be slow, so please be patient. If there’s an error sending the email, you’ll receive a detailed error message.

Error Messages

  • Invalid email: If the email doesn’t end with @stud.hs-kempten.de
  • Already verified: If the email is already linked to another account
  • Email send error: If there’s a problem sending the verification email

Implementation Details

if !email_used.ends_with("@stud.hs-kempten.de") {
    return Err(Error::WithMessage(lang.invalid_email().into()));
}
The command generates a verification code and stores it temporarily along with the email address. An email is then sent to the provided address containing the verification code.

verify code

Enter the verification code you received via email to complete the verification process.
code
string
required
The verification code sent to your email address.

Usage

/verify code code:ABC123

Validation

The command checks that:
  • You have previously initiated verification with /verify init
  • The code matches the one that was sent to your email
  • You are not already verified

Response

On successful verification:
  • You’ll receive a confirmation message
  • Your Discord account will be linked to your email in the database
  • You’ll automatically receive the “Verified” role
  • The verification code will be removed from temporary storage

Error Messages

  • Already verified: If you’ve already completed verification or if you haven’t initiated the verification process
  • Invalid code: If the code doesn’t match the one sent to your email

Implementation Details

let actual_code = code_key.code == supplied_code;

if !actual_code {
    return Err(Error::WithMessage(lang.err_invalid_code().into()));
}

sqlx::query("INSERT INTO verified_users (user_id, user_email) VALUES ($1, $2)")
    .bind(user_id.0 as i64)
    .bind(code_key.email.clone())
    .execute(pool)
    .await
    .map_err(Error::Database)?;
After successful verification, the user is added to the verified_users table and automatically receives the verified role.

Localization

This command supports multiple languages:
LanguageCommand NameInit SubcommandDescription
English/verifyinitRequest a verification code by providing your student email address
German/verifizierenstartFordere einen Verifizierungscode an, indem du deine Studierenden E-Mail Adresse angibst
Japanese/verifyinit(Uses English as fallback)

Permissions

  • Guild Only: This command can only be used in a server, not in DMs
  • No special permissions required for users to run this command

Database Schema

The verification process interacts with the verified_users table:
SELECT * FROM verified_users WHERE user_email = $1
SELECT * FROM verified_users WHERE user_id = $1
INSERT INTO verified_users (user_id, user_email) VALUES ($1, $2)

Example Flow

  1. User runs /verify init email:student@stud.hs-kempten.de
  2. Bot validates the email format
  3. Bot checks if email is already in use
  4. Bot generates a verification code and sends it via email
  5. User receives email with code
  6. User runs /verify code code:ABC123
  7. Bot validates the code
  8. Bot adds user to database and assigns verified role
  9. User is now verified and has access to additional server features

Build docs developers (and LLMs) love