goat
command
info
No description
0
views
0
likes
0
installs
Aliases: botinfo
raw source
module.exports = {
config: {
name: "info",
aliases: ["botinfo"],
version: "10.0.0",
author: "๐๐๐๐ฎ๐
",
countDown: 0,
role: 0,
description: { en: "Show bot information." },
category: "system",
guide: { en: "{pn}" }
},
onStart: async function ({ api, message, event, config }) {
return sendInfo(api, message, event, config);
},
onChat: async function ({ api, message, event, config }) {
const body = (event.body || "").trim().toLowerCase();
if (body !== "info" && body !== "botinfo") return;
return sendInfo(api, message, event, config);
}
};
const handled = new Set();
function isDuplicate(event) {
const key =
event.messageID ||
`${event.threadID}:${event.senderID}:${event.body}`;
if (handled.has(key)) return true;
handled.add(key);
setTimeout(() => {
handled.delete(key);
}, 5000);
return false;
}
async function sendInfo(api, message, event, config) {
if (isDuplicate(event)) return;
const uptime = process.uptime();
const days = Math.floor(uptime / 86400);
const hours = Math.floor((uptime % 86400) / 3600);
const minutes = Math.floor((uptime % 3600) / 60);
const seconds = Math.floor(uptime % 60);
let runtime = "";
if (days > 0) runtime += `${days}d `;
if (hours > 0) runtime += `${hours}h `;
if (minutes > 0) runtime += `${minutes}m `;
runtime += `${seconds}s`;
const prefix = global.config?.PREFIX || global.GoatBot?.config?.prefix || "/";
const msg = `โโโโโโฆ ๐๐จ๐ ๐๐ง๐๐จ โฆโโโโโโ
๐ค ๐๐๐ฆ๐ ยป ๐๐๐๐ฎ๐
'๐ฌ ๐๐จ๐ ๐ซ๐ชฝ
๐ ๐๐ฐ๐ง๐๐ซ ยป ๐๐๐๐ฎ๐
โฐ ๐๐ฉ๐ญ๐ข๐ฆ๐ ยป ${runtime}
โก ๐๐ซ๐๐๐ข๐ฑ ยป ${prefix}
โโ ๐๐ก๐๐ง๐ค๐ฌ ๐๐จ๐ซ ๐ฎ๐ฌ๐ข๐ง๐ ๐ฆ๐ ๐ซ โโ`;
return message.reply(msg);
}