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