import fetch from 'node-fetch';

const handler = async (m, { conn }) => {
  try {
    const res = await fetch('https://some-random-api.com/animu/quote');
    if (!res.ok) throw await res.text();
    const json = await res.json();
    const { sentence, character, anime } = json;

    const message = `ğŸ’ŒğŸ“šğ�™Œğ�™�ğ�™Šğ�™�ğ�™€  â�€Â° â”„â”€â”€â€¢â™¥ï¸�â™¥ï¸�â€¢â”€â”€â”€â”€â”€â•®
                                  ğŸ“šMá´�á´›Éªá´ á´€á´›Éªá´�É´á´€ÊŸ Qá´œá´�á´›á´‡sğŸ“š
                                  â•°â”€â”€â”€â€¢â€¢â€¢â”€â”€â”€â”€â”„ Â°â�€             
    
    ${sentence}\n                                                                                          ğŸ“šğŸ’Œ   
  ğŸ“�ğ�˜¼ğ�™�ğ�™�ğ�™ƒğ�™Šğ�™� ${anime}`;
    conn.sendMessage(m.chat, { text: message }, 'extendedTextMessage', { quoted: m });
  } catch (error) {
    console.error(error);
  }
};

handler.help = ['animequote'];
handler.tags = ['internet'];
handler.command = /^(quotes|q|quote)$/i;

export default handler;
