Economy
Weekly
The `weekly` command allows users to earn coins and experience points weekly in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Command Details
- Name: weekly
- Aliases: week
- Category: Economy
- Description: Earn some coins and experience points weekly.
- Usage:
P weekly
,p weekly
, or/weekly
- Examples:
P weekly
p weekly
/weekly
- Cooldown: 3 seconds (with a weekly reset in 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 (500,000–1,000,000) and experience points (200–250) weekly.
- Verified users receive a 30% bonus on coins and XP.
- Checks for a weekly cooldown, resetting every 7 days from the last claim (Asia/Bangkok timezone). If the cooldown is active, displays the remaining time (days, hours, minutes, seconds).
- Updates user balance and XP 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 day/night emoji thumbnail based on the current time (6 AM–6 PM for day, otherwise night).
- A banner image for the weekly reminder.
- A footer with the requester's display name and avatar.
- 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 weekly reset timing in the Asia/Bangkok timezone.- Direct
Users
schema updates for balance and XP. client.utils.checkCooldown
andclient.utils.updateCooldown
for cooldown management.client.embed()
to create a formatted embed with dynamic emojis and images.getCooldownMessage
helper to format remaining time for cooldown messages.createSuccessEmbed
helper to build the success embed.- Language localization for messages and emojis.
- Error handling for user fetch failures or other issues.
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 `/`.
Peach
The `peach` command allows users to earn coins and experience points by being "peachy" in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.