// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "kick", version: "2.0", author: "Mehedi-saito", countDown: 5, role: 1, description: { en: "Kick member out of the group and show a GIF with their name", vi: "Kick thành viên khỏi nhóm và hiện GIF với tên của họ" }, category: "box chat", guide: { en: "{pn} @tag / reply: Kick the tagged or replied user", vi: "{pn} @tag / reply: Kick người được tag hoặc reply" } }, langs: { en: { needAdmin: "⚠️ Please add the bot as admin first before using this feature", kicked: "👢 Kicked: %1", noTarget: "⚠️ Please tag or reply to the person you want to kick" }, vi: { needAdmin: "⚠️ Vui lòng thêm bot làm quản trị viên trước khi sử dụng tính năng này", kicked: "👢 Đã kick: %1", noTarget: "⚠️ Vui lòng tag hoặc reply người bạn muốn kick" } }, onStart: async function ({ message, event, args, threadsData, api, getLang, usersData }) { const adminIDs = await threadsData.get(event.threadID, "adminIDs") || []; if (!adminIDs.includes(api.getCurrentUserID())) return message.reply(getLang("needAdmin")); let uids = []; if (Object.keys(event.mentions).length > 0) { uids = Object.keys(event.mentions); } else if (event.messageReply) { uids = [event.messageReply.senderID]; } else if (args[0] && !isNaN(args[0])) { uids = [args[0]]; } if (uids.length === 0) return message.reply(getLang("noTarget")); // GIF URLs provided by user const gifUrls = [ "https://drive.google.com/uc?export=download&id=1JZAOg2vq_3fTsQ725p0vbBin3gPPYLsM", "https://drive.google.com/uc?export=download&id=1KjNMQO4B8ZdzdnnCEvP9CJLCWWhSHIQs" ]; const axios = require("axios"); const fs = require("fs-extra"); const path = require("path"); const { createCanvas, loadImage, registerFont } = require("canvas"); async function processAndKick(uid) { try { // Get user name let name = "Unknown"; try { const userInfo = await api.getUserInfo(uid); name = userInfo[uid]?.name || userInfo[uid]?.firstName || "Unknown"; } catch (e) { try { const data = await usersData.get(uid); name = data?.name || "Unknown"; } catch (e2) {} } // Kick first await api.removeUserFromGroup(uid, event.threadID); // Choose a random GIF or first one const gifUrl = gifUrls[0]; // larger one // Download GIF const response = await axios.get(gifUrl, { responseType: "arraybuffer", timeout: 30000 }); const gifBuffer = Buffer.from(response.data); // For simplicity and reliability (no gif-encoder needed), we send the original GIF // + a text message with the name in ash-style. // True per-frame text overlay requires extra packages (gif-encoder-2 / gifuct etc.) // which are not in default GoatBot dependencies. const cachePath = path.join(__dirname, "cache"); await fs.ensureDir(cachePath); const filePath = path.join(cachePath, `kick_\( {uid}_ \){Date.now()}.gif`); await fs.writeFile(filePath, gifBuffer); await message.reply({ body: getLang("kicked", name), attachment: fs.createReadStream(filePath) }); // Clean up after a short delay setTimeout(() => { fs.unlink(filePath).catch(() => {}); }, 15000); } catch (e) { console.error(e); return message.reply(getLang("needAdmin")); } } // Process first uid (to avoid rate limits / multiple kicks at once) await processAndKick(uids[0]); // If multiple, kick the rest without GIF (to keep it simple) for (let i = 1; i < uids.length; i++) { try { await api.removeUserFromGroup(uids[i], event.threadID); } catch (e) {} } } };