(sock: any, message: any, args: any[], context: BotContext)
| 13 | ownerOnly: true, |
| 14 | |
| 15 | async handler(sock: any, message: any, args: any[], context: BotContext) { |
| 16 | const { chatId, channelInfo } = context; |
| 17 | |
| 18 | await sock.sendMessage(chatId, { |
| 19 | text: '🔄 *Testing internet speed...*\n\nPlease wait, this may take a moment.', |
| 20 | ...channelInfo |
| 21 | }, { quoted: message }); |
| 22 | |
| 23 | try { |
| 24 | const { stdout, stderr } = await execAsync('python3 lib/speed.py', { timeout: 120000 }); |
| 25 | |
| 26 | const result = (stdout || stderr || '').trim(); |
| 27 | |
| 28 | if (!result) { |
| 29 | return await sock.sendMessage(chatId, { |
| 30 | text: '❌ No output from speed test.', |
| 31 | ...channelInfo |
| 32 | }, { quoted: message }); |
| 33 | } |
| 34 | |
| 35 | await sock.sendMessage(chatId, { |
| 36 | text: result, |
| 37 | ...channelInfo |
| 38 | }, { quoted: message }); |
| 39 | |
| 40 | } catch (error: any) { |
| 41 | await sock.sendMessage(chatId, { |
| 42 | text: `❌ Speed test failed: ${error.message}`, |
| 43 | ...channelInfo |
| 44 | }, { quoted: message }); |
| 45 | } |
| 46 | } |
| 47 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected