← back to browse
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);
}

View raw file