Work
Apply Job
The applyjob command allows users to apply for a job from available positions such as Police, IT, Doctor, Teacher, Engineer, or Student. This command supports both message and slash command usage.
Command Details
- Name: applyjob
- Aliases: apply, jobapply
- Category: Work
- Description: Apply for a job with one of the five available positions.
- Usage:
applyjob <position>
- Examples:
applyjob Police
applyjob IT
applyjob Doctor
applyjob Teacher
applyjob Engineer
applyjob Student
- Cooldown: 10 seconds
- Arguments: Required (position)
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: User must be registered to apply for a job.
Functionality
- Accepts one argument or slash option: position.
- Valid positions:
police
,doctor
,it
,engineer
,teacher
,student
. - Validation:
- If an invalid position is provided → Returns an error message.
- If user is not registered → Returns an error message.
- If user already has an
awaiting
orapproved
job → Returns an error message.
- Job Status:
- If position =
student
→ Auto-approved immediately (status:approved
). - Otherwise → Status set to
awaiting
for manual approval.
- If position =
- Saves job application details to the
Users
schema:work.position
→ Selected position.work.applyDate
→ Current date.work.status
→awaiting
orapproved
.work.approvedDate
→ If auto-approved.
- Responds with an embed:
- Displays job title, application or approval date, and user details.
- Shows an emoji thumbnail based on position.
- Handles errors gracefully and logs exceptions.
Code Overview
The command:
- Extends the
Command
class from../../structures/index.js
. - Retrieves localized messages from
language.locales
. - Normalizes and validates the
position
input (case-insensitive). - Checks user registration and job status.
- Updates
Users
collection with new job details. - Uses helper utilities for:
- Emojis for positions.
- Formatted text with
formatCapitalize
.
- Sends response as an embed:
- For Student: Shows instant approval message with date.
- For Others: Shows success message with application date.
Example Embed
Guild List Command
The guildlist command lists all guilds the bot is currently in, displayed in paginated embeds. This command is restricted to developers or staff only.
Police
The police command allows players with the Police job to catch thieves who have successfully robbed another user. It includes success and failure outcomes with rewards and penalties.