Get started with Peachy now 🍑
PEACHYPEACHY
Utility

Theme

The `theme` command allows users to toggle between peach, goma, and normal themes or view their current theme setting in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.

Theme Command

The theme command is a utility feature in a Discord bot that allows users to set or view their preferred theme (peach, goma, or normal).

Command Details

  • Name: theme
  • Aliases: None
  • Category: Utility
  • Description: Toggles between peach, goma, and normal themes or views the current theme setting.
  • Usage:
    • Prefix: P theme [show|normal|peach|goma|help], p theme [show|normal|peach|goma|help]
    • Slash: /theme show, /theme help
  • Examples:
    • P theme show
    • p theme peach
    • P theme goma
    • /theme help
  • Cooldown: 3 seconds
  • Arguments: Optional for prefix command (show, normal, peach, goma, help); required for slash command (subcommand: show or help)
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages, ViewChannel, EmbedLinks
    • User: None
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • Allows users to view their current theme or set their theme to normal, peach, or goma.
  • Supports the following subcommands:
    • show (or no argument in prefix commands): Displays the user's current theme.
    • normal, peach, or goma: Sets the user's theme to the specified option.
    • help: Shows command usage examples and information.
  • Sends an embed with:
    • A description indicating the current theme or theme change confirmation.
    • A theme-specific image (e.g., globalGif.welcomeToPeach, globalGif.welcomeToGoma).
    • A theme-specific color (e.g., peach: #8BD3DD, goma: #94716B, normal: #F582AE).
    • A footer showing the requester's display name and avatar.
  • Manages user inventory and equipped items:
    • Unequips any existing theme-related item and returns it to the inventory.
    • Updates the user's theme preference in the database.
  • Supports both prefix-based (P or p) and slash command (/) inputs.
  • If the user is not found in the database or an error occurs, an error message is displayed.

Code Overview

The command is built using a Command class structure and handles both message-based and interaction-based (slash command) inputs. It uses:

  • client.utils.getUser() to fetch user data from the database.
  • Database operations to update user preferences and manage inventory/equipped items.
  • client.embed() to create a formatted embed with theme-specific colors and images.
  • globalGif to source theme-specific images (e.g., welcomeToPeach, welcomeToGoma).
  • Language localization for messages and emojis via themeMessages.
  • A switch statement to handle subcommands (normal, peach, goma, help, or default for show).
  • Error handling for database fetch or update failures.