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
View
The `tree` command allows users to view or start a virtual tree in a Discord server. It can be triggered using the slash command `/` or prefix commands.
Giveaway
The `gstart` command allows users to create interactive coin giveaways with customizable descriptions, prizes, duration, and winner selection with optional autopay functionality.