(body, maxLength = 200)
| 320 | } |
| 321 | |
| 322 | extractPreview(body, maxLength = 200) { |
| 323 | if (!body) return 'No preview available'; |
| 324 | |
| 325 | const cleanText = body |
| 326 | .replace(/```[\s\S]*?```/g, '[code block]') |
| 327 | .replace(/`([^`]+)`/g, '$1') |
| 328 | .replace(/[#*_~]/g, '') |
| 329 | .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') |
| 330 | .replace(/\s+/g, ' ') |
| 331 | .trim(); |
| 332 | |
| 333 | return cleanText.length > maxLength |
| 334 | ? cleanText.substring(0, maxLength - 3) + '...' |
| 335 | : cleanText; |
| 336 | } |
| 337 | |
| 338 | async run() { |
| 339 | debugLog('🚀 Starting debug server...'); |