| 5 | description: 'Send a random good night message', |
| 6 | usage: '.goodnight', |
| 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/lovenight?apikey=${shizokeys}`); |
| 12 | if (!res.ok) { |
| 13 | throw new Error(await res.text()); |
| 14 | } |
| 15 | const json = await res.json(); |
| 16 | const goodnightMessage = json.result; |
| 17 | await sock.sendMessage(chatId, { text: goodnightMessage }, { quoted: message }); |
| 18 | } |
| 19 | catch (error) { |
| 20 | console.error('Goodnight plugin error:', error); |
| 21 | await sock.sendMessage(chatId, { text: '❌ Failed to get goodnight message. Please try again later!' }, { quoted: message }); |
| 22 | } |
| 23 | } |
| 24 | }; |