| 5 | description: 'Get a random truth from the Shizo API.', |
| 6 | usage: '.truth', |
| 7 | async handler(sock, message, args, context) { |
| 8 | const chatId = context.chatId || message.key.remoteJid; |
| 9 | try { |
| 10 | const shizokeys = 'shizo'; |
| 11 | const res = await fetch(`https://shizoapi.onrender.com/api/texts/truth?apikey=${shizokeys}`); |
| 12 | if (!res.ok) { |
| 13 | throw await res.text(); |
| 14 | } |
| 15 | const json = await res.json(); |
| 16 | const truthMessage = json.result; |
| 17 | await sock.sendMessage(chatId, { |
| 18 | text: truthMessage |
| 19 | }, { quoted: message }); |
| 20 | } |
| 21 | catch (error) { |
| 22 | console.error('Error in truth command:', error); |
| 23 | await sock.sendMessage(chatId, { |
| 24 | text: '❌ Failed to get truth. Please try again later!' |
| 25 | }, { quoted: message }); |
| 26 | } |
| 27 | } |
| 28 | }; |