455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/caption.js
javascript · 55 lines
1/**#command2name: caption3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// کامند: caption13try {14 var uid = "";15 if (typeof user !== "undefined" && user) {16 if (user.telegramid) uid = String(user.telegramid);17 else if (user.id) uid = String(user.id);18 }19 var q = "";20 if (typeof params !== "undefined" && params) q = String(params).trim();21 22 if (!q) {23 await db.global.set("await_caption_" + uid, "1");24 Bot.sendMessage("📝 کپشنساز\n\nموضوع پست را بنویس:");25 return;26 }27 28 await db.global.set("await_caption_" + uid, "");29 var chatId = uid;30 if (typeof chat !== "undefined" && chat) {31 if (chat.chatid) chatId = chat.chatid;32 else if (chat.id) chatId = chat.id;33 }34 await db.global.set("last_ask_uid_" + chatId, uid);35 await db.global.set("last_status_" + uid, "📝 کپشنساز");36 await db.global.set("last_user_prompt_" + uid, "caption: " + q);37 try { Api.sendChatAction({ chat_id: chatId, action: "typing" }); } catch (e) {}38 39 HTTP.post({40 url: "https://api.groq.com/openai/v1/chat/completions",41 headers: { "Authorization": "Bearer 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" },42 body: {43 model: "openai/gpt-oss-20b",44 messages: [45 { role: "system", content: "۳ کپشن اینستا فارسی: کوتاه، داستانی، فروش. هشتگ کم." },46 { role: "user", content: q }47 ]48 },49 background: true,50 success: "/onAiSuccess",51 error: "/onAiError"52 });53} catch (e) {54 Bot.sendMessage("⚠️ خطا caption:\n" + String(e && e.message ? e.message : e));55}