Get started with Peachy now 🍑
PEACHYPEACHY
Economy

Daily

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

Command Details

  • Name: daily
  • Aliases: daily
  • Category: Economy
  • Description: Earn some coins and experience points daily.
  • Usage: P daily, p daily, or /daily
  • Examples:
    • P daily
    • p daily
    • /daily
  • Cooldown: 5 seconds (with a daily reset at 5 PM Asia/Bangkok timezone)
  • 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 (50,000–100,000) and experience points (100–150) daily.
  • Verified users receive a 40% bonus on coins and XP.
  • Checks for a daily cooldown, resetting at 5 PM (Asia/Bangkok timezone). If the cooldown is active, displays the remaining time (hours, minutes, seconds).
  • Updates user balance and XP using client.economyManager.addCoins (if available) or 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 day/night emoji thumbnail based on the current time (6 AM–6 PM for day, otherwise night).
    • A banner image for the daily reminder.
    • A footer with the requester's display name and avatar.
  • Supports achievement checks (e.g., "daily_devotion" for a 7-day streak) via client.achievementManager.
  • 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-timezone for handling daily reset timing in the Asia/Bangkok timezone.
  • client.economyManager (if available) or direct Users schema updates for balance and XP.
  • client.utils.checkCooldown and client.utils.updateCooldown for cooldown management.
  • client.embed() to create a formatted embed with dynamic emojis and images.
  • Language localization for messages and emojis.
  • Error handling for user fetch failures or other issues.