455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/_onAiError.js
javascript · 51 lines
1/**#command2name: /onAiError3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: /onAiError14answer: 15keyboard: 16parse_mode: markdown17aliases: 18allow_only_group: false19need_reply: false20is_web: 021#command**/22 23try {24 var rawErr = "";25 try {26 if (typeof content !== "undefined" && content) {27 if (typeof content === "string") rawErr = content;28 else rawErr = JSON.stringify(content);29 }30 } catch (eC) {}31 try {32 if (!rawErr && typeof error !== "undefined" && error) {33 if (error.message) rawErr = String(error.message);34 else rawErr = JSON.stringify(error);35 }36 } catch (eE) {}37 rawErr = String(rawErr || "");38 39 if (rawErr.indexOf("Rate limit") >= 0 || rawErr.indexOf("rate limit") >= 0 || rawErr.indexOf("tokens per minute") >= 0 || rawErr.indexOf("TPM") >= 0) {40 Bot.sendMessage("⏳ ظرفیت لحظهای پر شد (سقف Groq: ۸۰۰۰ توکن در دقیقه).\n۶۰ ثانیه صبر کن، بعد دوباره بپرس.");41 return;42 }43 if (rawErr.indexOf("429") >= 0) {44 Bot.sendMessage("⏳ کمی شلوغ است. یک دقیقه صبر کن و دوباره بفرست.");45 return;46 }47 48 Bot.sendMessage("😅 خطا در AI. ۱۰ ثانیه بعد دوباره بفرست.");49} catch (e3) {50 try { Bot.sendMessage("😅 خطا در AI. دوباره بفرست."); } catch (e4) {}51}