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

Function normalizeErrorMessage

admin_board/admin_board.ts:292–324  ·  view source on GitHub ↗
(detail: string)

Source from the content-addressed store, hash-verified

290 if (detail.includes("PEER_ID_INVALID")) {
291 return "目标对话或用户无效,或当前账号无法访问";
292 }
293 if (detail.includes("USER_ID_INVALID")) {
294 return "目标用户无效,或不在该对话中";
295 }
296 if (detail.includes("USER_NOT_PARTICIPANT")) {
297 return "目标用户不在该对话中";
298 }
299 if (detail.includes("ADMINS_TOO_MUCH")) {
300 return "管理员数量已达到 Telegram 限制";
301 }
302 if (detail.includes("RIGHT_FORBIDDEN")) {
303 return "当前账号没有足够权限执行该操作";
304 }
305 if (detail.includes("USER_CREATOR")) {
306 return "群主无法被下掉管理员";
307 }
308 if (detail.includes("BOT_GROUPS_BLOCKED")) {
309 return "该目标无法被当前方式调整管理员权限";
310 }
311 return detail;
312}
313
314function toTargetChat(entity: Api.Chat | Api.Channel): TargetChat {
315 return {
316 entity,
317 titleDisplay: entity.title || "未命名对话",
318 username:
319 entity instanceof Api.Channel && entity.username ? entity.username : null,
320 isChannel: entity instanceof Api.Channel,
321 storageKey: String(entity.id),
322 };
323}
324
325async function resolveTargetChat(
326 msg: Api.Message,
327 rawTarget?: string,

Callers 3

handleSeatActionFunction · 0.85
handleTrimActionFunction · 0.85
AdminBoardPluginClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected