bbb / bot /command /other /ping.js
Nexchan's picture
dolla
72ee6f0
raw
history blame contribute delete
761 Bytes
import axios from "axios";
async function delay(ms) {
return new Promise((r) => setTimeout(r, ms));
}
export default {
command: ["ping", "p"],
description: "Cek respon bot",
example: "%p%cmd",
name: "ping",
tags: "other",
run: async (m, { conn }) => {
try {
const start = Date.now();
m.reply("⏳ Mengukur ping...");
// Simulasi delay kecil biar terasa natural
await delay(200);
const end = Date.now();
const ping = end - start;
await conn.sendMessage(
m.from,
{ text: `πŸ“ Pong!\nπŸ“‘ *${ping}ms*` },
{ quoted: m }
);
} catch (e) {
console.error(e);
await m.reply("Terjadi kesalahan: " + e.message);
}
},
};