(sock, message, args, context)
| 6 | description: 'Get a random mountain image', |
| 7 | usage: '.mountain', |
| 8 | async handler(sock, message, args, context) { |
| 9 | const chatId = context.chatId || message.key.remoteJid; |
| 10 | try { |
| 11 | const res = await axios.get('https://raw.githubusercontent.com/GlobalTechInfo/Database/main/images/mountain.json'); |
| 12 | if (!res.data || !Array.isArray(res.data) || res.data.length === 0) { |
| 13 | return await sock.sendMessage(chatId, { text: '❌ Failed to fetch image.' }, { quoted: message }); |
| 14 | } |
| 15 | const randomImage = res.data[Math.floor(Math.random() * res.data.length)]; |
| 16 | await sock.sendMessage(chatId, { image: { url: randomImage }, caption: '🏔️ Mountain Image' }, { quoted: message }); |
| 17 | } |
| 18 | catch (err) { |
| 19 | console.error('Mountain image plugin error:', err); |
| 20 | await sock.sendMessage(chatId, { text: '❌ Error while fetching image.' }, { quoted: message }); |
| 21 | } |
| 22 | } |
| 23 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected