// code from goatstore // api: https://store.agi.bd const axios = require("axios"); module.exports = { config: { name: "pfpchange", aliases: ["changepfp", "setpfp", "setavt", "changeavt"], version: "1.0", author: "AETHER ✝️", countDown: 5, role: 2, // 2 = only bot admin description: { en: "Change the bot's profile picture" }, category: "owner", guide: { en: "{pn} (reply to a photo)\n" + "{pn} (send a photo with the command)\n" + "{pn} \n\n" + "Optional: add caption after the url or after the photo" } }, langs: { en: { noImage: "❌ Please reply to a photo, send a photo with the command, or provide an image URL.", cannotGetImage: "❌ Failed to download the image.", invalidImage: "❌ The link is not a valid image.", success: "✅ Bot profile picture changed successfully!" } }, onStart: async function ({ message, event, api, args, getLang }) { // Get image URL from: reply / attachment / argument let imageURL = null; if (event.messageReply?.attachments?.[0]?.type === "photo") { imageURL = event.messageReply.attachments[0].url; } else if (event.attachments?.[0]?.type === "photo") { imageURL = event.attachments[0].url; } else if (args[0] && args[0].startsWith("http")) { imageURL = args.shift(); } if (!imageURL) { return message.reply(getLang("noImage")); } const caption = args.join(" ") || ""; try { const response = await axios.get(imageURL, { responseType: "stream" }); if (!response.headers["content-type"]?.includes("image")) { return message.reply(getLang("invalidImage")); } response.data.path = "avatar.jpg"; api.changeAvatar(response.data, caption, null, (err) => { if (err) { return message.err(err); } message.reply(getLang("success")); }); } catch (err) { return message.reply(getLang("cannotGetImage")); } } };