()
| 205 | if (hours > 0) parts.push(`${hours}小时`); |
| 206 | if (minutes > 0) parts.push(`${minutes}分钟`); |
| 207 | if (seconds > 0) parts.push(`${seconds}秒`); |
| 208 | |
| 209 | return parts.join(" ") || "0秒"; |
| 210 | } |
| 211 | |
| 212 | // 主处理函数 |
| 213 | async function handleServiceRequest(msg: Api.Message): Promise<void> { |
| 214 | try { |
| 215 | const args = msg.message.slice(1).split(" ").slice(1); // 移除命令名 |
| 216 | |
| 217 | let serviceName: string; |
| 218 | let isAutoDetected = false; |
| 219 | |
| 220 | if (args.length > 0) { |
| 221 | // 用户指定了服务名称 — validate to prevent shell injection |
| 222 | const validated = sanitizeServiceName(args[0]); |
| 223 | if (!validated) { |
| 224 | await msg.edit({ text: `❌ 服务名称包含非法字符,只允许字母、数字、-、_、.和@` }); |
no outgoing calls
no test coverage detected