Get started with Peachy now 🍑
PEACHYPEACHY
Profile

Bio

The `bio` command allows users to set, view, or reset their profile biography in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.

Command Details

  • Name: bio
  • Aliases: None
  • Category: Profile
  • Description: Set your profile bio
  • Usage: P bio <text || reset || show || help>, p bio <text || reset || show || help>, or /bio <subcommand>
  • Examples:
    • P bio I love coding
    • p bio reset
    • /bio show
    • P bio help
  • Cooldown: 5 seconds
  • Arguments: text/subcommand (required)
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages, ViewChannel, EmbedLinks
    • User: None
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • Comprehensive bio management system with multiple subcommands.
  • Set Bio: Allows users to write a custom biography (up to 300 characters).
  • Show Bio: Displays the current biography in a formatted code block.
  • Reset Bio: Resets the biography to the default "No bio written." message.
  • Help: Shows usage examples and command syntax.
  • Character limit validation to prevent overly long biographies.
  • Database integration for persistent bio storage.
  • Formatted display using ARM syntax highlighting in code blocks.
  • Real-time database updates when bio is modified.
  • Error handling for missing text and invalid inputs.
  • Supports both prefix-based (P or p) 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 database bio updates.
  • Switch statement for handling different subcommands (help, reset, show, default).
  • Character length validation (300 character limit) for bio text.
  • client.utils.oops() for displaying error messages to users.
  • Formatted embed creation with author information and bot branding.
  • Code block formatting with ARM syntax highlighting for bio display.
  • Language localization for all messages and responses.
  • Error handling for database operations and invalid input validation.
  • Conditional logic for handling different interaction types and argument parsing.