Profile
Gender
The `gender` command allows users to set, view, or reset their gender preference in their profile. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Command Details
- Name: gender
- Aliases: None
- Category: Profile
- Description: Set your gender
- Usage:
P gender <male || female || reset || help>
,p gender <male || female || reset || help>
, or/gender <subcommand>
- Examples:
P gender male
p gender female
/gender reset
P gender help
- Cooldown: 5 seconds
- Arguments: gender/subcommand (optional for viewing)
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Simple gender preference management system for user profiles.
- Set Gender: Allows users to set their gender to male or female.
- Visual Display: Shows appropriate gender emojis with the selection.
- Reset Function: Resets gender to "Not specified" default state.
- Help Command: Displays usage examples and available options.
- View Current: Shows current gender setting when no arguments provided.
- Capitalized Display: Properly formats gender names with capitalization.
- Database Integration: Persistent storage of gender preference.
- Default State Handling: Gracefully handles unset gender preferences.
- Emoji Integration: Uses themed emojis for male and female options.
- Error Handling: Validates inputs and provides helpful responses.
- Supports both prefix-based (
P
orp
) and slash command (/
) inputs.
Code Overview
The command is built using a Command
class structure and handles both message-based and interaction-based (slash command) inputs. It uses:
Users.findOne({ userId: ctx.author.id })
to fetch current user profile data.Users.updateOne()
with$set
operator for updating gender preference.client.utils.formatCapitalize()
for proper name formatting of gender selections.- Switch statement for handling different subcommands (help, reset, male, female, default).
- Conditional emoji display based on selected gender (male/female emojis).
- Database integration for persistent gender preference storage.
- Embed formatting with themed title using decorative emojis.
- Language localization for all messages, success responses, and error handling.
- Default case handling for viewing current gender when no subcommand provided.
- Error handling for database operations and input validation.
- Flexible argument parsing for both interaction and message-based inputs.
Birthday
The `birthday` command allows users to set, view, or reset their birthday and automatically calculates their zodiac sign. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Level
The `level` command displays a user's level and XP progress with a premium visual level card. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.