(sock, message, args, context)
| 7 | description: 'Waste someone in style!', |
| 8 | usage: '.wasted @user', |
| 9 | async handler(sock, message, args, context) { |
| 10 | const chatId = context.chatId || message.key.remoteJid; |
| 11 | let userToWaste; |
| 12 | if (message.message?.extendedTextMessage?.contextInfo?.mentionedJid?.length > 0) { |
| 13 | userToWaste = message.message.extendedTextMessage.contextInfo.mentionedJid[0]; |
| 14 | } |
| 15 | else if (message.message?.extendedTextMessage?.contextInfo?.participant) { |
| 16 | userToWaste = message.message.extendedTextMessage.contextInfo.participant; |
| 17 | } |
| 18 | if (!userToWaste) { |
| 19 | return await sock.sendMessage(chatId, { |
| 20 | text: 'Please mention someone or reply to their message to waste them!', |
| 21 | ...channelInfo |
| 22 | }, { quoted: message }); |
| 23 | } |
| 24 | try { |
| 25 | let profilePic; |
| 26 | try { |
| 27 | profilePic = await sock.profilePictureUrl(userToWaste, 'image'); |
| 28 | } |
| 29 | catch { |
| 30 | profilePic = 'https://i.imgur.com/2wzGhpF.jpeg'; |
| 31 | } |
| 32 | const wastedResponse = await axios.get(`https://some-random-api.com/canvas/overlay/wasted?avatar=${encodeURIComponent(profilePic)}`, { responseType: 'arraybuffer' }); |
| 33 | await sock.sendMessage(chatId, { |
| 34 | image: Buffer.from(wastedResponse.data), |
| 35 | caption: `⚰️ *Wasted* : ${sock.store?.contacts?.[userToWaste]?.name || sock.store?.contacts?.[userToWaste]?.notify || (userToWaste.includes('@s.whatsapp.net') ? `+${ userToWaste.replace('@s.whatsapp.net', '')}` : 'User')} 💀\n\nRest in pieces!`, |
| 36 | mentions: [userToWaste], |
| 37 | ...channelInfo |
| 38 | }, { quoted: message }); |
| 39 | } |
| 40 | catch (error) { |
| 41 | console.error('Error in wasted command:', error); |
| 42 | await sock.sendMessage(chatId, { |
| 43 | text: '❌ Failed to create wasted image! Try again later.', |
| 44 | ...channelInfo |
| 45 | }, { quoted: message }); |
| 46 | } |
| 47 | } |
| 48 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected