| 7 | description: 'Get a random quote', |
| 8 | usage: '.quote', |
| 9 | async handler(sock: any, message: any, args: any, context: BotContext) { |
| 10 | const chatId = context.chatId || message.key.remoteJid; |
| 11 | try { |
| 12 | const apiKey = 'shizo'; |
| 13 | const res = await fetch(`https://shizoapi.onrender.com/api/texts/quotes?apikey=${apiKey}`); |
| 14 | if (!res.ok) throw await res.text(); |
| 15 | const json = await res.json() as any as any; |
| 16 | const quoteMessage = json.result; |
| 17 | await sock.sendMessage(chatId, { text: quoteMessage }, { quoted: message }); |
| 18 | } catch(error: any) { |
| 19 | console.error('Quote Command Error:', error); |
| 20 | await sock.sendMessage(chatId, { |
| 21 | text: '❌ Failed to get quote. Please try again later!' |
| 22 | }, { quoted: message }); |
| 23 | } |
| 24 | } |
| 25 | }; |