Social
The facebook command allows users to manage their Facebook profile details, including setting a name or link, viewing their own or another user's details, or accessing help information. This command is available to all registered users.
Command Details
- Name: facebook
- Aliases: fb
- Category: Profile
- Description: Manage your Facebook profile
- Usage:
facebook
facebook @mention
facebook name <YourFacebookName>
facebook link <YourFacebookLink>
facebook help
- Examples:
facebook
- Shows your current Facebook detailsfacebook @mention
- Shows the mentioned user's Facebook detailsfacebook name MyFBName
- Sets your Facebook namefacebook link https://facebook.com/MyProfile
- Sets your Facebook linkfacebook help
- Shows command usage examples
- Cooldown: 5 seconds
- Arguments: Optional (subcommand, name, link, or user mention)
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: User must be registered for profile updates or viewing
Functionality
- Supports subcommands:
name
to set a Facebook name,link
to set a Facebook link,help
to display usage examples, and default behavior to view profile details. - For
name
, validates the input (max 21 characters) and updates the user'ssocial.facebook.name
in theUsers
schema. - For
link
, validates the input as a valid URL and updates the user'ssocial.facebook.link
in theUsers
schema. - For
help
, displays a detailed embed with command usage and examples. - For default (no subcommand), shows the target's Facebook name and link (if set) or a "Not set" message.
- Retrieves user data from the
Users
schema and supports viewing another user's profile via mention. - Sends localized embeds for success, errors, or help, with proper formatting for names and clickable links.
- Validates inputs, ensuring valid names, URLs, and registered users, with appropriate error messages.
Code Overview
The command:
- Extends the
Command
class from../../structures/index.js
. - Imports
Users
schema for profile data management. - Uses the
run
method to handle both message and slash command inputs, parsing subcommands and arguments. - Supports subcommands (
name
,link
,help
) and default behavior for viewing profiles. - Validates inputs: checks name length (≤21 characters) and URL format using a regex pattern.
- Updates the database with
Users.updateOne
for name and link changes. - Creates embeds with
client.embed()
for consistent display, including clickable links and localized messages. - Uses
client.utils.sendErrorMessage
andclient.utils.oops
for error handling, ensuring user-friendly feedback.
View Relationship
The viewrelationship command displays a user's relationships (partner, bestie, brother, sister) with detailed views for specific types or an overview of all relationships. This command is available to all registered users.
The instagram command allows users to manage their Instagram profile details, including setting a name or link, viewing their own or another user's details, or accessing help information. This command is available to all registered users.