MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getBotUptime

Function getBotUptime

service/service.ts:207–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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// 主处理函数
213async 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: `❌ 服务名称包含非法字符,只允许字母、数字、-、_、.和@` });

Callers 1

handleServiceRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected