Last active
March 10, 2025 06:24
-
-
Save KOULIKS94/27344d2f58899e4ca196d45c7208e72b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| name: "ping", | |
| description: "Check bot response time", | |
| execute: async (client, message) => { | |
| try { | |
| const start = Date.now(); // Get timestamp before sending reply | |
| const sentMessage = await client.sendMessage(message.key.remoteJid, { text: "Pinging..." }); | |
| const end = Date.now(); // Get timestamp after sending reply | |
| const ping = end - start; // Calculate latency | |
| await client.sendMessage(message.key.remoteJid, { text: `Pong! 🏓 Response time: ${ping}ms` }); | |
| } catch (error) { | |
| console.error("Ping command error:", error); | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment