(sock, message, args, context)
| 53 | usage: '.smenu', |
| 54 | isPrefixless: true, |
| 55 | async handler(sock, message, args, context) { |
| 56 | const chatId = context.chatId || message.key.remoteJid; |
| 57 | try { |
| 58 | const imagePath = path.join(process.cwd(), 'assets/thumb.png'); |
| 59 | const thumbnail = fs.existsSync(imagePath) ? fs.readFileSync(imagePath) : null; |
| 60 | const categories = Array.from(CommandHandler.categories.keys()); |
| 61 | const stats = CommandHandler.getDiagnostics(); |
| 62 | const menuEmoji = getRandomEmoji(menuEmojis); |
| 63 | const activeEmoji = getRandomEmoji(activeEmojis); |
| 64 | const disabledEmoji = getRandomEmoji(disabledEmojis); |
| 65 | const fastEmoji = getRandomEmoji(fastEmojis); |
| 66 | const slowEmoji = getRandomEmoji(slowEmojis); |
| 67 | let menuText = `${menuEmoji} *${config.botName || 'MEGA-MD'}* ${menuEmoji}\n\n`; |
| 68 | menuText += `┏━━━━━━━━━━━━━━━━┓\n`; |
| 69 | menuText += `┃ 📱 *Bot:* ${config.botName || 'MEGA-MD'}\n`; |
| 70 | menuText += `┃ 🔖 *Version:* ${config.version || '6.0.0'}\n`; |
| 71 | menuText += `┃ 👤 *Owner:* ${config.botOwner || 'Unknown'}\n`; |
| 72 | menuText += `┃ ⏰ *Time:* ${formatTime()}\n`; |
| 73 | menuText += `┃ ℹ️ *Prefix:* ${config.prefixes ? config.prefixes.join(', ') : '.'}\n`; |
| 74 | menuText += `┃ 📊 *Plugins:* ${CommandHandler.commands.size}\n`; |
| 75 | menuText += `┗━━━━━━━━━━━━━━━━┛\n\n`; |
| 76 | const topCmds = stats.slice(0, 3).filter(s => s.usage > 0); |
| 77 | if (topCmds.length > 0) { |
| 78 | menuText += `🔥 *TOP COMMANDS:*\n`; |
| 79 | topCmds.forEach((c, i) => { |
| 80 | const rank = i === 0 ? '🥇' : i === 1 ? '🥈' : '🥉'; |
| 81 | menuText += `${rank} .${c.command} • ${c.usage} uses\n`; |
| 82 | }); |
| 83 | menuText += `\n`; |
| 84 | } |
| 85 | for (const cat of categories) { |
| 86 | const catEmoji = getCategoryEmoji(cat); |
| 87 | menuText += `${catEmoji} *${cat.toUpperCase()}*\n`; |
| 88 | menuText += `┌─────────────────\n`; |
| 89 | const catCmds = CommandHandler.getCommandsByCategory(cat); |
| 90 | catCmds.forEach((cmdName, index) => { |
| 91 | const isLast = index === catCmds.length - 1; |
| 92 | const prefix = isLast ? '└' : '├'; |
| 93 | const isOff = CommandHandler.disabledCommands.has(cmdName.toLowerCase()); |
| 94 | const cmdStats = stats.find(s => s.command === cmdName.toLowerCase()); |
| 95 | const statusIcon = isOff ? disabledEmoji : activeEmoji; |
| 96 | let speedTag = ''; |
| 97 | if (cmdStats && !isOff) { |
| 98 | const ms = parseFloat(cmdStats.average_speed); |
| 99 | if (ms > 0 && ms < 100) |
| 100 | speedTag = ` ${fastEmoji}`; |
| 101 | else if (ms > 1000) |
| 102 | speedTag = ` ${slowEmoji}`; |
| 103 | } |
| 104 | menuText += `${prefix}─ ${statusIcon} .${cmdName}${speedTag}\n`; |
| 105 | }); |
| 106 | menuText += `\n`; |
| 107 | } |
| 108 | menuText += `┌────────────────\n`; |
| 109 | menuText += `├ 💡 *LEGEND*\n`; |
| 110 | menuText += `├─ ${activeEmoji} Active Command\n`; |
| 111 | menuText += `├─ ${disabledEmoji} Disabled Command\n`; |
| 112 | menuText += `├─ ${fastEmoji} Fast Response\n`; |
nothing calls this directly
no test coverage detected