← back to browse
goat command

aniinfo

البحث عن معلومات أنمي

0
views
0
likes
0
installs

Aliases: الأنمي, انمي, anime

raw source
const axios = require("axios");

module.exports = {
  config: {
    name: "aniinfo",
    aliases: ["الأنمي", "انمي", "anime"],
    version: "3.0",
    author: "EryXenX",
    shortDescription: "البحث عن معلومات أنمي",
    longDescription: "جلب معلومات شاملة عن الأنمي باللغة العربية",
    category: "anime",
    guide: "{pn} [اسم الأنمي]"
  },

  onStart: async function ({ api, event, args }) {
    const query = args.join(" ");
    if (!query)
      return api.sendMessage("⚠️ يرجى كتابة اسم الأنمي المراد البحث عنه!", event.threadID);

    try {
      // 1. البحث في قاعدة البيانات
      const res = await axios.get(`https://api.jikan.moe/v4/anime?q=${encodeURIComponent(query)}&limit=1`);
      const anime = res.data.data ? res.data.data[0] : null;

      if (!anime)
        return api.sendMessage(`❌ لم يتم العثور على أنمي باسم: "${query}"`, event.threadID);

      // 2. ترجمة القصة تلقائياً إلى العربية
      let arabicSynopsis = "لا يتوفر وصف بالعربية لهذا الأنمي.";
      if (anime.synopsis) {
        try {
          const transRes = await axios.get(
            `https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=ar&dt=t&q=${encodeURIComponent(anime.synopsis.substring(0, 500))}`
          );
          arabicSynopsis = transRes.data[0].map(item => item[0]).join(" ");
        } catch (e) {
          arabicSynopsis = anime.synopsis.substring(0, 300) + "...";
        }
      }

      // 3. صياغة النتيجة بالكامل بالعربية
      const statusText = anime.status === "Finished Airing" ? "منتهي" : "مستمر في العرض";
      const typeText = anime.type === "TV" ? "مسلسل تلفزيوني" : (anime.type === "Movie" ? "فيلم" : anime.type || "غير معروف");
      const genresText = anime.genres ? anime.genres.map(g => g.name).join(" ، ") : "غير محدد";

      const msg = 
`🌸 معلومات الأنمي 🌸

📌 العنوان: ${anime.title_english || anime.title}
🎬 النوع: ${typeText}
📺 عدد الحلقات: ${anime.episodes || "غير معروف"}
⭐ التقييم: ${anime.score || "غير مقيم"} / 10
⌛ الحالة: ${statusText}
🏷️ التصنيفات: ${genresText}

📝 القصة:
${arabicSynopsis}

🔗 رابط المعاينة:
${anime.url}`;

      return api.sendMessage(msg, event.threadID);
    } catch (error) {
      return api.sendMessage("❌ تعذر جلب البيانات حالياً، يرجى المحاولة لاحقاً.", event.threadID);
    }
  }
};

View raw file