Invites
The `invites` command allows users to display the total number of invite uses for a specified user in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Invites Command
The invites
command is a utility feature in a Discord bot that displays the total number of invite uses for a specified user.
Command Details
- Name:
invites
- Aliases: None
- Category: Utility
- Description: Displays the total number of uses for all invites created by a specified user.
- Usage:
- Prefix:
P invites [@User]
,p invites [@User]
- Slash:
/invites [user]
- Prefix:
- Examples:
P invites @User
p invites @User
/invites @User
- Cooldown: 3 seconds
- Arguments: Required for slash command (user); optional for prefix command (user mention or ID)
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Displays the total number of invite uses for a specified user, defaulting to the command issuer if no user is mentioned in prefix commands.
- Sends an initial "searching" message with a loading emoji, then replaces it with an embed containing:
- The total invite uses for the specified user (e.g., "You currently have X invites").
- A title with customizable emojis.
- A footer showing the requester's display name and avatar.
- A timestamp.
- Supports both prefix-based (
P
orp
) and slash command (/
) inputs. - If no invite data is found for the user, a message indicating "No invite data available" is displayed.
- If an error occurs while fetching invite data, an error message is shown.
Code Overview
The command is built using a Command
class structure and handles both message-based and interaction-based (slash command) inputs. It uses:
InviteTrackerSchema.aggregate()
to query and sum the total invite uses for a user in the current guild.client.embed()
to create a formatted embed.- Language localization for messages and emojis.
- Error handling for cases where invite data retrieval fails.
Icon
The `icon` command allows users to display the server's icon in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Language
The `language` command allows users to manage their language settings or view their current language in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.