Get started with Peachy now 🍑
PEACHYPEACHY
Economy

Goma

The `goma` command allows users to earn coins and experience points by being "goma" in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.

Command Details

  • Name: goma
  • Aliases: g
  • Category: Economy
  • Description: Earn some coins and experience points by being goma.
  • Usage: P goma, p goma, or /goma
  • Examples:
    • P goma
    • p goma
    • /goma
  • Cooldown: 5 seconds (with a 5-minute cooldown between claims)
  • Arguments: None
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages, ViewChannel, EmbedLinks
    • User: None
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • Awards a random amount of coins (400–500) and experience points (5–10) per use.
  • Verified users receive a 40% bonus on coins and XP.
  • Checks for a 5-minute cooldown between claims. If the cooldown is active, displays the remaining time (minutes, seconds).
  • Updates user balance, XP, and goma streak using direct database updates via the Users schema.
  • Displays an embed with:
    • A title with customizable emojis.
    • The earned coins and XP, including any bonus for verified users.
    • A footer with the requester's display name and avatar.
  • Tracks the user's goma streak (goma.streak) in the database.
  • Handles errors (e.g., user not found) with a custom error message.

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.
  • chance library to generate random coin and XP amounts.
  • moment for handling cooldown duration calculations.
  • Direct Users schema updates for balance, XP, and goma streak.
  • client.utils.checkCooldown and client.utils.updateCooldown for cooldown management.
  • client.embed() to create a formatted embed with dynamic emojis.
  • Language localization for messages and emojis.
  • Error handling for user fetch failures or other issues.