(sock, chatId, message)
| 1 | const fetch = require('node-fetch'); |
| 2 | |
| 3 | async function truthCommand(sock, chatId, message) { |
| 4 | try { |
| 5 | const shizokeys = 'shizo'; |
| 6 | const res = await fetch(`https://shizoapi.onrender.com/api/texts/truth?apikey=${shizokeys}`); |
| 7 | |
| 8 | if (!res.ok) { |
| 9 | throw await res.text(); |
| 10 | } |
| 11 | |
| 12 | const json = await res.json(); |
| 13 | const truthMessage = json.result; |
| 14 | |
| 15 | // Send the truth message |
| 16 | await sock.sendMessage(chatId, { text: truthMessage }, { quoted: message }); |
| 17 | } catch (error) { |
| 18 | console.error('Error in truth command:', error); |
| 19 | await sock.sendMessage(chatId, { text: '❌ Failed to get truth. Please try again later!' }, { quoted: message }); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | module.exports = { truthCommand }; |
nothing calls this directly
no outgoing calls
no test coverage detected