← back to browse
goat command

admininfo

Displays Admin Info in floral styled box

0
views
0
likes
0
installs
raw source
const axios = require("axios");
const fs = require("fs-extra");
const moment = require("moment-timezone");

module.exports = {
	config: {
		name: "admininfo",
		version: "2.2.0",
		author: "SUJON-BOSS",
		countDown: 5,
		role: 0,
		shortDescription: "Displays Admin Info in floral styled box",
		longDescription: "Displays Admin Information with photo",
		category: "info"
	},

	onStart: async function ({ api, event }) {
		const time = moment()
			.tz("Asia/Dhaka")
			.format("DD/MM/YYYY hh:mm A");

		const cacheDir = __dirname + "/cache";
		const imagePath = cacheDir + "/owner.jpg";

		try {
			// Cache folder তৈরি
			await fs.ensureDir(cacheDir);

			// পুরোনো file থাকলে remove
			if (await fs.pathExists(imagePath)) {
				await fs.remove(imagePath);
			}

			// Owner photo download
			const response = await axios({
				method: "GET",
				url: "https://i.postimg.cc/FR6Tdrnv/received-1461582061731133.jpg",
				responseType: "arraybuffer",
				timeout: 30000
			});

			await fs.writeFile(imagePath, response.data);

			// Send message
			await api.sendMessage(
				{
					body:
`╭•┄┅═══❁🌸❁═══┅┄•╮
       🌼 𝐀𝐃𝐌𝐈𝐍 𝐈𝐍𝐅𝐎 🌼
╰•┄┅═══❁🌸❁═══┅┄•╯

╭⊱ 𝗡𝗮𝗺𝗲: 𝗦𝗨𝗝𝗢𝗡
├⊱ 𝗚𝗲𝗻𝗱𝗲𝗿: 𝗠𝗮𝗹𝗲
├⊱ 𝗥𝗲𝗹𝗮𝘁𝗶𝗼𝗻: 𝗠𝗮𝗿𝗶𝗱
├⊱ 𝗔𝗴𝗲: 26
├⊱ 𝗥𝗲𝗹𝗶𝗴𝗶𝗼𝗻: 𝗜𝘀𝗹𝗮𝗺
├⊱ 𝗔𝗱𝗱𝗿𝗲𝘀𝘀: Kaliakor, Gazipur
╰⊱ 𝗘𝗱𝘂𝗰𝗮𝘁𝗶𝗼𝗻: Job Holder

╭─❖ 𝗦𝗼𝗰𝗶𝗮𝗹 𝗟𝗶𝗻𝗸𝘀 ❖─╮
▶ TikTok: tiktok.com/@sujon  
▶ Facebook: facebook.com/sujonxn123  
▶ YouTube: youtube.com/@Sujon-bai  
╰──────────────────────╯

⌚ Updated Time: ${time}
`,
					attachment: fs.createReadStream(imagePath)
				},
				event.threadID
			);

			// Send হয়ে গেলে file delete
			await fs.remove(imagePath);

		} catch (error) {
			console.log("admininfo Error:", error.message);

			// Error হলেও temporary file delete
			try {
				await fs.remove(imagePath);
			} catch (e) {}

			return api.sendMessage(
				"❌ Admin info image load failed!",
				event.threadID
			);
		}
	}
};

View raw file