Get started with Peachy now πŸ‘
PEACHYPEACHY
Growing A Tree

Water

The `water` command allows users to water their virtual tree in a Discord server, helping it grow. It is triggered exclusively using the slash command `/`.

Command Details

  • Name: water
  • Aliases: None
  • Category: Games
  • Description: Waters a user's virtual tree to increase its height and XP.
  • Usage: /water
  • Examples:
    • /water
  • Cooldown: 5 seconds
  • Arguments: None
  • Slash Command: Enabled
  • Permissions:
    • Bot: SendMessages, ViewChannel, EmbedLinks
    • User: None
  • Player Requirements: None (no voice, DJ, or active player required)

Functionality

  • The command is exclusive to slash command input (/water) and does not support prefix-based triggers.
  • Checks if the user has an existing tree in the database using the Tree schema.
  • If no tree is found, an ephemeral error message is displayed: "❌ You don't have a tree yet. Use /tree to start one!"
  • Enforces a 1-minute cooldown between watering actions, displaying a time-remaining message if the user attempts to water too soon.
  • On successful watering:
    • Increases the tree’s height by 1 ft.
    • Adds 10 XP to the tree.
    • Increments the water count by 1.
    • Updates the last watered timestamp and records the user who watered it.
  • Sends a confirmation message: "πŸ’§ You watered [tree name]! It is now [height] ft tall."
  • Error messages are ephemeral (flags: 64) to keep the channel clean.

Code Overview

The command is built using a Command class structure and handles slash command interactions. It uses:

  • Tree schema to query and update tree data (height, XP, water count, last watered, last watered by).
  • Ep