Company
Approved Job
The `approvedjob` command allows staff or developers to approve or reject a user's job application, optionally providing a rejection reason.
Command Details
- Name: approvedjob
- Aliases: aj
- Category: Company
- Description: Approve or reject a user's job application.
- Usage:
approvedjob <userId> <approved|rejected> [reason] - Examples:
approvedjob 123456789012345678 approvedapprovedjob 123456789012345678 rejected Spamming during interview
- Cooldown: None specified
- Arguments:
- userId: The Discord user ID of the applicant.
- status: Either
approvedorrejected. - reason: Required only if status is
rejected.
- Slash Command: Disabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: Developer or Staff only
- Player Requirements: None
Functionality
- Fetches the user from the
Usersschema usinguserId. - Validates:
- User exists in the database.
- The user has an active application (
work.statusnot "not yet applied"). - Status is either
approvedorrejected.
- If approved:
- Updates
work.statustoapproved. - Sets
approvedDate.
- Updates
- If rejected:
- Updates
work.statustorejected. - Stores
rejectionReason. - Increments
work.rejections.
- Updates
- Responds with an embed summarizing the action taken.
- Handles:
- Missing parameters.
- Invalid statuses.
- Nonexistent users.
- Errors with
client.utils.sendErrorMessage().
Code Overview
- Extends the
Commandclass. - Imports:
Usersschema from../../schemas/user.
- Core logic:
- Validates input (ID, status, reason).
- Updates database document with the appropriate status and fields.
- Returns success embed with custom title and footer.
- Error handling:
- Sends descriptive error messages for invalid input, missing data, or database issues.
Apply Job List
The `applyjoblist` command lists all users with pending job applications grouped by job position. This command is intended for staff or developers only.
Check User Apply
The `checkuserapply` command lists all users who have applied for a job, including their job position and application status.