| 6 | usage: '.privacy — show menu', |
| 7 | ownerOnly: true, |
| 8 | async handler(sock, message, args, context) { |
| 9 | const chatId = context.chatId || message.key.remoteJid; |
| 10 | const channelInfo = context.channelInfo || {}; |
| 11 | const setting = args[0]?.toLowerCase(); |
| 12 | const value = args[1]?.toLowerCase(); |
| 13 | // ── No args: show full menu ─────────────────────────────────────── |
| 14 | if (!setting) { |
| 15 | return await sock.sendMessage(chatId, { |
| 16 | text: `╔══════════════╗\n` + |
| 17 | `║🔒*PRIVACY SETTING*║\n` + |
| 18 | `╚══════════════╝\n` + |
| 19 | `📌 *Usage:* \`.pvcy <set> <val>\`\n\n` + |
| 20 | `────────────────────\n` + |
| 21 | `*⚙️ PRIVACY CONTROLS*\n\n` + |
| 22 | `👁️ *lastseen* — \`all\` \`contacts\` \`blacklist\` \`none\`\n\n` + |
| 23 | `🟢 *online* — \`all\` \`match_last_seen\`\n\n` + |
| 24 | `🖼️ *profile* — \`all\` \`contacts\` \`blacklist\` \`none\`\n\n` + |
| 25 | `📊 *status* — \`all\` \`contacts\` \`blacklist\` \`none\`\n\n` + |
| 26 | `✅ *receipts* — \`all\` \`none\`\n\n` + |
| 27 | `👥 *groups* — \`all\` \`contacts\` \`blacklist\`\n\n` + |
| 28 | `⏳ *timer* — \`off\` \`24h\` \`7d\` \`90d\`\n\n` + |
| 29 | `*🚫 BLOCK CONTROLS*\n\n` + |
| 30 | `🔴 *block* — \`<number>\` or reply to msg\n\n` + |
| 31 | `🟢 *unblock* — \`<number>\` or reply to msg\n\n` + |
| 32 | `📋 *blocklist* — view blocked users\n\n` + |
| 33 | `*📊 INFO*\n` + |
| 34 | `🔍 *status* — view privacy settings\n` + |
| 35 | `────────────────────\n\n` + |
| 36 | `💡 *Examples:*\n` + |
| 37 | `› \`.privacy lastseen all\`\n\n` + |
| 38 | `› \`.privacy receipts none\`\n\n` + |
| 39 | `› \`.privacy timer 7d\`\n\n` + |
| 40 | `› \`.privacy block 923001234567\`\n\n` + |
| 41 | `› \`.privacy blocklist\`\n\n` + |
| 42 | `› \`.privacy status\``, |
| 43 | ...channelInfo |
| 44 | }, { quoted: message }); |
| 45 | } |
| 46 | // ── status: show current privacy settings ───────────────────────── |
| 47 | if (setting === 'status') { |
| 48 | try { |
| 49 | const s = await sock.fetchPrivacySettings(true); |
| 50 | const fmt = (v) => v ? `\`${v}\`` : `\`unknown\``; |
| 51 | return await sock.sendMessage(chatId, { |
| 52 | text: `╔═══════════════╗\n` + |
| 53 | `║🔒*CURRENT PRIVACY*║\n` + |
| 54 | `╚═══════════════╝\n\n` + |
| 55 | `👁️ *Last Seen:* ${fmt(s.last)}\n\n` + |
| 56 | `🟢 *Online:* ${fmt(s.online)}\n\n` + |
| 57 | `🖼️ *Profile Pic:* ${fmt(s.profile)}\n\n` + |
| 58 | `📊 *Status:* ${fmt(s.status)}\n\n` + |
| 59 | `✅ *Read Receipts:* ${fmt(s.readreceipts)}\n\n` + |
| 60 | `👥 *Groups Add:* ${fmt(s.groupadd)}\n\n` + |
| 61 | `_Use \`.pvcy <set> <value>\` to change_`, |
| 62 | ...channelInfo |
| 63 | }, { quoted: message }); |
| 64 | } |
| 65 | catch (e) { |