import genshindb from "genshin-db";
const handler = async (m, { conn, text, usedPrefix, command }) => {
  if (!text)
    throw `Contoh: *${usedPrefix + command} ruin guard*\nHarap berikan nama musuh.`;
  try {
    let result = await genshindb.enemies(text);
    if (result) {
      let response = `*Musuh Ditemukan: ${result.name}*\n\n`;
      response += `_${result.description || "Deskripsi tidak tersedia"}_\n\n`;
      response += `*Level:* ${result.level || "Data tidak tersedia"}\n`;
      response += `*Rarity:* ${result.rarity || "Data tidak tersedia"}\n`;
      response += `*Element:* ${result.element || "Data tidak tersedia"}`;
      m.reply(response);
    } else {
      throw new Error("Musuh tidak ditemukan.");
    }
  } catch (error) {
    console.error(error);
    let available = await genshindb.enemies("names", {
      matchCategories: true,
    });
    m.reply(
      `*Tidak Ditemukan*\n\n*Musuh yang tersedia:* ${available.join(", ")}`,
    );
  }
};
handler.help = ["gienemy <nama musuh>"];
handler.tags = ["genshin"];
handler.command = /^((gi|genshin)(enemies?|enemy))$/i;
handler.limit = true;
export default handler;
