Information
Ping
The `ping` command shows the bot's latency and connection status in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Command Details
- Name: ping
- Aliases: pong
- Category: Information
- Description: Shows the bot's ping
- Usage:
P ping
,p ping
, or/ping
- Examples:
P ping
p ping
/ping
- Cooldown: 3 seconds
- Arguments: None
- Slash Command: Enabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks
- User: None
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Displays the bot's connection latency in multiple categories.
- Shows a loading message while calculating ping values.
- Displays an embed with:
- A title with customizable emojis showing "PING".
- Bot ping with a randomized value (15-30ms range).
- API ping showing Discord WebSocket latency.
- Database ping showing MongoDB connection latency.
- A footer with the requester's display name and avatar.
- Timestamp of when the command was executed.
- Uses code blocks with
.ini
syntax highlighting for ping values. - Supports both prefix-based (
P
orp
) and slash command (/
) inputs. - Handles errors with appropriate error messages.
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.embed()
to create a formatted embed with ping information.client.utils.emojiToImage
to convert emojis into images for the thumbnail.client.utils.getLoopElement
for spacing formatting in field names.Math.floor(Math.random())
to generate randomized bot ping values.process.hrtime()
for high-precision database ping measurement.mongoose.connection.db.command({ ping: 1 })
to test database connectivity.ctx.client.ws.ping
to get Discord API WebSocket latency.- Language localization for messages and footer text.
- Timestamp and user information display for better user experience.
- Error handling for unexpected issues during execution.
Info
The `info` command provides information about the bot and its features in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Privacy Policy
The `privacy` command displays the bot's privacy policy in a Discord server. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.